1 #ifndef SCRIPT_H 2 #define SCRIPT_H 3 4 // CHDK Script interface 5 6 // Note: used in modules and platform independent code. 7 // Do not add platform dependent stuff in here (#ifdef/#endif compile options or camera dependent values) 8 9 //------------------------------------------------------------------- 10 // Current stage of script processing 11 12 enum { 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 }; 16 17 //------------------------------------------------------------------- 18 // Possible data types 19 #define DTYPE_INT 0 // Default 20 #define DTYPE_TABLE 1 // For parameters that select from a list of values, send to Lua as a table (Lua only) 21 22 // Structure used to hold a single script parameter 23 typedef struct _sc_param 24 { 25 char *name; // Parameter name 26 char *desc; // Title / description 27 int val; // Current value 28 int def_val; // Default value (from script, used to reset values) 29 int old_val; // Previous value (to detect change) 30 int range; // Min / Max values for validation 31 short range_type; // Specifies if range values is signed (-9999-32767) or unsigned (0-65535) 32 // Note: -9999 limit on negative values is due to current gui_menu code (and because menu only displays chars) 33 short data_type; // See defines above 34 int option_count; // Number of options for parameter 35 char* option_buf; // Memory buffer to store option names for parameter 36 const char** options; // Array of option names (points into option_buf memory) 37 38 struct _sc_param* next; // Next parameter in linked list 39 } sc_param; 40 41 //------------------------------------------------------------------- 42 43 // External references 44 extern char script_title[36]; 45 extern sc_param* script_params; 46 47 //------------------------------------------------------------------- 48 49 extern void script_load(const char *fn); 50 extern void save_params_values(int enforce); 51 52 extern void script_console_add_line(long str_id); 53 extern void script_console_add_error(long str_id); 54 extern void script_print_screen_statement(int val); 55 //------------------------------------------------------------------- 56 57 extern void script_get_alt_text(char *buf); 58 extern void script_set_terminate_key(int key, const char *keyname); 59 60 extern int script_is_running(); 61 extern long script_stack_start(); 62 extern long script_start_gui( int autostart ); 63 // for kbd_task kbd_process only, check if terminate has been requested by another task 64 extern void script_check_terminate(void); 65 // request and wait for script terminate from other task 66 extern void script_wait_terminate(void); 67 extern void script_end(); 68 //------------------------------------------------------------------- 69 70 #endif