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

gehe zum Quellcode dieser Datei

Makrodefinitionen

#define SCRIPT_DEFAULT_FILENAME   "A/CHDK/SCRIPTS/DEFAULT.LUA"
 
#define SCRIPT_DATA_PATH   "A/CHDK/DATA/"
 
#define DEFAULT_PARAM_SET   10
 
#define MAX_PARAM_NAME_LEN   64
 
#define IS_SPACE(p)   ((*p == ' ') || (*p == '\t'))
 
#define IS_EOL(p)   ((*p == '\n') || (*p == '\r'))
 
#define SCRIPT_SUBMENU_PARAMS_IDX   8
 
#define SCRIPT_SUBMENU_BOTTOM_IDX   34
 

Aufzählungen

enum  FilenameMakeModeEnum { MAKE_PARAMSETNUM_FILENAME, MAKE_PARAM_FILENAME, MAKE_PARAM_FILENAME_V2 }
 

Funktionen

static void gui_update_script_submenu ()
 
sc_paramfind_param (char *name)
 
sc_paramnew_param (char *name)
 
const char * skip_whitespace (const char *p)
 
const char * skip_to_token (const char *p)
 
const char * skip_token (const char *p)
 
const char * skip_toeol (const char *p)
 
const char * skip_eol (const char *p)
 
const char * skip_tochar (const char *p, char end)
 
const char * get_token (const char *p, char *buf, int maxlen)
 
const char * get_name (const char *p, int maxlen, sc_param **sp, int create)
 
const char * get_script_filename ()
 
static void process_title (const char *ptr)
 
static void process_subtitle (const char *ptr)
 
static int check_param (const char *ptr)
 
static void process_param (const char *ptr)
 
static const char * get_default (sc_param *p, const char *ptr, int isScript)
 
static void process_default (const char *ptr, int isScript)
 
static const char * get_range (sc_param *p, const char *ptr, char end)
 
static void process_range (const char *ptr)
 
static const char * get_values (sc_param *p, const char *ptr, char end)
 
static void process_values (const char *ptr)
 
static int process_single (const char *ptr)
 
static void script_scan ()
 
static char * make_param_filename (enum FilenameMakeModeEnum mode)
 
static void get_last_paramset_num ()
 
static int load_params_values ()
 
static void do_save_param_file ()
 
void save_params_values (int enforce)
 
void script_reset_to_default_params_values ()
 
void script_load (const char *fn)
 
static const char * gui_script_param_set_enum (int change, int arg)
 
static void gui_load_script_selected (const char *fn)
 
static void gui_load_script (int arg)
 
static void gui_reset_script_default (int arg)
 
static void gui_load_script_default (int arg)
 
static void cb_change_param_save_enum ()
 

Variablen

char script_title [36]
 
_chdk_version_t script_version
 
int script_has_version = 0
 
static int last_script_param_set = -1
 
static int is_script_loaded = 0
 
sc_paramscript_params = 0
 
static sc_paramtail = 0
 
int script_param_count
 
static const char * gui_script_autostart_modes [] = { "Off", "On", "Once", "ALT"}
 
static CMenuItem param_save [2]
 
static CMenuItem hdr_script_submenu_items []
 
static CMenuItemscript_submenu_items = 0
 
int script_submenu_count = 0
 
CMenu script_submenu = {0x27,LANG_MENU_SCRIPT_TITLE, 0 }
 

Makro-Dokumentation

#define DEFAULT_PARAM_SET   10

Definiert in Zeile 35 der Datei gui_script.c.

#define IS_EOL (   p)    ((*p == '\n') || (*p == '\r'))

Definiert in Zeile 84 der Datei gui_script.c.

#define IS_SPACE (   p)    ((*p == ' ') || (*p == '\t'))

Definiert in Zeile 83 der Datei gui_script.c.

#define MAX_PARAM_NAME_LEN   64

Definiert in Zeile 36 der Datei gui_script.c.

