Browse Source

module to implement default fallbacks and lock mechanisms

Roberto Ierusalimschy 31 years ago
parent
commit
63d300167e
2 changed files with 67 additions and 0 deletions
  1. 51 0
      fallback.c
  2. 16 0
      fallback.h

+ 51 - 0
fallback.c

@@ -0,0 +1,51 @@
+/*
+** fallback.c
+** TecCGraf - PUC-Rio
+*/
+ 
+char *rcs_fallback="$Id: $";
+
+#include <stdio.h>
+ 
+#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");
+}
+

+ 16 - 0
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
+