mirror of https://github.com/rusefi/lua.git
details
This commit is contained in:
parent
bcdbdaccc3
commit
aee07c6599
39
lua.c
39
lua.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lua.c,v 1.29 1999/12/20 13:03:20 roberto Exp roberto $
|
** $Id: lua.c,v 1.30 1999/12/21 17:34:23 roberto Exp roberto $
|
||||||
** Lua stand-alone interpreter
|
** Lua stand-alone interpreter
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -67,16 +67,22 @@ static int ldo (int (*f)(lua_State *L, const char *), const char *name) {
|
||||||
|
|
||||||
static void print_message (void) {
|
static void print_message (void) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Lua: command line options:\n"
|
"usage: lua [options]. Available options are:\n"
|
||||||
" -v print version information\n"
|
|
||||||
" -d turn debug on\n"
|
|
||||||
" -e stat dostring `stat'\n"
|
|
||||||
" -q interactive mode without prompt\n"
|
|
||||||
" -i interactive mode with prompt\n"
|
|
||||||
" - execute stdin as a file\n"
|
" - execute stdin as a file\n"
|
||||||
" -f name dofile `name' with following arguments in table `arg'\n"
|
" -d turn debug on\n"
|
||||||
" a=b set global `a' with string `b'\n"
|
" -e stat execute string `stat'\n"
|
||||||
" name dofile `name'\n\n");
|
" -f name execute file `name' with remaining arguments in table `arg'\n"
|
||||||
|
" -i enter interactive mode with prompt\n"
|
||||||
|
" -q enter interactive mode without prompt\n"
|
||||||
|
" -v print version information\n"
|
||||||
|
" a=b set global `a' to string `b'\n"
|
||||||
|
" name execute file `name'\n"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void print_version (void) {
|
||||||
|
printf("%s %s\n", LUA_VERSION, LUA_COPYRIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -166,7 +172,7 @@ int main (int argc, char *argv[]) {
|
||||||
lua_userinit();
|
lua_userinit();
|
||||||
if (argc < 2) { /* no arguments? */
|
if (argc < 2) { /* no arguments? */
|
||||||
if (isatty(0)) {
|
if (isatty(0)) {
|
||||||
printf("%s %s\n", LUA_VERSION, LUA_COPYRIGHT);
|
print_version();
|
||||||
manual_input(1);
|
manual_input(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -186,10 +192,13 @@ int main (int argc, char *argv[]) {
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
lua_setdebug(lua_state, 1);
|
lua_setdebug(lua_state, 1);
|
||||||
|
if (i==argc-1) { /* last argument? */
|
||||||
|
print_version();
|
||||||
|
manual_input(1);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
printf("%s %s\n(written by %s)\n",
|
print_version();
|
||||||
LUA_VERSION, LUA_COPYRIGHT, LUA_AUTHORS);
|
|
||||||
break;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
i++;
|
i++;
|
||||||
|
@ -210,9 +219,7 @@ int main (int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
getargs(argc-i, argv+i); /* collect following arguments */
|
getargs(argc-i, argv+i); /* collect following arguments */
|
||||||
file_input(argv, i);
|
file_input(argv, i);
|
||||||
return 0; /* stop running arguments */
|
i = argc; /* stop running arguments */
|
||||||
case '-':
|
|
||||||
i = argc; /* end loop */
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
print_message();
|
print_message();
|
||||||
|
|
6
lua.h
6
lua.h
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lua.h,v 1.42 1999/12/02 16:24:45 roberto Exp roberto $
|
** $Id: lua.h,v 1.43 1999/12/06 11:41:28 roberto Exp roberto $
|
||||||
** Lua - An Extensible Extension Language
|
** Lua - An Extensible Extension Language
|
||||||
** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil
|
** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil
|
||||||
** e-mail: lua@tecgraf.puc-rio.br
|
** e-mail: lua@tecgraf.puc-rio.br
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
#define lua_h
|
#define lua_h
|
||||||
|
|
||||||
#define LUA_VERSION "Lua 3.x"
|
#define LUA_VERSION "Lua 3.x"
|
||||||
#define LUA_COPYRIGHT "Copyright (C) 1994-1999 TeCGraf, PUC-Rio"
|
#define LUA_COPYRIGHT "Copyright (C) 1994-2000 TeCGraf, PUC-Rio"
|
||||||
#define LUA_AUTHORS "W. Celes, R. Ierusalimschy & L. H. de Figueiredo"
|
#define LUA_AUTHORS "W. Celes, R. Ierusalimschy & L. H. de Figueiredo"
|
||||||
|
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ extern lua_State *lua_state;
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Copyright (c) 1994-1999 TeCGraf, PUC-Rio. All rights reserved.
|
* Copyright (C) 1994-2000 TeCGraf, PUC-Rio. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, without written agreement and without license
|
* Permission is hereby granted, without written agreement and without license
|
||||||
* or royalty fees, to use, copy, modify, and distribute this software and its
|
* or royalty fees, to use, copy, modify, and distribute this software and its
|
||||||
|
|
Loading…
Reference in New Issue