diff --git a/include/WindComp.h b/include/WindComp.h index 1368272..eb1f015 100644 --- a/include/WindComp.h +++ b/include/WindComp.h @@ -47,6 +47,11 @@ unsigned WindComp_apply_plus(unsigned char* args, const unsigned char* argsEnd); unsigned WindComp_apply_minus(unsigned char* args, const unsigned char* argsEnd); +/*/ filtering functions /*/ + +// Checks if item in comp buffer is true or false after NOT +int WindComp_check_not(void); + // Maps an array of instructions onto the item in the comp buffer. // Returns zero if error. int WindComp_map(unsigned char* ins, const unsigned char* insEnd); diff --git a/src/flow/WindComp.c b/src/flow/WindComp.c index 977b338..37a3efb 100644 --- a/src/flow/WindComp.c +++ b/src/flow/WindComp.c @@ -2,7 +2,9 @@ static unsigned char WindComp_BUF[WindComp_BUF_SIZE]; +// Access to body chunk of comp item. static unsigned char* WindComp_BODY = WindComp_BUF + 1; +// End of comp item. static const unsigned char* WindComp_END = WindComp_BUF + WindComp_BUF_SIZE; static unsigned WindComp_ITEM_LEN = 0; @@ -164,6 +166,16 @@ unsigned WindComp_apply_minus(unsigned char* args, const unsigned char* argsEnd) return mover - args; } +int WindComp_check_not(void) +{ + switch(WindComp_BUF[0]) + { + case WindBool: + return *WindComp_BODY; + } + return 0; +} + /*Applies series of operations to item in comp*/ int WindComp_map(unsigned char* ins, const unsigned char* insEnd) { @@ -210,5 +222,17 @@ int WindComp_map(unsigned char* ins, const unsigned char* insEnd) int WindComp_filter(unsigned char* ins, const unsigned char* insEnd) { + unsigned moveChecker = 0; + // Active while object has still not failed a filter. + while(WindComp_get_len() && ins != insEnd) + { + switch(*ins) + { + case WindType_Not: + ins++; + break; + default: return 0; + } + } return 1; }