Changeset 846


Ignore:
Timestamp:
12/01/09 04:05:26 (3 years ago)
Author:
reyalp
Message:

fix ubasic test program

Location:
trunk/lib/ubasic
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/ubasic/Makefile

    r515 r846  
    1212 
    1313check: 
    14         gcc -g -Wall -DTEST -DCAMERA_a610 -o ubasic_test$(EXE) *.c 
     14        gcc -g -Wall -DUBASIC_TEST -DCAMERA_$(PLATFORM) -DPLATFORMID=$(PLATFORMID) -o ubasic_test$(EXE) *.c 
    1515 
    1616clean: 
  • trunk/lib/ubasic/camera_functions.c

    r515 r846  
    1 #ifdef TEST 
     1#ifdef UBASIC_TEST 
    22 
    33#include <stdio.h> 
    44 
    55static int tv=0, av=0, zoom=0, focus=0, iso=0, raw=0, raw_nr=0,autostart=0;  
    6  
     6int movie_status=0; 
     7int shot_histogram_enabled=0; 
     8int state_kbd_script_run=1; 
     9int zoom_points = 3; 
    710#define MODE_REC                0x0100 
    811 
     
    135138int md_detect_motion(void) 
    136139{ 
     140    printf("*** md_detect_motion ***\n"); 
    137141        return 0; 
    138142} 
    139143int md_get_cell_diff(int column, int row) 
    140144{ 
     145    printf("*** md_get_sell_diff %d %d ***\n", column, row); 
    141146        return 0; 
    142147} 
    143148int md_init_motion_detector() 
    144149{ 
     150    printf("*** md_init_motion_detector ***\n"); 
    145151        return 0; 
    146152} 
     
    153159int ubasic_camera_get_nr(to)  
    154160{ 
     161    printf("*** get raw nr ***\n"); 
    155162        return raw_nr; 
    156163}; 
     
    413420} 
    414421 
    415  
    416  
    417  
    418  
     422int get_exposure_counter(void) 
     423{ 
     424    printf("*** get_exposure_counter ***\n"); 
     425        return 123; 
     426} 
     427 
     428 
     429int ubasic_camera_is_pressed(const char *v)  
     430{ 
     431    printf("*** ubasic_camera_is_pressed %s ***\n", v); 
     432        return 0; 
     433} 
     434 
     435 
     436int shot_histogram_get_range(int from, int to) 
     437{ 
     438    printf("*** shot_histogram_get_range %d,%d ***\n", from,to); 
     439        return 100; 
     440} 
     441 
     442void script_print_screen_statement(int v) 
     443{ 
     444    printf("*** script_print_screensatement %d ***\n", v); 
     445} 
     446 
     447int get_tick_count(void) 
     448{ 
     449    printf("*** get_tick_count ***\n"); 
     450        // what should it return ? 
     451        return 10; 
     452} 
     453 
     454short shooting_get_drive_mode() 
     455{ 
     456    printf("*** shooting_get_drive_mode ***\n"); 
     457        // what should it return ? 
     458        return 10; 
     459} 
     460 
     461int shot_histogram_isenabled() 
     462{ 
     463    printf("*** shot_histogram_isenabled ***\n"); 
     464        return shot_histogram_enabled; 
     465} 
     466 
     467int get_ccd_temp()  
     468{ 
     469    printf("*** get_ccd_temp ***\n"); 
     470        return 69; 
     471} 
     472int get_optical_temp() 
     473{ 
     474    printf("*** get_optical_temp ***\n"); 
     475        return 69; 
     476} 
     477 
     478int get_battery_temp() 
     479{ 
     480    printf("*** get_battery_temp ***\n"); 
     481        return 69; 
     482} 
     483 
     484void play_sound() 
     485{ 
     486    printf("*** play_sound ***\n"); 
     487}        
     488 
     489void TurnOnBackLight() 
     490{ 
     491    printf("*** TurOnBackLight ***\n"); 
     492} 
     493 
     494void TurnOffBackLight() 
     495{ 
     496    printf("*** TurnOffBackLight ***\n"); 
     497} 
     498 
     499void DoAFLock() 
     500{ 
     501    printf("*** DoAFLock ***\n"); 
     502} 
     503 
     504void UnlockAF() 
     505{ 
     506    printf("*** UnlockAF ***\n"); 
     507} 
     508 
     509int shot_histogram_set(int x) 
     510{ 
     511    printf("*** shot_histogram_set ***\n"); 
     512        return 1; 
     513} 
     514 
     515void levent_set_record() 
     516{ 
     517    printf("*** levent_set_record ***\n"); 
     518} 
     519 
     520void levent_set_play() 
     521{ 
     522    printf("*** levent_set_play ***\n"); 
     523} 
    419524 
    420525 
  • trunk/lib/ubasic/tokenizer.c

    r826 r846  
    3535#endif 
    3636 
    37 #ifdef TEST 
     37#ifdef UBASIC_TEST 
    3838#include <string.h> 
    3939#include <ctype.h> 
  • trunk/lib/ubasic/ubasic.c

    r826 r846  
    3535#endif 
    3636 
    37 #ifdef TEST 
     37#ifdef UBASIC_TEST 
    3838#include "../../include/ubasic.h" 
    3939#include "../../include/platform.h" 
    4040#include "../../include/script.h" 
     41#include "../../include/shot_histogram.h" 
    4142#include "../../include/levent.h" 
    4243#include <string.h> 
     44#include <time.h> 
    4345#include <fcntl.h> 
    4446#include <io.h> 
     47#include <stdlib.h> /* rand,srand */ 
    4548#else 
    4649#include "ubasic.h" 
     
    4851#include "script.h" 
    4952#include "camera.h" 
     53#include "shot_histogram.h" 
     54#include "stdlib.h" 
    5055#include "levent.h" 
    5156#endif 
    52 //#include "platform.h" 
    5357#include "tokenizer.h" 
    54 #include "shot_histogram.h" 
     58 
     59 
    5560#include "../../include/conf.h" 
    5661 
    5762#include "camera_functions.h" 
    5863 
    59 #include "stdlib.h" /* exit() */ 
    6064 
    6165#define INCLUDE_OLD_GET__SYNTAX 
     
    244248case TOKENIZER_GET_SCRIPT_AUTOSTART: 
    245249    accept(TOKENIZER_GET_SCRIPT_AUTOSTART); 
     250#ifdef UBASIC_TEST 
     251        r = 0; 
     252#else 
    246253    r = conf.script_startup; 
     254#endif 
    247255    break; 
    248256case TOKENIZER_GET_USB_POWER: 
     
    467475  } 
    468476    break; 
    469   case TOKENIZER_GET_TIME: 
     477  case TOKENIZER_GET_TIME: { 
    470478    accept(TOKENIZER_GET_TIME); 
    471           unsigned long t2 = time(NULL); 
    472           int time = expr(); 
    473           static struct tm *ttm; 
    474           ttm = localtime(&t2); 
    475   if (time==0) r = ttm->tm_sec; 
    476   else if (time==1) r = ttm->tm_min; 
    477   else if (time==2) r = ttm->tm_hour; 
    478   else if (time==3) r = ttm->tm_mday; 
    479   else if (time==4) r = ttm->tm_mon+1; 
    480   else if (time==5) r = 1900+ttm->tm_year; 
    481  break; 
     479    unsigned long t2 = time(NULL); 
     480    int tmode = expr(); 
     481    static struct tm *ttm; 
     482    ttm = localtime(&t2); 
     483    if (tmode==0) r = ttm->tm_sec; 
     484    else if (tmode==1) r = ttm->tm_min; 
     485    else if (tmode==2) r = ttm->tm_hour; 
     486    else if (tmode==3) r = ttm->tm_mday; 
     487    else if (tmode==4) r = ttm->tm_mon+1; 
     488    else if (tmode==5) r = 1900+ttm->tm_year; 
     489    break; 
     490 } 
    482491 case TOKENIZER_GET_RAW: 
    483492    accept(TOKENIZER_GET_RAW); 
     493#ifdef UBASIC_TEST 
     494        r = 1; 
     495#else 
    484496    r = conf.save_raw;      
     497#endif 
    485498    break; 
    486499  default: 
     
    18691882    accept(TOKENIZER_SET_SCRIPT_AUTOSTART); 
    18701883    to = expr(); 
     1884#ifndef UBASIC_TEST 
    18711885        if (to >= 0 && to <= 2) conf.script_startup=to; 
    18721886        conf_save(); 
     1887#endif 
    18731888    accept_cr(); 
    18741889} 
Note: See TracChangeset for help on using the changeset viewer.