diff options
Diffstat (limited to 'lua.c')
| -rw-r--r-- | lua.c | 12 |
1 files changed, 9 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.c,v 1.14 1998/02/11 20:56:05 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.15 1998/12/28 13:44:54 roberto Exp $ |
| 3 | ** Lua stand-alone interpreter | 3 | ** Lua stand-alone interpreter |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -33,20 +33,26 @@ typedef void (*handler)(int); /* type for signal actions */ | |||
| 33 | static void laction (int i); | 33 | static void laction (int i); |
| 34 | 34 | ||
| 35 | 35 | ||
| 36 | static lua_LHFunction old_linehook = NULL; | ||
| 37 | static lua_CHFunction old_callhook = NULL; | ||
| 38 | |||
| 39 | |||
| 36 | static handler lreset (void) { | 40 | static handler lreset (void) { |
| 37 | lua_linehook = NULL; | ||
| 38 | lua_callhook = NULL; | ||
| 39 | return signal(SIGINT, laction); | 41 | return signal(SIGINT, laction); |
| 40 | } | 42 | } |
| 41 | 43 | ||
| 42 | 44 | ||
| 43 | static void lstop (void) { | 45 | static void lstop (void) { |
| 46 | lua_linehook = old_linehook; | ||
| 47 | lua_callhook = old_callhook; | ||
| 44 | lreset(); | 48 | lreset(); |
| 45 | lua_error("interrupted!"); | 49 | lua_error("interrupted!"); |
| 46 | } | 50 | } |
| 47 | 51 | ||
| 48 | 52 | ||
| 49 | static void laction (int i) { | 53 | static void laction (int i) { |
| 54 | old_linehook = lua_linehook; | ||
| 55 | old_callhook = lua_callhook; | ||
| 50 | lua_linehook = (lua_LHFunction)lstop; | 56 | lua_linehook = (lua_LHFunction)lstop; |
| 51 | lua_callhook = (lua_CHFunction)lstop; | 57 | lua_callhook = (lua_CHFunction)lstop; |
| 52 | } | 58 | } |