#define SCRIPT_DATA_PATH   "A/CHDK/DATA/"

Definiert in Zeile 18 der Datei gui_script.c.

#define SCRIPT_DEFAULT_FILENAME   "A/CHDK/SCRIPTS/DEFAULT.LUA"

Definiert in Zeile 17 der Datei gui_script.c.

#define SCRIPT_SUBMENU_BOTTOM_IDX   34

Definiert in Zeile 830 der Datei gui_script.c.

#define SCRIPT_SUBMENU_PARAMS_IDX   8

Definiert in Zeile 829 der Datei gui_script.c.

Dokumentation der Aufzählungstypen

Aufzählungswerte
MAKE_PARAMSETNUM_FILENAME 
MAKE_PARAM_FILENAME 
MAKE_PARAM_FILENAME_V2 

Definiert in Zeile 21 der Datei gui_script.c.

21  {
22  MAKE_PARAMSETNUM_FILENAME, // "DATA/scriptname.cfg"
23  MAKE_PARAM_FILENAME, // "DATA/scriptname_%d"
24  MAKE_PARAM_FILENAME_V2 // "DATA/scriptname.$d"
25 };

Dokumentation der Funktionen

static void cb_change_param_save_enum ( )
static

Definiert in Zeile 810 der Datei gui_script.c.

811 {
813  {
816  }
817  else
818  {
820  }
821 }
static int check_param ( const char *  ptr)
static

Definiert in Zeile 175 der Datei gui_script.c.

176 {
177  sc_param *p;
178  ptr = get_name(ptr, MAX_PARAM_NAME_LEN, &p, 0);
179  if (p)
180  return 1;
181  return 0;
182 }
static void do_save_param_file ( )
static

Definiert in Zeile 640 der Datei gui_script.c.

641 {
642  char buf[100];
643 
645  int fd = open(fn, O_WRONLY|O_CREAT|O_TRUNC, 0777);
646 
647  if (fd >= 0)
648  {
649  sc_param *p = script_params;
650  while (p)
651  {
652  // Only save parameters, skip 'subtitle' lines
653  if (p->name != 0)
654  {
655  // Only need to save name and value - saved as #name=value
656  sprintf(buf,"#%s=%d\n",p->name,p->val);
657  write(fd, buf, strlen(buf));
658  }
659  p = p->next;
660  }
661  close(fd);
662  }
663 }
sc_param* find_param ( char *  name)

Definiert in Zeile 44 der Datei gui_script.c.

45 {
47  while (p)
48  {
49  if ((p->name != 0) && (strcmp(name, p->name) == 0))
50  break;
51  p = p->next;
52  }
53  return p;
54 }
static const char* get_default ( sc_param p,
const char *  ptr,
int  isScript 
)
static

Definiert in Zeile 207 der Datei gui_script.c.

208 {
209  ptr = skip_to_token(ptr);
210  if (p)
211  {
213  int range = 0;
214  if (strncmp(ptr, "true", 4) == 0)
215  {
216  p->val = 1;
218  range = MENU_MINMAX(1,0); // Force boolean data type in Lua (ToDo: this is clunky, needs fixing)
219 
220  }
221  else if (strncmp(ptr, "false", 5) == 0)
222  {
223  p->val = 0;
225  range = MENU_MINMAX(1,0); // Force boolean data type in Lua (ToDo: this is clunky, needs fixing)
226  }
227  else
228  {
229  p->val = strtol(ptr, NULL, 0);
230  }
231  p->old_val = p->val;
232  if (isScript) // Loading from script file (rather than saved param set file)
233  {
234  p->def_val = p->val;
235  p->range = range;
236  p->range_type = type;
237  }
238  }
239  return skip_token(ptr);
240 }
static void get_last_paramset_num ( )
static

Definiert in Zeile 533 der Datei gui_script.c.

