mirror of https://github.com/rusefi/lua.git
new function "luaI_findconstantbyname".
This commit is contained in:
parent
b074306267
commit
b17c76817d
6
lex.c
6
lex.c
|
@ -1,4 +1,4 @@
|
||||||
char *rcs_lex = "$Id: lex.c,v 2.17 1995/10/03 18:06:10 roberto Exp $";
|
char *rcs_lex = "$Id: lex.c,v 2.18 1995/10/06 13:10:53 roberto Exp roberto $";
|
||||||
|
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
@ -200,7 +200,7 @@ int yylex (void)
|
||||||
return WRONGTOKEN;
|
return WRONGTOKEN;
|
||||||
save_and_next(); /* pass the second ']' */
|
save_and_next(); /* pass the second ']' */
|
||||||
*(yytextLast-2) = 0; /* erases ']]' */
|
*(yytextLast-2) = 0; /* erases ']]' */
|
||||||
yylval.vWord = luaI_findconstant(lua_constcreate(yytext+2));
|
yylval.vWord = luaI_findconstantbyname(yytext+2);
|
||||||
return STRING;
|
return STRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ int yylex (void)
|
||||||
}
|
}
|
||||||
next(); /* skip the delimiter */
|
next(); /* skip the delimiter */
|
||||||
*yytextLast = 0;
|
*yytextLast = 0;
|
||||||
yylval.vWord = luaI_findconstant(lua_constcreate(yytext));
|
yylval.vWord = luaI_findconstantbyname(yytext);
|
||||||
return STRING;
|
return STRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
opcode.c
4
opcode.c
|
@ -3,7 +3,7 @@
|
||||||
** TecCGraf - PUC-Rio
|
** TecCGraf - PUC-Rio
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *rcs_opcode="$Id: opcode.c,v 3.41 1995/10/09 13:10:20 roberto Exp roberto $";
|
char *rcs_opcode="$Id: opcode.c,v 3.42 1995/10/09 18:45:59 roberto Exp roberto $";
|
||||||
|
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -678,7 +678,7 @@ void lua_pushstring (char *s)
|
||||||
*/
|
*/
|
||||||
void lua_pushliteral (char *s)
|
void lua_pushliteral (char *s)
|
||||||
{
|
{
|
||||||
tsvalue(top) = lua_constant[luaI_findconstant(lua_constcreate(s))];
|
tsvalue(top) = lua_constant[luaI_findconstantbyname(s)];
|
||||||
tag(top) = LUA_T_STRING;
|
tag(top) = LUA_T_STRING;
|
||||||
incr_top;
|
incr_top;
|
||||||
}
|
}
|
||||||
|
|
13
table.c
13
table.c
|
@ -3,7 +3,7 @@
|
||||||
** Module to control static tables
|
** Module to control static tables
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *rcs_table="$Id: table.c,v 2.32 1995/09/15 20:47:53 roberto Exp $";
|
char *rcs_table="$Id: table.c,v 2.33 1995/10/04 14:20:26 roberto Exp roberto $";
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -119,9 +119,8 @@ Word luaI_findsymbolbyname (char *name)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Given a name, search it at constant table and return its index. If not
|
** Given a tree node, check it is has a correspondent constant index. If not,
|
||||||
** found, allocate it.
|
** allocate it.
|
||||||
** On error, return -1.
|
|
||||||
*/
|
*/
|
||||||
Word luaI_findconstant (TreeNode *t)
|
Word luaI_findconstant (TreeNode *t)
|
||||||
{
|
{
|
||||||
|
@ -146,6 +145,12 @@ Word luaI_findconstant (TreeNode *t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Word luaI_findconstantbyname (char *name)
|
||||||
|
{
|
||||||
|
return luaI_findconstant(lua_constcreate(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Traverse symbol table objects
|
** Traverse symbol table objects
|
||||||
*/
|
*/
|
||||||
|
|
3
table.h
3
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.9 1994/11/23 14:31:11 roberto Stab roberto $
|
** $Id: table.h,v 2.10 1994/12/20 21:20:36 roberto Exp roberto $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef table_h
|
#ifndef table_h
|
||||||
|
@ -21,6 +21,7 @@ void lua_initconstant (void);
|
||||||
Word luaI_findsymbolbyname (char *name);
|
Word luaI_findsymbolbyname (char *name);
|
||||||
Word luaI_findsymbol (TreeNode *t);
|
Word luaI_findsymbol (TreeNode *t);
|
||||||
Word luaI_findconstant (TreeNode *t);
|
Word luaI_findconstant (TreeNode *t);
|
||||||
|
Word luaI_findconstantbyname (char *name);
|
||||||
void lua_travsymbol (void (*fn)(Object *));
|
void lua_travsymbol (void (*fn)(Object *));
|
||||||
void lua_markobject (Object *o);
|
void lua_markobject (Object *o);
|
||||||
void lua_pack (void);
|
void lua_pack (void);
|
||||||
|
|
Loading…
Reference in New Issue