slviajero / tinybasic

A BASIC interpreter for Arduino, ESP, RP2040, STM32, Infineon XMC and POSIX with IoT and microcontroller features.
GNU General Public License v3.0
203 stars 31 forks source link

compile problem "undeclared" for lexliteral & outliteral #52

Closed guidol70 closed 1 year ago

guidol70 commented 1 year ago

did got this undeclared (first use in this function) error on the new REM-version of basic.c in Linux and MinGW

basic.c: In function ‘nexttoken’:
basic.c:2398:13: error: ‘lexliteral’ undeclared (first use in this function)
 2398 |         if (lexliteral) {
basic.c:2398:13: note: each undeclared identifier is reported only once for each function it appears in
basic.c: In function ‘outputtoken’:
basic.c:4843:34: error: ‘outliteral’ undeclared (first use in this function)
 4843 |         if (token == LINENUMBER) outliteral=0;

solved that with a init of lexliteral & outliteral in this part of the code (before int main):

/* debug mode switch */
#define DEBUG 0

/* Init lexliteral & outliteral */
int lexliteral;
int outliteral;

/*
 * the core basic language headers including some Arduino device stuff
 */
#include "basic.h"

BTW: with cpinew*.bas & Linux the output of the digits is printed after the complete calculation and not while calculation :( On Windows and TTGO VGA32 it seems calcualting is faster than printing on the screen, because it looks like the measured time is shorter than it took to print the numbers on the screen

slviajero commented 1 year ago

My apologies, I forgot to check in basic.h - fixed now.

Am 26.03.2023 um 15:31 schrieb Guido Lehwalder @.***>:

didnt got this undeclared (first use in this function) error in debian on X86, but today on armbian while I did try to compile:

basic.c: In function ‘nexttoken’: basic.c:2398:13: error: ‘lexliteral’ undeclared (first use in this function) 2398 | if (lexliteral) { basic.c:2398:13: note: each undeclared identifier is reported only once for each function it appears in basic.c: In function ‘outputtoken’: basic.c:4843:34: error: ‘outliteral’ undeclared (first use in this function) 4843 | if (token == LINENUMBER) outliteral=0; BTW: with cpinew*.bas & Linux the output of the digits is printed after the complete calculation and not while calculation :( On Windows and TTGO VGA32 it seems calcualting is faster than printing on the screen, because it looks like the measured time is shorter than it took to print the numbers on the screen

Yes! I noticed this as well.

slviajero commented 1 year ago

basic.h now hopefully fixed, thank you for bringing it up ;-)