mirror of https://github.com/rusefi/lua.git
fixed strings (not collectable) don't need to be inserted in the constant table.
This commit is contained in:
parent
3e42969979
commit
d6e4c29733
6
inout.c
6
inout.c
|
@ -5,7 +5,7 @@
|
||||||
** Also provides some predefined lua functions.
|
** Also provides some predefined lua functions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *rcs_inout="$Id: inout.c,v 2.31 1996/02/13 17:30:39 roberto Exp roberto $";
|
char *rcs_inout="$Id: inout.c,v 2.32 1996/02/14 18:25:04 roberto Exp roberto $";
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -66,7 +66,7 @@ int lua_openfile (char *fn)
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
lua_linenumber = 1;
|
lua_linenumber = 1;
|
||||||
lua_parsedfile = lua_constcreate(fn)->str;
|
lua_parsedfile = luaI_createfixedstring(fn)->str;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ void lua_openstring (char *s)
|
||||||
lua_setinput (stringinput);
|
lua_setinput (stringinput);
|
||||||
st = s;
|
st = s;
|
||||||
lua_linenumber = 1;
|
lua_linenumber = 1;
|
||||||
lua_parsedfile = lua_constcreate("(string)")->str;
|
lua_parsedfile = luaI_createfixedstring("(string)")->str;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
4
lua.stx
4
lua.stx
|
@ -1,6 +1,6 @@
|
||||||
%{
|
%{
|
||||||
|
|
||||||
char *rcs_luastx = "$Id: lua.stx,v 3.32 1996/02/14 18:25:04 roberto Exp roberto $";
|
char *rcs_luastx = "$Id: lua.stx,v 3.33 1996/02/26 17:07:20 roberto Exp roberto $";
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -487,7 +487,7 @@ funcname : var { $$ =$1; init_func(); }
|
||||||
code_word(luaI_findconstant($3));
|
code_word(luaI_findconstant($3));
|
||||||
$$ = 0; /* indexed variable */
|
$$ = 0; /* indexed variable */
|
||||||
init_func();
|
init_func();
|
||||||
add_localvar(lua_constcreate("self"));
|
add_localvar(luaI_createfixedstring("self"));
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
40
table.c
40
table.c
|
@ -3,7 +3,7 @@
|
||||||
** Module to control static tables
|
** Module to control static tables
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *rcs_table="$Id: table.c,v 2.46 1996/02/14 13:35:51 roberto Exp roberto $";
|
char *rcs_table="$Id: table.c,v 2.47 1996/02/14 18:25:04 roberto Exp roberto $";
|
||||||
|
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
#include "opcode.h"
|
#include "opcode.h"
|
||||||
|
@ -39,19 +39,19 @@ static struct {
|
||||||
char *name;
|
char *name;
|
||||||
lua_CFunction func;
|
lua_CFunction func;
|
||||||
} int_funcs[] = {
|
} int_funcs[] = {
|
||||||
{"nextvar", lua_nextvar},
|
{"assert", luaI_assert},
|
||||||
{"error", luaI_error},
|
|
||||||
{"tonumber", lua_obj2number},
|
|
||||||
{"setfallback", luaI_setfallback},
|
|
||||||
{"next", lua_next},
|
|
||||||
{"dofile", lua_internaldofile},
|
{"dofile", lua_internaldofile},
|
||||||
{"setglobal", luaI_setglobal},
|
|
||||||
{"getglobal", luaI_getglobal},
|
|
||||||
{"type", luaI_type},
|
|
||||||
{"tostring", luaI_tostring},
|
|
||||||
{"print", luaI_print},
|
|
||||||
{"dostring", lua_internaldostring},
|
{"dostring", lua_internaldostring},
|
||||||
{"assert", luaI_assert}
|
{"error", luaI_error},
|
||||||
|
{"getglobal", luaI_getglobal},
|
||||||
|
{"next", lua_next},
|
||||||
|
{"nextvar", lua_nextvar},
|
||||||
|
{"print", luaI_print},
|
||||||
|
{"setfallback", luaI_setfallback},
|
||||||
|
{"setglobal", luaI_setglobal},
|
||||||
|
{"tonumber", lua_obj2number},
|
||||||
|
{"tostring", luaI_tostring},
|
||||||
|
{"type", luaI_type}
|
||||||
};
|
};
|
||||||
|
|
||||||
#define INTFUNCSIZE (sizeof(int_funcs)/sizeof(int_funcs[0]))
|
#define INTFUNCSIZE (sizeof(int_funcs)/sizeof(int_funcs[0]))
|
||||||
|
@ -100,8 +100,6 @@ Word luaI_findsymbol (TaggedString *t)
|
||||||
lua_table[lua_ntable].varname = t;
|
lua_table[lua_ntable].varname = t;
|
||||||
s_tag(lua_ntable) = LUA_T_NIL;
|
s_tag(lua_ntable) = LUA_T_NIL;
|
||||||
lua_ntable++;
|
lua_ntable++;
|
||||||
if (!t->marked)
|
|
||||||
t->marked = 2; /* avoid GC */
|
|
||||||
}
|
}
|
||||||
return t->varindex;
|
return t->varindex;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +107,7 @@ Word luaI_findsymbol (TaggedString *t)
|
||||||
|
|
||||||
Word luaI_findsymbolbyname (char *name)
|
Word luaI_findsymbolbyname (char *name)
|
||||||
{
|
{
|
||||||
return luaI_findsymbol(lua_createstring(name));
|
return luaI_findsymbol(luaI_createfixedstring(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -133,8 +131,6 @@ Word luaI_findconstant (TaggedString *t)
|
||||||
t->constindex = lua_nconstant;
|
t->constindex = lua_nconstant;
|
||||||
lua_constant[lua_nconstant] = t;
|
lua_constant[lua_nconstant] = t;
|
||||||
lua_nconstant++;
|
lua_nconstant++;
|
||||||
if (!t->marked)
|
|
||||||
t->marked = 2; /* avoid GC */
|
|
||||||
}
|
}
|
||||||
return t->constindex;
|
return t->constindex;
|
||||||
}
|
}
|
||||||
|
@ -142,13 +138,15 @@ Word luaI_findconstant (TaggedString *t)
|
||||||
|
|
||||||
Word luaI_findconstantbyname (char *name)
|
Word luaI_findconstantbyname (char *name)
|
||||||
{
|
{
|
||||||
return luaI_findconstant(lua_createstring(name));
|
return luaI_findconstant(luaI_createfixedstring(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
TaggedString *lua_constcreate(char *name)
|
TaggedString *luaI_createfixedstring (char *name)
|
||||||
{
|
{
|
||||||
int i = luaI_findconstantbyname(name);
|
TaggedString *ts = lua_createstring(name);
|
||||||
return lua_constant[i];
|
if (!ts->marked)
|
||||||
|
ts->marked = 2; /* avoid GC */
|
||||||
|
return ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
4
table.h
4
table.h
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
** Module to control static tables
|
** Module to control static tables
|
||||||
** TeCGraf - PUC-Rio
|
** TeCGraf - PUC-Rio
|
||||||
** $Id: table.h,v 2.17 1996/02/12 18:32:40 roberto Exp roberto $
|
** $Id: table.h,v 2.18 1996/02/14 13:35:51 roberto Exp roberto $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef table_h
|
#ifndef table_h
|
||||||
|
@ -26,7 +26,7 @@ Word luaI_findsymbolbyname (char *name);
|
||||||
Word luaI_findsymbol (TaggedString *t);
|
Word luaI_findsymbol (TaggedString *t);
|
||||||
Word luaI_findconstant (TaggedString *t);
|
Word luaI_findconstant (TaggedString *t);
|
||||||
Word luaI_findconstantbyname (char *name);
|
Word luaI_findconstantbyname (char *name);
|
||||||
TaggedString *lua_constcreate (char *str);
|
TaggedString *luaI_createfixedstring (char *str);
|
||||||
int lua_markobject (Object *o);
|
int lua_markobject (Object *o);
|
||||||
Long luaI_collectgarbage (void);
|
Long luaI_collectgarbage (void);
|
||||||
void lua_pack (void);
|
void lua_pack (void);
|
||||||
|
|
Loading…
Reference in New Issue