534 {
535  // skip if no script available
536  if (conf.script_file[0] == 0) return;
537 
540  {
542  last_script_param_set = -1; // failed to load so force next save
543  }
544  else
545  {
546  last_script_param_set = conf.script_param_set; // save last value loaded from file
547  }
548  if ((conf.script_param_set < 0) || (conf.script_param_set > 10))
550 }
const char* get_name ( const char *  p,
int  maxlen,
sc_param **  sp,
int  create 
)

Definiert in Zeile 112 der Datei gui_script.c.

113 {
114  char str[MAX_PARAM_NAME_LEN+1];
115  *sp = 0;
116  p = skip_whitespace(p);
117  if (p[0] && isalpha(p[0]))
118  {
119  p = get_token(p, str, maxlen);
120  *sp = find_param(str);
121  if ((*sp == 0) && create)
122  *sp = new_param(str);
123  }
124  return p;
125 }
static const char* get_range ( sc_param p,
const char *  ptr,
char  end 
)
static

Definiert in Zeile 252 der Datei gui_script.c.

253 {
255  int min = strtol(ptr,NULL,0);
257  int max = strtol(ptr,NULL,0);
258 
259  if (p)
260  {
261  p->range = MENU_MINMAX(min,max);
263  if ((p->range == MENU_MINMAX(0,1)) || (p->range == MENU_MINMAX(1,0)))
265  else if ((min >= 0) && (max >= 0))
267  }
268 
269  ptr = skip_tochar(ptr, end);
270  if (end && (*ptr == end)) ptr++;
271  return ptr;
272 }
const char* get_script_filename ( )

Definiert in Zeile 128 der Datei gui_script.c.

129 {
130  const char* name = 0;
131  // find name of script
132  if (conf.script_file[0] != 0)
133  {
134  name = strrchr(conf.script_file, '/');
135  if (name)
136  name++;
137  else
138  name = conf.script_file;
139  }
140  return name;
141 }
const char* get_token ( const char *  p,
char *  buf,
int  maxlen 
)

Definiert in Zeile 99 der Datei gui_script.c.

100 {
101  p = skip_whitespace(p);
102  int l = skip_token(p) - p;
103  int n = (l <= maxlen) ? l : maxlen;
104  strncpy(buf, p, n);
105  buf[n] = 0;
106  return p + l;
107 }
static const char* get_values ( sc_param p,
const char *  ptr,
char  end 
)
static

Definiert in Zeile 284 der Datei gui_script.c.

285 {
287  int len = skip_tochar(ptr, end) - ptr;
288 
289  if (p)
290  {
291  p->range = 0;
293 
294  p->option_buf = malloc(len+1);
295  strncpy(p->option_buf, ptr, len);
296  p->option_buf[len] = 0;
297 
298  const char *s = p->option_buf;
299  int cnt = 0;
300  while (*s)
301  {
302  s = skip_whitespace(skip_token(s));
303  cnt++;
304  }
305  p->option_count = cnt;
306  p->options = malloc(cnt * sizeof(char*));
307 
308  s = p->option_buf;
309  cnt = 0;
310  while (*s)
311  {
312  p->options[cnt] = s;
313  s = skip_token(s);
314  if (*s)
315  {
316  *((char*)s) = 0;
317  s = skip_whitespace(s+1);
318  }
319  cnt++;
320  }
321  }
322 
323  ptr += len;
324  if (end && (*ptr == end)) ptr++;
325  return ptr;
326 }
static void gui_load_script ( int  arg)
static

Definiert in Zeile 787 der Datei gui_script.c.

static void gui_load_script_default ( int  arg)
static

Definiert in Zeile 801 der Datei gui_script.c.

static void gui_load_script_selected ( const char *  fn)
static

Definiert in Zeile 776 der Datei gui_script.c.

777 {
778  if (fn)
779  {
780  gui_menu_cancel_redraw(); // Stop menu redraw until after menu rebuilt from script params
782  script_load(fn);
784  }
785 }
static void gui_reset_script_default ( int  arg)
static

Definiert in Zeile 792 der Datei gui_script.c.

