本文整理汇总了C++中Parse_String函数的典型用法代码示例。如果您正苦于以下问题:C++ Parse_String函数的具体用法?C++ Parse_String怎么用?C++ Parse_String使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Parse_String函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Parse_ProgramParamReg
/**
* Parse a program local parameter register "p[##]"
*/
static GLboolean
Parse_ProgramParamReg(struct parse_state *parseState, GLint *regNum)
{
GLubyte token[100];
if (!Parse_String(parseState, "p["))
RETURN_ERROR1("Expected p[");
if (!Parse_Token(parseState, token))
RETURN_ERROR;
if (IsDigit(token[0])) {
/* a numbered program parameter register */
GLint reg = _mesa_atoi((const char *) token);
if (reg >= MAX_NV_FRAGMENT_PROGRAM_PARAMS)
RETURN_ERROR1("Invalid constant program number");
*regNum = reg;
}
else {
RETURN_ERROR;
}
if (!Parse_String(parseState, "]"))
RETURN_ERROR1("Expected ]");
return GL_TRUE;
}
开发者ID:MttDs,项目名称:new-rexeno-tindpe,代码行数:30,代码来源:nvfragparse.c
示例2: Parse_FragReg
/**
* Parse f[name] - fragment input register
*/
static GLboolean
Parse_FragReg(struct parse_state *parseState, GLint *tempRegNum)
{
GLubyte token[100];
GLint j;
/* Match 'f[' */
if (!Parse_String(parseState, "f["))
RETURN_ERROR1("Expected f[");
/* get <name> and look for match */
if (!Parse_Token(parseState, token)) {
RETURN_ERROR;
}
for (j = 0; InputRegisters[j]; j++) {
if (_mesa_strcmp((const char *) token, InputRegisters[j]) == 0) {
*tempRegNum = j;
parseState->inputsRead |= (1 << j);
break;
}
}
if (!InputRegisters[j]) {
/* unknown input register label */
RETURN_ERROR2("Invalid register name", token);
}
/* Match '[' */
if (!Parse_String(parseState, "]"))
RETURN_ERROR1("Expected ]");
return GL_TRUE;
}
开发者ID:MttDs,项目名称:new-rexeno-tindpe,代码行数:35,代码来源:nvfragparse.c
示例3: Parse_ScalarInstruction
static GLboolean
Parse_ScalarInstruction(struct parse_state *parseState,
struct prog_instruction *inst,
enum prog_opcode opcode)
{
if (opcode == OPCODE_RCC && !parseState->isVersion1_1)
RETURN_ERROR1("RCC illegal for vertex program 1.0");
inst->Opcode = opcode;
inst->StringPos = parseState->curLine - parseState->start;
/* dest reg */
if (!Parse_MaskedDstReg(parseState, &inst->DstReg))
RETURN_ERROR;
/* comma */
if (!Parse_String(parseState, ","))
RETURN_ERROR;
/* first src arg */
if (!Parse_ScalarSrcReg(parseState, &inst->SrcReg[0]))
RETURN_ERROR;
/* semicolon */
if (!Parse_String(parseState, ";"))
RETURN_ERROR;
return GL_TRUE;
}
开发者ID:Magister,项目名称:x11rdp_xorg71,代码行数:29,代码来源:nvvertparse.c
示例4: Parse_AddressInstruction
static GLboolean
Parse_AddressInstruction(struct parse_state *parseState, struct prog_instruction *inst)
{
inst->Opcode = OPCODE_ARL;
inst->StringPos = parseState->curLine - parseState->start;
/* Make ARB_vp backends happy */
inst->DstReg.File = PROGRAM_ADDRESS;
inst->DstReg.WriteMask = WRITEMASK_X;
inst->DstReg.Index = 0;
/* dest A0 reg */
if (!Parse_AddrReg(parseState))
RETURN_ERROR;
/* comma */
if (!Parse_String(parseState, ","))
RETURN_ERROR;
/* parse src reg */
if (!Parse_ScalarSrcReg(parseState, &inst->SrcReg[0]))
RETURN_ERROR;
/* semicolon */
if (!Parse_String(parseState, ";"))
RETURN_ERROR;
return GL_TRUE;
}
开发者ID:Magister,项目名称:x11rdp_xorg71,代码行数:29,代码来源:nvvertparse.c
示例5: Parse_Paren_Begin
UCS2 *Parser::Parse_Concat(bool pathname)
{
UCS2 *str;
UCS2 *New;
Parse_Paren_Begin();
New = Parse_String();
EXPECT
CASE(RIGHT_PAREN_TOKEN)
UNGET
EXIT
END_CASE
OTHERWISE
UNGET
Parse_Comma();
str = Parse_String(pathname);
New = UCS2_strcat(New, str);
POV_FREE(str);
END_CASE
END_EXPECT
Parse_Paren_End();
return New;
}
开发者ID:wfpokorny,项目名称:povray,代码行数:28,代码来源:parser_strings.cpp
示例6: Parse_AbsParamReg
/**
* Parse absolute program parameter register "c[##]"
*/
static GLboolean
Parse_AbsParamReg(struct parse_state *parseState, GLint *regNum)
{
GLubyte token[100];
if (!Parse_String(parseState, "c"))
RETURN_ERROR;
if (!Parse_String(parseState, "["))
RETURN_ERROR;
if (!Parse_Token(parseState, token))
RETURN_ERROR;
if (IsDigit(token[0])) {
/* a numbered program parameter register */
GLint reg = _mesa_atoi((char *) token);
if (reg >= MAX_NV_VERTEX_PROGRAM_PARAMS)
RETURN_ERROR1("Bad program parameter number");
*regNum = reg;
}
else {
RETURN_ERROR;
}
if (!Parse_String(parseState, "]"))
RETURN_ERROR;
return GL_TRUE;
}
开发者ID:Magister,项目名称:x11rdp_xorg71,代码行数:33,代码来源:nvvertparse.c
示例7: Parse_UnaryOpInstruction
static GLint
Parse_UnaryOpInstruction(struct parse_state *parseState,
struct vp_instruction *inst, enum vp_opcode opcode)
{
if (opcode == VP_OPCODE_ABS && !parseState->isVersion1_1)
RETURN_ERROR1("ABS illegal for vertex program 1.0");
inst->Opcode = opcode;
inst->StringPos = parseState->curLine - parseState->start;
/* dest reg */
if (!Parse_MaskedDstReg(parseState, &inst->DstReg))
RETURN_ERROR;
/* comma */
if (!Parse_String(parseState, ","))
RETURN_ERROR;
/* src arg */
if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[0]))
RETURN_ERROR;
/* semicolon */
if (!Parse_String(parseState, ";"))
RETURN_ERROR;
return GL_TRUE;
}
开发者ID:basecq,项目名称:q2dos,代码行数:28,代码来源:nvvertparse.c
示例8: Parse_OutputReg
static GLboolean
Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum)
{
GLubyte token[100];
/* Match "o[" */
if (!Parse_String(parseState, "o["))
RETURN_ERROR1("Expected o[");
/* Get output reg name */
if (!Parse_Token(parseState, token))
RETURN_ERROR;
/* try to match an output register name */
if (_mesa_strcmp((char *) token, "COLR") == 0 ||
_mesa_strcmp((char *) token, "COLH") == 0) {
/* note that we don't distinguish between COLR and COLH */
*outputRegNum = FRAG_RESULT_COLOR;
parseState->outputsWritten |= (1 << FRAG_RESULT_COLOR);
}
else if (_mesa_strcmp((char *) token, "DEPR") == 0) {
*outputRegNum = FRAG_RESULT_DEPTH;
parseState->outputsWritten |= (1 << FRAG_RESULT_DEPTH);
}
else {
RETURN_ERROR1("Invalid output register name");
}
/* Match ']' */
if (!Parse_String(parseState, "]"))
RETURN_ERROR1("Expected ]");
return GL_TRUE;
}
开发者ID:MttDs,项目名称:new-rexeno-tindpe,代码行数:34,代码来源:nvfragparse.c
示例9: Parse_BiOpInstruction
static GLboolean
Parse_BiOpInstruction(struct parse_state *parseState,
struct prog_instruction *inst,
enum prog_opcode opcode)
{
if (opcode == OPCODE_DPH && !parseState->isVersion1_1)
RETURN_ERROR1("DPH illegal for vertex program 1.0");
if (opcode == OPCODE_SUB && !parseState->isVersion1_1)
RETURN_ERROR1("SUB illegal for vertex program 1.0");
inst->Opcode = opcode;
inst->StringPos = parseState->curLine - parseState->start;
/* dest reg */
if (!Parse_MaskedDstReg(parseState, &inst->DstReg))
RETURN_ERROR;
/* comma */
if (!Parse_String(parseState, ","))
RETURN_ERROR;
/* first src arg */
if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[0]))
RETURN_ERROR;
/* comma */
if (!Parse_String(parseState, ","))
RETURN_ERROR;
/* second src arg */
if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[1]))
RETURN_ERROR;
/* semicolon */
if (!Parse_String(parseState, ";"))
RETURN_ERROR;
/* make sure we don't reference more than one program parameter register */
if (inst->SrcReg[0].File == PROGRAM_ENV_PARAM &&
inst->SrcReg[1].File == PROGRAM_ENV_PARAM &&
inst->SrcReg[0].Index != inst->SrcReg[1].Index)
RETURN_ERROR1("Can't reference two program parameter registers");
/* make sure we don't reference more than one vertex attribute register */
if (inst->SrcReg[0].File == PROGRAM_INPUT &&
inst->SrcReg[1].File == PROGRAM_INPUT &&
inst->SrcReg[0].Index != inst->SrcReg[1].Index)
RETURN_ERROR1("Can't reference two vertex attribute registers");
return GL_TRUE;
}
开发者ID:Multi2Sim,项目名称:m2s-bench-parsec-3.0-src,代码行数:51,代码来源:nvvertparse.c
示例10: Parse_PrintInstruction
static GLboolean
Parse_PrintInstruction(struct parse_state *parseState,
struct prog_instruction *inst)
{
const GLubyte *str;
GLubyte *msg;
GLuint len;
GLint idx;
/* The first argument is a literal string 'just like this' */
if (!Parse_String(parseState, "'"))
RETURN_ERROR1("Expected '");
str = parseState->pos;
for (len = 0; str[len] != '\''; len++) /* find closing quote */
;
parseState->pos += len + 1;
msg = (GLubyte*) malloc(len + 1);
memcpy(msg, str, len);
msg[len] = 0;
inst->Data = msg;
if (Parse_String(parseState, ",")) {
/* got an optional register to print */
GLubyte token[100];
GetToken(parseState, token);
if (token[0] == 'o') {
/* dst reg */
if (!Parse_OutputReg(parseState, &idx))
RETURN_ERROR;
inst->SrcReg[0].Index = idx;
inst->SrcReg[0].File = PROGRAM_OUTPUT;
}
else {
/* src reg */
if (!Parse_VectorSrc(parseState, &inst->SrcReg[0]))
RETURN_ERROR;
}
}
else {
inst->SrcReg[0].File = PROGRAM_UNDEFINED;
}
inst->SrcReg[0].Swizzle = SWIZZLE_NOOP;
inst->SrcReg[0].Abs = GL_FALSE;
inst->SrcReg[0].Negate = NEGATE_NONE;
return GL_TRUE;
}
开发者ID:GunioRobot,项目名称:mesa-7.10.2-PS3,代码行数:50,代码来源:nvfragparse.c
示例11: Parse_DummyReg
/**
* Parse a write-only dummy register: RC or HC.
*/
static GLboolean
Parse_DummyReg(struct parse_state *parseState, GLint *regNum)
{
if (Parse_String(parseState, "RC")) {
*regNum = 0;
}
else if (Parse_String(parseState, "HC")) {
*regNum = 1;
}
else {
RETURN_ERROR1("Invalid write-only register name");
}
return GL_TRUE;
}
开发者ID:GunioRobot,项目名称:mesa-7.10.2-PS3,代码行数:18,代码来源:nvfragparse.c
示例12: GET
UCS2 *Parser::Parse_Substr(bool pathname)
{
UCS2 *str;
UCS2 *New;
int l, d;
GET(LEFT_PAREN_TOKEN);
str = Parse_String(pathname);
Parse_Comma();
l = (int)Parse_Float();
Parse_Comma();
d = (int)Parse_Float();
GET(RIGHT_PAREN_TOKEN);
if(((l + d - 1) > UCS2_strlen(str)) || (l < 0) || (d < 0))
Error("Illegal parameters in substr.");
New = reinterpret_cast<UCS2 *>(POV_MALLOC(sizeof(UCS2) * (d + 1), "temporary string"));
UCS2_strncpy(New, &(str[l - 1]), d);
New[d] = 0;
POV_FREE(str);
return New;
}
开发者ID:Nyoho,项目名称:povray,代码行数:27,代码来源:parsestr.cpp
示例13: Parse_String
std::string Parser::Parse_SysString(bool pathname, bool require)
{
UCS2 *cstr = Parse_String(pathname, require);
std::string ret(UCS2toSysString(cstr));
POV_FREE(cstr);
return ret;
}
开发者ID:wfpokorny,项目名称:povray,代码行数:7,代码来源:parser_strings.cpp
示例14: Parse_AddrReg
/**
* Parse address register "A0.x"
*/
static GLboolean
Parse_AddrReg(struct parse_state *parseState)
{
/* match 'A0' */
if (!Parse_String(parseState, "A0"))
RETURN_ERROR;
/* match '.' */
if (!Parse_String(parseState, "."))
RETURN_ERROR;
/* match 'x' */
if (!Parse_String(parseState, "x"))
RETURN_ERROR;
return GL_TRUE;
}
开发者ID:BackupTheBerlios,项目名称:dri-ex-svn,代码行数:20,代码来源:nvvertparse.c
示例15: Parse_OptionSequence
static GLboolean
Parse_OptionSequence(struct parse_state *parseState,
struct vp_instruction program[])
{
while (1) {
if (!Parse_String(parseState, "OPTION"))
return GL_TRUE; /* ok, not an OPTION statement */
if (Parse_String(parseState, "NV_position_invariant")) {
parseState->isPositionInvariant = GL_TRUE;
}
else {
RETURN_ERROR1("unexpected OPTION statement");
}
if (!Parse_String(parseState, ";"))
return GL_FALSE;
}
}
开发者ID:basecq,项目名称:q2dos,代码行数:17,代码来源:nvvertparse.c
示例16: Parse_AttribReg
/**
* Parse v[#] or v[<name>]
*/
static GLboolean
Parse_AttribReg(struct parse_state *parseState, GLint *tempRegNum)
{
GLubyte token[100];
GLint j;
/* Match 'v' */
if (!Parse_String(parseState, "v"))
RETURN_ERROR;
/* Match '[' */
if (!Parse_String(parseState, "["))
RETURN_ERROR;
/* match number or named register */
if (!Parse_Token(parseState, token))
RETURN_ERROR;
if (parseState->isStateProgram && token[0] != '0')
RETURN_ERROR1("Only v[0] accessible in vertex state programs");
if (IsDigit(token[0])) {
GLint reg = _mesa_atoi((char *) token);
if (reg >= MAX_NV_VERTEX_PROGRAM_INPUTS)
RETURN_ERROR1("Bad vertex attribute register name");
*tempRegNum = reg;
}
else {
for (j = 0; InputRegisters[j]; j++) {
if (_mesa_strcmp((const char *) token, InputRegisters[j]) == 0) {
*tempRegNum = j;
break;
}
}
if (!InputRegisters[j]) {
/* unknown input register label */
RETURN_ERROR2("Bad register name", token);
}
}
/* Match '[' */
if (!Parse_String(parseState, "]"))
RETURN_ERROR;
return GL_TRUE;
}
开发者ID:BackupTheBerlios,项目名称:dri-ex-svn,代码行数:49,代码来源:nvvertparse.c
示例17: Record
char * Db_Record::Get_Field_Number (int number, char field [], int field_size)
{
char *ptr = Record ();
if (ptr == NULL) {
Status (RECORD_SIZE);
return (NULL);
}
for (int i=0; i < number && ptr != NULL; i++) {
ptr = Parse_String (ptr, field, field_size);
}
return (field);
}
开发者ID:kravitz,项目名称:transims4,代码行数:13,代码来源:Db_Record.cpp
示例18: Parse_OutputReg
static GLboolean
Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum)
{
GLubyte token[100];
GLint start, j;
/* Match 'o' */
if (!Parse_String(parseState, "o"))
RETURN_ERROR;
/* Match '[' */
if (!Parse_String(parseState, "["))
RETURN_ERROR;
/* Get output reg name */
if (!Parse_Token(parseState, token))
RETURN_ERROR;
if (parseState->isPositionInvariant)
start = 1; /* skip HPOS register name */
else
start = 0;
/* try to match an output register name */
for (j = start; OutputRegisters[j]; j++) {
if (_mesa_strcmp((const char *) token, OutputRegisters[j]) == 0) {
*outputRegNum = j;
break;
}
}
if (!OutputRegisters[j])
RETURN_ERROR1("Unrecognized output register name");
/* Match ']' */
if (!Parse_String(parseState, "]"))
RETURN_ERROR1("Expected ]");
return GL_TRUE;
}
开发者ID:BackupTheBerlios,项目名称:dri-ex-svn,代码行数:39,代码来源:nvvertparse.c
示例19: Parse_VectorOrScalarConstant
/**
* Parse <number>, <varname> or {a, b, c, d}.
* Return number of values in the vector or scalar, or zero if parse error.
*/
static GLuint
Parse_VectorOrScalarConstant(struct parse_state *parseState, GLfloat *vec)
{
if (Parse_String(parseState, "{")) {
return Parse_VectorConstant(parseState, vec);
}
else {
GLboolean b = Parse_ScalarConstant(parseState, vec);
if (b) {
vec[1] = vec[2] = vec[3] = vec[0];
}
return b;
}
}
开发者ID:GunioRobot,项目名称:mesa-7.10.2-PS3,代码行数:18,代码来源:nvfragparse.c
示例20: Parse_AddressInstruction
static GLboolean
Parse_AddressInstruction(struct parse_state *parseState, struct vp_instruction *inst)
{
inst->Opcode = VP_OPCODE_ARL;
inst->StringPos = parseState->curLine - parseState->start;
/* dest A0 reg */
if (!Parse_AddrReg(parseState))
RETURN_ERROR;
/* comma */
if (!Parse_String(parseState, ","))
RETURN_ERROR;
/* parse src reg */
if (!Parse_ScalarSrcReg(parseState, &inst->SrcReg[0]))
RETURN_ERROR;
/* semicolon */
if (!Parse_String(parseState, ";"))
RETURN_ERROR;
return GL_TRUE;
}
开发者ID:BackupTheBerlios,项目名称:dri-ex-svn,代码行数:24,代码来源:nvvertparse.c
注:本文中的Parse_String函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论