Example #1
0
static TString* LoadWString(LoadState* S)
{
 size_t size;
 LoadVar(S,size);
 if (size==0)
  return NULL;
 else
 {
  lua_WChar* s=(lua_WChar*)luaZ_openspace(S->L,S->b,size*2);
  LoadVector(S,s,size,2);
  return luaS_newlwstr(S->L,s,size-1);		/* remove trailing '\0' */
 }
}
static TString* LoadString(LoadState* S)
{
 size_t size;
 LoadVar(S,size);
 if (size==0)
  return NULL;
 else
 {
  char* s=luaZ_openspace(S->L,S->b,size);
  LoadBlock(S,s,size);
  return luaS_newlstr(S->L,s,size-1);		/* remove trailing '\0' */
 }
}
void Factor() {
  if(Look == '(') {
    Match('(');
    BoolExpression();
    Match(')');
  }
  else if(IsAlpha(Look)) {
    GetName();
    LoadVar(Value);
  } else {
    LoadConst(GetNum());
  }
}
Example #4
0
static lua_Number LoadNumber(LoadState* S)
{
 lua_Number x;
 if(S->toflt)
 {
  switch(S->numsize)
  {
   case 1: {
    int8_t y;
    LoadVar(S,y);
    x = (lua_Number)y;
   } break;
   case 2: {
    int16_t y;
    LoadVar(S,y);
    x = (lua_Number)y;
   } break;
   case 4: {
    int32_t y;
    LoadVar(S,y);
    x = (lua_Number)y;
   } break;
   case 8: {
    int64_t y;
    LoadVar(S,y);
    x = (lua_Number)y;
   } break;
   default: lua_assert(0);
  }
 }
 else
 {
  LoadVar(S,x); /* should probably handle more cases for float here... */
 }
 return x;
}
Example #5
0
File: lundump.c Project: 1dao/puss
static TString *LoadString (LoadState *S) {
  size_t size = LoadByte(S);
  if (size == 0xFF)
    LoadVar(S, size);
  if (size == 0)
    return NULL;
  else if (--size <= LUAI_MAXSHORTLEN) {  /* short string? */
    char buff[LUAI_MAXSHORTLEN];
    LoadVector(S, buff, size);
    return luaS_newlstr(S->L, buff, size);
  }
  else {  /* long string */
    TString *ts = luaS_createlngstrobj(S->L, size);
    LoadVector(S, getstr(ts), size);  /* load directly in final place */
    return ts;
  }
}
Example #6
0
static TString* LoadString(LoadState* S)
{
 size_t size = 0;
 if ( sizeof(size_t) <= SIZE_T_PRECOMPILED_CHUNK )
  LoadVar(S,size);
 else
  LoadMem(S,&size,1,SIZE_T_PRECOMPILED_CHUNK);

 if (size==0)
  return NULL;
 else
 {
  char* s=luaZ_openspace(S->L,S->b,size);
  LoadBlock(S,s,size);
  return luaS_newlstr(S->L,s,size-1);		/* remove trailing '\0' */
 }
}
Example #7
0
void Factor()
{
    if (Token == '(') {
        Next();
        BoolExpression();
        MatchString(")");
    } else {
        if (Token == 'x') {
            LoadVar(Value);
        } else if (Token == '#') {
            LoadConst(Value);
        } else {
            Expected("Math Factor");
        }
        Next();
    }
}
Example #8
0
static TString* LoadString(LoadState* S)
{
    int32_t size;
    LoadVar(S,size);
    if (size==0)
        return NULL;
    else
    {
        char* s;
        if (!luaZ_direct_mode(S->Z)) {
            s = luaZ_openspace(S->L,S->b,size);
            LoadBlock(S,s,size);
            return luaS_newlstr(S->L,s,size-1); /* remove trailing zero */
        } else {
            s = (char*)luaZ_get_crt_address(S->Z);
            LoadBlock(S,NULL,size);
            return luaS_newrolstr(S->L,s,size-1);
        }
    }
}
Example #9
0
static lua_Number LoadNumber(LoadState* S)
{
 lua_Number x;
 LoadVar(S,x);
 return x;
}
Example #10
0
static int LoadChar(LoadState* S)
{
 char x;
 LoadVar(S,x);
 return x;
}
Example #11
0
static lua_Integer LoadInteger(LoadState* S)
{
 lua_Integer x;
 LoadVar(S,x);
 return x;
}
Example #12
0
static int LoadInt (LoadState *S) {
  int x;
  LoadVar(S, x);
  return x;
}
Example #13
0
static lu_byte LoadByte (LoadState *S) {
  lu_byte x;
  LoadVar(S, x);
  return x;
}
Example #14
0
static killa_Number LoadNumber(LoadState* S)
{
 killa_Number x;
 LoadVar(S,x);
 return x;
}