diff options
-rw-r--r-- | lauxlib.c (renamed from auxlib.c) | 27 | ||||
-rw-r--r-- | lauxlib.h (renamed from auxlib.h) | 13 |
2 files changed, 17 insertions, 23 deletions
@@ -1,25 +1,20 @@ | |||
1 | char *rcs_auxlib="$Id: auxlib.c,v 1.4 1997/04/07 14:48:53 roberto Exp roberto $"; | 1 | /* |
2 | ** $Id: $ | ||
3 | ** Auxiliar functions for building Lua libraries | ||
4 | ** See Copyright Notice in lua.h | ||
5 | */ | ||
6 | |||
2 | 7 | ||
3 | #include <stdio.h> | ||
4 | #include <stdarg.h> | 8 | #include <stdarg.h> |
9 | #include <stdio.h> | ||
5 | #include <string.h> | 10 | #include <string.h> |
6 | 11 | ||
12 | #include "lauxlib.h" | ||
7 | #include "lua.h" | 13 | #include "lua.h" |
8 | #include "auxlib.h" | ||
9 | #include "luadebug.h" | 14 | #include "luadebug.h" |
10 | 15 | ||
11 | 16 | ||
12 | 17 | ||
13 | int luaI_findstring (char *name, char *list[]) | ||
14 | { | ||
15 | int i; | ||
16 | for (i=0; list[i]; i++) | ||
17 | if (strcmp(list[i], name) == 0) | ||
18 | return i; | ||
19 | return -1; /* name not found */ | ||
20 | } | ||
21 | |||
22 | |||
23 | void luaL_arg_check(int cond, int numarg, char *extramsg) | 18 | void luaL_arg_check(int cond, int numarg, char *extramsg) |
24 | { | 19 | { |
25 | if (!cond) { | 20 | if (!cond) { |
@@ -28,9 +23,9 @@ void luaL_arg_check(int cond, int numarg, char *extramsg) | |||
28 | if (funcname == NULL) | 23 | if (funcname == NULL) |
29 | funcname = "???"; | 24 | funcname = "???"; |
30 | if (extramsg == NULL) | 25 | if (extramsg == NULL) |
31 | luaL_verror("bad argument #%d to function `%s'", numarg, funcname); | 26 | luaL_verror("bad argument #%d to function `%.50s'", numarg, funcname); |
32 | else | 27 | else |
33 | luaL_verror("bad argument #%d to function `%s' (%s)", | 28 | luaL_verror("bad argument #%d to function `%.50s' (%.100s)", |
34 | numarg, funcname, extramsg); | 29 | numarg, funcname, extramsg); |
35 | } | 30 | } |
36 | } | 31 | } |
@@ -72,7 +67,7 @@ void luaL_openlib (struct luaL_reg *l, int n) | |||
72 | 67 | ||
73 | void luaL_verror (char *fmt, ...) | 68 | void luaL_verror (char *fmt, ...) |
74 | { | 69 | { |
75 | char buff[1000]; | 70 | char buff[500]; |
76 | va_list argp; | 71 | va_list argp; |
77 | va_start(argp, fmt); | 72 | va_start(argp, fmt); |
78 | vsprintf(buff, fmt, argp); | 73 | vsprintf(buff, fmt, argp); |
@@ -1,12 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: auxlib.h,v 1.2 1997/04/06 14:08:08 roberto Exp roberto $ | 2 | ** $Id: $ |
3 | ** Auxiliar functions for building Lua libraries | ||
4 | ** See Copyright Notice in lua.h | ||
3 | */ | 5 | */ |
4 | 6 | ||
7 | |||
5 | #ifndef auxlib_h | 8 | #ifndef auxlib_h |
6 | #define auxlib_h | 9 | #define auxlib_h |
7 | 10 | ||
11 | |||
8 | #include "lua.h" | 12 | #include "lua.h" |
9 | 13 | ||
14 | |||
10 | struct luaL_reg { | 15 | struct luaL_reg { |
11 | char *name; | 16 | char *name; |
12 | lua_CFunction func; | 17 | lua_CFunction func; |
@@ -21,10 +26,4 @@ double luaL_opt_number (int numArg, double def); | |||
21 | void luaL_verror (char *fmt, ...); | 26 | void luaL_verror (char *fmt, ...); |
22 | 27 | ||
23 | 28 | ||
24 | |||
25 | /* -- private part (only for Lua modules */ | ||
26 | |||
27 | int luaI_findstring (char *name, char *list[]); | ||
28 | |||
29 | |||
30 | #endif | 29 | #endif |