Andy Lustig
/
stateScript_v2
fork of StateScript
Fork of stateScript_v2 by
Diff: behave.h
- Revision:
- 4:abee20c0bf2a
- Parent:
- 3:d7b0a0890d96
- Child:
- 7:5fe7329751d4
--- a/behave.h Sat Oct 10 22:37:17 2015 +0000 +++ b/behave.h Fri Jan 15 22:13:23 2016 +0000 @@ -14,10 +14,6 @@ #define MAXVARNAMESIZE 30 //The maximum number of characters of a variable name - - - - #ifdef MBEDHARDWARE #include "mbedInterface.h" #endif @@ -25,6 +21,11 @@ #include "fpgaInterface.h" #endif +#define BLOCKMEMORYTYPES 1 +#define VARIABLEMEMORYTYPES 2 +#define ENVSETTINGSMEMORYTYPES 4 + + /* #define NUMEVENTS 50 #define NUMCONDITIONS 150 @@ -480,38 +481,28 @@ class scriptStream { public: scriptStream(digitalPort* portVectorInput, int numPortsInput, eventQueue* queueInput, sSystem* system); - void parseBlock(); + void parseBlock(); //Parses everything since the last semicolon was found void addLineToCurrentBlock(char* lineInput); // if the line did not end with a semicolon, add it to the current block + +private: + int* findIntVariable(string nameInput); //used to retrieve the pointer to the designated variable if it exists int* findIntVariable(const char* nameInput); //used to retrieve the pointer to the designated variable if it exists int* findIntVariable(const char* nameInput, int start, int end); //used to retrieve the pointer to the designated variable if it exists - bool createIntVariable(string nameInput); // creates a new interger variable action* evaluateAssignmentForAction(string expression); //parses a numerical assignment or operation (a = b - c) action* evaluateAssignmentForAction(const char* expression); //parses a numerical assignment or operation (a = b - c) - bool evaluateConditions(string& expression, event* currentEvent); //parses a condition statement (a == b && c > d) - //condition* parseConditions(string& expression); //parses a condition statement (a == b && c > d) - //std::size_t findFirstOrOutsideParenth(string& expression); - //std::size_t findFirstAndOutsideParenth(string& expression); - //bool isOutsideParenth(string& expression,std::size_t foundItem); - condition* parseConditions(const char* expression,int start, int end); //parses a condition statement (a == b && c > d) int findFirstOrOutsideParenth(const char* expression, int start, int end); int findFirstAndOutsideParenth(const char* expression, int start, int end); bool isOutsideParenth(const char* expression,int foundItem, int start, int end); bool isNum(const char* expression, int start, int end); bool areStringsSame(const char* str1, const char* str2, int start, int end); - int getRandomParam(string expression); int getRandomParam(const char* expression,int start,int end); - - int findStringLoc(const char* refString,const char* findString,int start, int end); - - - -private: + void clearEnvironmentVariables(int mode); int currentTriggerPort; int currentTriggerDir;