From 63d300167e9c31bd394fa1439d04cd3a3b995894 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 7 Nov 1994 13:20:56 -0200 Subject: module to implement default fallbacks and lock mechanisms --- fallback.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ fallback.h | 16 ++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 fallback.c create mode 100644 fallback.h diff --git a/fallback.c b/fallback.c new file mode 100644 index 00000000..023d11c3 --- /dev/null +++ b/fallback.c @@ -0,0 +1,51 @@ +/* +** fallback.c +** TecCGraf - PUC-Rio +*/ + +char *rcs_fallback="$Id: $"; + +#include + +#include "fallback.h" +#include "lua.h" + + +void luaI_errorFB (void) +{ + lua_Object o = lua_getparam(1); + if (lua_isstring(o)) + fprintf (stderr, "lua: %s\n", lua_getstring(o)); + else + fprintf(stderr, "lua: unknown error\n"); +} + + +void luaI_indexFB (void) +{ + lua_pushnil(); +} + + +void luaI_gettableFB (void) +{ + lua_error("indexed expression not a table"); +} + + +void luaI_arithFB (void) +{ + lua_error("unexpected type at conversion to number"); +} + +void luaI_concatFB (void) +{ + lua_error("unexpected type at conversion to string"); +} + + +void luaI_orderFB (void) +{ + lua_error("unexpected type at comparison"); +} + diff --git a/fallback.h b/fallback.h new file mode 100644 index 00000000..71080abd --- /dev/null +++ b/fallback.h @@ -0,0 +1,16 @@ +/* +** $Id: $ +*/ + +#ifndef fallback_h +#define fallback_h + +void luaI_errorFB (void); +void luaI_indexFB (void); +void luaI_gettableFB (void); +void luaI_arithFB (void); +void luaI_concatFB (void); +void luaI_orderFB (void); + +#endif + -- cgit v1.2.3-55-g6feb