/********************************* * * * main * * * *********************************/ int main(int argc, char **argv) { /* yydebug = 1; */ progname = argv[0]; if (argc > 2) { fprintf(stderr, usage, progname); exit(1); } SystemConstruct(); if (argc > 1) { yyin = fopen(argv[1], "r"); if (yyin == NULL) { printMsg(ERROR_MSG, "%s: can not open %s\n", progname, argv[1]); yyin = stdin; } } ParseStream(); SystemDestruct(); printf ("\n"); /* [H-O] [FIX] SHOULD BE VIA I/O MODULE */ return(0); }
void MessagePackReader::ParseStream(Handler& handler) { log_time(INFO); // setup for stream parsing handler_ = &handler; parseError_.Clear(); ResetToken(); handler.StartDocument(); // Actually parse the stream. This function may be called recursively. try { ParseStream(); } catch (AnyRpcException &fault) { log_error("catch exception, stream offset=" << is_.Tell()); fault.SetOffset( is_.Tell() ); SetParseError(fault); } handler.EndDocument(); }
OP_STATUS OpScopeTPReader::ParseNextMessage() { if (!enabled) return OpStatus::OK; return ParseStream(); }
OP_STATUS OpScopeTPReader::OnDataReady() { if (!enabled) return OpStatus::OK; do { RETURN_IF_ERROR(ParseStream()); } while (continous && enabled); return OpStatus::OK; }
/** Parses the configuration file. If the file does not exist this is ignored. */ void ConfigurationFileParser::Parse() { SCXCoreLib::SCXLogHandle log = SCXLogHandleFactory::GetLogHandle(L"scx.core.providers.runasprovider.configparser"); try { ParseStream(*SCXFile::OpenWFstream(m_file, std::ios_base::in)); } catch (SCXException& e) { SCX_LOGWARNING(log, StrAppend(L"Failed to read file: ", m_file.Get())); SCX_LOGWARNING(log, StrAppend(L"Reason for failure: ", e.What())); } }
void MessagePackReader::ParseArray(size_t length) { log_debug("MessagePackReader::ParseArray, length=" << length); ResetToken(); handler_->StartArray(length); for (size_t i=0; i<length; i++) { ParseStream(); if (i != (length-1)) handler_->ArraySeparator(); } handler_->EndArray(length); }
void MessagePackReader::ParseMap(size_t length) { log_debug("MessagePackReader::ParseMap, length=" << length); ResetToken(); handler_->StartMap(length); for (size_t i=0; i<length; i++) { ParseKey(); ParseStream(); if (i != (length-1)) handler_->MapSeparator(); } handler_->EndMap(length); }
OP_STATUS OpScopeTPReader::OnDataReady(const char *data, size_t len, BOOL parse_message) { OP_ASSERT(data != NULL); OP_ASSERT(len > 0); RETURN_IF_ERROR(incoming->AppendBytes(data, len)); if (enabled && parse_message) { do { RETURN_IF_ERROR(ParseStream()); } while (continous && enabled); } return OpStatus::OK; }
void COsakiParser::OnData(EUI64 * pId, ONDEMANDPARAM *pOndemand, BYTE nSeq, BYTE *pszData, BYTE nLength) { DATASTREAM *pStream; if(pOndemand) { pOndemand->stat.nCount ++; pOndemand->stat.nRecvCount ++; pOndemand->stat.nRecv += nLength + sizeof(CODI_HEADER) + sizeof(EUI64) + sizeof(CODI_TAIL); pStream = pOndemand->pDataStream; if(pStream && !ParseStream(pStream, pszData, nLength, pOndemand)) { /** 아직 Frame이 완료되지 않았을 때 */ XDEBUG(" PENDDING FRAME CURR=%d\r\n", pStream->nLength); } } }
/*********************** * * * Readfile * * * ***********************/ void Readfile(char *file) { char openFile[MAX_STRING_LENGTH_DEFAULT]; readingFile = BTRUE; if (FileChange(openFile, file)) { printMsg(MSG, "\n[ Opening %s ]", openFile); ParseStream(); FileRestore(); printMsg(MSG, "[ Closing %s ]", openFile); } /* fi */ else { readingFile = BFALSE; strcpy(openFile, file); printMsg(ERROR_MSG, "Could not open %s.", file); } /* esle */ }
void Parse() { std::wistringstream stream(m_Configuration); ParseStream(stream); };
void CL_ParseTEnt(void) { int type; vec3_t pos; #ifdef QUAKE2 vec3_t endpos; #endif dlight_t *dl; int rnd; int colorStart, colorLength; type = MSG_ReadByte(); switch(type) { case TE_WIZSPIKE: // spike hitting wall pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); R_RunParticleEffect (pos, vec3_origin, 20, 30); // S_StartSound (-1, 0, cl_sfx_wizhit, pos, 1, 1); break; case TE_KNIGHTSPIKE: // spike hitting wall pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); R_RunParticleEffect (pos, vec3_origin, 226, 20); // S_StartSound (-1, 0, cl_sfx_knighthit, pos, 1, 1); break; case TE_SPIKE: // spike hitting wall pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); #ifdef GLTEST Test_Spawn (pos); #else R_RunParticleEffect (pos, vec3_origin, 0, 10); #endif if ( rand() % 5 ) S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1); else { rnd = rand() & 3; if (rnd == 1) S_StartSound (-1, 0, cl_sfx_ric1, pos, 1, 1); else if (rnd == 2) S_StartSound (-1, 0, cl_sfx_ric2, pos, 1, 1); else S_StartSound (-1, 0, cl_sfx_ric3, pos, 1, 1); } break; case TE_SUPERSPIKE: // super spike hitting wall pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); R_RunParticleEffect (pos, vec3_origin, 0, 20); if ( rand() % 5 ) S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1); else { rnd = rand() & 3; if (rnd == 1) S_StartSound (-1, 0, cl_sfx_ric1, pos, 1, 1); else if (rnd == 2) S_StartSound (-1, 0, cl_sfx_ric2, pos, 1, 1); else S_StartSound (-1, 0, cl_sfx_ric3, pos, 1, 1); } break; case TE_GUNSHOT: // bullet hitting wall pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); R_RunParticleEffect (pos, vec3_origin, 0, 20); break; case TE_EXPLOSION: // rocket explosion pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); R_ParticleExplosion (pos); break; dl = CL_AllocDlight (0); VectorCopy (pos, dl->origin); dl->radius = 350; dl->die = cl.time + 0.5; dl->decay = 300; S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1); break; /* //jfm:not used case TE_TAREXPLOSION: // tarbaby explosion pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); R_BlobExplosion (pos); S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1); break; */ case TE_LIGHTNING1: case TE_LIGHTNING2: case TE_LIGHTNING3: MSG_ReadShort(); MSG_ReadCoord(); MSG_ReadCoord(); MSG_ReadCoord(); MSG_ReadCoord(); MSG_ReadCoord(); MSG_ReadCoord(); break; case TE_STREAM_CHAIN: case TE_STREAM_SUNSTAFF1: case TE_STREAM_SUNSTAFF2: case TE_STREAM_LIGHTNING: case TE_STREAM_LIGHTNING_SMALL: case TE_STREAM_COLORBEAM: case TE_STREAM_ICECHUNKS: case TE_STREAM_GAZE: case TE_STREAM_FAMINE: ParseStream(type); break; case TE_LAVASPLASH: pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); R_LavaSplash (pos); break; case TE_TELEPORT: pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); R_TeleportSplash (pos); break; /* //jfm:not used case TE_EXPLOSION2: // color mapped explosion pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); colorStart = MSG_ReadByte (); colorLength = MSG_ReadByte (); R_ParticleExplosion2 (pos, colorStart, colorLength); dl = CL_AllocDlight (0); VectorCopy (pos, dl->origin); dl->radius = 350; dl->die = cl.time + 0.5; dl->decay = 300; S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1); break; */ default: Sys_Error ("CL_ParseTEnt: bad type"); } }