From: Dan White Date: Fri, 10 May 2013 22:53:05 +0000 (-0500) Subject: msp4th: ensure string arrays start as zero-length X-Git-Tag: cheetah~94 X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=03a72d0b95cbdfbab5a2eb8fb7b89325ed61194d;p=430.git msp4th: ensure string arrays start as zero-length --- diff --git a/msp4th/main.c b/msp4th/main.c index 11f50c9..aa7672c 100644 --- a/msp4th/main.c +++ b/msp4th/main.c @@ -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; } diff --git a/msp4th/test4th.c b/msp4th/test4th.c index 8c8a7ef..825a95a 100644 --- a/msp4th/test4th.c +++ b/msp4th/test4th.c @@ -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; }