Skip to content

Commit

Permalink
added greater than type
Browse files Browse the repository at this point in the history
  • Loading branch information
jweinst1 committed Jun 10, 2018
1 parent 6a35f79 commit 5dfe8c0
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/WindLoad.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ void WindLoad_minus(void);
void WindLoad_multiply(void);
void WindLoad_del(void);
void WindLoad_lt(void);
void WindLoad_gt(void);

// Loads number onto load buffer.
void WindLoad_number(const char** code);
Expand Down
3 changes: 2 additions & 1 deletion include/WindType.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ typedef enum
WindType_Plus,
WindType_Minus,
WindType_Multiply,
WindType_Lt, // < op
WindType_Lt,
WindType_Gt,
WindType_Del,
WindType_Sep
} WindType;
Expand Down
4 changes: 4 additions & 0 deletions src/code/WindRun.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ int WindRun_load(const char** code)
*code += 1;
WindLoad_lt();
continue;
case '>':
*code += 1;
WindLoad_gt();
continue;
case 'D':
if((*code)[1] == 'e' && (*code)[2] == 'l' )
{
Expand Down
2 changes: 2 additions & 0 deletions src/code/WindType.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ static const char* WindType_STR_MULTIPLY = "Multiply";
static const char* WindType_STR_SEP = "Separator";
static const char* WindType_STR_DEL = "Delete";
static const char* WindType_STR_LT = "LessThan";
static const char* WindType_STR_GT = "GreaterThan";

const char* WindType_get_str(WindType type)
{
Expand All @@ -29,5 +30,6 @@ const char* WindType_get_str(WindType type)
case WindType_Del: return WindType_STR_DEL;
case WindType_Sep: return WindType_STR_SEP;
case WindType_Lt: return WindType_STR_LT;
case WindType_Gt: return WindType_STR_GT;
}
}
6 changes: 6 additions & 0 deletions src/flow/WindLoad.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ static unsigned char WIND_MINUS[] = {WindType_Minus};
static unsigned char WIND_MULTIPLY[] = {WindType_Multiply};
static unsigned char WIND_DEL[] = {WindType_Del};
static unsigned char WIND_LT[] = {WindType_Lt};
static unsigned char WIND_GT[] = {WindType_Gt};

// Used as default initalizer for moved C-string result.
static char* NUM_RESULT_INIT = "";
Expand Down Expand Up @@ -77,6 +78,11 @@ void WindLoad_lt(void)
WindData_load_write(WIND_LT, sizeof(WIND_LT));
}

void WindLoad_gt(void)
{
WindData_load_write(WIND_GT, sizeof(WIND_GT));
}

void WindLoad_number(const char** code)
{
char** movedStr = &NUM_RESULT_INIT;
Expand Down
4 changes: 4 additions & 0 deletions src/util/IOUtil.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ int IOUtil_print(const unsigned char* start, const unsigned char* end)
start++;
printf("< ");
break;
case WindType_Gt:
start++;
printf("> ");
break;
case WindType_Del:
start++;
printf("Del ");
Expand Down

0 comments on commit 5dfe8c0

Please sign in to comment.