package logo.lang; import java.util.Hashtable; public class rLogoPrimitive extends Hashtable { public final static int COMMAND_NOT_FOUND = 0; public final static int SHOW = 1; public final static int RUN = 2; public final static int REPEAT = 3; public final static int WHILE = 4; public final static int IF_ELSE = 5; public final static int MAKE = 6; public final static int TO = 7; public final static int FORWARD = 8; public final static int BACK = 9; public final static int RIGHT = 10; public final static int LEFT = 11; public final static int PEN_UP = 12; public final static int PEN_DOWN = 13; public final static int SHOW_TURTLE = 14; public final static int HIDE_TURTLE = 15; public final static int CLEAR_SCREEN = 16; public final static int AUTO = 17; public final static int MANUAL = 18; public final static int PAINT = 19; public final static int HOME = 20; public final static int SET_PEN_COLOR = 21; public final static int SET_BACK_COLOR = 22; public final static int WRITE = 23; public final static int PAUSE = 24; public final static int PARAMS = 25; public final static int BATCH = 26; public final static int DUMP = 27; public final static int END = 28; public final static int HELP = 29; public final static int TOPICS = 30; //not a command, just a help topic public final static int TOPIC_NAME= 31; //more help, for the severely confused. public final static int TUTORIAL=32; public final static int TUTORIAL2=33; public final static int TUTORIAL3=34; public int lookup(String s) { int result=COMMAND_NOT_FOUND; Integer i = (Integer) get(s); if ( i!=null ) { result=i.intValue(); } return result; } public rLogoPrimitive() { put("show",new Integer(SHOW)); put("run",new Integer(RUN)); put("repeat",new Integer(REPEAT)); put("while",new Integer(WHILE)); put("ifelse",new Integer(IF_ELSE)); put("make",new Integer(MAKE)); put("to",new Integer(TO)); put("forward",new Integer(FORWARD)); put("fd",new Integer(FORWARD)); put("back",new Integer(BACK)); put("bk",new Integer(BACK)); put("back",new Integer(BACK)); put("right",new Integer(RIGHT)); put("rt",new Integer(RIGHT)); put("left",new Integer(LEFT)); put("lt",new Integer(LEFT)); put("penup",new Integer(PEN_UP)); put("pu",new Integer(PEN_UP)); put("pendown",new Integer(PEN_DOWN)); put("pd",new Integer(PEN_DOWN)); put("showturtle",new Integer(SHOW_TURTLE)); put("st",new Integer(SHOW_TURTLE)); put("hideturtle",new Integer(HIDE_TURTLE)); put("ht",new Integer(HIDE_TURTLE)); put("clearscreen",new Integer(CLEAR_SCREEN)); put("cs",new Integer(CLEAR_SCREEN)); put("auto",new Integer(AUTO)); put("manual",new Integer(MANUAL)); put("paint",new Integer(PAINT)); put("home",new Integer(HOME)); put("setpencolor",new Integer(SET_PEN_COLOR)); put("setpc",new Integer(SET_PEN_COLOR)); put("setbackcolor",new Integer(SET_BACK_COLOR)); put("setbc",new Integer(SET_BACK_COLOR)); put("write",new Integer(WRITE)); put("pause",new Integer(PAUSE)); put("params",new Integer(PARAMS)); put("end",new Integer(END)); put("batch",new Integer(BATCH)); put("dump",new Integer(DUMP)); put("help",new Integer(HELP)); put("?",new Integer(HELP)); put("topics",new Integer(TOPICS)); put("topic_name",new Integer(TOPIC_NAME)); put("tutorial",new Integer(TUTORIAL)); put("tutorial2",new Integer(TUTORIAL2)); put("tutorial3",new Integer(TUTORIAL3)); } }