+#include <stdlib.h>
+#include <stdio.h>
#include "opts.h"
-int foo(void)
+OptionList_T* OPTS_ParseOptions( int argc, char** argv )
{
- return 42;
+ ParserContext_T ctx;
+ ctx.options = 0;
+
+ //while( ctx.tok_stream.stream.cur_char != EOF )
+ //{
+ // OPTS_ParseOption( &(ctx) );
+ //}
+
+ return ctx.options;
+}
+
+OptionList_T* OPTS_ParseOption( ParserContext_T* ctx )
+{
+ return NULL;
+}
+
+char* OPTS_NextToken( TokenContext_T* ctx )
+{
+ return NULL;
+}
+
+char OPTS_NextCharacter( StreamContext_T* ctx )
+{
+ char current = EOF;
+
+ if( ctx->line_idx < ctx->arg_count )
+ {
+ ctx->col_idx++;
+
+ if(ctx->arg_vect[ ctx->line_idx ][ ctx->col_idx ] == '\0')
+ {
+ ctx->col_idx = 0;
+ ctx->line_idx++;
+ }
+
+ if( ctx->line_idx < ctx->arg_count )
+ {
+ current = ctx->arg_vect[ ctx->line_idx ][ ctx->col_idx ];
+ }
+ }
+
+ return current;
}
+
+void OPTS_FreeOptionList( OptionList_T* opts )
+{
+
+}
+
#ifndef OPTS_H
#define OPTS_H
-int foo(void);
+typedef struct {
+ int line_idx;
+ int col_idx;
+ int arg_count;
+ char** arg_vect;
+} StreamContext_T;
+
+typedef struct {
+ StreamContext_T stream;
+ char* cur_token;
+} TokenContext_T;
+
+typedef struct OptionList {
+ char** key;
+ char** val;
+ struct OptionList* next;
+} OptionList_T;
+
+typedef struct {
+ TokenContext_T tok_stream;
+ OptionList_T* options;
+} ParserContext_T;
+
+OptionList_T* OPTS_ParseOptions( int argc, char** argv );
+
+OptionList_T* OPTS_ParseOption( ParserContext_T* ctx );
+
+char* OPTS_NextToken( TokenContext_T* ctx );
+
+char OPTS_NextCharacter( StreamContext_T* ctx );
+
+void OPTS_FreeOptionList( OptionList_T* options );
#endif
--- /dev/null
+// Unit Test Framework Includes
+#include "UnitTest++.h"
+
+// File To Test
+#include "opts.h"
+
+using namespace UnitTest;
+
+//-----------------------------------------------------------------------------
+// Begin Unit Tests
+//-----------------------------------------------------------------------------
+namespace {
+ //-------------------------------------------------------------------------
+ // Test NextCharacter Function
+ //-------------------------------------------------------------------------
+ TEST(Verify_NextCharacter_Can_Loop_Through_Characters)
+ {
+ StreamContext_T ctx;
+ }
+}