diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-03-13 17:07:18 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-03-13 17:07:18 -0300 |
commit | a39489194edf4c16642fc8518aa0017090a082f8 (patch) | |
tree | 9383c95882049e3cadd40316003181af5f2320a2 | |
parent | a3addae03634794b841b6c8c4dd8ff83542d8896 (diff) | |
download | lua-a39489194edf4c16642fc8518aa0017090a082f8.tar.gz lua-a39489194edf4c16642fc8518aa0017090a082f8.tar.bz2 lua-a39489194edf4c16642fc8518aa0017090a082f8.zip |
changing prefix of configurable macros from "lua_" to "l_"
-rw-r--r-- | liolib.c | 52 |
1 files changed, 26 insertions, 26 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: liolib.c,v 2.117 2014/02/26 15:27:56 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 2.118 2014/03/06 17:12:02 roberto Exp roberto $ |
3 | ** Standard I/O (and system) library | 3 | ** Standard I/O (and system) library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -29,14 +29,14 @@ | |||
29 | #include "lualib.h" | 29 | #include "lualib.h" |
30 | 30 | ||
31 | 31 | ||
32 | #if !defined(lua_checkmode) | 32 | #if !defined(l_checkmode) |
33 | 33 | ||
34 | /* | 34 | /* |
35 | ** Check whether 'mode' matches '[rwa]%+?b?'. | 35 | ** Check whether 'mode' matches '[rwa]%+?b?'. |
36 | ** Change this macro to accept other modes for 'fopen' besides | 36 | ** Change this macro to accept other modes for 'fopen' besides |
37 | ** the standard ones. | 37 | ** the standard ones. |
38 | */ | 38 | */ |
39 | #define lua_checkmode(mode) \ | 39 | #define l_checkmode(mode) \ |
40 | (*mode != '\0' && strchr("rwa", *(mode++)) != NULL && \ | 40 | (*mode != '\0' && strchr("rwa", *(mode++)) != NULL && \ |
41 | (*mode != '+' || ++mode) && /* skip if char is '+' */ \ | 41 | (*mode != '+' || ++mode) && /* skip if char is '+' */ \ |
42 | (*mode != 'b' || ++mode) && /* skip if char is 'b' */ \ | 42 | (*mode != 'b' || ++mode) && /* skip if char is 'b' */ \ |
@@ -46,31 +46,31 @@ | |||
46 | 46 | ||
47 | /* | 47 | /* |
48 | ** {====================================================== | 48 | ** {====================================================== |
49 | ** lua_popen spawns a new process connected to the current | 49 | ** l_popen spawns a new process connected to the current |
50 | ** one through the file streams. | 50 | ** one through the file streams. |
51 | ** ======================================================= | 51 | ** ======================================================= |
52 | */ | 52 | */ |
53 | 53 | ||
54 | #if !defined(lua_popen) /* { */ | 54 | #if !defined(l_popen) /* { */ |
55 | 55 | ||
56 | #if defined(LUA_USE_POSIX) /* { */ | 56 | #if defined(LUA_USE_POSIX) /* { */ |
57 | 57 | ||
58 | #define lua_popen(L,c,m) (fflush(NULL), popen(c,m)) | 58 | #define l_popen(L,c,m) (fflush(NULL), popen(c,m)) |
59 | #define lua_pclose(L,file) (pclose(file)) | 59 | #define l_pclose(L,file) (pclose(file)) |
60 | 60 | ||
61 | #elif defined(LUA_WIN) /* }{ */ | 61 | #elif defined(LUA_WIN) /* }{ */ |
62 | 62 | ||
63 | #define lua_popen(L,c,m) (_popen(c,m)) | 63 | #define l_popen(L,c,m) (_popen(c,m)) |
64 | #define lua_pclose(L,file) (_pclose(file)) | 64 | #define l_pclose(L,file) (_pclose(file)) |
65 | 65 | ||
66 | #else /* }{ */ | 66 | #else /* }{ */ |
67 | 67 | ||
68 | /* ANSI definitions */ | 68 | /* ANSI definitions */ |
69 | #define lua_popen(L,c,m) \ | 69 | #define l_popen(L,c,m) \ |
70 | ((void)((void)c, m), \ | 70 | ((void)((void)c, m), \ |
71 | luaL_error(L, LUA_QL("popen") " not supported"), \ | 71 | luaL_error(L, LUA_QL("popen") " not supported"), \ |
72 | (FILE*)0) | 72 | (FILE*)0) |
73 | #define lua_pclose(L,file) ((void)((void)L, file), -1) | 73 | #define l_pclose(L,file) ((void)L, (void)file, -1) |
74 | 74 | ||
75 | #endif /* } */ | 75 | #endif /* } */ |
76 | 76 | ||
@@ -79,16 +79,16 @@ | |||
79 | /* }====================================================== */ | 79 | /* }====================================================== */ |
80 | 80 | ||
81 | 81 | ||
82 | #if !defined(lua_getc) /* { */ | 82 | #if !defined(l_getc) /* { */ |
83 | 83 | ||
84 | #if defined(LUA_USE_POSIX) | 84 | #if defined(LUA_USE_POSIX) |
85 | #define lua_getc(f) getc_unlocked(f) | 85 | #define l_getc(f) getc_unlocked(f) |
86 | #define lua_lockfile(f) flockfile(f) | 86 | #define l_lockfile(f) flockfile(f) |
87 | #define lua_unlockfile(f) funlockfile(f) | 87 | #define l_unlockfile(f) funlockfile(f) |
88 | #else | 88 | #else |
89 | #define lua_getc(f) getc(f) | 89 | #define l_getc(f) getc(f) |
90 | #define lua_lockfile(f) ((void)0) | 90 | #define l_lockfile(f) ((void)0) |
91 | #define lua_unlockfile(f) ((void)0) | 91 | #define l_unlockfile(f) ((void)0) |
92 | #endif | 92 | #endif |
93 | 93 | ||
94 | #endif /* } */ | 94 | #endif /* } */ |
@@ -96,11 +96,11 @@ | |||
96 | 96 | ||
97 | /* | 97 | /* |
98 | ** {====================================================== | 98 | ** {====================================================== |
99 | ** lua_fseek: configuration for longer offsets | 99 | ** l_fseek: configuration for longer offsets |
100 | ** ======================================================= | 100 | ** ======================================================= |
101 | */ | 101 | */ |
102 | 102 | ||
103 | #if !defined(lua_fseek) /* { */ | 103 | #if !defined(l_fseek) /* { */ |
104 | 104 | ||
105 | #if defined(LUA_USE_POSIX) /* { */ | 105 | #if defined(LUA_USE_POSIX) /* { */ |
106 | 106 | ||
@@ -244,7 +244,7 @@ static int io_open (lua_State *L) { | |||
244 | const char *mode = luaL_optstring(L, 2, "r"); | 244 | const char *mode = luaL_optstring(L, 2, "r"); |
245 | LStream *p = newfile(L); | 245 | LStream *p = newfile(L); |
246 | const char *md = mode; /* to traverse/check mode */ | 246 | const char *md = mode; /* to traverse/check mode */ |
247 | luaL_argcheck(L, lua_checkmode(md), 2, "invalid mode"); | 247 | luaL_argcheck(L, l_checkmode(md), 2, "invalid mode"); |
248 | p->f = fopen(filename, mode); | 248 | p->f = fopen(filename, mode); |
249 | return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1; | 249 | return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1; |
250 | } | 250 | } |
@@ -255,7 +255,7 @@ static int io_open (lua_State *L) { | |||
255 | */ | 255 | */ |
256 | static int io_pclose (lua_State *L) { | 256 | static int io_pclose (lua_State *L) { |
257 | LStream *p = tolstream(L); | 257 | LStream *p = tolstream(L); |
258 | return luaL_execresult(L, lua_pclose(L, p->f)); | 258 | return luaL_execresult(L, l_pclose(L, p->f)); |
259 | } | 259 | } |
260 | 260 | ||
261 | 261 | ||
@@ -263,7 +263,7 @@ static int io_popen (lua_State *L) { | |||
263 | const char *filename = luaL_checkstring(L, 1); | 263 | const char *filename = luaL_checkstring(L, 1); |
264 | const char *mode = luaL_optstring(L, 2, "r"); | 264 | const char *mode = luaL_optstring(L, 2, "r"); |
265 | LStream *p = newprefile(L); | 265 | LStream *p = newprefile(L); |
266 | p->f = lua_popen(L, filename, mode); | 266 | p->f = l_popen(L, filename, mode); |
267 | p->closef = &io_pclose; | 267 | p->closef = &io_pclose; |
268 | return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1; | 268 | return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1; |
269 | } | 269 | } |
@@ -401,10 +401,10 @@ static int read_line (lua_State *L, FILE *f, int chop) { | |||
401 | luaL_Buffer b; | 401 | luaL_Buffer b; |
402 | int c; | 402 | int c; |
403 | luaL_buffinit(L, &b); | 403 | luaL_buffinit(L, &b); |
404 | lua_lockfile(f); | 404 | l_lockfile(f); |
405 | while ((c = lua_getc(f)) != EOF && c != '\n') | 405 | while ((c = l_getc(f)) != EOF && c != '\n') |
406 | luaL_addchar(&b, c); | 406 | luaL_addchar(&b, c); |
407 | lua_unlockfile(f); | 407 | l_unlockfile(f); |
408 | if (!chop && c == '\n') luaL_addchar(&b, c); | 408 | if (!chop && c == '\n') luaL_addchar(&b, c); |
409 | luaL_pushresult(&b); /* close buffer */ | 409 | luaL_pushresult(&b); /* close buffer */ |
410 | return (c == '\n' || lua_rawlen(L, -1) > 0); | 410 | return (c == '\n' || lua_rawlen(L, -1) > 0); |