summaryrefslogtreecommitdiff
path: root/lua.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1998-12-28 11:44:54 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1998-12-28 11:44:54 -0200
commit766e67ef3b2af42f800b281e0fa0f57c7e3d2e3f (patch)
tree96fbaa15baec33d4f14b27df79778e766ef46f57 /lua.c
parent4c94d8cc2cbeac74ae3618b1322c3f3d3ec166ea (diff)
downloadlua-766e67ef3b2af42f800b281e0fa0f57c7e3d2e3f.tar.gz
lua-766e67ef3b2af42f800b281e0fa0f57c7e3d2e3f.tar.bz2
lua-766e67ef3b2af42f800b281e0fa0f57c7e3d2e3f.zip
to avoid warnings about "typecast" (Visual C++)
Diffstat (limited to 'lua.c')
-rw-r--r--lua.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/lua.c b/lua.c
index fccf5236..c7f22188 100644
--- a/lua.c
+++ b/lua.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.c,v 1.13 1998/01/19 19:49:49 roberto Exp roberto $ 2** $Id: lua.c,v 1.14 1998/02/11 20:56:05 roberto Exp roberto $
3** Lua stand-alone interpreter 3** Lua stand-alone interpreter
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -32,27 +32,27 @@ typedef void (*handler)(int); /* type for signal actions */
32 32
33static void laction (int i); 33static void laction (int i);
34 34
35static handler lreset (void) 35
36{ 36static handler lreset (void) {
37 lua_linehook = NULL; 37 lua_linehook = NULL;
38 lua_callhook = NULL; 38 lua_callhook = NULL;
39 return signal(SIGINT, laction); 39 return signal(SIGINT, laction);
40} 40}
41 41
42static void lstop (void) 42
43{ 43static void lstop (void) {
44 lreset(); 44 lreset();
45 lua_error("interrupted!"); 45 lua_error("interrupted!");
46} 46}
47 47
48static void laction (int i) 48
49{ 49static void laction (int i) {
50 lua_linehook = (lua_LHFunction)lstop; 50 lua_linehook = (lua_LHFunction)lstop;
51 lua_callhook = (lua_CHFunction)lstop; 51 lua_callhook = (lua_CHFunction)lstop;
52} 52}
53 53
54static int ldo (int (*f)(char *), char *name) 54
55{ 55static int ldo (int (*f)(char *), char *name) {
56 int res; 56 int res;
57 handler h = lreset(); 57 handler h = lreset();
58 res = f(name); /* dostring | dofile */ 58 res = f(name); /* dostring | dofile */
@@ -61,8 +61,7 @@ static int ldo (int (*f)(char *), char *name)
61} 61}
62 62
63 63
64static void print_message (void) 64static void print_message (void) {
65{
66 fprintf(stderr, 65 fprintf(stderr,
67"Lua: command line options:\n" 66"Lua: command line options:\n"
68" -v print version information\n" 67" -v print version information\n"
@@ -76,8 +75,7 @@ static void print_message (void)
76} 75}
77 76
78 77
79static void assign (char *arg) 78static void assign (char *arg) {
80{
81 if (strlen(arg) >= 500) 79 if (strlen(arg) >= 500)
82 fprintf(stderr, "lua: shell argument too long"); 80 fprintf(stderr, "lua: shell argument too long");
83 else { 81 else {
@@ -90,13 +88,11 @@ static void assign (char *arg)
90 } 88 }
91} 89}
92 90
93#define BUF_SIZE 512
94 91
95static void manual_input (int prompt) 92static void manual_input (int prompt) {
96{
97 int cont = 1; 93 int cont = 1;
98 while (cont) { 94 while (cont) {
99 char buffer[BUF_SIZE]; 95 char buffer[BUFSIZ];
100 int i = 0; 96 int i = 0;
101 lua_beginblock(); 97 lua_beginblock();
102 if (prompt) 98 if (prompt)
@@ -112,13 +108,13 @@ static void manual_input (int prompt)
112 buffer[i-1] = '\n'; 108 buffer[i-1] = '\n';
113 else break; 109 else break;
114 } 110 }
115 else if (i >= BUF_SIZE-1) { 111 else if (i >= BUFSIZ-1) {
116 fprintf(stderr, "lua: argument line too long\n"); 112 fprintf(stderr, "lua: argument line too long\n");
117 break; 113 break;
118 } 114 }
119 else buffer[i++] = c; 115 else buffer[i++] = (char)c;
120 } 116 }
121 buffer[i] = 0; 117 buffer[i] = '\0';
122 ldo(lua_dostring, buffer); 118 ldo(lua_dostring, buffer);
123 lua_endblock(); 119 lua_endblock();
124 } 120 }