diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1995-05-02 15:43:03 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1995-05-02 15:43:03 -0300 |
commit | 18ea2eff80c720632cb6a89d560c5cce2377df06 (patch) | |
tree | 67fc3acd282d134099b2f92657e191baeaff1277 | |
parent | 8156604823aa487f4436d33fe89302598faab3db (diff) | |
download | lua-18ea2eff80c720632cb6a89d560c5cce2377df06.tar.gz lua-18ea2eff80c720632cb6a89d560c5cce2377df06.tar.bz2 lua-18ea2eff80c720632cb6a89d560c5cce2377df06.zip |
calls to "lua_reportbug" changed to "lua_error", since
"lua_reportbug" is only an internal function to build debug information
-rw-r--r-- | fallback.c | 13 | ||||
-rw-r--r-- | hash.c | 5 | ||||
-rw-r--r-- | inout.c | 19 | ||||
-rw-r--r-- | inout.h | 8 | ||||
-rw-r--r-- | opcode.c | 9 | ||||
-rw-r--r-- | table.c | 14 |
6 files changed, 34 insertions, 34 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.10 1994/12/20 21:20:36 roberto Exp $"; | 6 | char *rcs_fallback="$Id: fallback.c,v 1.11 1995/02/06 19:34:03 roberto Exp roberto $"; |
7 | 7 | ||
8 | #include <stdio.h> | 8 | #include <stdio.h> |
9 | #include <string.h> | 9 | #include <string.h> |
@@ -11,7 +11,6 @@ char *rcs_fallback="$Id: fallback.c,v 1.10 1994/12/20 21:20:36 roberto Exp $"; | |||
11 | #include "mem.h" | 11 | #include "mem.h" |
12 | #include "fallback.h" | 12 | #include "fallback.h" |
13 | #include "opcode.h" | 13 | #include "opcode.h" |
14 | #include "inout.h" | ||
15 | #include "lua.h" | 14 | #include "lua.h" |
16 | 15 | ||
17 | 16 | ||
@@ -84,31 +83,31 @@ static void indexFB (void) | |||
84 | 83 | ||
85 | static void gettableFB (void) | 84 | static void gettableFB (void) |
86 | { | 85 | { |
87 | lua_reportbug("indexed expression not a table"); | 86 | lua_error("indexed expression not a table"); |
88 | } | 87 | } |
89 | 88 | ||
90 | 89 | ||
91 | static void arithFB (void) | 90 | static void arithFB (void) |
92 | { | 91 | { |
93 | lua_reportbug("unexpected type at conversion to number"); | 92 | lua_error("unexpected type at conversion to number"); |
94 | } | 93 | } |
95 | 94 | ||
96 | static void concatFB (void) | 95 | static void concatFB (void) |
97 | { | 96 | { |
98 | lua_reportbug("unexpected type at conversion to string"); | 97 | lua_error("unexpected type at conversion to string"); |
99 | } | 98 | } |
100 | 99 | ||
101 | 100 | ||
102 | static void orderFB (void) | 101 | static void orderFB (void) |
103 | { | 102 | { |
104 | lua_reportbug("unexpected type at comparison"); | 103 | lua_error("unexpected type at comparison"); |
105 | } | 104 | } |
106 | 105 | ||
107 | static void GDFB (void) { } | 106 | static void GDFB (void) { } |
108 | 107 | ||
109 | static void funcFB (void) | 108 | static void funcFB (void) |
110 | { | 109 | { |
111 | lua_reportbug("call expression not a function"); | 110 | lua_error("call expression not a function"); |
112 | } | 111 | } |
113 | 112 | ||
114 | 113 | ||
@@ -3,14 +3,13 @@ | |||
3 | ** hash manager for lua | 3 | ** hash manager for lua |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_hash="$Id: hash.c,v 2.23 1995/01/12 14:19:04 roberto Exp $"; | 6 | char *rcs_hash="$Id: hash.c,v 2.24 1995/02/06 19:34:03 roberto Exp roberto $"; |
7 | 7 | ||
8 | #include <string.h> | 8 | #include <string.h> |
9 | 9 | ||
10 | #include "mem.h" | 10 | #include "mem.h" |
11 | #include "opcode.h" | 11 | #include "opcode.h" |
12 | #include "hash.h" | 12 | #include "hash.h" |
13 | #include "inout.h" | ||
14 | #include "table.h" | 13 | #include "table.h" |
15 | #include "lua.h" | 14 | #include "lua.h" |
16 | 15 | ||
@@ -54,7 +53,7 @@ static Word hashindex (Hash *t, Object *ref) /* hash function */ | |||
54 | switch (tag(ref)) | 53 | switch (tag(ref)) |
55 | { | 54 | { |
56 | case LUA_T_NIL: | 55 | case LUA_T_NIL: |
57 | lua_reportbug ("unexpected type to index table"); | 56 | lua_error ("unexpected type to index table"); |
58 | return -1; /* UNREACHEABLE */ | 57 | return -1; /* UNREACHEABLE */ |
59 | case LUA_T_NUMBER: | 58 | case LUA_T_NUMBER: |
60 | return (((Word)nvalue(ref))%nhash(t)); | 59 | return (((Word)nvalue(ref))%nhash(t)); |
@@ -5,7 +5,7 @@ | |||
5 | ** Also provides some predefined lua functions. | 5 | ** Also provides some predefined lua functions. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | char *rcs_inout="$Id: inout.c,v 2.17 1995/03/17 20:27:11 celes Exp roberto $"; | 8 | char *rcs_inout="$Id: inout.c,v 2.18 1995/03/17 20:42:20 roberto Exp roberto $"; |
9 | 9 | ||
10 | #include <stdio.h> | 10 | #include <stdio.h> |
11 | #include <stdlib.h> | 11 | #include <stdlib.h> |
@@ -26,11 +26,7 @@ Word lua_debugline = 0; | |||
26 | 26 | ||
27 | 27 | ||
28 | /* Internal variables */ | 28 | /* Internal variables */ |
29 | 29 | ||
30 | #ifndef MAXFUNCSTACK | ||
31 | #define MAXFUNCSTACK 100 | ||
32 | #endif | ||
33 | |||
34 | typedef struct FuncStackNode { | 30 | typedef struct FuncStackNode { |
35 | struct FuncStackNode *next; | 31 | struct FuncStackNode *next; |
36 | char *file; | 32 | char *file; |
@@ -124,7 +120,7 @@ void lua_pushfunction (char *file, Word function) | |||
124 | FuncStackNode *newNode; | 120 | FuncStackNode *newNode; |
125 | if (nfuncstack++ >= MAXFUNCSTACK) | 121 | if (nfuncstack++ >= MAXFUNCSTACK) |
126 | { | 122 | { |
127 | lua_reportbug("function stack overflow"); | 123 | lua_error("function stack overflow"); |
128 | } | 124 | } |
129 | newNode = new(FuncStackNode); | 125 | newNode = new(FuncStackNode); |
130 | newNode->function = function; | 126 | newNode->function = function; |
@@ -149,12 +145,10 @@ void lua_popfunction (void) | |||
149 | } | 145 | } |
150 | 146 | ||
151 | /* | 147 | /* |
152 | ** Report bug building a message and sending it to lua_error function. | 148 | ** Report bug building a message. |
153 | */ | 149 | */ |
154 | void lua_reportbug (char *s) | 150 | void luaI_reportbug (char *msg, int size) |
155 | { | 151 | { |
156 | char msg[MAXFUNCSTACK*80]; | ||
157 | strcpy (msg, s); | ||
158 | if (lua_debugline != 0) | 152 | if (lua_debugline != 0) |
159 | { | 153 | { |
160 | if (funcStack) | 154 | if (funcStack) |
@@ -179,7 +173,6 @@ void lua_reportbug (char *s) | |||
179 | lua_debugline, lua_filename()); | 173 | lua_debugline, lua_filename()); |
180 | } | 174 | } |
181 | } | 175 | } |
182 | lua_error (msg); | ||
183 | } | 176 | } |
184 | 177 | ||
185 | 178 | ||
@@ -292,6 +285,6 @@ void luaI_error (void) | |||
292 | { | 285 | { |
293 | char *s = lua_getstring(lua_getparam(1)); | 286 | char *s = lua_getstring(lua_getparam(1)); |
294 | if (s == NULL) s = "(no message)"; | 287 | if (s == NULL) s = "(no message)"; |
295 | lua_reportbug(s); | 288 | lua_error(s); |
296 | } | 289 | } |
297 | 290 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: inout.h,v 1.6 1994/11/21 21:41:09 roberto Stab roberto $ | 2 | ** $Id: inout.h,v 1.7 1994/12/20 21:20:36 roberto Exp roberto $ |
3 | */ | 3 | */ |
4 | 4 | ||
5 | 5 | ||
@@ -8,6 +8,10 @@ | |||
8 | 8 | ||
9 | #include "types.h" | 9 | #include "types.h" |
10 | 10 | ||
11 | #ifndef MAXFUNCSTACK | ||
12 | #define MAXFUNCSTACK 100 | ||
13 | #endif | ||
14 | |||
11 | extern Word lua_linenumber; | 15 | extern Word lua_linenumber; |
12 | extern Bool lua_debug; | 16 | extern Bool lua_debug; |
13 | extern Word lua_debugline; | 17 | extern Word lua_debugline; |
@@ -18,7 +22,7 @@ char *lua_openstring (char *s); | |||
18 | void lua_closestring (void); | 22 | void lua_closestring (void); |
19 | void lua_pushfunction (char *file, Word function); | 23 | void lua_pushfunction (char *file, Word function); |
20 | void lua_popfunction (void); | 24 | void lua_popfunction (void); |
21 | void lua_reportbug (char *s); | 25 | void luaI_reportbug (char *s, int size); |
22 | 26 | ||
23 | void lua_internaldofile (void); | 27 | void lua_internaldofile (void); |
24 | void lua_internaldostring (void); | 28 | void lua_internaldostring (void); |
@@ -3,7 +3,7 @@ | |||
3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_opcode="$Id: opcode.c,v 3.35 1995/02/10 12:51:29 roberto Exp celes $"; | 6 | char *rcs_opcode="$Id: opcode.c,v 3.36 1995/04/11 17:56:30 celes Exp roberto $"; |
7 | 7 | ||
8 | #include <setjmp.h> | 8 | #include <setjmp.h> |
9 | #include <stdlib.h> | 9 | #include <stdlib.h> |
@@ -68,9 +68,14 @@ Object *luaI_Address (lua_Object o) | |||
68 | ** Error messages | 68 | ** Error messages |
69 | */ | 69 | */ |
70 | 70 | ||
71 | #define MAXMESSAGE MAXFUNCSTACK*80 | ||
72 | |||
71 | static void lua_message (char *s) | 73 | static void lua_message (char *s) |
72 | { | 74 | { |
73 | lua_pushstring(s); | 75 | char msg[MAXMESSAGE]; |
76 | strcpy (msg, s); | ||
77 | luaI_reportbug(msg, MAXMESSAGE-strlen(s)); | ||
78 | lua_pushstring(msg); | ||
74 | do_call(&luaI_fallBacks[FB_ERROR].function, (top-stack)-1, 0, (top-stack)-1); | 79 | do_call(&luaI_fallBacks[FB_ERROR].function, (top-stack)-1, 0, (top-stack)-1); |
75 | } | 80 | } |
76 | 81 | ||
@@ -3,7 +3,7 @@ | |||
3 | ** Module to control static tables | 3 | ** Module to control static tables |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_table="$Id: table.c,v 2.27 1995/01/13 22:11:12 roberto Exp celes $"; | 6 | char *rcs_table="$Id: table.c,v 2.28 1995/01/18 20:15:54 celes Exp roberto $"; |
7 | 7 | ||
8 | #include <string.h> | 8 | #include <string.h> |
9 | 9 | ||
@@ -11,8 +11,8 @@ char *rcs_table="$Id: table.c,v 2.27 1995/01/13 22:11:12 roberto Exp celes $"; | |||
11 | #include "opcode.h" | 11 | #include "opcode.h" |
12 | #include "tree.h" | 12 | #include "tree.h" |
13 | #include "hash.h" | 13 | #include "hash.h" |
14 | #include "inout.h" | ||
15 | #include "table.h" | 14 | #include "table.h" |
15 | #include "inout.h" | ||
16 | #include "lua.h" | 16 | #include "lua.h" |
17 | #include "fallback.h" | 17 | #include "fallback.h" |
18 | 18 | ||
@@ -228,14 +228,14 @@ static void lua_nextvar (void) | |||
228 | TreeNode *next; | 228 | TreeNode *next; |
229 | lua_Object o = lua_getparam(1); | 229 | lua_Object o = lua_getparam(1); |
230 | if (o == LUA_NOOBJECT) | 230 | if (o == LUA_NOOBJECT) |
231 | lua_reportbug("too few arguments to function `nextvar'"); | 231 | lua_error("too few arguments to function `nextvar'"); |
232 | if (lua_getparam(2) != LUA_NOOBJECT) | 232 | if (lua_getparam(2) != LUA_NOOBJECT) |
233 | lua_reportbug("too many arguments to function `nextvar'"); | 233 | lua_error("too many arguments to function `nextvar'"); |
234 | if (lua_isnil(o)) | 234 | if (lua_isnil(o)) |
235 | varname = NULL; | 235 | varname = NULL; |
236 | else if (!lua_isstring(o)) | 236 | else if (!lua_isstring(o)) |
237 | { | 237 | { |
238 | lua_reportbug("incorrect argument to function `nextvar'"); | 238 | lua_error("incorrect argument to function `nextvar'"); |
239 | return; /* to avoid warnings */ | 239 | return; /* to avoid warnings */ |
240 | } | 240 | } |
241 | else | 241 | else |
@@ -262,7 +262,7 @@ static void setglobal (void) | |||
262 | lua_Object name = lua_getparam(1); | 262 | lua_Object name = lua_getparam(1); |
263 | lua_Object value = lua_getparam(2); | 263 | lua_Object value = lua_getparam(2); |
264 | if (!lua_isstring(name)) | 264 | if (!lua_isstring(name)) |
265 | lua_reportbug("incorrect argument to function `setglobal'"); | 265 | lua_error("incorrect argument to function `setglobal'"); |
266 | lua_pushobject(value); | 266 | lua_pushobject(value); |
267 | lua_storeglobal(lua_getstring(name)); | 267 | lua_storeglobal(lua_getstring(name)); |
268 | } | 268 | } |
@@ -272,6 +272,6 @@ static void getglobal (void) | |||
272 | { | 272 | { |
273 | lua_Object name = lua_getparam(1); | 273 | lua_Object name = lua_getparam(1); |
274 | if (!lua_isstring(name)) | 274 | if (!lua_isstring(name)) |
275 | lua_reportbug("incorrect argument to function `getglobal'"); | 275 | lua_error("incorrect argument to function `getglobal'"); |
276 | lua_pushobject(lua_getglobal(lua_getstring(name))); | 276 | lua_pushobject(lua_getglobal(lua_getstring(name))); |
277 | } | 277 | } |