Karpova Lab fork of stateScript

Dependencies:   SMARTWAV SOMO_II mbed

Fork of stateScript_v2_karpova by Andy Lustig

Revision:
1:3a050d26d4f6
Parent:
0:8dbd6bd9167f
--- a/behave.h	Tue May 19 15:45:42 2015 +0000
+++ b/behave.h	Wed Jun 03 22:54:25 2015 +0000
@@ -20,28 +20,43 @@
 
 #ifdef MBEDHARDWARE
     #include "mbedInterface.h"
+    #define NUMEVENTS 50
+    #define NUMCONDITIONS 150
+    #define NUMINTCOMPARE 150
+    #define NUMACTIONS 150
+    #define NUMPORTMESSAGES 150
+    #define NUMINTOPERATIONS 150
+    #define NUMDISPLAYACTIONS 30
+    #define NUMTRIGGERACTIONS 30
+    #define NUMFUNCTIONS 50
+    #define INPUTCHARBUFFERSIZE 500
+    #define NUMINTVARS 30
+
 #endif
 #ifdef FPGAHARDWARE
     #include "fpgaInterface.h"
-#endif
+
+    #define NUMEVENTS 50
+    #define NUMCONDITIONS 150
+    #define NUMINTCOMPARE 150
+    #define NUMACTIONS 150
+    #define NUMPORTMESSAGES 150
+    #define NUMINTOPERATIONS 150
+    #define NUMDISPLAYACTIONS 30
+    #define NUMTRIGGERACTIONS 30
+    #define NUMINTVARS 30
 
 
-#define NUMEVENTS 50
-#define NUMCONDITIONS 150
-#define NUMINTCOMPARE 150
-#define NUMACTIONS 150
-#define NUMPORTMESSAGES 150
-#define NUMINTOPERATIONS 150
-#define NUMDISPLAYACTIONS 30
-#define NUMTRIGGERACTIONS 30
+
+    #define NUMFUNCTIONS 50
+    #define INPUTCHARBUFFERSIZE 3072
+#endif
+
 
 #define ARITHMATIC_CONDITION    0
 #define OR_CONDITION    1
 #define AND_CONDITION    2
 
-#define NUMFUNCTIONS 50
-#define INPUTCHARBUFFERSIZE 3072
-
 using namespace std;
 
 class event; //we foreward declare this because of class interdependencies
@@ -101,7 +116,8 @@
 public:
     intVariable();
     intVariable(std::string& tagInput, int initialValue);
-    void set(std::string& tagInput, int initialValue);
+    void set(const char* tagInput, int initialValue);
+    void release();
     int value;
     //string tag;
     char tag[MAXVARNAMESIZE+1];
@@ -455,21 +471,30 @@
 public:
     blockBuffer();
     bool addLine(char* input, int numChars);
-    string getNextLine();
+    //string getNextLine();
+    char* getNextLine();
     int16_t linesAvailable();
     bool empty();
     void resetBuffer();
 
 private:
+/*
 #ifdef MBEDHARDWARE
     //On the MBED, we need to put this on a different memory bank
     __attribute((section("AHBSRAM1"),aligned)) char charBuffer[INPUTCHARBUFFERSIZE];
 #else
     char charBuffer[INPUTCHARBUFFERSIZE];
 #endif
+*/
     int16_t bufferWritePos;
     int16_t bufferReadPos;
     int16_t _linesAvailable;
+    char* lines[200];
+    int16_t writeLine;
+    int16_t readLine;
+
+
+
 
 };
 
@@ -480,12 +505,12 @@
     scriptStream(digitalPort* portVectorInput, int numPortsInput, eventQueue* queueInput, sSystem* system);
     void parseBlock();
     void addLineToCurrentBlock(char* lineInput); // if the line did not end with a semicolon, add it to the current block
-    int* findIntVariable(string nameInput); //used to retrieve the pointer to the designated variable if it exists
+    //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)
+    bool createIntVariable(const 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)