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

void script_console_add_error ( long  str_id)

Definiert in Zeile 94 der Datei script.c.

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

Definiert in Zeile 81 der Datei script.c.

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

Definiert in Zeile 230 der Datei script.c.

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

Definiert in Zeile 148 der Datei script.c.

149 {
151  {
153  }
154  else
155  {
156  strcpy(buf,"<ALT>");
157  }
158 }
int script_is_running ( )

Definiert in Zeile 135 der Datei script.c.

136 {
138 }
void script_load ( const char *  fn)

Definiert in Zeile 734 der Datei gui_script.c.

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

Definiert in Zeile 60 der Datei script.c.

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

Definiert in Zeile 141 der Datei script.c.

long script_stack_start ( )

Definiert in Zeile 126 der Datei script.c.

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

Definiert in Zeile 274 der Datei script.c.

275 {
276  if (conf.script_file[0] == 0) return 0;
277 
280 
281  // Kill high speed USB timer if running
283 
284  // Keyboard init
288 
289  // Close old console, will be re-opened when first line added
290  console_close();
292 
294 
296 
299  {
300  return -1;
301  }
302 
303  sc_param *p = script_params;
304  while (p)
305  {
306  if (p->name != 0)
307  {
308  libscriptapi->set_variable(p->name, p->val, (p->range == 1), (p->data_type == DTYPE_TABLE), p->option_count, p->options);
309  }
310  p = p->next;
311  }
312 
314 
316 
317  return script_stack_start();
318 }
void script_wait_terminate ( void  )

Definiert in Zeile 217 der Datei script.c.

218 {
220  return;
221  }
223  // TODO timeout?
225  msleep(10);
226  }
227 }

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.