793 {
794  gui_menu_cancel_redraw(); // Stop menu redraw until after menu rebuilt from script params
796  conf.script_file[0] = 0; // Reset loaded script
799 }
static const char* gui_script_param_set_enum ( int  change,
int  arg 
)
static

Definiert in Zeile 754 der Datei gui_script.c.

755 {
756  static const char* modes[]={ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "Default" };
757 
758  if (change != 0)
759  {
761  gui_enum_value_change(&conf.script_param_set,change,sizeof(modes)/sizeof(modes[0]));
762 
765  else
767 
768  if ( !load_params_values() )
771  }
772 
773  return modes[conf.script_param_set];
774 }
static void gui_update_script_submenu ( )
static

Definiert in Zeile 848 der Datei gui_script.c.

849 {
850  int i;
851  sc_param *p;
852 
853  int warn = 0;
855  {
856  warn = 1;
857  }
858 
859  // Calculate # of header items, and total required for header, parameters, back button and terminator
860  int f = (sizeof(hdr_script_submenu_items) / sizeof(CMenuItem)) + warn;
861  int n = f + script_param_count + 2;
862 
863  // If we need more room, then free up old buffer
865  {
869  }
870 
871  // If no buffer allocated, allocate one
872  if (script_submenu_items == 0)
873  {
874  script_submenu_items = malloc(n * sizeof(CMenuItem));
875  memset(script_submenu_items, 0, n * sizeof(CMenuItem));
876  // Update size of buffer if smaller than new size
877  if (script_submenu_count < n)
879  }
880 
881  // Copy header items
883 
884  // Add warning if no @chdk_version, or if chdk_version < script_version
885  if (warn)
886  {
888  {
889  static char warning[50];
890  sprintf(warning, "Script requires CHDK ver: %d.%d.%d.%d", script_version.major, script_version.minor, script_version.maintenance, script_version.revision);
891  script_submenu_items[f-1].text = (int)warning;
893  }
894  else
895  {
896  script_submenu_items[f-1].text = (int)"No @chdk_version, assuming CHDK 1.3";
898  }
899  }
900 
901  // Update menu to point to new submenu buffer
903 
904  // Build parameter menu items
905  for (i=f, p=script_params; p; i++, p=p->next)
906  {
907  script_submenu_items[i].symbol = 0x0;
908  script_submenu_items[i].text = (int)p->desc;
909  script_submenu_items[i].type = p->range_type;
910  script_submenu_items[i].value = &p->val;
911  script_submenu_items[i].arg = p->range;
912 
913  if (p->option_count != 0)
914  {
915  script_submenu_items[i].opt_len = p->option_count;
916  script_submenu_items[i].arg = (int)p->options;
917  }
918  }
919 
920  // Fill in 'Back' button
921  memset(&script_submenu_items[i],0,sizeof(CMenuItem)*2);
922  script_submenu_items[i].symbol = 0x51;
925 }
static int load_params_values ( )
static

Definiert in Zeile 558 der Datei gui_script.c.

