void CompilationEngine::compileParameterList()
{
    /* ((type varName)(',' type varName)*)? */

    tagNonTerminal("parameterList");

    if (jt.tokenType() != TokenType::kSYMBOL) {

        readType();
        nextToken();
        readIdentifier();
        nextToken();

        while (jt.tokenType() == TokenType::kSYMBOL && jt.symbol() == ',') {
            readSymbol(',');
            nextToken();
            readType();
            nextToken();
            readIdentifier();
            nextToken();
        }
    }

    untagNonTerminal("parameterList");
}
示例#2
0
void Vfile::read_dynamics(ifstream &v) {
	short len;
	short GroupID;
	int frame;
	int prev_frame = -1;
	while(1) {
		readType(v, &len);
		if (v.eof()) { cout << "JUST KIDDING: Actually end of v file" << endl; return; }
		if (VDEBUG) cout << "length of dynamic data record: " << len << endl;
		readType(v, &GroupID);
		if (GroupID != bodies.GroupID) {
			cout << "Ignoring data from different GroupID" << endl;
			v.seekg(len - 2, std::ios_base::cur);
		} else {
			readType(v, &frame);
			if (prev_frame != -1 && prev_frame+1 != frame) {
				cout << "Frame jump : " << prev_frame
					<< "to " << frame << endl;
			}
			prev_frame = frame;
			vector< double > d(bodies.DOFlabels.size(), 0.0);
			for (unsigned int i = 0; i < d.size(); ++i) {
				readType(v, &(d[i]));
				if (VDEBUG) cout << d[i] << '\t';
			}
			if (VDEBUG) cout << endl;
			frames.push_back(d);
		}
	}
}
void CompilationEngine::compileClassVarDec()
{
    /* ('static' | 'field') type varName (',' varName)* ';' */

    tagNonTerminal("classVarDec");

    if (jt.keyword() == Keyword::kFIELD)
        readKeyword("field", Keyword::kFIELD);
    else
        readKeyword("static", Keyword::kSTATIC);

    nextToken();
    readType();
    nextToken();
    readIdentifier();
    nextToken();

    while (jt.tokenType() == TokenType::kSYMBOL && jt.symbol() == ',') {
        readSymbol(',');
        nextToken();
        readIdentifier();
        nextToken();
    }

    readSymbol(';');
    untagNonTerminal("classVarDec");
    nextToken();
}
void CompilationEngine::compileSubroutine()
{
    /* ('constructor' | 'function' | 'method')
       ('void' | type) subroutineName '(' parameterList ')'
       subroutineBody */

    tagNonTerminal("subroutineDec");

    if (jt.keyword() == Keyword::kCONSTRUCTOR)
        readKeyword("constructor", Keyword::kCONSTRUCTOR);
    else if (jt.keyword() == Keyword::kFUNCTION)
        readKeyword("function", Keyword::kFUNCTION);
    else
        readKeyword("method", Keyword::kMETHOD);

    nextToken();

    if (jt.tokenType() == TokenType::kKEYWORD && jt.keyword() == Keyword::kVOID)
        readKeyword("void", Keyword::kVOID);
    else
        readType();

    nextToken();
    readIdentifier();
    nextToken();
    readSymbol('(');
    nextToken();
    compileParameterList();
    readSymbol(')');
    nextToken();
    compileSubroutineBody();
    untagNonTerminal("subroutineDec");
}
示例#5
0
void TypeTable::loadFromFile(const QString& fileName)
{
    TRACE("reading file " + fileName);
    KConfig confFile(fileName, KConfig::SimpleConfig);

    /*
     * Read library name and properties.
     */
    KConfigGroup cf = confFile.group(TypeTableGroup);
    m_displayName = cf.readEntry(LibDisplayName);
    if (m_displayName.isEmpty()) {
        // use file name instead
        QFileInfo fi(fileName);
        m_displayName = fi.completeBaseName();
    }

    m_shlibNameRE = QRegExp(cf.readEntry(ShlibRE));
    m_enabledBuiltins = cf.readEntry(EnableBuiltin, QStringList());

    QString printQString = cf.readEntry(PrintQStringCmd);
    m_printQStringDataCmd = printQString.toAscii();

    /*
     * Get the types. We search for entries of kind Types1, Types2, etc.
     * because a single entry Types could get rather long for large
     * libraries.
     */
    QString typesEntry;
    for (int i = 1; ; i++) {
        // next bunch of types
        KConfigGroup cf = confFile.group(TypeTableGroup);
        typesEntry.sprintf(TypesEntryFmt, i);
        if (!cf.hasKey(typesEntry))
            break;

        QStringList typeNames = cf.readEntry(typesEntry, QStringList());

        // now read them
        QString alias;
        for (QStringList::iterator it = typeNames.begin(); it != typeNames.end(); ++it)
        {
            KConfigGroup cf = confFile.group(*it);
            // check if this is an alias
            alias = cf.readEntry(AliasEntry);
            if (alias.isEmpty()) {
                readType(cf, *it);
            } else {
                // look up the alias type and insert it
                TypeInfoMap::iterator i = m_typeDict.find(alias);
                if (i == m_typeDict.end()) {
                    TRACE(*it + ": alias " + alias + " not found");
                } else {
                    m_aliasDict.insert(std::make_pair(*it, &i->second));
                    TRACE(*it + ": alias " + alias);
                }
            }
        }
    } // for all Types%d
}
示例#6
0
文件: rules.cpp 项目: KDE/kwin
void Rules::readFromCfg(const KConfigGroup& cfg)
{
    description = cfg.readEntry("Description");
    if (description.isEmpty())  // capitalized first, lowercase for backwards compatibility
        description = cfg.readEntry("description");
    READ_MATCH_STRING(wmclass, .toLower().toLatin1());
    wmclasscomplete = cfg.readEntry("wmclasscomplete" , false);
    READ_MATCH_STRING(windowrole, .toLower().toLatin1());
    READ_MATCH_STRING(title,);
    READ_MATCH_STRING(clientmachine, .toLower().toLatin1());
    types = NET::WindowTypeMask(cfg.readEntry<uint>("types", NET::AllTypesMask));
    READ_FORCE_RULE2(placement, QString(), Placement::policyFromString, false);
    READ_SET_RULE_DEF(position, , invalidPoint);
    READ_SET_RULE(size, , QSize());
    if (size.isEmpty() && sizerule != (SetRule)Remember)
        sizerule = UnusedSetRule;
    READ_FORCE_RULE(minsize, , QSize());
    if (!minsize.isValid())
        minsize = QSize(1, 1);
    READ_FORCE_RULE(maxsize, , QSize());
    if (maxsize.isEmpty())
        maxsize = QSize(32767, 32767);
    READ_FORCE_RULE(opacityactive, , 0);
    if (opacityactive < 0 || opacityactive > 100)
        opacityactive = 100;
    READ_FORCE_RULE(opacityinactive, , 0);
    if (opacityinactive < 0 || opacityinactive > 100)
        opacityinactive = 100;
    READ_SET_RULE(ignoregeometry, , false);
    READ_SET_RULE(desktop, , 0);
    READ_SET_RULE(screen, , 0);
    READ_SET_RULE(activity, , QString());
    type = readType(cfg, QStringLiteral("type"));
    typerule = type != NET::Unknown ? readForceRule(cfg, QStringLiteral("typerule")) : UnusedForceRule;
    READ_SET_RULE(maximizevert, , false);
    READ_SET_RULE(maximizehoriz, , false);
    READ_SET_RULE(minimize, , false);
    READ_SET_RULE(shade, , false);
    READ_SET_RULE(skiptaskbar, , false);
    READ_SET_RULE(skippager, , false);
    READ_SET_RULE(skipswitcher, , false);
    READ_SET_RULE(above, , false);
    READ_SET_RULE(below, , false);
    READ_SET_RULE(fullscreen, , false);
    READ_SET_RULE(noborder, , false);
    decocolor = readDecoColor(cfg);
    decocolorrule = decocolor.isEmpty() ? UnusedForceRule : readForceRule(cfg, QStringLiteral("decocolorrule"));
    READ_FORCE_RULE(blockcompositing, , false);
    READ_FORCE_RULE(fsplevel, limit0to4, 0); // fsp is 0-4
    READ_FORCE_RULE(fpplevel, limit0to4, 0); // fpp is 0-4
    READ_FORCE_RULE(acceptfocus, , false);
    READ_FORCE_RULE(closeable, , false);
    READ_FORCE_RULE(autogroup, , false);
    READ_FORCE_RULE(autogroupfg, , true);
    READ_FORCE_RULE(autogroupid, , QString());
    READ_FORCE_RULE(strictgeometry, , false);
    READ_SET_RULE(shortcut, , QString());
    READ_FORCE_RULE(disableglobalshortcuts, , false);
}
示例#7
0
NLPacket::NLPacket(Packet&& packet) :
    Packet(std::move(packet))
{
    readType();
    readVersion();
    readSourceID();
    
    adjustPayloadStartAndCapacity(NLPacket::localHeaderSize(_type), _payloadSize > 0);
}
示例#8
0
文件: loader.c 项目: McMbuvi/GF-core
static void readAbsFun(FILE *f, AbsFun fun) {
  fun->name   = readCId(f);
  fun->ty     = readType(f);
  fun->arrity = readInt(f);
  if (readTag(f) != 0)
    fun->equs   = readEquations(f);
  else
    fun->equs   = NULL;
}
示例#9
0
void Vfile::read_header(ifstream &v) {
	char buffer[2];
	short version;
	v.read(buffer, 2);
	if (v.fail()) cout << "ERROR: header read failed" << endl;
	if (buffer[0]!='V') { cout << "ERROR: expected V, got " << buffer[0] << endl; read_ok = false; }
	if (buffer[1]!='#') { cout << "ERROR: expected #, got " << buffer[1] << endl; read_ok = false; }
	readType(v, &version);
	cout << "Got version: " << version << endl;
}
示例#10
0
文件: Packet.cpp 项目: rabedik/hifi
Packet::Packet(std::unique_ptr<char[]> data, qint64 size, const HifiSockAddr& senderSockAddr) :
    _packetSize(size),
    _packet(std::move(data)),
    _senderSockAddr(senderSockAddr)
{
    _type = readType();
    _version = readVersion();
    _payloadCapacity = _packetSize - localHeaderSize(_type);
    _payloadSize = _payloadCapacity;
    _payloadStart = _packet.get() + (_packetSize - _payloadCapacity);
}
示例#11
0
// ===================================================
// Methods
// ===================================================
void
BCInterfaceData0D::readBC( const std::string& fileName, const std::string& dataSection, const std::string& name )
{
    // Call to the base class
    dataContainer_Type::readBC( fileName, dataSection, name );

    // Read 0D data
    GetPot dataFile( fileName );

    readFlag( dataFile, ( dataSection + name + "/flag" ).c_str() );
    readType( dataFile, ( dataSection + name + "/type0D" ).c_str() );
}
示例#12
0
NLPacket::NLPacket(std::unique_ptr<char[]> data, qint64 size, const HifiSockAddr& senderSockAddr) :
    Packet(std::move(data), size, senderSockAddr)
{    
    // sanity check before we decrease the payloadSize with the payloadCapacity
    Q_ASSERT(_payloadSize == _payloadCapacity);
    
    readType();
    readVersion();
    readSourceID();
    
    adjustPayloadStartAndCapacity(NLPacket::localHeaderSize(_type), _payloadSize > 0);
}
示例#13
0
void Client::receiveData(){
       if(type == -1)
           type = readType();
       switch(type){
       case Constants::STRING:
           receiveString();
           break;
       case Constants::IMAGE:
           receiveImage();
           break;
       };
}
Ref<Tip, Owner> HaxeMessageSyntax::parse(String message)
{
	Ref<Tip, Owner> tip;
	Ref<Token, Owner> rootToken = match(message);
	if (rootToken) {
		Ref<Token> token = rootToken->firstChild();
		if (token->rule() == typeTip_) {
			token = token->firstChild();
			if (token->rule() == value_) {
				String typeString = readValue(message, token);
				tip = new TypeTip(readType(typeString));
			}
		}
		else if (token->rule() == membersTip_) {
			Ref<Members, Owner> members = new Members(token->countChildren());
			int memberIndex = 0;
			token = token->firstChild();
			while (token) {
				String name, description;
				Ref<Type, Owner> type;
				Ref<Token> child = token->firstChild();
				while (child) {
					if (child->rule() == memberName_)
						name = message->copy(child->i0(), child->i1());
					else if (child->rule() == memberType_)
						type = readType(readValue(message, child));
					else if (child->rule() == memberDescription_)
						description = message->copy(child->i0(), child->i1());;
					child = child->nextSibling();
				}
				// debug("\"%%\",\"%%\",\"%%\"\n", name, type, description);
				members->set(memberIndex++, new Member(name, type, description));
				token = token->nextSibling();
			}
			tip = new MembersTip(members);
		}
	}
	
	return tip;
}
QString TableManagement::buildCreateTable(){
    QString tag = "CREATE TABLE IF NOT EXISTS " + nameTable() + " (";
    const QMetaObject *metaObject = object()->metaObject();
    for (int i = 1; i < metaObject->propertyCount(); ++i) {

        QString propertyName = QString::fromUtf8(metaObject->property(i).name());

        tag += propertyName + ' ' +
                readType(object()->property(propertyName.toLatin1().constData()));
        if(i != metaObject->propertyCount() - 1) tag += ", ";
        else tag += ')';
    }
    return tag;
}
示例#16
0
文件: serial.c 项目: Teider/QuIES
void getCommand(){
	
	packageCounter++;
	
	if(packageCounter == 4){
		readType();
	}
	
	if(packageCounter == packageSize){
		
		packageCounter = 0;
		packageSize = 4;
		
		getMotion(package);
	}
}
示例#17
0
void Vfile::read_sections(ifstream &v) {
	int len;
	char buffer_name[28];
	while(1) {
		readType(v, &len);
		if (len==0) {
			cout << "Reached end of sections" << endl;
			v.seekg(28, std::ios_base::cur); // skip rest of blank header
			return;
		} else {
			cout << "Section length: " << len << endl;
			v.read(buffer_name, 28);
			cout << "Section name: " << buffer_name << endl;
			if (strcmp(buffer_name, "DATAGROUP")==0) {
				read_datagroups(v, len);
			} else {
				v.seekg(len, std::ios_base::cur);
			}
		}
	}
	return;
}
示例#18
0
void CompilationEngine::compileVarDec()
{
    /* 'var' type varName (',' varName)* ';' */

    tagNonTerminal("varDec");
    readKeyword("var", Keyword::kVAR);
    nextToken();
    readType();
    nextToken();
    readIdentifier();
    nextToken();

    while (jt.tokenType() == TokenType::kSYMBOL && jt.symbol() == ',') {
        readSymbol(',');
        nextToken();
        readIdentifier();
        nextToken();
    }

    readSymbol(';');
    untagNonTerminal("varDec");
    nextToken();
}
示例#19
0
void BinReader::readModules()
{
    // modules

    int numModules = bytes->readInt();

    for (int i = 0; i < numModules; i++)
    {
        const char *type    = readPoolString();
        const char *name    = readPoolString();
        const char *version = readPoolString();

        Module *module = Module::create(assembly, name);

        int numTypes = bytes->readInt();

        for (int j = 0; j < numTypes; j++)
        {
            Type *type = readType();
            module->addType(type);
        }
    }
}
int receiveFile(int sock){
	fp = fopen(file_path,"w");
	if(fp == NULL)
	{
			perror("open");
			exit(EXIT_FAILURE);
	}
	int test =4;
	while(1){
		char buf[BUFFSIZE];
		test--;
		if(recvfrom(sock, &buf, BUFFSIZE, 0, (struct sockaddr*) &sin6_cli, &sin6len) == -1){
				perror("Connection Lost");
				exit(EXIT_FAILURE);
		}
		
		
		int type = readType(buf[0]);
		int seq = readSeqNumber(buf[1]);
		printf("Received test:%d seq:%d\n", test, seq);
		if(type == PTYPE_DATA && test !=0){
			window_start = (window_start+1)%MAXWINDOWSIZE;
			
			if(seq == seq_number && xor_count !=0){
				memcpy(&buffer[(XORFREQ-xor_count)*PAYLOADSIZE], &buf[4], PAYLOADSIZE);
				msg_rvcd++;
				xor_count--;
				
				seq_number = (seq_number+1)%256;
				window_end = (window_end+ 1)%MAXWINDOWSIZE;
				sendMsg(sock, PTYPE_ACK, seq_number, window_end);
				printf("Ack sent %d %d\n", seq_number, window_end);
				last_length =readLength(buf);
				if(last_length<512){
						xor_count=0;
				}
				
			}else{// else discard packet, send last ack again.
				sendMsg(sock, PTYPE_ACK, seq_number, window_end);
			}
			
		}else if(type == PTYPE_XOR){
			computeXor(buffer);
			int seq = readSeqNumber(buf[1]);
			if(seq == seq_number && xor_count == 0){
					if(checkXor(buf)){
							xor_count = XORFREQ;
							seq_number= (seq_number+1)%256;
							window_end = (window_end+ 1)%MAXWINDOWSIZE;
							
							sendMsg(sock, PTYPE_ACK, seq_number, window_end);
							
							if(last_length<512){return 0;}
							msg_rvcd=0;
							
					}else{
							// Make choice if XOR is wrong

							/* No ack sent, all window will be retransmitted*/
					}
			}
				
		}
		if(test ==0){
			test = 1000;	
		}
	}
	fclose(fp);
		
}
示例#21
0
void DetailExcelWidget::getSheetData(Worksheet* sheet)
{
    sheetName.push_back(sheet->sheetName());
    readHead(sheet);
    readType(sheet);
}
示例#22
0
int Datagroup::read(ifstream &v) {
	short Reclen;
	readType(v, &Reclen);
	if (Reclen==0) { 
		cout << "Found datagroups null terminator" << endl;
		return 2;
	}
	if (VDEBUG) cout << "Datagroup record length " << Reclen << endl;
	readType(v, &GroupID);
	char DL;
	readType(v, &DL);
	if (DL != 0) {
		char * buffer_desc = new char[DL];
		v.read(buffer_desc, DL);
		Desc = string(buffer_desc);
		delete [] buffer_desc;
	} else {
		cout << "Huh, no desc for datagroup record" << endl;
	}
	readType(v, &Type);
	char Width;
	readType(v, &Width);

	// because I don't trust the next generation of computers
	//	not to switch datatypes
	if (Type==1)
		assert(Width==1 && sizeof(char)==1);
	if (Type==2)
		assert(Width==1 && sizeof(char)==1);
	if (Type==3)
		assert(Width==2 && sizeof(short)==2);
	if (Type==4)
		assert(Width==4 && sizeof(int)==4);
	if (Type==5)
		assert(Width==sizeof(float));
	if (Type==6)
		assert(Width==sizeof(double));
	if (Type==7)
		assert(Width==1 && sizeof(char)==1);

	readType(v, &FR);
	cout << "Framerate is " << FR << endl;

	short NumDOFS;
	readType(v, &NumDOFS);
	cout << "Got " << int(NumDOFS) << " DOFs in datagroup" << endl;
	for (int i = 0; i < NumDOFS; ++i) {
		char len;
		readType(v, &len);
		if (VDEBUG) cout << "DOFlabel " << i << "'s length: " << int(len) << endl;
		char * buffer_DOFlabel = new char[len];
		v.read(buffer_DOFlabel, len);
		DOFlabels.push_back(string(buffer_DOFlabel));
		delete [] buffer_DOFlabel;
		if (VDEBUG) cout << "DOFlabel " << i << "'s contents: " << DOFlabels[i] << endl;
	}
	if (v.fail())
		cout << "ERROR: datagroup read, but fail bit is set" << endl;
	else
		cout << "Datagroup read successfully" << endl;

	return Reclen + 2;
}
示例#23
0
bool KDesktopFile::hasLinkType() const
{
  return readType() == QLatin1String("Link");
}
示例#24
0
bool KDesktopFile::hasApplicationType() const
{
  return readType() == QLatin1String("Application");
}
示例#25
0
bool KDesktopFile::hasDeviceType() const
{
  return readType() == QLatin1String("FSDevice");
}
void ChanneledJsonDecompressor::read(dynamic* outObj) {
  uint8_t curType = readType();

  // Map
  if (inRange(curType, TYPE_SHORT_MAP_BASE, SHORT_TYPE_LENGTH)) {
    readMap(curType - TYPE_SHORT_MAP_BASE, outObj);
    return;
  }
  if (curType == TYPE_LONG_MAP) {
    int64_t mapLength = readVarInt(CHANNEL_MAPLEN);
    readMap(mapLength, outObj);
    return;
  }

  // Array
  if (inRange(curType, TYPE_SHORT_ARRAY_BASE, SHORT_TYPE_LENGTH)) {
    readArray(curType - TYPE_SHORT_ARRAY_BASE, outObj);
    return;
  }
  if (curType == TYPE_LONG_ARRAY) {
    int64_t arrayLength = readVarInt(CHANNEL_ARRAYLEN);
    readArray(arrayLength, outObj);
    return;
  }

  // String - different types
  if (curType == TYPE_MEMOISED_STRING) {
    int memoisedIdx = readVarInt(CHANNEL_MEMOSTRS);
    *outObj = memoStrings_[memoisedIdx];
    return;
  }

  if (inRange(curType, TYPE_SHORT_STRING_BASE, SHORT_TYPE_LENGTH)) {
    uint32_t stringLength = curType - TYPE_SHORT_STRING_BASE;
    readString(stringLength, CHANNEL_STRS, outObj);
    memoStrings_[memoStringsNext_] = outObj->asString();
    ++memoStringsNext_;
    return;
  }

  if (curType == TYPE_STRING_SIZE) {
    uint32_t stringLength = readVarInt(CHANNEL_STRLEN);
    readString(stringLength, CHANNEL_STRS, outObj);
    memoStrings_[memoStringsNext_] = outObj->asString();
    ++memoStringsNext_;
    return;
  }

  // Boolean
  if (curType == TYPE_BOOL_TRUE) {
    *outObj = true;
    return;
  }

  if (curType == TYPE_BOOL_FALSE) {
    *outObj = false;
    return;
  }

  // Integer
  if (inRange(curType, TYPE_SMALL_INT_BASE, SHORT_TYPE_LENGTH)) {
    *outObj = curType - TYPE_SMALL_INT_BASE;
    return;
  }

  if (curType == TYPE_LONG_INT) {
    *outObj = readVarInt(CHANNEL_INTS);
    return;
  }

  // None
  if (curType == TYPE_NONE) {
    *outObj = nullptr;
    return;
  }

  // Double
  if (curType == TYPE_DOUBLE) {
    readDouble(outObj);
    return;
  }

  //TODO(noamler) - unknown type error handling. Log?
  *outObj = nullptr;

}
示例#27
0
文件: loader.c 项目: McMbuvi/GF-core
static void readHypo(FILE *f, Hypo h) {
  h->bt  = readTag(f);
  h->var = readCId(f);
  h->ty  = readType(f);
}
示例#28
0
文件: loader.c 项目: McMbuvi/GF-core
static Expr readExpr(FILE *f) {
  int tag = readTag(f);
  
  switch (tag) {
  case TAG_ABS:
    {
        ExprAbs e = (ExprAbs) malloc(sizeof(struct _ExprAbs));
        e->_.tag = tag;
        e->bt    = readTag(f);
        e->var   = readCId(f);
        e->body  = readExpr(f);
        return ((Expr) e);
    }
  case TAG_APP:
    {
        ExprApp e = (ExprApp) malloc(sizeof(struct _ExprApp));
        e->_.tag = tag;
        e->left  = readExpr(f);
        e->right = readExpr(f);
        return ((Expr) e);
    }
  case TAG_LIT:
    {
        ExprLit e = (ExprLit) malloc(sizeof(struct _ExprLit));
        e->_.tag = tag;
        e->lit   = readLiteral(f);
        return ((Expr) e);
    }
  case TAG_MET:
    {
        ExprMeta e = (ExprMeta) malloc(sizeof(struct _ExprMeta));
        e->_.tag = tag;
        e->id    = readInt(f);
        return ((Expr) e);
    }
  case TAG_FUN:
    {
        ExprFun e = (ExprFun) malloc(sizeof(struct _ExprFun));
        e->_.tag = tag;
        e->fun   = readCId(f);
        return ((Expr) e);
    }
  case TAG_VAR:
    {
        ExprVar e = (ExprVar) malloc(sizeof(struct _ExprVar));
        e->_.tag = tag;
        e->index = readInt(f);
        return ((Expr) e);
    }
  case TAG_TYP:
    {
        ExprTyped e = (ExprTyped) malloc(sizeof(struct _ExprTyped));
        e->_.tag = tag;
        e->e     = readExpr(f);
        e->ty    = readType(f);
        return ((Expr) e);
    }
  case TAG_IMP:
    {
        ExprImplArg e = (ExprImplArg) malloc(sizeof(struct _ExprImplArg));
        e->_.tag = tag;
        e->e     = readExpr(f);
        return ((Expr) e);
    }
  default:
    __pgf_panic("Unknown expression tag");
  }
}
示例#29
0
文件: ResourceID.cpp 项目: vcmi/vcmi
ResourceID::ResourceID(std::string name_):
	type{readType(name_)},
	name{readName(std::move(name_))}
{}
示例#30
0
            return TagValue::StringVector;
        case TagValue::TimeVector:
            return TagValue::TimeVector;
        default:
            error(Event::ParseError, "Invalid type for tag value: %d", x);
            return TagValue::Null;
        }
    }

    std::istream & operator>>(std::istream& in, TagValue &t) {
        switch (in.peek()) {
        case 'b':
            // binary blob
        {
            in.get();
            TagValue::Type type = readType(in.get());
            // skip the next two chars (they are for word-alignment and future proofing)
            if (in.get() != 0 || in.get() != 0) {
                goto error;
            }
            switch (type) {
            case TagValue::Null: {
                TagValue nullTag;
                t = nullTag;
                return in;
            }
            case TagValue::Int: {
                int x;
                in.read((char *)&x, sizeof(int));
                t = x;
                return in;