aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-11-25 15:33:33 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-11-25 15:33:33 -0200
commit9b1c586b2f5b86173bf0ceca8a0dd84510af9024 (patch)
tree5a53a779e3991c9d2836547ef583aac33683fd81
parentd9340154accd593984fa0d2101fe5f3b63f4c3a2 (diff)
downloadlua-9b1c586b2f5b86173bf0ceca8a0dd84510af9024.tar.gz
lua-9b1c586b2f5b86173bf0ceca8a0dd84510af9024.tar.bz2
lua-9b1c586b2f5b86173bf0ceca8a0dd84510af9024.zip
renaming `stringdump' -> `string.dump'
-rw-r--r--lbaselib.c22
-rw-r--r--lstrlib.c21
2 files changed, 21 insertions, 22 deletions
diff --git a/lbaselib.c b/lbaselib.c
index c0769327..76df655e 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbaselib.c,v 1.108 2002/11/18 11:20:01 roberto Exp roberto $ 2** $Id: lbaselib.c,v 1.109 2002/11/22 18:01:46 roberto Exp roberto $
3** Basic library 3** Basic library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -256,25 +256,6 @@ static int luaB_loadstring (lua_State *L) {
256} 256}
257 257
258 258
259static int writer (lua_State *L, const void* b, size_t size, void* B) {
260 (void)L;
261 luaL_addlstring((luaL_Buffer*) B, (const char *)b, size);
262 return 1;
263}
264
265
266static int luaB_stringdump (lua_State *L) {
267 luaL_Buffer b;
268 luaL_checktype(L, 1, LUA_TFUNCTION);
269 luaL_buffinit(L,&b);
270 if (!lua_dump(L, writer, &b))
271 luaL_error(L, "unable to dump given function");
272 luaL_pushresult(&b);
273 return 1;
274}
275
276
277
278static int luaB_loadfile (lua_State *L) { 259static int luaB_loadfile (lua_State *L) {
279 const char *fname = luaL_optstring(L, 1, NULL); 260 const char *fname = luaL_optstring(L, 1, NULL);
280 return passresults(L, luaL_loadfile(L, fname)); 261 return passresults(L, luaL_loadfile(L, fname));
@@ -526,7 +507,6 @@ static const luaL_reg base_funcs[] = {
526 {"collectgarbage", luaB_collectgarbage}, 507 {"collectgarbage", luaB_collectgarbage},
527 {"gcinfo", luaB_gcinfo}, 508 {"gcinfo", luaB_gcinfo},
528 {"loadfile", luaB_loadfile}, 509 {"loadfile", luaB_loadfile},
529 {"stringdump", luaB_stringdump},
530 {"dofile", luaB_dofile}, 510 {"dofile", luaB_dofile},
531 {"loadstring", luaB_loadstring}, 511 {"loadstring", luaB_loadstring},
532 {"require", luaB_require}, 512 {"require", luaB_require},
diff --git a/lstrlib.c b/lstrlib.c
index 824ee36e..1b3e75a7 100644
--- a/lstrlib.c
+++ b/lstrlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstrlib.c,v 1.89 2002/08/23 19:45:24 roberto Exp roberto $ 2** $Id: lstrlib.c,v 1.90 2002/11/14 15:41:38 roberto Exp roberto $
3** Standard library for string operations and pattern-matching 3** Standard library for string operations and pattern-matching
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -117,6 +117,24 @@ static int str_char (lua_State *L) {
117} 117}
118 118
119 119
120static int writer (lua_State *L, const void* b, size_t size, void* B) {
121 (void)L;
122 luaL_addlstring((luaL_Buffer*) B, (const char *)b, size);
123 return 1;
124}
125
126
127static int str_dump (lua_State *L) {
128 luaL_Buffer b;
129 luaL_checktype(L, 1, LUA_TFUNCTION);
130 luaL_buffinit(L,&b);
131 if (!lua_dump(L, writer, &b))
132 luaL_error(L, "unable to dump given function");
133 luaL_pushresult(&b);
134 return 1;
135}
136
137
120 138
121/* 139/*
122** {====================================================== 140** {======================================================
@@ -730,6 +748,7 @@ static const luaL_reg strlib[] = {
730 {"rep", str_rep}, 748 {"rep", str_rep},
731 {"byte", str_byte}, 749 {"byte", str_byte},
732 {"format", str_format}, 750 {"format", str_format},
751 {"dump", str_dump},
733 {"find", str_find}, 752 {"find", str_find},
734 {"gfind", gfind}, 753 {"gfind", gfind},
735 {"gsub", str_gsub}, 754 {"gsub", str_gsub},