Skip to content
Browse files

Tweaks to get it compiling for desktop again.

Sorry about that.
  • Loading branch information...
1 parent 18f45f6 commit 133ef404aafb13cf023126a66ab9a820267a7e96 Scott Lawrence committed Jan 2, 2013
Showing with 26 additions and 12 deletions.
  1. +26 −12 Arduino/TinyBasicPlus.ino
View
38 Arduino/TinyBasicPlus.ino
@@ -143,6 +143,8 @@ char eliminateCompileErrors = 1; // fix to suppress arduino build errors
#else
// Not arduino setup
#include <stdio.h>
+ #include <stdlib.h>
+ #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,9 +871,11 @@ void loop()
boolean alsoWait = false;
int val;
+#ifdef ARDUINO
#if ENABLE_TONES
noTone( kPiezoPin );
#endif
+#endif
program_start = program;
program_end = program_start;
@@ -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;

0 comments on commit 133ef40

Please sign in to comment.
Something went wrong with that request. Please try again.