CHDK_DE Vorschauversion  Trunk Rev. 5833
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
ubasic.c-Dateireferenz
#include "camera_info.h"
#include "gui.h"
#include "fileutil.h"
#include "conf.h"
#include "script_api.h"
#include "module_def.h"
#include "gui_lang.h"
+ Include-Abhängigkeitsdiagramm für ubasic.c:

gehe zum Quellcode dieser Datei

Funktionen

int ubasic_init (const char *program, int is_ptp)
 
int ubasic_run (void)
 
void ubasic_end (void)
 
void ubasic_set_variable (int varum, int value)
 
void ubasic_set_as_ret (int md_ret)
 
int jump_label (char *label)
 
static int ubasic_run_restore (void)
 
static void _set_variable (char *name, int value, __attribute__((unused)) int isBool, __attribute__((unused)) int isTable, __attribute__((unused)) int labelCount, __attribute__((unused)) const char **labels)
 
static int ubasic_init_file (char const *filename)
 
static void ubasic_script_shoot_hook_run (__attribute__((unused)) int hook)
 
static int module_unloader ()
 

Variablen

static char * script_source = 0
 
static char last_script [100] = ""
 
libscriptapi_sym _libubasic
 
ModuleInfo _module_info
 

Dokumentation der Funktionen

static void _set_variable ( char *  name,
int  value,
__attribute__((unused)) int  isBool,
__attribute__((unused)) int  isTable,
__attribute__((unused)) int  labelCount,
__attribute__((unused)) const char **  labels 
)
static

Definiert in Zeile 23 der Datei ubasic.c.

25 {
26  ubasic_set_variable(name[0] - (name[0]>='a'?'a':('A'-26)), value);
27 }
int jump_label ( char *  label)

Definiert in Zeile 909 der Datei ubasic.c.

910 {
911  char currLabel[MAX_STRINGLEN];
913  currLabel[0] = 0;
915  tokenizer_next();
916  if (tokenizer_token() == TOKENIZER_LABEL) {
917  tokenizer_label(currLabel, sizeof(currLabel));
918  tokenizer_next();
919  if(strcmp(label, currLabel) == 0) {
921  DEBUG_PRINTF("jump_linenum: Found line %d\n", tokenizer_line_number());
922  break;
923  }
924  }
925  }
928  DEBUG_PRINTF("Label %s not found", label);
930  }
931  return 0;
932  } else {
933  return 1;
934  }
935 }
static int module_unloader ( )
static

Definiert in Zeile 52 der Datei ubasic.c.

53 {
54  if (script_source)
55  {
57  script_source = 0;
58  }
59  return 0;
60 }
void ubasic_end ( void  )

Definiert in Zeile 2787 der Datei ubasic.c.

2787  {
2788 }
int ubasic_init ( const char *  program,
int  is_ptp 
)
static int ubasic_init_file ( char const filename)
static

Definiert in Zeile 32 der Datei ubasic.c.

33 {
34  if (strcmp(last_script, filename) != 0)
35  {
36  strcpy(last_script, filename);
37  if (script_source)
39  script_source = load_file(filename, 0, 1);
40  }
41  if (script_source)
42  {
43  return ubasic_init(script_source, 0);
44  }
45  return 0;
46 }
int ubasic_run ( void  )

Definiert in Zeile 2722 der Datei ubasic.c.

2723 {
2724  unsigned start_tick = get_tick_count();
2725  unsigned lines = 0;
2726  flag_yield = 0;
2727 
2728  do
2729  {
2730  if ( ended || tokenizer_finished() )
2731  {
2732  DEBUG_PRINTF("uBASIC program finished\n");
2733  if (ubasic_error)
2734  {
2735  // Generate error message
2736  char buf[100];
2737  const char *msg;
2739  {
2741  }
2742  else
2743  {
2745  }
2746  sprintf(buf, "uBASIC:%d %s ", ubasic_linenumber(), msg);
2747  // Show error message
2748  script_console_add_error((long)buf);
2750  return SCRIPT_RUN_ERROR;
2751  }
2752  // Show 'Finished' message
2754  return SCRIPT_RUN_ENDED;
2755  }
2756 
2757  line_statement();
2758 
2759  // Return control to CHDK only if external processing required
2760  if ( flag_yield )
2761  return SCRIPT_RUN_RUNNING;
2762 
2763  lines++;
2764  } while (lines < yield_max_lines && get_tick_count() - start_tick < yield_max_ms);
2765 
2766  return SCRIPT_RUN_RUNNING;
2767 }
static int ubasic_run_restore ( void  )
static

Definiert in Zeile 21 der Datei ubasic.c.

21 { return jump_label("restore"); }
static void ubasic_script_shoot_hook_run ( __attribute__((unused)) int  hook)
static

Definiert in Zeile 49 der Datei ubasic.c.

49 { return; }
void ubasic_set_as_ret ( int  md_ret)

Definiert in Zeile 2792 der Datei ubasic.c.

2793 {
2794  if (ubasic_as_ret_var_num >= 0)
2796 }
void ubasic_set_variable ( int  varum,
int  value 
)

Definiert in Zeile 2770 der Datei ubasic.c.

2771 {
2772  if(varnum >= 0 && varnum < MAX_VARNUM) {
2773  variables[varnum] = value;
2774  }
2775 }

Variablen-Dokumentation

char last_script[100] = ""
static

Definiert in Zeile 30 der Datei ubasic.c.

char* script_source = 0
static

Definiert in Zeile 29 der Datei ubasic.c.