Index: /trunk/lib/ubasic/camera_functions.c
===================================================================
--- /trunk/lib/ubasic/camera_functions.c	(revision 845)
+++ /trunk/lib/ubasic/camera_functions.c	(revision 846)
@@ -1,8 +1,11 @@
-#ifdef TEST
+#ifdef UBASIC_TEST
 
 #include <stdio.h>
 
 static int tv=0, av=0, zoom=0, focus=0, iso=0, raw=0, raw_nr=0,autostart=0; 
-
+int movie_status=0;
+int shot_histogram_enabled=0;
+int state_kbd_script_run=1;
+int zoom_points = 3;
 #define MODE_REC                0x0100
 
@@ -135,12 +138,15 @@
 int md_detect_motion(void)
 {
+    printf("*** md_detect_motion ***\n");
 	return 0;
 }
 int md_get_cell_diff(int column, int row)
 {
+    printf("*** md_get_sell_diff %d %d ***\n", column, row);
 	return 0;
 }
 int md_init_motion_detector()
 {
+    printf("*** md_init_motion_detector ***\n");
 	return 0;
 }
@@ -153,4 +159,5 @@
 int ubasic_camera_get_nr(to) 
 {
+    printf("*** get raw nr ***\n");
 	return raw_nr;
 };
@@ -413,8 +420,106 @@
 }
 
-
-
-
-
+int get_exposure_counter(void)
+{
+    printf("*** get_exposure_counter ***\n");
+	return 123;
+}
+
+
+int ubasic_camera_is_pressed(const char *v) 
+{
+    printf("*** ubasic_camera_is_pressed %s ***\n", v);
+	return 0;
+}
+
+
+int shot_histogram_get_range(int from, int to)
+{
+    printf("*** shot_histogram_get_range %d,%d ***\n", from,to);
+	return 100;
+}
+
+void script_print_screen_statement(int v)
+{
+    printf("*** script_print_screensatement %d ***\n", v);
+}
+
+int get_tick_count(void)
+{
+    printf("*** get_tick_count ***\n");
+	// what should it return ?
+	return 10;
+}
+
+short shooting_get_drive_mode()
+{
+    printf("*** shooting_get_drive_mode ***\n");
+	// what should it return ?
+	return 10;
+}
+
+int shot_histogram_isenabled()
+{
+    printf("*** shot_histogram_isenabled ***\n");
+	return shot_histogram_enabled;
+}
+
+int get_ccd_temp() 
+{
+    printf("*** get_ccd_temp ***\n");
+	return 69;
+}
+int get_optical_temp()
+{
+    printf("*** get_optical_temp ***\n");
+	return 69;
+}
+
+int get_battery_temp()
+{
+    printf("*** get_battery_temp ***\n");
+	return 69;
+}
+
+void play_sound()
+{
+    printf("*** play_sound ***\n");
+}	
+
+void TurnOnBackLight()
+{
+    printf("*** TurOnBackLight ***\n");
+}
+
+void TurnOffBackLight()
+{
+    printf("*** TurnOffBackLight ***\n");
+}
+
+void DoAFLock()
+{
+    printf("*** DoAFLock ***\n");
+}
+
+void UnlockAF()
+{
+    printf("*** UnlockAF ***\n");
+}
+
+int shot_histogram_set(int x)
+{
+    printf("*** shot_histogram_set ***\n");
+	return 1;
+}
+
+void levent_set_record()
+{
+    printf("*** levent_set_record ***\n");
+}
+
+void levent_set_play()
+{
+    printf("*** levent_set_play ***\n");
+}
 
 
Index: /trunk/lib/ubasic/ubasic.c
===================================================================
--- /trunk/lib/ubasic/ubasic.c	(revision 845)
+++ /trunk/lib/ubasic/ubasic.c	(revision 846)
@@ -35,12 +35,15 @@
 #endif
 
-#ifdef TEST
+#ifdef UBASIC_TEST
 #include "../../include/ubasic.h"
 #include "../../include/platform.h"
 #include "../../include/script.h"