559 {
560  // skip if no script loaded
561  if (conf.script_file[0] == 0) return 0;
562  // skip if 'default' parameters requested
563  if (conf.script_param_set == DEFAULT_PARAM_SET) return 0;
564 
565  if ((conf.script_param_set < 0) || (conf.script_param_set > 10))
567 
569 
570  char* buf = load_file(nm, 0, 1);
571  if (buf == 0)
572  {
574  buf = load_file(nm, 0, 1);
575  if (buf == 0)
576  return 0;
577  }
578 
579  const char* ptr = buf;
580  int valid = 1;
581 
582  // Initial scan of saved paramset file
583  // Ensure all saved params match defaults from script
584  // If not assume saved file is invalid and don't load it
585  // may occur if script is changed, or file was saved by a different script with same name
586  while (ptr[0] && valid)
587  {
588  ptr = skip_whitespace(ptr);
589  if (ptr[0] == '@')
590  {
591  if (strncmp("@param", ptr, 6) == 0)
592  {
593  if (!check_param(ptr+6))
594  valid = 0;
595  }
596  }
597  else if (ptr[0] == '#')
598  {
599  if (!check_param(ptr+1))
600  valid = 0;
601  }
602  ptr = skip_eol(ptr);
603  }
604 
605  if (valid)
606  {
607  // All ok, reset and process file
608  ptr = buf;
609 
610  while (ptr[0])
611  {
612  ptr = skip_whitespace(ptr);
613  if (ptr[0]=='@')
614  {
615  // Already checked file, so only need to load the @default values
616  // @param, @range & @values already set from script
617  if (strncmp("@default", ptr, 8)==0)
618  {
619  process_default(ptr+8, 0);
620  }
621  }
622  else if (ptr[0] == '#')
623  {
624  process_default(ptr+1, 0);
625  }
626  ptr = skip_eol(ptr);
627  }
628  }
629 
630  free(buf);
631 
632  return valid;
633 }
static char* make_param_filename ( enum FilenameMakeModeEnum  mode)
static

Definiert in Zeile 494 der Datei gui_script.c.

495 {
496  // output buffer
497  static char tgt_buf[100];
498 
499  // find name of script
500  const char* name = get_script_filename();
501 
502  // make path
503  strcpy(tgt_buf, SCRIPT_DATA_PATH);
504 
505  // add script filename
506  char* s = tgt_buf + strlen(tgt_buf);
507  strncpy(s, name, 12);
508  s[12] = 0;
509 
510  // find where extension start and replace it
511  s = strrchr(tgt_buf, '.');
512  if (!s) s = tgt_buf + strlen(tgt_buf);
513 
514  switch (mode)
515  {
517  strcpy(s,".cfg");
518  break;
519  case MAKE_PARAM_FILENAME:
520  sprintf(s,"_%d", conf.script_param_set);
521  break;
523  sprintf(s,".%d", conf.script_param_set);
524  break;
525  }
526 
527  return tgt_buf;
528 }
sc_param* new_param ( char *  name)

Definiert in Zeile 57 der Datei gui_script.c.

58 {
59  sc_param *p = malloc(sizeof(sc_param));
60  memset(p, 0, sizeof(sc_param));
61  if (tail)
62  {
63  tail->next = p;
64  tail = p;
65  }
66  else
67  {
68  script_params = tail = p;
69  }
71 
72  if (name != 0)
73  {
74  p->name = malloc(strlen(name)+1);
75  strcpy(p->name, name);
76  }
77 
78  return p;
79 }
static void process_default ( const char *  ptr,
int  isScript 
)
static

Definiert in Zeile 242 der Datei gui_script.c.

243 {
244  sc_param *p;
245  ptr = get_name(ptr, MAX_PARAM_NAME_LEN, &p, isScript);
246  get_default(p, ptr, isScript);
247 }
static void process_param ( const char *  ptr)
static

Definiert in Zeile 189 der Datei gui_script.c.

190 {
191  sc_param *p;
192  ptr = get_name(ptr, MAX_PARAM_NAME_LEN, &p, 1);
193  if (p)
194  {
196  int l = skip_toeol(ptr) - ptr;
198  p->desc = malloc(l+1);
199  strncpy(p->desc, ptr, l);
200  p->desc[l] = 0;
201  }
202 }
static void process_range ( const char *  ptr)
static

Definiert in Zeile 274 der Datei gui_script.c.

275 {
276  sc_param *p;
277  ptr = get_name(ptr, MAX_PARAM_NAME_LEN, &p, 1);
278  get_range(p, ptr, 0);
279 }
static int process_single ( const char *  ptr)
static

Definiert in Zeile 340 der Datei gui_script.c.

