Пример #1
0
void CppiaStackVar::fromStream(CppiaStream &stream)
{
   nameId = stream.getInt();
   id = stream.getInt();
   capture = stream.getBool();
   typeId = stream.getInt();
}
Пример #2
0
void CppiaVar::load(CppiaStream &stream)
{
   readAccess = getAccess(stream);
   writeAccess = getAccess(stream);
   isVirtual = stream.getBool();
   nameId = stream.getInt();
   typeId = stream.getInt();
   if (stream.getInt())
      init = createCppiaExpr(stream);
}
Пример #3
0
void CppiaConst::fromStream(CppiaStream &stream)
{
   std::string tok = stream.getToken();
   if (tok[0]=='i')
   {
      type = cInt;

      dval = ival = stream.getInt();
   }
   else if (tok=="true")
   {
      type = cInt;
      dval = ival = 1;
   }
   else if (tok=="false")
   {
      type = cInt;
      dval = ival = 0;
   }
   else if (tok[0]=='f')
   {
      type = cFloat;
      int strIndex = stream.getInt();
      String val = stream.module->strings[strIndex];
      dval = atof(val.__s);
      ival = dval;
   }
   else if (tok[0]=='s')
   {
      type = cString;
      ival = stream.getInt();
   }
   else if (tok=="NULL")
      type = cNull;
   else if (tok=="THIS")
      type = cThis;
   else if (tok=="SUPER")
      type = cSuper;
   else
      throw "unknown const value";
}
Пример #4
0
CppiaVar::Access CppiaVar::getAccess(CppiaStream &stream)
{
   std::string tok = stream.getToken();
   if (tok.size()!=1)
      throw "bad var access length";
   switch(tok[0])
   {
      case 'N': return accNormal;
      case 'n': return accNo;
      case 'R': return accResolve;
      case 'C': return accCall;
      case 'V': return accCallNative;
   }
   throw "bad access code";
   return accNormal;
}