CHDK_DE Vorschauversion  Trunk Rev. 5163
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
script.h-Dateireferenz
+ Dieser Graph zeigt, welche Datei direkt oder indirekt diese Datei enthält:

gehe zum Quellcode dieser Datei

Datenstrukturen

struct  _sc_param
 

Makrodefinitionen

#define DTYPE_INT   0
 
#define DTYPE_TABLE   1
 

Typdefinitionen

typedef struct _sc_param sc_param
 

Aufzählungen

enum  { SCRIPT_STATE_INACTIVE =0, SCRIPT_STATE_RAN, SCRIPT_STATE_INTERRUPTED }
 

Funktionen

void script_load (const char *fn)
 
void save_params_values (int enforce)
 
void script_console_add_line (long str_id)
 
void script_console_add_error (long str_id)
 
void script_print_screen_statement (int val)
 
void script_get_alt_text (char *buf)
 
void script_set_terminate_key (int key, const char *keyname)
 
int script_is_running ()
 
long script_stack_start ()
 
long script_start_gui (int autostart)
 
void script_check_terminate (void)
 
void script_wait_terminate (void)
 
void script_end ()
 

Variablen

char script_title [36]
 
sc_paramscript_params
 

Makro-Dokumentation

#define DTYPE_INT   0

Definiert in Zeile 19 der Datei script.h.

#define DTYPE_TABLE   1

Definiert in Zeile 20 der Datei script.h.

Dokumentation der benutzerdefinierten Typen

typedef struct _sc_param sc_param

Dokumentation der Aufzählungstypen

anonymous enum
Aufzählungswerte
SCRIPT_STATE_INACTIVE 
SCRIPT_STATE_RAN 
SCRIPT_STATE_INTERRUPTED 

Definiert in Zeile 12 der Datei script.h.

12  { SCRIPT_STATE_INACTIVE=0, // 0 - script is inactive now
13  SCRIPT_STATE_RAN, // 1 - script works now
14  SCRIPT_STATE_INTERRUPTED, // 2 - shutter button was pressed, cancel script
15 };

Dokumentation der Funktionen

void save_params_values ( int  enforce)

Definiert in Zeile 677 der Datei gui_script.c.

678 {
680  {
681  // Write paramsetnum file
683  {
687  }
688 
689  int i, changed=0;
690 
691  // Check is anything changed since last time
692  sc_param *p = script_params;
693  while (p)
694  {
695  if (p->old_val != p->val)
696  {
697  changed++;
698  p->old_val = p->val;
699  }
700  p = p->next;
701  }
702 
703  if (enforce || changed)
704  {
705  // Write parameters file
707  }
708  }
709 }
void script_check_terminate ( void  )

Definiert in Zeile 163 der Datei script.c.

void script_console_add_error ( long  str_id)

Definiert in Zeile 95 der Datei script.c.

96 {
97  console_set_autoredraw(1); // Force console display on
99 }
void script_console_add_line ( long  str_id)

Definiert in Zeile 82 der Datei script.c.

83 {
84  const char* str = lang_str(str_id);
85  console_add_line(str);
86 
87  if (print_screen_p && (print_screen_d >= 0)) {
88  char nl = '\n';
89  // TODO this should be uncached memory
90  write(print_screen_d, str, strlen(str) );
91  write(print_screen_d, &nl, 1);
92  }
93 }
void script_end ( )

Definiert in Zeile 231 der Datei script.c.

232 {
233  // Tell other code that script has ended
236 
237  // reset the script terminate key
239 
241  console_set_autoredraw(1); // Force console display on in case script turned it off
242 
243  // Restore old handler - prevent calling MD draw after module unloaded
244  if (old_gui_handler)
245  {
247  // if script switched in or out of alt, try to preserve
248  // TODO is there ever a situation where it should be something other than default or alt?
250  gui_set_mode(&defaultGuiHandler);
251  } else if(old_gui_handler == &defaultGuiHandler && camera_info.state.gui_mode_alt) {
253  } else {
255  }
256  old_gui_handler = 0;
257  }
258 
259  // Reset script language module
261 
262  // Kill off the action_stack for the script, since we've just reset the script
263  // language and unloaded the MD module, we don't need to let the stack empty
264  // itself.
267 
270 
271  conf_setAutosave(1); // Turn on autosave of config file in conf_setValue in case script turned it off
273 }
void script_get_alt_text ( char *  buf)

Definiert in Zeile 149 der Datei script.c.

150 {
152  {
154  }
155  else
156  {
157  strcpy(buf,"<ALT>");
158  }
159 }
int script_is_running ( )

Definiert in Zeile 136 der Datei script.c.

137 {
139 }
void script_load ( const char *  fn)

Definiert in Zeile 734 der Datei gui_script.c.

735 {
736  char* buf;
737 
738  // if filename is empty, try to load default named script.
739  // if no such one, no script will be used
740  if ((fn == 0) || (fn[0] == 0))
742 
744 
745  get_last_paramset_num(); // update data paths
746  script_scan(); // re-fill @title/@names/@range/@value + reset values to @default
748 
750 }
void script_print_screen_statement ( int  val)

Definiert in Zeile 61 der Datei script.c.

62 {
63  // Negative values for 'val' parameter will append to log file,
64  // positive values will truncate the log file
65  int flag_trunc = O_TRUNC;
66 
67  print_screen_p = val;
68  if (val) {
70  if (val<0) {
71  flag_trunc = 0;
72  val = -val;
73  }
74  while (val > 9999) val -= 10000;
75  sprintf(print_screen_file, "A/CHDK/LOGS/LOG_%04d.TXT", val);
78  }
80 }
void script_set_terminate_key ( int  key,
const char *  keyname 
)

Definiert in Zeile 142 der Datei script.c.

long script_stack_start ( )

Definiert in Zeile 127 der Datei script.c.

128 {
129  script_terminate_request = 0; // ensure any previous terminate request is cleared
130 
134 }
long script_start_gui ( int  autostart)

Definiert in Zeile 275 der Datei script.c.

276 {
277  int i;
278 
279  if (conf.script_file[0] == 0) return 0;
280 
282  camera_info.state.auto_started = autostart;
283 
284  // Kill high speed USB timer if running
286 
287  // Keyboard init
291 
292  // Close old console, will be re-opened when first line added
293  console_close();
295 
297 
299 
302  {
303  return -1;
304  }
305 
306  sc_param *p = script_params;
307  while (p)
308  {
309  if (p->name != 0)
310  {
311  libscriptapi->set_variable(p->name, p->val, (p->range == 1), (p->data_type == DTYPE_TABLE), p->option_count, p->options);
312  }
313  p = p->next;
314  }
315 
317 
319 
320  return script_stack_start();
321 }
void script_wait_terminate ( void  )

Definiert in Zeile 218 der Datei script.c.

219 {
221  return;
222  }
224  // TODO timeout?
226  msleep(10);
227  }
228 }

Variablen-Dokumentation

sc_param* script_params

Definiert in Zeile 38 der Datei gui_script.c.

char script_title[36]

Definiert in Zeile 29 der Datei gui_script.c.