+#include "../../include/shot_histogram.h"
 #include "../../include/levent.h"
 #include <string.h>
+#include <time.h>
 #include <fcntl.h>
 #include <io.h>
+#include <stdlib.h> /* rand,srand */
 #else
 #include "ubasic.h"
@@ -48,14 +51,15 @@
 #include "script.h"
 #include "camera.h"
+#include "shot_histogram.h"
+#include "stdlib.h"
 #include "levent.h"
 #endif
-//#include "platform.h"
 #include "tokenizer.h"
-#include "shot_histogram.h"
+
+
 #include "../../include/conf.h"
 
 #include "camera_functions.h"
 
-#include "stdlib.h" /* exit() */
 
 #define INCLUDE_OLD_GET__SYNTAX
@@ -244,5 +248,9 @@
 case TOKENIZER_GET_SCRIPT_AUTOSTART:
     accept(TOKENIZER_GET_SCRIPT_AUTOSTART);
+#ifdef UBASIC_TEST
+	r = 0;
+#else
     r = conf.script_startup;
+#endif
     break;
 case TOKENIZER_GET_USB_POWER:
@@ -467,20 +475,25 @@
   }
     break;
-  case TOKENIZER_GET_TIME:
+  case TOKENIZER_GET_TIME: {
     accept(TOKENIZER_GET_TIME);
-	  unsigned long t2 = time(NULL);
-	  int time = expr();
-	  static struct tm *ttm;
-	  ttm = localtime(&t2);
-  if (time==0) r = ttm->tm_sec;
-  else if (time==1) r = ttm->tm_min;
-  else if (time==2) r = ttm->tm_hour;
-  else if (time==3) r = ttm->tm_mday;
-  else if (time==4) r = ttm->tm_mon+1;
-  else if (time==5) r = 1900+ttm->tm_year;
- break;
+    unsigned long t2 = time(NULL);
+    int tmode = expr();
+    static struct tm *ttm;
+    ttm = localtime(&t2);
+    if (tmode==0) r = ttm->tm_sec;
+    else if (tmode==1) r = ttm->tm_min;
+    else if (tmode==2) r = ttm->tm_hour;
+    else if (tmode==3) r = ttm->tm_mday;
+    else if (tmode==4) r = ttm->tm_mon+1;
+    else if (tmode==5) r = 1900+ttm->tm_year;
+    break;
+ }
  case TOKENIZER_GET_RAW:
     accept(TOKENIZER_GET_RAW);
+#ifdef UBASIC_TEST
+	r = 1;
+#else
     r = conf.save_raw;     
+#endif
     break;
   default:
@@ -1869,6 +1882,8 @@
     accept(TOKENIZER_SET_SCRIPT_AUTOSTART);
     to = expr();
+#ifndef UBASIC_TEST
 	if (to >= 0 && to <= 2) conf.script_startup=to;
 	conf_save();
+#endif
     accept_cr();
 }
Index: /trunk/lib/ubasic/tokenizer.c
===================================================================
--- /trunk/lib/ubasic/tokenizer.c	(revision 845)
+++ /trunk/lib/ubasic/tokenizer.c	(revision 846)
@@ -35,5 +35,5 @@
 #endif
 
-#ifdef TEST
+#ifdef UBASIC_TEST
 #include <string.h>
 #include <ctype.h>
Index: /trunk/lib/ubasic/Makefile
===================================================================
--- /trunk/lib/ubasic/Makefile	(revision 845)
+++ /trunk/lib/ubasic/Makefile	(revision 846)
@@ -12,5 +12,5 @@
 
 check:
-	gcc -g -Wall -DTEST -DCAMERA_a610 -o ubasic_test$(EXE) *.c
+	gcc -g -Wall -DUBASIC_TEST -DCAMERA_$(PLATFORM) -DPLATFORMID=$(PLATFORMID) -o ubasic_test$(EXE) *.c
 
 clean:
