diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-09-11 17:29:27 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-09-11 17:29:27 -0300 |
commit | 8060193702b21a06af3541555db4cd317c733ce9 (patch) | |
tree | d1cfa3a4ac41dc6766188680659c1bd1311e22a8 /lauxlib.c | |
parent | 2779e81fbbdebf8b7cac97c167ff109bad537c4b (diff) | |
download | lua-8060193702b21a06af3541555db4cd317c733ce9.tar.gz lua-8060193702b21a06af3541555db4cd317c733ce9.tar.bz2 lua-8060193702b21a06af3541555db4cd317c733ce9.zip |
`lauxlib' is now part of the libraries (not used by core Lua)
Diffstat (limited to 'lauxlib.c')
-rw-r--r-- | lauxlib.c | 24 |
1 files changed, 1 insertions, 23 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.33 2000/08/29 20:43:28 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.34 2000/09/11 17:38:42 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -118,28 +118,6 @@ void luaL_verror (lua_State *L, const char *fmt, ...) { | |||
118 | } | 118 | } |
119 | 119 | ||
120 | 120 | ||
121 | #define EXTRALEN sizeof("string \"...\"0") | ||
122 | |||
123 | void luaL_chunkid (char *out, const char *source, int len) { | ||
124 | if (*source == '(') { | ||
125 | strncpy(out, source+1, len-1); /* remove first char */ | ||
126 | out[len-1] = '\0'; /* make sure `out' has an end */ | ||
127 | out[strlen(out)-1] = '\0'; /* remove last char */ | ||
128 | } | ||
129 | else { | ||
130 | len -= EXTRALEN; | ||
131 | if (*source == '@') | ||
132 | sprintf(out, "file `%.*s'", len, source+1); | ||
133 | else { | ||
134 | const char *b = strchr(source , '\n'); /* stop at first new line */ | ||
135 | int lim = (b && (b-source)<len) ? b-source : len; | ||
136 | sprintf(out, "string \"%.*s\"", lim, source); | ||
137 | strcpy(out+lim+(EXTRALEN-sizeof("...\"0")), "...\""); | ||
138 | } | ||
139 | } | ||
140 | } | ||
141 | |||
142 | |||
143 | /* | 121 | /* |
144 | ** {====================================================== | 122 | ** {====================================================== |
145 | ** Generic Buffer manipulation | 123 | ** Generic Buffer manipulation |