341 {
342  sc_param *p;
343  ptr = get_name(ptr, MAX_PARAM_NAME_LEN, &p, 1);
344  if (p)
345  {
346  ptr = get_default(p, ptr, 1);
348  if ((*ptr == '"') || (*ptr == '\''))
349  {
350  const char *s = skip_tochar(ptr+1, *ptr);
351  p->desc = malloc(s-ptr);
352  strncpy(p->desc, ptr+1, s-ptr-1);
353  p->desc[s-ptr-1] = 0;
354  if (*s == *ptr) s++;
355  ptr = skip_whitespace(s);
356  }
357  else
358  {
359  // Error - log to console and abort
360  return 0;
361  }
362  if (*ptr == '[')
363  {
364  ptr = get_range(p, ptr+1, ']');
365  }
366  else if (*ptr == '{')
367  {
368  ptr = get_values(p, ptr+1, '}');
370  if (strncmp(ptr,"table",5) == 0)
371  {
372  p->data_type = DTYPE_TABLE;
373  p->val--; // Initial value is 1 based for Lua table, convert to 0 based for C code
374  p->def_val--; // also adjust default
375  }
376  }
378  if (strncmp(ptr,"bool",4) == 0)
379  {
380  p->range = MENU_MINMAX(1,0); // Force boolean data type in Lua (ToDo: this is clunky, needs fixing)
382  ptr = skip_token(ptr);
383  }
385  if (strncmp(ptr,"long",4) == 0)
386  {
387  p->range = 9999999;
389  ptr = skip_token(ptr);
390  }
391  }
392  return 1;
393 }
static void process_subtitle ( const char *  ptr)
static

Definiert in Zeile 157 der Datei gui_script.c.

158 {
160  int l = skip_toeol(ptr) - ptr;
161  if (l >= sizeof(script_title)) l = sizeof(script_title) - 1;
162  sc_param *p = new_param(0);
163  p->desc = malloc(l+1);
164  strncpy(p->desc, ptr, l);
165  p->desc[l] = 0;
167 }
static void process_title ( const char *  ptr)
static

Definiert in Zeile 148 der Datei gui_script.c.

149 {
151  int l = skip_toeol(ptr) - ptr;
152  if (l >= sizeof(script_title)) l = sizeof(script_title) - 1;
153  strncpy(script_title, ptr, l);
154  script_title[l] = 0;
155 }
static void process_values ( const char *  ptr)
static

Definiert in Zeile 328 der Datei gui_script.c.

329 {
330  sc_param *p;
331  ptr = get_name(ptr, MAX_PARAM_NAME_LEN, &p, 1);
332  get_values(p, ptr, 0);
333 }
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_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_reset_to_default_params_values ( )

Definiert in Zeile 714 der Datei gui_script.c.

715 {
716  sc_param *p = script_params;
717  while (p)
718  {
719  p->val = p->def_val;
720  p = p->next;
721  }
722 }
static void script_scan ( )
static

Definiert in Zeile 402 der Datei gui_script.c.

