diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-11-07 13:20:56 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-11-07 13:20:56 -0200 |
| commit | 63d300167e9c31bd394fa1439d04cd3a3b995894 (patch) | |
| tree | 312bae817e06a0390f0db9a5e6e8a63a0ea01130 | |
| parent | 62ec3797d518f55513c992fe1819dc5dbb072226 (diff) | |
| download | lua-63d300167e9c31bd394fa1439d04cd3a3b995894.tar.gz lua-63d300167e9c31bd394fa1439d04cd3a3b995894.tar.bz2 lua-63d300167e9c31bd394fa1439d04cd3a3b995894.zip | |
module to implement default fallbacks and lock mechanisms
| -rw-r--r-- | fallback.c | 51 | ||||
| -rw-r--r-- | fallback.h | 16 |
2 files changed, 67 insertions, 0 deletions
diff --git a/fallback.c b/fallback.c new file mode 100644 index 00000000..023d11c3 --- /dev/null +++ b/fallback.c | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | /* | ||
| 2 | ** fallback.c | ||
| 3 | ** TecCGraf - PUC-Rio | ||
| 4 | */ | ||
| 5 | |||
| 6 | char *rcs_fallback="$Id: $"; | ||
| 7 | |||
| 8 | #include <stdio.h> | ||
| 9 | |||
| 10 | #include "fallback.h" | ||
| 11 | #include "lua.h" | ||
| 12 | |||
| 13 | |||
| 14 | void luaI_errorFB (void) | ||
| 15 | { | ||
| 16 | lua_Object o = lua_getparam(1); | ||
| 17 | if (lua_isstring(o)) | ||
| 18 | fprintf (stderr, "lua: %s\n", lua_getstring(o)); | ||
| 19 | else | ||
| 20 | fprintf(stderr, "lua: unknown error\n"); | ||
| 21 | } | ||
| 22 | |||
| 23 | |||
| 24 | void luaI_indexFB (void) | ||
| 25 | { | ||
| 26 | lua_pushnil(); | ||
| 27 | } | ||
| 28 | |||
| 29 | |||
| 30 | void luaI_gettableFB (void) | ||
| 31 | { | ||
| 32 | lua_error("indexed expression not a table"); | ||
| 33 | } | ||
| 34 | |||
| 35 | |||
| 36 | void luaI_arithFB (void) | ||
| 37 | { | ||
| 38 | lua_error("unexpected type at conversion to number"); | ||
| 39 | } | ||
| 40 | |||
| 41 | void luaI_concatFB (void) | ||
| 42 | { | ||
| 43 | lua_error("unexpected type at conversion to string"); | ||
| 44 | } | ||
| 45 | |||
| 46 | |||
| 47 | void luaI_orderFB (void) | ||
| 48 | { | ||
| 49 | lua_error("unexpected type at comparison"); | ||
| 50 | } | ||
| 51 | |||
diff --git a/fallback.h b/fallback.h new file mode 100644 index 00000000..71080abd --- /dev/null +++ b/fallback.h | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | /* | ||
| 2 | ** $Id: $ | ||
| 3 | */ | ||
| 4 | |||
| 5 | #ifndef fallback_h | ||
| 6 | #define fallback_h | ||
| 7 | |||
| 8 | void luaI_errorFB (void); | ||
| 9 | void luaI_indexFB (void); | ||
| 10 | void luaI_gettableFB (void); | ||
| 11 | void luaI_arithFB (void); | ||
| 12 | void luaI_concatFB (void); | ||
| 13 | void luaI_orderFB (void); | ||
| 14 | |||
| 15 | #endif | ||
| 16 | |||
