msp4th: ensure string arrays start as zero-length
authorDan White <dan@whiteaudio.com>
Fri, 10 May 2013 22:53:05 +0000 (17:53 -0500)
committerDan White <dan@whiteaudio.com>
Fri, 10 May 2013 22:53:05 +0000 (17:53 -0500)
msp4th/main.c
msp4th/test4th.c

index 11f50c979692f51bd4ac935f307d89066d886cc1..aa7672cf9a28906f626d95e41d6aa34cbe2031a1 100644 (file)
@@ -135,17 +135,20 @@ static __inline__ void setup_default_msp4th(void)
     default_config.putchar = &uart_putchar;
     default_config.getchar = &uart_getchar;
 
+    // terminate the strings
+    lineBufferArray[0] = 0;
+    wordBufferArray[0] = 0;
+    cmdListArray[0] =0;
 
-    /* howto execute a line of words on init
+
+    // howto execute a line of words on init
+    /*
     uint8_t *str = (uint8_t *)"1 2 3 4 5 s.\r";
     for (i=0; i < 14; i++) {
         lineBufferArray[i] = str[i];
         lineBufferArray[i+1] = 0;
     }
     */
-
-    lineBufferArray[0] = 0;
-    wordBufferArray[0] = 0;
 }
 
 
index 8c8a7ef6ed3c99cd2970fb653d20cc65d3e4ce3b..825a95a7bf03ac7972cffc73bc3649c02b9ca544 100644 (file)
@@ -76,50 +76,30 @@ void config_msp4th(void)
     default_config.putchar = &my_putchar;
     default_config.getchar = &my_getchar;
 
-    /*
-    msp4th_mathStackStartAddress = &mathStackArray[MATH_STACK_SIZE - 1];
-    msp4th_addrStackStartAddress = &addrStackArray[ADDR_STACK_SIZE - 1];
-
-    msp4th_prog = &progArray[0];
-
-    msp4th_progOpcodes = &progOpcodesArray[0];
-
-    msp4th_cmdList = &cmdListArray[0];
-
-    msp4th_lineBuffer = &lineBufferArray[0];
-    msp4th_lineBufferLength = LINE_BUFFER_SIZE;
-
-    msp4th_wordBuffer = &wordBufferArray[0];
-    msp4th_wordBufferLength = WORD_BUFFER_SIZE;
-
-    msp4th_putchar = &my_putchar;
-    msp4th_getchar = &my_getchar;
-    */
-
+    // terminate the strings
+    lineBufferArray[0] = 0;
+    wordBufferArray[0] = 0;
+    cmdListArray[0] = 0;
 
-    for (i=0; i < MATH_STACK_SIZE; i++) {
-        mathStackArray[i] = 0;
-    }
 
-    for (i=0; i < ADDR_STACK_SIZE; i++) {
-        addrStackArray[i] = 0;
+    // howto execute a line of words on init
+    /*
+    uint8_t *str = (uint8_t *)"1 2 3 4 5 s.\r";
+    for (i=0; i < 14; i++) {
+        lineBufferArray[i] = str[i];
+        lineBufferArray[i+1] = 0;
     }
-
-    lineBufferArray[0] = 0;
-    wordBufferArray[0] = 0;
+    */
 }
 
 
 
 int main(void)
 {
+    config_msp4th();
 
-    while (1) {
-        config_msp4th();
-
-        msp4th_init(&default_config);
-        msp4th_processLoop();
-    }
+    msp4th_init(&default_config);
+    msp4th_processLoop();
 
     return 0;
 }