Changeset 5
- Timestamp:
- 02/26/07 17:11:21 (6 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 1 deleted
- 17 edited
-
THANKS (modified) (1 diff)
-
core/conf.c (modified) (1 diff)
-
core/gui.c (modified) (2 diffs)
-
core/kbd.c (modified) (7 diffs)
-
doc (added)
-
doc/BASIC.txt (added)
-
include/keyboard.h (modified) (1 diff)
-
include/ubasic.h (modified) (1 diff)
-
lib/ubasic/Makefile (modified) (1 diff)
-
lib/ubasic/README (modified) (1 diff)
-
lib/ubasic/camera_functions.c (modified) (2 diffs)
-
lib/ubasic/camera_functions.h (modified) (1 diff)
-
lib/ubasic/run-ubasic.c (added)
-
lib/ubasic/tokenizer.c (modified) (9 diffs)
-
lib/ubasic/tokenizer.h (modified) (4 diffs)
-
lib/ubasic/ubasic.c (modified) (18 diffs)
-
lib/ubasic/ubasic.h (deleted)
-
platform/a610/main.c (modified) (1 diff)
-
platform/a620/main.c (modified) (1 diff)
-
script/default.bas (modified) (1 diff)
-
script/script.bas (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/THANKS
r1 r5 4 4 5 5 * Pablo dAngelo for 6 useful ideas and suggestion 6 useful ideas and suggestion, BASIC interpreter 7 extensions 7 8 8 9 * Adam Dunkels for -
trunk/core/conf.c
r1 r5 28 28 const char *ubasic_script_default = 29 29 #if 1 30 " 1sleep 1000\n"31 " 2if a<1 then let a=2\n"32 " 3if b<1 then let b=3\n"33 " 4for s=1 to a\n"34 " 5 shot\n"35 " 6for n=1 to b\n"36 " 7click \"right\"\n"37 " 8next n\n"38 " 9next s\n"39 " 10 shot\n"40 " 11end\n";30 "sleep 1000\n" 31 "if a<1 then let a=2\n" 32 "if b<1 then let b=3\n" 33 "for s=1 to a\n" 34 "shoot\n" 35 "for n=1 to b\n" 36 "click \"right\"\n" 37 "next n\n" 38 "next s\n" 39 "shoot\n" 40 "end\n"; 41 41 #else 42 " 1sleep 1000\n"43 " 2if a<1 then let a=2\n"44 " 4for s=1 to a\n"45 " 5 shot\n"46 " 7set_tv_rel b\n"47 " 9next s\n"48 " 10 shot\n"49 " 11end\n";42 "sleep 1000\n" 43 "if a<1 then let a=2\n" 44 "for s=1 to a\n" 45 "shoot\n" 46 "set_tv_rel b\n" 47 "next s\n" 48 "shoot\n" 49 "end\n"; 50 50 #endif 51 51 -
trunk/core/gui.c
r1 r5 210 210 211 211 #ifdef HISTO 212 if (conf_show_histo && kbd_is_key_pressed(KEY_SHO T_HALF)){212 if (conf_show_histo && kbd_is_key_pressed(KEY_SHOOT_HALF)){ 213 213 const int hx=219; 214 214 const int hy=48; … … 460 460 if (ubasic_error){ 461 461 const char *msg; 462 switch (ubasic_error){ 463 case 1: 464 msg = "Parse err."; 465 break; 466 case 2: 467 msg = "Unk stmt"; 468 break; 469 case 3: 470 msg = "Unk key"; 471 break; 472 default: 473 msg = "Unk err"; 474 } 475 sprintf(osd_buf, "uBASIC:%d %s ", ubasic_line, msg); 462 if (ubasic_error >= UBASIC_E_ENDMARK) { 463 msg = ubasic_errstrings[UBASIC_E_UNKNOWN_ERROR]; 464 } else { 465 msg = ubasic_errstrings[ubasic_error]; 466 } 467 sprintf(osd_buf, "uBASIC:%d %s ", ubasic_linenumber(), msg); 476 468 draw_txt_string(0, 0, osd_buf); 477 469 } -
trunk/core/kbd.c
r1 r5 10 10 #define SCRIPT_END 0 11 11 #define SCRIPT_CLICK 1 12 #define SCRIPT_SHO T 212 #define SCRIPT_SHOOT 2 13 13 #define SCRIPT_SLEEP 3 14 14 #define SCRIPT_PRESS 4 … … 51 51 } 52 52 53 void kbd_sched_sho t()53 void kbd_sched_shoot() 54 54 { 55 55 // WARNING stack program flow is reversed … … 59 59 KBD_STACK_PUSH(SCRIPT_WAIT_SAVE); 60 60 61 KBD_STACK_PUSH(KEY_SHO T_FULL);61 KBD_STACK_PUSH(KEY_SHOOT_FULL); 62 62 KBD_STACK_PUSH(SCRIPT_RELEASE); 63 63 64 64 kbd_sched_delay(20); 65 65 66 KBD_STACK_PUSH(KEY_SHO T_FULL);66 KBD_STACK_PUSH(KEY_SHOOT_FULL); 67 67 KBD_STACK_PUSH(SCRIPT_PRESS); 68 68 … … 152 152 } 153 153 154 void ubasic_camera_sho t()155 { 156 kbd_sched_sho t();154 void ubasic_camera_shoot() 155 { 156 kbd_sched_shoot(); 157 157 } 158 158 … … 160 160 { 161 161 /* Alternative keyboard mode stated/exited by pressing print key. 162 * While running Alt. mode sho t key will start a script execution.162 * While running Alt. mode shoot key will start a script execution. 163 163 */ 164 164 … … 177 177 } 178 178 179 if (kbd_is_key_pressed(KEY_SHO T_FULL)){179 if (kbd_is_key_pressed(KEY_SHOOT_FULL)){ 180 180 key_pressed = 1; 181 181 if (!state_kbd_script_run){ … … 216 216 { KEY_RIGHT, "right" }, 217 217 { KEY_SET, "set" }, 218 { KEY_SHO T_HALF, "shot_half" },219 { KEY_SHO T_FULL, "shot_full" },218 { KEY_SHOOT_HALF, "shoot_half" }, 219 { KEY_SHOOT_FULL, "shoot_full" }, 220 220 { KEY_ZOOM_IN, "zoom_in" }, 221 221 { KEY_ZOOM_OUT, "zoom_out" }, -
trunk/include/keyboard.h
r1 r5 7 7 #define KEY_RIGHT 4 8 8 #define KEY_SET 5 9 #define KEY_SHO T_HALF 610 #define KEY_SHO T_FULL 79 #define KEY_SHOOT_HALF 6 10 #define KEY_SHOOT_FULL 7 11 11 #define KEY_ZOOM_IN 8 12 12 #define KEY_ZOOM_OUT 9 -
trunk/include/ubasic.h
r1 r5 1 #ifndef UBASIC_H 2 #define UBASIC_H 1 /* 2 * Copyright (c) 2006, Adam Dunkels 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. Neither the name of the author nor the names of its contributors 14 * may be used to endorse or promote products derived from this software 15 * without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 */ 30 31 #ifndef __UBASIC_H__ 32 #define __UBASIC_H__ 33 34 enum ubasic_errors 35 { 36 UBASIC_E_NONE = 0, 37 UBASIC_E_PARSE, 38 UBASIC_E_UNK_STATEMENT, 39 UBASIC_E_UNK_KEY, 40 UBASIC_E_UNK_LABEL, 41 UBASIC_E_GOSUB_STACK_EXHAUSTED, 42 UBASIC_E_UNMATCHED_RETURN, 43 UBASIC_E_UNKNOWN_ERROR, 44 UBASIC_E_ENDMARK 45 }; 46 47 /** holds short error messages for all known ubasic_errors */ 48 extern const char *ubasic_errstrings[UBASIC_E_ENDMARK]; 3 49 4 50 extern int ubasic_error; 5 extern int ubasic_line;6 51 7 52 void ubasic_init(const char *program); 8 53 void ubasic_run(void); 9 54 int ubasic_finished(void); 55 int ubasic_linenumber(); 10 56 11 57 int ubasic_get_variable(int varnum); 12 58 void ubasic_set_variable(int varum, int value); 13 59 14 #endif 60 #endif /* __UBASIC_H__ */ -
trunk/lib/ubasic/Makefile
r1 r5 8 8 9 9 check: 10 gcc - DTEST -o test *.c10 gcc -Wall -DTEST -o test *.c 11 11 12 12 clean: -
trunk/lib/ubasic/README
r1 r5 2 2 http://www.sics.se/~adam/ubasic/ 3 3 4 functions stubs for camera control added by Pablo d'Angelo 4 Pablo d'Angelo improved the parser to support labels and removed 5 the line numbers. 5 6 -
trunk/lib/ubasic/camera_functions.c
r1 r5 1 1 #ifdef TEST 2 3 #include <stdio.h> 4 2 5 void ubasic_camera_click(const char *s) 3 6 { … … 5 8 } 6 9 7 void ubasic_camera_sleep( longv)10 void ubasic_camera_sleep(int v) 8 11 { 9 12 printf("***sleep %d***\n",v); 10 13 } 11 14 12 void ubasic_camera_sho t()15 void ubasic_camera_shoot() 13 16 { 14 printf("***sho t***\n");17 printf("***shoot***\n"); 15 18 } 16 19 17 //##################################### 18 #if 0 19 const char *ub_script = 20 "10 sleep 3000\n" 20 void shooting_set_tv(int v) 21 { 22 printf("***set tv %d***\n",v); 23 } 21 24 22 "20 shot\n" 25 void shooting_set_tv_rel(int v) 26 { 27 printf("***set tv rel %d***\n",v); 28 } 23 29 24 "30 click \"right\"\n" 25 "40 click \"right\"\n" 26 "50 click \"right\"\n" 30 void shooting_set_av(int v) 31 { 32 printf("***set av %d***\n",v); 33 } 27 34 28 "60 shot\n" 35 void shooting_set_av_rel(int v) 36 { 37 printf("***set av rel %d***\n",v); 38 } 29 39 30 "70 click \"right\"\n" 31 "80 click \"right\"\n" 32 "90 click \"right\"\n" 40 int shooting_get_tv() 41 { 42 return 0; 43 } 33 44 34 "100 shot\n" 45 int shooting_get_av() 46 { 47 return 0; 48 } 35 49 36 "110 click \"right\"\n"37 "120 click \"right\"\n"38 "130 click \"right\"\n"39 50 40 "140 shot\n"41 42 "500 end\n"43 ;44 #elif 045 const char *ub_script =46 "10 sleep 1000\n"47 "20 for s = 1 to 5\n"48 "30 shot\n"49 "40 for n = 1 to 3\n"50 "50 click \"right\"\n"51 "60 next n\n"52 "70 next s\n"53 "80 end\n"54 ;55 #else56 const char *ub_script =57 "10 sleep 1000\n"58 "11 let a = 0\n"59 "12 let b = 2\n"60 "12 if a < 1 then let a = 3\n"61 "20 for s = 1 to a\n"62 "30 shot\n"63 "40 for n = 1 to b\n"64 "50 click \"right\"\n"65 "60 next n\n"66 "70 next s\n"67 "80 end\n";68 51 #endif 69 70 int main()71 {72 ubasic_init(ub_script);73 do {74 ubasic_run();75 } while(!ubasic_finished());76 77 }78 #endif -
trunk/lib/ubasic/camera_functions.h
r1 r5 2 2 void ubasic_camera_click(const char *s); 3 3 void ubasic_camera_sleep(long v); 4 void ubasic_camera_sho t();4 void ubasic_camera_shoot(); 5 5 -
trunk/lib/ubasic/tokenizer.c
r1 r5 32 32 33 33 #if DEBUG 34 #define DEBUG_PRINTF(...) printf(__VA_ARGS__)34 #define DEBUG_PRINTF(...) fprintf(stderr,__VA_ARGS__) 35 35 #else 36 36 #define DEBUG_PRINTF(...) … … 49 49 }; 50 50 51 static int current_token = TOKENIZER_ERROR; 51 static ubasic_token current_token = TOKENIZER_ERROR; 52 static int current_line = 0; 52 53 53 54 static const struct keyword_token keywords[] = { … … 66 67 67 68 {"click", TOKENIZER_CLICK}, 68 {"shot", TOKENIZER_SHOT}, 69 {"shot", TOKENIZER_SHOOT}, // for compatibility 70 {"shoot", TOKENIZER_SHOOT}, 69 71 {"sleep", TOKENIZER_SLEEP}, 70 72 … … 87 89 { 88 90 if(*ptr == '\n') { 89 return TOKENIZER_CR;90 } else if(*ptr == '\r') {91 91 return TOKENIZER_CR; 92 92 } else if(*ptr == ',') { … … 130 130 DEBUG_PRINTF("get_next_token(): '%s'\n", ptr); 131 131 132 // eat all whitespace 133 while(*ptr == ' ' || *ptr == '\t' || *ptr == '\r') ptr++; 134 132 135 if(*ptr == 0) { 133 136 return TOKENIZER_ENDOFINPUT; … … 152 155 DEBUG_PRINTF("get_next_token: error due to too long number\n"); 153 156 return TOKENIZER_ERROR; 157 } else if(*ptr == ':') { 158 // label 159 nextptr = ptr; 160 do { 161 ++nextptr; 162 } while(*nextptr != ' ' && * nextptr != '\n' && *nextptr != '\t'); 163 return TOKENIZER_LABEL; 154 164 } else if((i=singlechar()) != 0) { 155 165 if (i == TOKENIZER_CR){ 156 // eliminate empty lines, support cr+lf line ending 157 do { 158 ptr++; 159 } while (singlechar() == TOKENIZER_CR); 160 ptr--; 166 // move to next line, and skip all following empty lines as well 167 while (singlechar() == TOKENIZER_CR) 168 { 169 current_line++; 170 ptr++; 171 // eat all whitespace 172 while(*ptr == ' ' || *ptr == '\t' || *ptr == '\r') ptr++; 173 }; 174 ptr--; 175 // dangelo: now the last char might point to a whitespace instead of 176 // a CR. I hope that doesn't break anything. 161 177 } 162 178 nextptr = ptr + 1; 163 164 179 return i; 165 180 } else if(*ptr == '"') { … … 192 207 { 193 208 ptr = program; 209 current_line = 1; 194 210 current_token = get_next_token(); 195 211 } … … 247 263 /*---------------------------------------------------------------------------*/ 248 264 void 265 tokenizer_label(char *dest, int len) 266 { 267 char *string_end; 268 char *string_end2; 269 int string_len; 270 271 if(tokenizer_token() != TOKENIZER_LABEL) { 272 return; 273 } 274 // allow string \n and space to end labels 275 // TODO: allow tabs as well 276 string_end = strchr(ptr + 1, ' '); 277 string_end2 = strchr(ptr + 1, '\n'); 278 if (string_end == NULL) 279 string_end = string_end2; 280 else if (string_end2 == NULL) { 281 282 } 283 else if (string_end2 < string_end) 284 string_end = string_end2; 285 286 if(string_end == NULL) { 287 return; 288 } 289 string_len = string_end - ptr - 1; 290 if(len < string_len) { 291 string_len = len; 292 } 293 memcpy(dest, ptr + 1, string_len); 294 dest[string_len] = 0; 295 } 296 /*---------------------------------------------------------------------------*/ 297 void 249 298 tokenizer_error_print(void) 250 299 { … … 264 313 } 265 314 /*---------------------------------------------------------------------------*/ 315 int tokenizer_line_number(void) 316 { 317 return current_line; 318 } -
trunk/lib/ubasic/tokenizer.h
r1 r5 31 31 #define __TOKENIZER_H__ 32 32 33 enum {33 typedef enum { 34 34 TOKENIZER_ERROR, 35 35 TOKENIZER_ENDOFINPUT, … … 65 65 TOKENIZER_EQ, 66 66 TOKENIZER_CR, 67 TOKENIZER_LABEL, 67 68 TOKENIZER_SLEEP, 68 69 TOKENIZER_CLICK, 69 TOKENIZER_SHO T,70 TOKENIZER_SHOOT, 70 71 TOKENIZER_GET_TV, 71 72 TOKENIZER_SET_TV, … … 73 74 TOKENIZER_GET_AV, 74 75 TOKENIZER_SET_AV, 75 TOKENIZER_SET_AV_REL, 76 77 }; 76 TOKENIZER_SET_AV_REL 77 } ubasic_token; 78 78 79 79 void tokenizer_init(const char *program); … … 83 83 int tokenizer_variable_num(void); 84 84 void tokenizer_string(char *dest, int len); 85 void tokenizer_label(char *dest, int len); 86 87 int tokenizer_line_number(void); 88 void tokenizer_skip_line(void); 85 89 86 90 int tokenizer_finished(void); -
trunk/lib/ubasic/ubasic.c
r1 r5 30 30 31 31 #if DEBUG 32 #define DEBUG_PRINTF(...) printf(__VA_ARGS__)32 #define DEBUG_PRINTF(...) fprintf(stderr, __VA_ARGS__) 33 33 #else 34 34 #define DEBUG_PRINTF(...) … … 42 42 43 43 #include "stdlib.h" /* exit() */ 44 45 #ifdef DEBUG 46 #include <stdio.h> 47 #endif 44 48 45 49 static char const *program_ptr; … … 70 74 71 75 int ubasic_error; 72 int ubasic_line; 76 const char *ubasic_errstrings[UBASIC_E_ENDMARK] = 77 { 78 "No err", 79 "Parse err", 80 "Unk stmt", 81 "Unk key", 82 "Unk label", 83 "Stack ful", 84 "bad return", 85 "Unk err" 86 }; 87 88 /*---------------------------------------------------------------------------*/ 89 int 90 ubasic_linenumber() 91 { 92 return tokenizer_line_number(); 93 } 73 94 74 95 /*---------------------------------------------------------------------------*/ … … 80 101 tokenizer_init(program); 81 102 ended = 0; 82 ubasic_error = 0; 83 ubasic_line = 0; 103 ubasic_error = UBASIC_E_NONE; 84 104 } 85 105 /*---------------------------------------------------------------------------*/ … … 95 115 tokenizer_next(); 96 116 ended = 1; 97 ubasic_error = 1;117 ubasic_error = UBASIC_E_PARSE; 98 118 return; 99 119 } … … 234 254 return r1; 235 255 } 256 257 #if 0 236 258 /*---------------------------------------------------------------------------*/ 237 259 static void … … 252 274 } 253 275 } 276 #endif 277 278 /*---------------------------------------------------------------------------*/ 279 static void 280 jump_line(int linenum) 281 { 282 tokenizer_init(program_ptr); 283 while(tokenizer_line_number() != linenum) { 284 tokenizer_next(); 285 } 286 /* swallow the CR that would be read next */ 287 accept(TOKENIZER_CR); 288 289 } 290 /*---------------------------------------------------------------------------*/ 291 // TODO: error handling? 292 static int 293 jump_label(char * label) 294 { 295 char currLabel[MAX_STRINGLEN]; 296 tokenizer_init(program_ptr); 297 currLabel[0] = 0; 298 while(tokenizer_token() != TOKENIZER_ENDOFINPUT) { 299 tokenizer_next(); 300 if (tokenizer_token() == TOKENIZER_LABEL) { 301 tokenizer_label(currLabel, sizeof(currLabel)); 302 tokenizer_next(); 303 if(strcmp(label, currLabel) == 0) { 304 accept(TOKENIZER_CR); 305 DEBUG_PRINTF("jump_linenum: Found line %d\n", tokenizer_line_number()); 306 break; 307 } 308 } 309 } 310 if (tokenizer_token() == TOKENIZER_ENDOFINPUT) { 311 DEBUG_PRINTF("Label %s not found", label); 312 ubasic_error = UBASIC_E_UNK_LABEL; 313 return 0; 314 } else { 315 return 1; 316 } 317 } 254 318 /*---------------------------------------------------------------------------*/ 255 319 static void … … 257 321 { 258 322 accept(TOKENIZER_GOTO); 259 jump_linenum(tokenizer_num()); 323 if(tokenizer_token() == TOKENIZER_STRING) { 324 tokenizer_string(string, sizeof(string)); 325 tokenizer_next(); 326 jump_label(string); 327 } else { 328 DEBUG_PRINTF("ubasic.c: goto_statement(): no label specified\n"); 329 // exit(1); 330 #warning todo: well... there should be something... definitely. 331 // exit(1); 332 ended = 1; 333 ubasic_error = UBASIC_E_UNK_LABEL; 334 } 260 335 } 261 336 /*---------------------------------------------------------------------------*/ … … 288 363 tokenizer_next(); 289 364 } 290 365 /*---------------------------------------------------------------------------*/ 291 366 static void 292 367 if_statement(void) … … 334 409 gosub_statement(void) 335 410 { 336 int linenum;337 411 accept(TOKENIZER_GOSUB); 338 linenum = tokenizer_num(); 339 accept(TOKENIZER_NUMBER); 340 accept(TOKENIZER_CR); 341 if(gosub_stack_ptr < MAX_GOSUB_STACK_DEPTH) { 342 gosub_stack[gosub_stack_ptr] = tokenizer_num(); 343 gosub_stack_ptr++; 344 jump_linenum(linenum); 412 if(tokenizer_token() == TOKENIZER_STRING) { 413 tokenizer_string(string, sizeof(string)); 414 tokenizer_next(); 415 accept(TOKENIZER_CR); 416 if(gosub_stack_ptr < MAX_GOSUB_STACK_DEPTH) { 417 gosub_stack[gosub_stack_ptr] = tokenizer_line_number(); 418 gosub_stack_ptr++; 419 jump_label(string); 420 } else { 421 DEBUG_PRINTF("gosub_statement: gosub stack exhausted\n"); 422 // exit(1); 423 #warning todo: well... there should be something... definitely. 424 // exit(1); 425 ended = 1; 426 ubasic_error = UBASIC_E_GOSUB_STACK_EXHAUSTED; 427 } 345 428 } else { 346 DEBUG_PRINTF("gosub_statement: gosub stack exhausted\n"); 429 DEBUG_PRINTF("ubasic.c: goto_statement(): no label specified\n"); 430 // exit(1); 431 #warning todo: well... there should be something... definitely. 432 // exit(1); 433 ended = 1; 434 ubasic_error = UBASIC_E_UNK_LABEL; 347 435 } 348 436 } … … 354 442 if(gosub_stack_ptr > 0) { 355 443 gosub_stack_ptr--; 356 jump_line num(gosub_stack[gosub_stack_ptr]);444 jump_line(gosub_stack[gosub_stack_ptr]); 357 445 } else { 358 446 DEBUG_PRINTF("return_statement: non-matching return\n"); 447 ended = 1; 448 ubasic_error = UBASIC_E_UNMATCHED_RETURN; 359 449 } 360 450 } … … 373 463 ubasic_get_variable(var) + 1); 374 464 if(ubasic_get_variable(var) <= for_stack[for_stack_ptr - 1].to) { 375 jump_line num(for_stack[for_stack_ptr - 1].line_after_for);465 jump_line(for_stack[for_stack_ptr - 1].line_after_for); 376 466 } else { 377 467 for_stack_ptr--; … … 400 490 401 491 if(for_stack_ptr < MAX_FOR_STACK_DEPTH) { 402 for_stack[for_stack_ptr].line_after_for = tokenizer_ num();492 for_stack[for_stack_ptr].line_after_for = tokenizer_line_number(); 403 493 for_stack[for_stack_ptr].for_variable = for_variable; 404 494 for_stack[for_stack_ptr].to = to; … … 442 532 /*---------------------------------------------------------------------------*/ 443 533 static void 444 sho t_statement(void)445 { 446 accept(TOKENIZER_SHO T);447 ubasic_camera_sho t();448 DEBUG_PRINTF("End of sho t\n");534 shoot_statement(void) 535 { 536 accept(TOKENIZER_SHOOT); 537 ubasic_camera_shoot(); 538 DEBUG_PRINTF("End of shoot\n"); 449 539 accept(TOKENIZER_CR); 450 540 } … … 514 604 statement(void) 515 605 { 516 inttoken;517 606 ubasic_token token; 607 518 608 token = tokenizer_token(); 519 609 520 610 switch(token) { 521 611 case TOKENIZER_PRINT: … … 529 619 click_statement(); 530 620 break; 531 case TOKENIZER_SHO T:532 sho t_statement();621 case TOKENIZER_SHOOT: 622 shoot_statement(); 533 623 break; 534 624 … … 585 675 // exit(1); 586 676 ended = 1; 587 ubasic_error = 2;677 ubasic_error = UBASIC_E_UNK_STATEMENT; 588 678 } 589 679 } … … 592 682 line_statement(void) 593 683 { 594 ubasic_line = tokenizer_num();595 DEBUG_PRINTF("----------- Line number %d ---------\n", ubasic_line);684 /* line numbers have been removed */ 685 DEBUG_PRINTF("----------- Line number %d ---------\n", tokenizer_line_number()); 596 686 /* current_linenum = tokenizer_num();*/ 597 accept(TOKENIZER_NUMBER); 687 if (tokenizer_token() == TOKENIZER_LABEL) { 688 #ifdef DEBUG 689 tokenizer_label(string, sizeof(string)); 690 DEBUG_PRINTF("line_statement: label: %s\n", string ); 691 #endif 692 accept(TOKENIZER_LABEL); 693 return; 694 } 598 695 statement(); 599 696 return; -
trunk/platform/a610/main.c
r1 r5 267 267 { KEY_RIGHT , 0x00000004 }, 268 268 { KEY_SET , 0x00000100 }, 269 { KEY_SHO T_FULL, 0x00000030 }, // note 3 here!270 { KEY_SHO T_HALF, 0x00000010 },269 { KEY_SHOOT_FULL, 0x00000030 }, // note 3 here! 270 { KEY_SHOOT_HALF, 0x00000010 }, 271 271 { KEY_ZOOM_IN , 0x00000040 }, 272 272 { KEY_ZOOM_OUT , 0x00000080 }, -
trunk/platform/a620/main.c
r1 r5 267 267 { KEY_RIGHT , 0x00000004 }, 268 268 { KEY_SET , 0x00000100 }, 269 { KEY_SHO T_FULL, 0x00000030 }, // note 3 here!270 { KEY_SHO T_HALF, 0x00000010 },269 { KEY_SHOOT_FULL, 0x00000030 }, // note 3 here! 270 { KEY_SHOOT_HALF, 0x00000010 }, 271 271 { KEY_ZOOM_IN , 0x00000040 }, 272 272 { KEY_ZOOM_OUT , 0x00000080 }, -
trunk/script/default.bas
r1 r5 1 1sleep 10002 2if a<1 then let a=23 3if b<1 then let b=34 4for s=1 to a5 5shot6 6for n=1 to b7 7click "right"8 8next n9 9next s10 10shot11 11end1 sleep 1000 2 if a<1 then let a=2 3 if b<1 then let b=3 4 for s=1 to a 5 shot 6 for n=1 to b 7 click "right" 8 next n 9 next s 10 shot 11 end -
trunk/script/script.bas
r1 r5 1 1sleep 10002 4for s=1 to 33 5shot4 6for n=1 to 55 7click "left"6 8next n7 9next s8 10shot9 11end1 sleep 1000 2 for s=1 to 3 3 shot 4 for n=1 to 5 5 click "left" 6 next n 7 next s 8 shot 9 end
Note: See TracChangeset
for help on using the changeset viewer.