diff options
Diffstat (limited to 'fallback.c')
-rw-r--r-- | fallback.c | 42 |
1 files changed, 27 insertions, 15 deletions
@@ -3,7 +3,7 @@ | |||
3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_fallback="$Id: fallback.c,v 1.3 1994/11/09 18:12:42 roberto Exp roberto $"; | 6 | char *rcs_fallback="$Id: fallback.c,v 1.4 1994/11/10 17:11:52 roberto Exp roberto $"; |
7 | 7 | ||
8 | #include <stdio.h> | 8 | #include <stdio.h> |
9 | #include <stdlib.h> | 9 | #include <stdlib.h> |
@@ -14,18 +14,28 @@ char *rcs_fallback="$Id: fallback.c,v 1.3 1994/11/09 18:12:42 roberto Exp robert | |||
14 | #include "lua.h" | 14 | #include "lua.h" |
15 | 15 | ||
16 | 16 | ||
17 | static void errorFB (void); | ||
18 | static void indexFB (void); | ||
19 | static void gettableFB (void); | ||
20 | static void arithFB (void); | ||
21 | static void concatFB (void); | ||
22 | static void orderFB (void); | ||
23 | static void GDFB (void); | ||
24 | |||
25 | |||
17 | /* | 26 | /* |
18 | ** Warning: This list must be in the same order as the #define's | 27 | ** Warning: This list must be in the same order as the #define's |
19 | */ | 28 | */ |
20 | struct FB luaI_fallBacks[] = { | 29 | struct FB luaI_fallBacks[] = { |
21 | {"error", {LUA_T_CFUNCTION, luaI_errorFB}}, | 30 | {"error", {LUA_T_CFUNCTION, errorFB}}, |
22 | {"index", {LUA_T_CFUNCTION, luaI_indexFB}}, | 31 | {"index", {LUA_T_CFUNCTION, indexFB}}, |
23 | {"gettable", {LUA_T_CFUNCTION, luaI_gettableFB}}, | 32 | {"gettable", {LUA_T_CFUNCTION, gettableFB}}, |
24 | {"arith", {LUA_T_CFUNCTION, luaI_arithFB}}, | 33 | {"arith", {LUA_T_CFUNCTION, arithFB}}, |
25 | {"order", {LUA_T_CFUNCTION, luaI_orderFB}}, | 34 | {"order", {LUA_T_CFUNCTION, orderFB}}, |
26 | {"concat", {LUA_T_CFUNCTION, luaI_concatFB}}, | 35 | {"concat", {LUA_T_CFUNCTION, concatFB}}, |
27 | {"unminus", {LUA_T_CFUNCTION, luaI_arithFB}}, | 36 | {"unminus", {LUA_T_CFUNCTION, arithFB}}, |
28 | {"settable", {LUA_T_CFUNCTION, luaI_gettableFB}} | 37 | {"settable", {LUA_T_CFUNCTION, gettableFB}}, |
38 | {"gc", {LUA_T_CFUNCTION, GDFB}} | ||
29 | }; | 39 | }; |
30 | 40 | ||
31 | #define N_FB (sizeof(luaI_fallBacks)/sizeof(struct FB)) | 41 | #define N_FB (sizeof(luaI_fallBacks)/sizeof(struct FB)) |
@@ -54,7 +64,7 @@ void luaI_setfallback (void) | |||
54 | } | 64 | } |
55 | 65 | ||
56 | 66 | ||
57 | void luaI_errorFB (void) | 67 | static void errorFB (void) |
58 | { | 68 | { |
59 | lua_Object o = lua_getparam(1); | 69 | lua_Object o = lua_getparam(1); |
60 | if (lua_isstring(o)) | 70 | if (lua_isstring(o)) |
@@ -64,34 +74,36 @@ void luaI_errorFB (void) | |||
64 | } | 74 | } |
65 | 75 | ||
66 | 76 | ||
67 | void luaI_indexFB (void) | 77 | static void indexFB (void) |
68 | { | 78 | { |
69 | lua_pushnil(); | 79 | lua_pushnil(); |
70 | } | 80 | } |
71 | 81 | ||
72 | 82 | ||
73 | void luaI_gettableFB (void) | 83 | static void gettableFB (void) |
74 | { | 84 | { |
75 | lua_reportbug("indexed expression not a table"); | 85 | lua_reportbug("indexed expression not a table"); |
76 | } | 86 | } |
77 | 87 | ||
78 | 88 | ||
79 | void luaI_arithFB (void) | 89 | static void arithFB (void) |
80 | { | 90 | { |
81 | lua_reportbug("unexpected type at conversion to number"); | 91 | lua_reportbug("unexpected type at conversion to number"); |
82 | } | 92 | } |
83 | 93 | ||
84 | void luaI_concatFB (void) | 94 | static void concatFB (void) |
85 | { | 95 | { |
86 | lua_reportbug("unexpected type at conversion to string"); | 96 | lua_reportbug("unexpected type at conversion to string"); |
87 | } | 97 | } |
88 | 98 | ||
89 | 99 | ||
90 | void luaI_orderFB (void) | 100 | static void orderFB (void) |
91 | { | 101 | { |
92 | lua_reportbug("unexpected type at comparison"); | 102 | lua_reportbug("unexpected type at comparison"); |
93 | } | 103 | } |
94 | 104 | ||
105 | static void GDFB (void) { } | ||
106 | |||
95 | 107 | ||
96 | /* | 108 | /* |
97 | ** Lock routines | 109 | ** Lock routines |