403 {
404  // Reset everything
405  sc_param *p = script_params;
406  while (p)
407  {
408  if (p->name) free(p->name);
409  if (p->desc) free(p->desc);
410  if (p->options) free(p->options);
411  if (p->option_buf) free(p->option_buf);
412  sc_param *l = p;
413  p = p->next;
414  free(l);
415  }
416  script_params = tail = 0;
417  script_param_count = 0;
418 
419  parse_version(&script_version, "1.3.0.0", 0);
420  script_has_version = 0;
421  is_script_loaded = 0;
422 
423  // Load script file
424  const char *buf=0;
425  if (conf.script_file[0] != 0)
426  buf = load_file_to_length(conf.script_file, 0, 1, 4096); // Assumes parameters are in first 4K of script file
427 
428  // Check file loaded
429  if (buf == 0)
430  {
431  strcpy(script_title, "NO SCRIPT");
432  return;
433  }
434 
435  // Build title from name (in case no title in script)
436  const char *c = get_script_filename();
437  strncpy(script_title, c, sizeof(script_title)-1);
438  script_title[sizeof(script_title)-1]=0;
439 
440  // Fillup order, defaults
441  const char *ptr = buf;
442  while (ptr[0])
443  {
444  ptr = skip_whitespace(ptr);
445  if (ptr[0] == '@')
446  {
447  if (strncmp("@title", ptr, 6)==0)
448  {
449  process_title(ptr+6);
450  }
451  else if (strncmp("@subtitle", ptr, 9)==0)
452  {
453  process_subtitle(ptr+9);
454  }
455  else if (strncmp("@param", ptr, 6)==0)
456  {
457  process_param(ptr+6);
458  }
459  else if (strncmp("@default", ptr, 8)==0)
460  {
461  process_default(ptr+8, 1);
462  }
463  else if (strncmp("@range", ptr, 6)==0)
464  {
465  process_range(ptr+6);
466  }
467  else if (strncmp("@values", ptr, 7)==0)
468  {
469  process_values(ptr+7);
470  }
471  else if (strncmp("@chdk_version", ptr, 13)==0)
472  {
473  ptr = skip_whitespace(ptr+13);
474  parse_version(&script_version, ptr, 0);
475  script_has_version = 1;
476  }
477  }
478  else if (ptr[0] == '#')
479  {
480  process_single(ptr+1);
481  }
482  ptr = skip_eol(ptr);
483  }
484 
485  free((void*)buf);
486  is_script_loaded = 1;
487 }
const char* skip_eol ( const char *  p)

Definiert in Zeile 90 der Datei gui_script.c.

90 { p = skip_toeol(p); if (*p == '\r') p++; if (*p == '\n') p++; return p; } // Skip past end of line
const char* skip_to_token ( const char *  p)

Definiert in Zeile 87 der Datei gui_script.c.

87 { while (IS_SPACE(p) || (*p == '=')) p++; return p; } // Skip to next token
const char* skip_tochar ( const char *  p,
char  end 
)

Definiert in Zeile 92 der Datei gui_script.c.

93 {
94  while (!IS_EOL(p) && (*p != end)) p++;
95  return p;
96 }
const char* skip_toeol ( const char *  p)

Definiert in Zeile 89 der Datei gui_script.c.

89 { while (*p && !IS_EOL(p)) p++; return p; } // Skip to end of line
const char* skip_token ( const char *  p)

Definiert in Zeile 88 der Datei gui_script.c.

88 { while (*p && !IS_EOL(p) && !IS_SPACE(p) && (*p != '=')) p++; return p; } // Skip past current token value
const char* skip_whitespace ( const char *  p)

Definiert in Zeile 86 der Datei gui_script.c.

86 { while (IS_SPACE(p)) p++; return p; } // Skip past whitespace

Variablen-Dokumentation

const char* gui_script_autostart_modes[] = { "Off", "On", "Once", "ALT"}
static

Definiert in Zeile 808 der Datei gui_script.c.

int is_script_loaded = 0
static

Definiert in Zeile 33 der Datei gui_script.c.

int last_script_param_set = -1
static

Definiert in Zeile 32 der Datei gui_script.c.

CMenuItem param_save[2]
static
int script_has_version = 0

Definiert in Zeile 31 der Datei gui_script.c.

int script_param_count

Definiert in Zeile 40 der Datei gui_script.c.

sc_param* script_params = 0

Definiert in Zeile 38 der Datei gui_script.c.

CMenu script_submenu = {0x27,LANG_MENU_SCRIPT_TITLE, 0 }

Definiert in Zeile 846 der Datei gui_script.c.

int script_submenu_count = 0

Definiert in Zeile 844 der Datei gui_script.c.

CMenuItem* script_submenu_items = 0
static

Definiert in Zeile 843 der Datei gui_script.c.

char script_title[36]

Definiert in Zeile 29 der Datei gui_script.c.

_chdk_version_t script_version

Definiert in Zeile 30 der Datei gui_script.c.

sc_param* tail = 0
static

Definiert in Zeile 39 der Datei gui_script.c.