mirror of https://github.com/rusefi/lua.git
comments
This commit is contained in:
parent
4fbb2531b3
commit
8278468041
40
liolib.c
40
liolib.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: liolib.c,v 1.27 1998/12/27 20:21:28 roberto Exp roberto $
|
||||
** $Id: liolib.c,v 1.28 1998/12/28 13:44:54 roberto Exp $
|
||||
** Standard I/O (and system) library
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -52,11 +52,6 @@ int pclose();
|
|||
|
||||
|
||||
|
||||
static int gettag (int i) {
|
||||
return (int)lua_getnumber(lua_getparam(i));
|
||||
}
|
||||
|
||||
|
||||
static void pushresult (int i) {
|
||||
if (i)
|
||||
lua_pushuserdata(NULL);
|
||||
|
@ -68,6 +63,17 @@ static void pushresult (int i) {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
** {======================================================
|
||||
** FILE Operations
|
||||
** =======================================================
|
||||
*/
|
||||
|
||||
static int gettag (int i) {
|
||||
return (int)lua_getnumber(lua_getparam(i));
|
||||
}
|
||||
|
||||
|
||||
static int ishandler (lua_Object f) {
|
||||
if (lua_isuserdata(f)) {
|
||||
if (lua_tag(f) == gettag(CLOSEDTAG))
|
||||
|
@ -190,9 +196,11 @@ static void io_appendto (void) {
|
|||
|
||||
|
||||
|
||||
/*====================================================
|
||||
/*
|
||||
** {======================================================
|
||||
** READ
|
||||
**===================================================*/
|
||||
** =======================================================
|
||||
*/
|
||||
|
||||
static int read_pattern (FILE *f, char *p) {
|
||||
int inskip = 0; /* {skip} level */
|
||||
|
@ -314,6 +322,8 @@ static void io_read (void) {
|
|||
} while ((p = luaL_opt_string(arg++, NULL)) != NULL);
|
||||
}
|
||||
|
||||
/* }====================================================== */
|
||||
|
||||
|
||||
static void io_write (void) {
|
||||
int arg = FIRSTARG;
|
||||
|
@ -350,6 +360,14 @@ static void io_flush (void) {
|
|||
pushresult(fflush(f) == 0);
|
||||
}
|
||||
|
||||
/* }====================================================== */
|
||||
|
||||
|
||||
/*
|
||||
** {======================================================
|
||||
** Other O.S. Operations
|
||||
** =======================================================
|
||||
*/
|
||||
|
||||
static void io_execute (void) {
|
||||
lua_pushnumber(system(luaL_check_string(1)));
|
||||
|
@ -412,6 +430,9 @@ static void io_exit (void) {
|
|||
exit(lua_isnumber(o) ? (int)lua_getnumber(o) : 1);
|
||||
}
|
||||
|
||||
/* }====================================================== */
|
||||
|
||||
|
||||
|
||||
static void io_debug (void) {
|
||||
for (;;) {
|
||||
|
@ -439,7 +460,8 @@ static void errorfb (void) {
|
|||
char *chunkname;
|
||||
int linedefined;
|
||||
lua_funcinfo(func, &chunkname, &linedefined);
|
||||
strcat(buff, (level==2) ? "Active Stack:\n\t" : "\t");
|
||||
if (level == 2) strcat(buff, "Active Stack:\n");
|
||||
strcat(buff, "\t");
|
||||
if (strlen(buff) > MAXMESSAGE-MESSAGESIZE) {
|
||||
strcat(buff, "...\n");
|
||||
break; /* buffer is full */
|
||||
|
|
19
lmathlib.c
19
lmathlib.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lmathlib.c,v 1.13 1998/12/30 17:22:17 roberto Exp roberto $
|
||||
** $Id: lmathlib.c,v 1.14 1998/12/30 21:23:26 roberto Exp $
|
||||
** Lua standard mathematical library
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -12,15 +12,18 @@
|
|||
#include "lua.h"
|
||||
#include "lualib.h"
|
||||
|
||||
#ifdef M_PI
|
||||
#define PI M_PI
|
||||
#else
|
||||
#define PI ((double)3.14159265358979323846)
|
||||
#endif
|
||||
|
||||
#define PI (3.14159265358979323846)
|
||||
|
||||
|
||||
#define FROMRAD(a) ((a)*(180.0/PI))
|
||||
#define TORAD(a) ((a)*(PI/180.0))
|
||||
/*
|
||||
** If you want Lua to operate in radians (instead of degrees),
|
||||
** changes these two macros to identities:
|
||||
** #define FROMRAD(a) (a)
|
||||
** #define TORAD(a) (a)
|
||||
*/
|
||||
#define FROMRAD(a) ((a)*(180.0/PI))
|
||||
#define TORAD(a) ((a)*(PI/180.0))
|
||||
|
||||
|
||||
static void math_abs (void)
|
||||
|
|
Loading…
Reference in New Issue