|
1 | 1 | /*
|
2 |
| -** $Id: luac.c,v 1.71 2014/11/26 12:08:59 lhf Exp $ |
| 2 | +** $Id: luac.c,v 1.72 2015/01/06 03:09:13 lhf Exp $ |
3 | 3 | ** Lua compiler (saves bytecodes to files; also lists bytecodes)
|
4 | 4 | ** See Copyright Notice in lua.h
|
5 | 5 | */
|
@@ -50,14 +50,14 @@ static void cannot(const char* what)
|
50 | 50 | static void usage(const char* message)
|
51 | 51 | {
|
52 | 52 | if (*message=='-')
|
53 |
| - fprintf(stderr,"%s: unrecognized option " LUA_QS "\n",progname,message); |
| 53 | + fprintf(stderr,"%s: unrecognized option '%s'\n",progname,message); |
54 | 54 | else
|
55 | 55 | fprintf(stderr,"%s: %s\n",progname,message);
|
56 | 56 | fprintf(stderr,
|
57 | 57 | "usage: %s [options] [filenames]\n"
|
58 | 58 | "Available options are:\n"
|
59 | 59 | " -l list (use -l -l for full listing)\n"
|
60 |
| - " -o name output to file " LUA_QL("name") " (default is \"%s\")\n" |
| 60 | + " -o name output to file 'name' (default is \"%s\")\n" |
61 | 61 | " -p parse only\n"
|
62 | 62 | " -s strip debug information\n"
|
63 | 63 | " -v show version information\n"
|
@@ -92,7 +92,7 @@ static int doargs(int argc, char* argv[])
|
92 | 92 | {
|
93 | 93 | output=argv[++i];
|
94 | 94 | if (output==NULL || *output==0 || (*output=='-' && output[1]!=0))
|
95 |
| - usage(LUA_QL("-o") " needs argument"); |
| 95 | + usage("'-o' needs argument"); |
96 | 96 | if (IS("-")) output=NULL;
|
97 | 97 | }
|
98 | 98 | else if (IS("-p")) /* parse only */
|
@@ -206,7 +206,7 @@ int main(int argc, char* argv[])
|
206 | 206 | }
|
207 | 207 |
|
208 | 208 | /*
|
209 |
| -** $Id: print.c,v 1.74 2014/07/21 01:41:45 lhf Exp $ |
| 209 | +** $Id: print.c,v 1.76 2015/01/05 16:12:50 lhf Exp $ |
210 | 210 | ** print bytecodes
|
211 | 211 | ** See Copyright Notice in lua.h
|
212 | 212 | */
|
@@ -263,8 +263,13 @@ static void PrintConstant(const Proto* f, int i)
|
263 | 263 | printf(bvalue(o) ? "true" : "false");
|
264 | 264 | break;
|
265 | 265 | case LUA_TNUMFLT:
|
266 |
| - printf(LUA_NUMBER_FMT,fltvalue(o)); |
| 266 | + { |
| 267 | + char buff[100]; |
| 268 | + sprintf(buff,LUA_NUMBER_FMT,fltvalue(o)); |
| 269 | + printf("%s",buff); |
| 270 | + if (buff[strspn(buff,"-0123456789")]=='\0') printf(".0"); |
267 | 271 | break;
|
| 272 | + } |
268 | 273 | case LUA_TNUMINT:
|
269 | 274 | printf(LUA_INTEGER_FMT,ivalue(o));
|
270 | 275 | break;
|
|
0 commit comments