From 133ef404aafb13cf023126a66ab9a820267a7e96 Mon Sep 17 00:00:00 2001 From: Scott Lawrence Date: Wed, 2 Jan 2013 14:20:20 -0500 Subject: [PATCH] Tweaks to get it compiling for desktop again. Sorry about that. --- Arduino/TinyBasicPlus.ino | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/Arduino/TinyBasicPlus.ino b/Arduino/TinyBasicPlus.ino index b940e03..f28df50 100644 --- a/Arduino/TinyBasicPlus.ino +++ b/Arduino/TinyBasicPlus.ino @@ -143,6 +143,8 @@ char eliminateCompileErrors = 1; // fix to suppress arduino build errors #else // Not arduino setup #include + #include + #undef ENABLE_TONES // size of our program ram #define kRamSize 4096 @@ -715,6 +717,7 @@ static short int expr4(void) return -a; return a; +#ifdef ARDUINO case FUNC_AREAD: #ifdef kAutoConf pinMode( a, INPUT ); @@ -725,9 +728,14 @@ static short int expr4(void) pinMode( a, INPUT ); #endif return digitalRead( a ); +#endif case FUNC_RND: +#ifdef ARDUINO return( random( a )); +#else + return( rand() % a ); +#endif } } @@ -863,8 +871,10 @@ void loop() boolean alsoWait = false; int val; +#ifdef ARDUINO #if ENABLE_TONES noTone( kPiezoPin ); +#endif #endif program_start = program; @@ -1550,7 +1560,6 @@ dwrite: #endif /*************************************************/ - files: // display a listing of files on the device. // version 1: no support for subdirectories @@ -1560,7 +1569,7 @@ files: goto warmstart; #else goto unimplemented; -#endif +#endif // ENABLE_FILEIO chain: @@ -1591,17 +1600,17 @@ load: fp = SD.open( (const char *)filename ); inFromFile = true; inhibitOutput = true; -#else + } +#else // ARDUINO // Desktop specific -#endif +#endif // ARDUINO // this will kickstart a series of events to read in from the file. - } } goto warmstart; -#else +#else // ENABLE_FILEIO goto unimplemented; -#endif +#endif // ENABLE_FILEIO @@ -1635,15 +1644,16 @@ save: // go back to standard output, close the file outToFile = false; fp.close(); -#else +#else // ARDUINO // desktop -#endif +#endif // ARDUINO goto warmstart; } -#else +#else // ENABLE_FILEIO goto unimplemented; -#endif +#endif // ENABLE_FILEIO + rseed: { short int value; @@ -1654,7 +1664,11 @@ rseed: if(expression_error) goto qwhat; +#if ARDUINO randomSeed( value ); +#else // ARDUINO + srand( value ); +#endif // ARDUINO goto run_next_statement; } @@ -1723,7 +1737,7 @@ static int isValidFnChar( char c ) return 0; } -static unsigned char * filenameWord(void) +unsigned char * filenameWord(void) { // SDL - I wasn't sure if this functionality existed above, so I figured i'd put it here unsigned char * ret = txtpos;