Browse Source

small changes to avoid shadowing

v5-2
Roberto Ierusalimschy 30 years ago
parent
commit
5e60b961de
  1. 12
      iolib.c
  2. 22
      lua.stx

12
iolib.c

@ -3,7 +3,7 @@
** Input/output library to LUA
*/
char *rcs_iolib="$Id: iolib.c,v 1.13 1994/10/18 18:34:47 roberto Exp celes $";
char *rcs_iolib="$Id: iolib.c,v 1.14 1994/10/19 17:02:20 celes Exp roberto $";
#include <stdlib.h>
#include <string.h>
@ -187,7 +187,7 @@ static void io_read (void)
;
if (c == '\"')
{
int c, n=0;
int n=0;
while((c = fgetc(in)) != '\"')
{
if (c == EOF)
@ -201,7 +201,7 @@ static void io_read (void)
}
else if (c == '\'')
{
int c, n=0;
int n=0;
while((c = fgetc(in)) != '\'')
{
if (c == EOF)
@ -269,9 +269,9 @@ static void io_read (void)
break;
case 'f': case 'g': case 'e':
{
float f;
sscanf (s, "%f", &f);
lua_pushnumber(f);
float fl;
sscanf (s, "%f", &fl);
lua_pushnumber(fl);
}
break;
default:

22
lua.stx

@ -1,6 +1,6 @@
%{
char *rcs_luastx = "$Id: lua.stx,v 3.3 1994/11/06 15:35:04 roberto Exp roberto $";
char *rcs_luastx = "$Id: lua.stx,v 3.4 1994/11/09 18:07:38 roberto Exp roberto $";
#include <stdio.h>
#include <stdlib.h>
@ -22,7 +22,7 @@ char *rcs_luastx = "$Id: lua.stx,v 3.3 1994/11/06 15:35:04 roberto Exp roberto $
static Long maxcode;
static Long maxmain;
static Long maxcurr ;
static Byte *code = NULL;
static Byte *funcCode = NULL;
static Byte **initcode;
static Byte *basepc;
static Long maincode;
@ -166,10 +166,10 @@ static void code_number (float f)
static void init_function (void)
{
if (code == NULL) /* first function */
if (funcCode == NULL) /* first function */
{
code = (Byte *) calloc(CODE_BLOCK, sizeof(Byte));
if (code == NULL)
funcCode = (Byte *) calloc(CODE_BLOCK, sizeof(Byte));
if (funcCode == NULL)
lua_error("not enough memory");
maxcode = CODE_BLOCK;
}
@ -240,7 +240,7 @@ functionlist : /* empty */
function : FUNCTION NAME
{
init_function();
pc=0; basepc=code; maxcurr=maxcode;
pc=0; basepc=funcCode; maxcurr=maxcode;
nlocalvar=0;
$<vWord>$ = lua_findsymbol($2);
}
@ -263,9 +263,9 @@ function : FUNCTION NAME
if (s_bvalue($<vWord>3) == NULL)
lua_error("not enough memory");
memcpy (s_bvalue($<vWord>3), basepc, pc*sizeof(Byte));
code = basepc; maxcode=maxcurr;
funcCode = basepc; maxcode=maxcurr;
#if LISTING
PrintCode(code,code+pc);
PrintCode(funcCode,funcCode+pc);
#endif
}
;
@ -273,7 +273,7 @@ function : FUNCTION NAME
method : FUNCTION NAME { $<vWord>$ = lua_findsymbol($2); } ':' NAME
{
init_function();
pc=0; basepc=code; maxcurr=maxcode;
pc=0; basepc=funcCode; maxcurr=maxcode;
nlocalvar=0;
localvar[nlocalvar]=lua_findsymbol("self"); /* self param. */
add_nlocalvar(1);
@ -298,9 +298,9 @@ method : FUNCTION NAME { $<vWord>$ = lua_findsymbol($2); } ':' NAME
if (b == NULL)
lua_error("not enough memory");
memcpy (b, basepc, pc*sizeof(Byte));
code = basepc; maxcode=maxcurr;
funcCode = basepc; maxcode=maxcurr;
#if LISTING
PrintCode(code,code+pc);
PrintCode(funcCode,funcCode+pc);
#endif
/* assign function to table field */
pc=maincode; basepc=*initcode; maxcurr=maxmain;

Loading…
Cancel
Save