CHDK_DE Vorschauversion  Trunk Rev. 6014
 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 923 der Datei ubasic.c.

924 {
925  char currLabel[MAX_STRINGLEN];
927  currLabel[0] = 0;
929  tokenizer_next();
930  if (tokenizer_token() == TOKENIZER_LABEL) {
931  tokenizer_label(currLabel, sizeof(currLabel));
932  tokenizer_next();
933  if(strcmp(label, currLabel) == 0) {
935  DEBUG_PRINTF("jump_linenum: Found line %d\n", tokenizer_line_number());
936  break;
937  }
938  }
939  }
942  DEBUG_PRINTF("Label %s not found", label);
944  }
945  return 0;
946  } else {
947  return 1;
948  }
949 }
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 2805 der Datei ubasic.c.

2805  {
2806 }
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 2740 der Datei ubasic.c.

2741 {
2742  unsigned start_tick = get_tick_count();
2743  unsigned lines = 0;
2744  flag_yield = 0;
2745 
2746  do
2747  {
2748  if ( ended || tokenizer_finished() )
2749  {
2750  DEBUG_PRINTF("uBASIC program finished\n");
2751  if (ubasic_error)
2752  {
2753  // Generate error message
2754  char buf[100];
2755  const char *msg;
2757  {
2759  }
2760  else
2761  {
2763  }
2764  sprintf(buf, "uBASIC:%d %s ", ubasic_linenumber(), msg);
2765  // Show error message
2766  script_console_add_error((long)buf);
2768  return SCRIPT_RUN_ERROR;
2769  }
2770  // Show 'Finished' message
2772  return SCRIPT_RUN_ENDED;
2773  }
2774 
2775  line_statement();
2776 
2777  // Return control to CHDK only if external processing required
2778  if ( flag_yield )
2779  return SCRIPT_RUN_RUNNING;
2780 
2781  lines++;
2782  } while (lines < yield_max_lines && get_tick_count() - start_tick < yield_max_ms);
2783 
2784  return SCRIPT_RUN_RUNNING;
2785 }
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 2810 der Datei ubasic.c.

2811 {
2812  if (ubasic_as_ret_var_num >= 0)
2814 }
void ubasic_set_variable ( int  varum,
int  value 
)

Definiert in Zeile 2788 der Datei ubasic.c.

2789 {
2790  if(varnum >= 0 && varnum < MAX_VARNUM) {
2791  variables[varnum] = value;
2792  }
2793 }

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.