From 27991bd283b8c060f4564d7be3d6244ac0973dc1 Mon Sep 17 00:00:00 2001 From: Rui Guo Date: Mon, 1 Jun 2009 16:54:57 +0800 Subject: [PATCH] Wrap script related code with compiler directive. --- src/acconfig.h | 2 ++ src/process.c | 8 ++++++++ src/screen.c | 10 ++++++++++ 3 files changed, 20 insertions(+) diff --git a/src/acconfig.h b/src/acconfig.h index bc324d5..ec641ce 100644 --- a/src/acconfig.h +++ b/src/acconfig.h @@ -140,6 +140,7 @@ * Syntax: screen //telnet host [port] * define RXVT_OSC if you want support for rxvts special * change fgcolor/bgcolor/bgpicture sequences + * define SCRIPT to add scripting support to screen. */ #undef SIMPLESCREEN #ifndef SIMPLESCREEN @@ -161,6 +162,7 @@ # define COLORS16 # define ZMODEM # define BLANKER_PRG +# define SCRIPT #endif /* SIMPLESCREEN */ #undef BUILTIN_TELNET diff --git a/src/process.c b/src/process.c index 48c8470..d1a3743 100644 --- a/src/process.c +++ b/src/process.c @@ -3911,6 +3911,7 @@ int key; do_source(*args); break; +#ifdef SCRIPT case RC_LUA: LuaCall(args); break; @@ -3918,6 +3919,7 @@ int key; case RC_LUASOURCE: ScriptSource(*args); break; +#endif #ifdef MULTIUSER case RC_SU: @@ -4411,8 +4413,12 @@ int key; #endif break; } + +#ifdef SCRIPT if (nr < RC_LAST) ScriptCommandExecuted(comms[nr].name, args, argc); +#endif + if (display != odisplay) { for (display = displays; display; display = display->d_next) @@ -5215,7 +5221,9 @@ struct win *wi; if (wi) WindowChanged(wi, 'u'); flayer = D_forecv->c_layer; +#ifdef SCRIPT ScriptForeWindowChanged(); +#endif /* Activate called afterwards, so no RefreshHStatus needed */ } diff --git a/src/screen.c b/src/screen.c index 6996437..158b9f6 100644 --- a/src/screen.c +++ b/src/screen.c @@ -382,7 +382,11 @@ char **av; #ifdef MULTIUSER char *sockp; #endif + +#ifdef SCRIPT char *script_file = 0; +#endif + char *sty = 0; #if (defined(AUX) || defined(_AUX_SOURCE)) && defined(POSIX) @@ -1349,6 +1353,7 @@ char **av; ServerSocket = MakeServerSocket(); InitKeytab(); +#ifdef SCRIPT LoadScripts(); ScriptInit(); if (script_file) @@ -1357,6 +1362,7 @@ char **av; free(script_file); script_file = 0; } +#endif #ifdef ETCSCREENRC # ifdef ALLOW_SYSSCREENRC @@ -1767,7 +1773,9 @@ int i; signal(SIGHUP, SIG_IGN); debug1("Finit(%d);\n", i); +#ifdef SCRIPT ScriptFinit(); +#endif while (windows) { @@ -2514,8 +2522,10 @@ int rec; winmsg_numrend = -winmsg_numrend; *p = '\0'; +#ifdef SCRIPT if (ScriptProcessCaption(str, win, padlen)) return winmsg_buf; +#endif if (!display) return winmsg_buf; -- 2.11.4.GIT