Browse Source

myString( token working

Noah 4 years ago
parent
commit
2b0f6b3969
2 changed files with 16 additions and 2 deletions
  1. 4 2
      src/tokens.cpp
  2. 12 0
      tests/get-single-token

+ 4 - 2
src/tokens.cpp

@@ -45,7 +45,7 @@ struct ConvertRule {
 };
 
 /// References to lists defined after functions.
-extern struct Token StandardTokens[199];
+extern struct Token StandardTokens[200];
 extern struct TwoByte CalcVars[302];
 extern struct ConvertRule Replacements[39];
 
@@ -372,6 +372,7 @@ bool lookupToken(unsigned short in, string &out)
 #define PLOT1			0xEC
 #define PLOT2			0xED
 #define PLOT3			0xEE
+#define TOSTRING        0xEF
 #define POWEROF			0xF0
 #define XTHROOT			0xF1
 #define VARSTATS_1		0xF2
@@ -727,7 +728,7 @@ struct Token StandardTokens[] = {
 	{ CTL_REPEAT,		"Repeat "	},
 	{ CTL_END,			"End"		},
 	{ CTL_PAUSE,		"Pause "	},
-	{ CTL_PAUSE,		"Pause"		},
+	{ CTL_PAUSE,		"Pause"		}, // note the space above
 	{ LABEL,			"Lbl "		},
 	{ CTL_GOTO,			"Goto "		},
 	{ INCSKIPIFHIGH,	"IS>("		},
@@ -747,6 +748,7 @@ struct Token StandardTokens[] = {
 	{ GETKEY,			"getKey"	},
 	{ CLRHOME,			"ClrHome"	},
 	{ CLRTABLE,			"ClrTable"	},
+    { TOSTRING,         "toString(" },
 
 	/** GetCalc **/
 	{ GET,				"Get("		},

+ 12 - 0
tests/get-single-token

@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# This is a shell script to get the binary (in hex format)
+# from a file created on the TI-84 that contains a single 
+# token. This is to add new tokens very quick and easy.
+
+# Note: Sometimes a token only uses only one binary, but
+# sometimes two. Be careful about that.
+
+[ -z $* ] && echo "Error: No Arguments provided" && exit 1
+od -A x -t x1z -v $1
+od -A x -t x1z -v $1 | awk '{if(NR==5) print $12 " " $13}'