From: Rui Guo Date: Tue, 2 Jun 2009 02:35:18 +0000 (+0800) Subject: Use language neutral description rather than lua. X-Git-Url: https://repo.or.cz/w/screen-lua.git/commitdiff_plain/990de22b3f33a1dc2dacd742688c191a1516d2fe Use language neutral description rather than lua. lua=>scriptcall luasource=>sourcescript sourcescript accept parameters but do not fully use them. --- diff --git a/src/comm.c b/src/comm.c index b7d3eda..45a0b4d 100644 --- a/src/comm.c +++ b/src/comm.c @@ -224,8 +224,6 @@ struct comm comms[RC_LAST + 1] = { "login", NEED_FORE|ARGS_01 }, #endif { "logtstamp", ARGS_012 }, - { "lua", ARGS_1 | ARGS_ORMORE}, - { "luasource", ARGS_1 }, #ifdef MAPKEYS { "mapdefault", NEED_DISPLAY|ARGS_0 }, { "mapnotnext", NEED_DISPLAY|ARGS_0 }, @@ -284,6 +282,9 @@ struct comm comms[RC_LAST + 1] = { "reset", NEED_FORE|ARGS_0 }, { "resize", NEED_DISPLAY|ARGS_0|ARGS_ORMORE }, { "screen", ARGS_0|ARGS_ORMORE }, +#ifdef SCRIPT + { "scriptcall", ARGS_1|ARGS_ORMORE }, +#endif #ifdef COPY_PASTE { "scrollback", NEED_FORE|ARGS_1 }, #endif @@ -299,6 +300,9 @@ struct comm comms[RC_LAST + 1] = { "slowpaste", NEED_FORE|ARGS_01 }, { "sorendition", ARGS_012 }, { "source", ARGS_1 }, +#ifdef SCRIPT + { "sourcescript", ARGS_1234 }, +#endif { "split", NEED_DISPLAY|ARGS_01 }, { "startup_message", ARGS_1 }, { "stuff", NEED_LAYER|ARGS_012 }, diff --git a/src/process.c b/src/process.c index d1a3743..cb615f4 100644 --- a/src/process.c +++ b/src/process.c @@ -3912,12 +3912,12 @@ int key; break; #ifdef SCRIPT - case RC_LUA: + case RC_SCRIPTCALL: LuaCall(args); break; - case RC_LUASOURCE: - ScriptSource(*args); + case RC_SOURCESCRIPT: + ScriptSource(*argl, args); break; #endif diff --git a/src/script.c b/src/script.c index e950099..9f0e6d5 100644 --- a/src/script.c +++ b/src/script.c @@ -67,11 +67,33 @@ void ScriptForeWindowChanged(void) ALL_SCRIPTS(sf_ForeWindowChanged, (), 0); } -void ScriptSource(const char *path) +void ScriptSource(int argc, const char **argv) { int ret; + int async = 0; + const char *binding = 0, *path; + + while (*argv && **argv == '-') { + // check for (-a | -async) + if ((*argv[1] == 'a' && !*argv[2]) + || strcmp(*argv, "-async") == 0) + async = 1; + // check for (-b | -binding) + else if ((*argv[1] == 'b' && !*argv[2]) + || strcmp(*argv, "-binding") == 0) { + argv++; + binding = *argv; + } + argv++; + } + + path = *argv; + if (!binding) { /* If one script loader accepts the file, we don't send it to any other loader */ ALL_SCRIPTS(sf_Source, (path), 1); + } else { + //TODO: select the specified engine. + } } int ScriptProcessCaption(const char *str, struct win *win, int len)