--- core/script.c-trunk436 2008-07-06 20:41:08.000000000 +0300+++ core/script.c 2008-07-06 21:00:16.000000000 +0300@@ -72,6 +72,7 @@ char script_title[36]; char script_params[SCRIPT_NUM_PARAMS][28];+int script_param_order[SCRIPT_NUM_PARAMS]; char script_console_buf[SCRIPT_CONSOLE_NUM_LINES][SCRIPT_CONSOLE_LINE_LENGTH+1]; static int script_console_lines=0; //-------------------------------------------------------------------@@ -88,7 +89,7 @@ } //--------------------------------------------------------------------static void process_param(const char *param) {+static int process_param(const char *param) { register const char *ptr = param; register int n, i=0; @@ -102,7 +103,9 @@ ++i; } script_params[n][i]=0;- } // ??? else produce error message+ n++;+ } else n=0; // ??? else produce error message + return n; // n=1 if '@param a' was processed, n=2 for 'b' ... n=26 for 'z'. n=0 if failed. } //-------------------------------------------------------------------@@ -121,7 +124,7 @@ //------------------------------------------------------------------- static void script_scan(const char *fn, int update_vars) { register const char *ptr = state_ubasic_script;- register int i;+ register int i,j=0,n; char *c; c=strrchr(fn, '/');@@ -129,6 +132,7 @@ script_title[sizeof(script_title)-1]=0; for (i=0; i<SCRIPT_NUM_PARAMS; ++i) { script_params[i][0]=0;+ script_param_order[i]=0; } while (ptr[0]) {@@ -139,7 +143,11 @@ process_title(ptr); } else if (strncmp("@param", ptr, 6)==0) { ptr+=6;- process_param(ptr);+ n=process_param(ptr); // n=1 if '@param a' was processed, n=2 for 'b' ... n=26 for 'z'. n=0 if failed.+ if (n>0 && n<SCRIPT_NUM_PARAMS) {+ script_param_order[j]=n;+ j++;+ } } else if (update_vars && strncmp("@default", ptr, 8)==0) { ptr+=8; process_default(ptr);
--- include/script.h-trunk436 2008-07-06 20:41:22.000000000 +0300+++ include/script.h 2008-07-06 20:43:40.000000000 +0300@@ -10,6 +10,7 @@ extern char script_title[36]; extern char script_params[SCRIPT_NUM_PARAMS][28];+extern int script_param_order[SCRIPT_NUM_PARAMS]; //------------------------------------------------------------------- extern void script_load(const char *fn);
--- core/gui.c-trunk436 2008-07-06 20:41:00.000000000 +0300+++ core/gui.c 2008-07-06 20:45:04.000000000 +0300@@ -1341,10 +1341,10 @@ script_submenu_items[p]=script_submenu_items_top[i]; } for (i=0; i<SCRIPT_NUM_PARAMS; ++i) {- if (script_params[i][0]) {- script_submenu_items[p].text=(int)script_params[i];+ if (script_param_order[i]) {+ script_submenu_items[p].text=(int)script_params[script_param_order[i]-1]; script_submenu_items[p].type=MENUITEM_INT;- script_submenu_items[p].value=&conf.ubasic_vars[i];+ script_submenu_items[p].value=&conf.ubasic_vars[script_param_order[i]-1]; ++p; } }
@title param test abc@param a first param a@default a 1@param b second param b@default b 2@param c third param c@default c 3print "abc",a,b,cend
@title param test cba@param c first param c@default c 1@param b second param b@default b 2@param a third param a@default a 3print "abc",a,b,cend
if this affects Lua, which I believe doesn't suffer from the single letter variable disease of uBasic.
n=process_param(ptr, 0); // n=1 if '@param a' was processed, n=2 for 'b' ... n=26 for 'z'. n=0 if failed. if (n>0 && n<SCRIPT_NUM_PARAMS) { script_param_order[j]=n;
n=process_param(ptr, 0); // n=1 if '@param a' was processed, n=2 for 'b' ... n=26 for 'z'. n=0 if failed. if (n>0 && n<=SCRIPT_NUM_PARAMS) { script_param_order[j]=n;
Started by firefly123 Feature Requests
Started by atalwar General Discussion and Assistance
Started by msl General Discussion and Assistance
Started by koshy « 1 2 3 » General Discussion and Assistance
Started by Little9070 Script Writing