Ejemplo n.º 1
0
bool
DictConv::parseLine(char* buf,
                    char* word_buf,
                    std::string& syls)
{
    /* ignore the empty lines and comment lines */
    if (*buf == '\n' || *buf == '#')
        return false;

    char* p = (char*)skipSpace(buf);
    char* t = (char*)skipNonSpace(p);
    while (p < t) *word_buf++ = *p++;
    *word_buf = 0;

    p = (char*)skipSpace(p);
    t = (char*)skipNonSpace(p);
    if (*t)
        *t++ = 0;
    p = (char*)skipSpace(t);
    t = (char*)skipNonSpace(p);
    if (*t)
        *t++ = 0;
    syls.assign(p);
    return true;
}
Ejemplo n.º 2
0
static void processIC_H( char *fname )
{
    char *p;
    char *ok;
    char *ic_start;
    unsigned ic_idx;

    file = fname;
    line = 0;
    ic_idx = NO_IDX;
    for(;;) {
        ok = fgets( buff, sizeof(buff), ic_h );
        if( ok == NULL ) break;
        ++line;
        p = skipSpace( buff );
        if( memcmp( p, "//", 2 ) == 0 ) {
            continue;
        }
        ic_start = strstr( p, "IC(" );
        if( ic_start != NULL ) {
            p = skipNonSpace( ic_start );
            p = skipSpace( p );
            ic_idx = whatICAmI( p );
            continue;
        }
        if( ic_idx != NO_IDX ) {
            if( buff[0] == '#' ) {
                addName( icPreProcTable, ic_idx, buff );
            }
        }
    }
}
Ejemplo n.º 3
0
int main (int argc, char *argv[]) {
  if (argc != 2) {
    std::cout << "Usage: ./numerics inputFileName" << std::endl;
    return EXIT_SUCCESS;
  }
  
  std::string line;
  Functions * functions = new Functions();
  std::fstream f(argv[1]);
  while (std::getline(f, line)) {
    std::size_t pos = 0;
    if ((pos = line.find("define")) != std::string::npos) {
      parse(line, functions);
    }
    else if (((pos = line.find("evaluate")) != std::string::npos)) {
      //compute the value of a function
      double res = evaluate(line, functions);
      printEval(line, res);
    }
    else if (((pos = line.find("numint")) != std::string::npos)) {
      pos += 6;
      skipSpace(line, pos);
      std::string s = line.substr(pos);
      double res = integeral(s, functions);
      printInte(line, res);
    }
    else if (((pos = line.find("mcint")) != std::string::npos)) {
      pos += 5;
      skipSpace(line, pos);
      std::string s = line.substr(pos);
      double res = mcint(s, functions);
      printMcint(line, res);
    }
    else if (((pos = line.find("max")) != std::string::npos)) {
      pos += 3;
      skipSpace(line, pos);
      std::string s = line.substr(pos);
      double res = gradAsc(s, functions, 0);
      printGrad(line, res, 0);
    }
    else if (((pos = line.find("min")) != std::string::npos)) {
      //std::cout << "This is a Gradient Descent" << std::endl;
      pos += 3;
      skipSpace(line, pos);
      std::string s = line.substr(pos);
      double res = gradAsc(s, functions, 1);
      printGrad(line, res, 1);
    }
    else if (((pos = line.find("exit")) != std::string::npos)) {
      delete functions;
      f.close();
      return EXIT_SUCCESS;
    }
  }
  delete functions;
  f.close();
  return EXIT_SUCCESS;
}
Ejemplo n.º 4
0
static void findFalconTags (void)
{
    vString *name = vStringNew ();
    const unsigned char *line;

    while ((line = fileReadLine ()) != NULL)
    {
        const unsigned char *cp = line;

        if (*cp == '#')
            continue;

        if (strncmp ((const char*) cp, "function", (size_t) 8) == 0)
        {
            cp += 8;
            cp = skipSpace (cp);
            
            while (isIdentifierChar ((int) *cp))
            {
                vStringPut (name, (int) *cp);
                ++cp;
            }
            vStringTerminate (name);
            makeSimpleTag (name, FalconKinds, K_FUNCTION);
            vStringClear (name);
        }
        else if (strncmp ((const char*) cp, "class", (size_t) 5) == 0)
        {
            cp += 5;
            cp = skipSpace (cp);
            
            while (isIdentifierChar ((int) *cp))
            {
                vStringPut (name, (int) *cp);
                ++cp;
            }
            vStringTerminate (name);
            makeSimpleTag (name, FalconKinds, K_CLASS);
            vStringClear (name);
        }
        else if (strncmp ((const char*) cp, "load", (size_t) 4) == 0)
        {
            cp += 4;
            cp = skipSpace (cp);
            
            while (isIdentifierChar ((int) *cp))
            {
                vStringPut (name, (int) *cp);
                ++cp;
            }
            vStringTerminate (name);
            makeSimpleTag (name, FalconKinds, K_NAMESPACE);
            vStringClear (name);
        }
    }
    vStringDelete (name);
}
Ejemplo n.º 5
0
static void scanSource( char *fname )
{
    char *mask_id;
    char *ok;
    char *t;
    char *p;
    char *s;
    char c;
    int begin_found;
    unsigned ic_idx;

    file = fname;
    line = 0;
    begin_found = 0;
    mask_id = NULL;
    for(;;) {
        ok = fgets( buff, sizeof(buff), src_c );
        if( ok == NULL ) break;
        ++line;
        if( begin_found ) {
            t = strstr( buff, "// ICMASK END" );
            if( t != NULL ) {
                begin_found = 0;
                continue;
            }
            p = skipSpace( buff );
            if( memcmp( p, "case", 4 ) == 0 ) {
                p = skipNonSpace( p );
                p = skipSpace( p );
                if( memcmp( p, "IC_", 3 ) == 0 ) {
                    ic_idx = whatICAmI( p );
                    addName( icMaskTable, ic_idx, mask_id );
                }
            }
        } else {
            t = strstr( buff, "// ICMASK BEGIN" );
            if( t != NULL ) {
                p = skipNonSpace( t );
                p = skipSpace( p );
                p = skipNonSpace( p );
                p = skipSpace( p );
                p = skipNonSpace( p );
                p = skipSpace( p );
                s = p;
                p = skipMacroName( p );
                c = *p;
                *p = '\0';
                mask_id = strdup( s );
                *p = c;
                begin_found = 1;
            }
        }
    }
    if( begin_found ) {
        fail( "// ICMASK BEGIN found without matching // ICMASK END\n" );
    }
}
Ejemplo n.º 6
0
int getWall(char **line) {
	char arg[3];
	char *start, *end;

	start = skipSpace(*line);
	end = findFirstSpace(start);
	copyString(arg, start, end);
	*line = skipSpace(end);

	return (atoi(arg));
}
Ejemplo n.º 7
0
TTemplatizerToken	getToken(CTemplatizerParser& t, bool skipspc, std::string* value = NULL)
{
	if (skipspc)
		t = skipSpace(t);

	if (!t.isValid())
		return Unknown;

	uint		i;
	CTemplatizerParser	result;
	for (i=0; i<sizeof(SimpleTokens)/sizeof(SimpleTokens[0]); ++i)
	{
		result = match(SimpleTokens[i].Text, t);
		if (result.isValid())
		{
			t = result;
			return SimpleTokens[i].Token;
		}
	}

	if (isalpha(*t))
	{
		TTemplatizerToken	retToken = Identifier;
		
		if (value != NULL)
			*value = "";
		do
		{
			while (isalpha(*t))
			{
				if (value != NULL)
					*value += *t;
				++t;
			}

			t = skipSpace(t);

			if (*t != EnvSeparator)
				break;

			retToken = ListIdentifier;

			if (value != NULL)
				*value += *t;
			++t;
		}
		while (true);

		return retToken;
	}

	return Unknown;
}
Ejemplo n.º 8
0
    bool convert(const String &input, LONGLONG &outResult, size_t size, bool ignoreWhiteSpace, size_t base)
    {
      ZS_THROW_INVALID_USAGE_IF((0 == size) || (size > sizeof(QWORD)))

      CSTR str = input;
      if (NULL == str)
        return false;

      if (ignoreWhiteSpace)
        skipSpace(str);

      bool hadSign = false;
      bool positive = isPositive(str, hadSign);
      base = shouldForceBase(str, base, hadSign);

      LONGLONG result = 0;

      BYTE digit = 0;
      if (positive) {
        while ((digit = gDigitToValue[*str]) < base) {
          LONGLONG lastResult = result;

          result *= base;
          result += static_cast<LONGLONG>(digit);
          if (result < lastResult)
            return false; // value had to flip
          ++str;
        }
        if (result > gMaxLongLongs[size-1])
          return false;
      } else {
        while ((digit = gDigitToValue[*str]) < base) {
          LONGLONG lastResult = result;

          result *= base;
          result -= static_cast<LONGLONG>(digit);
          if (lastResult < result)
            return false; // value had to flip
          ++str;
        }
        if (result < static_cast<LONGLONG>(gMinLongLongs[size-1]))
          return false;
      }

      if (ignoreWhiteSpace)
        skipSpace(str);

      if (0 != *str)
        return false;

      outResult = result;
      return true;
    }
Ejemplo n.º 9
0
Archivo: sml.c Proyecto: shigio/ctags
static void findSmlTags (void)
{
    vString *const identifier = vStringNew ();
    const unsigned char *line;
    smlKind lastTag = K_NONE;

    while ((line = fileReadLine ()) != NULL)
    {
        const unsigned char *cp = skipSpace (line);
        do
        {
            smlKind foundTag;
            if (CommentLevel != 0)
            {
                cp = (const unsigned char *) strstr ((const char *) cp, "*)");
                if (cp == NULL)
                    continue;
                else
                {
                    --CommentLevel;
                    cp += 2;
                }
            }
            foundTag = findNextIdentifier (&cp);
            if (foundTag != K_NONE)
            {
                cp = skipSpace (cp);
                cp = parseIdentifier (cp, identifier);
                if (foundTag == K_AND)
                {
                    if (lastTag != K_NONE)
                        makeSmlTag (lastTag, identifier);
                }
                else
                {
                    makeSmlTag (foundTag, identifier);
                    lastTag = foundTag;
                }
            }
            if (strstr ((const char *) cp, "(*") != NULL)
            {
                cp += 2;
                cp = (const unsigned char *) strstr ((const char *) cp, "*)");
                if (cp == NULL)
                    ++CommentLevel;
            }
        } while (cp != NULL  &&  strcmp ((const char *) cp, "") != 0);
    }
    vStringDelete (identifier);
}
Ejemplo n.º 10
0
/*
 * pStart - pointer to first char of function name
 * pEnd1  - pointer to (last + 1) char of function name
 */
bool isFunctionNameInCode(char *pStart, char *pEnd1) {
	char *p;

	p = skipSpace(pStart - 1, false);
	if (*p == '(' || *p == ')')
		return true;

	p = skipSpace(pEnd1);

	if (*p == '(' || *p == ')')
		return true;

	return false;
}
Ejemplo n.º 11
0
Archivo: xml.c Proyecto: jac8b/libcubic
bool extractAttributes(char **ptr, Attribute *a)
{
	// Find attribute name.
	{
		skipSpace(ptr);
		a->name = *ptr;

		findSpaceOrChar(ptr, '=');
		
		if (**ptr == '\0')
			return false;

		**ptr = '\0';
		++(*ptr);
	}
	
	// Find attribute value.
	{
		findCharAOrB(ptr, '\'', '\"');
		const char quot = **ptr;
		
		skipOne(ptr);
		a->value = *ptr;
		
		findChar(ptr, quot);
		
		if (**ptr == '\0')
			return false;
		
		**ptr = '\0';
		++(*ptr);
	}
	
	return true;
}
Ejemplo n.º 12
0
void LS_Surface::ReadObj(const char* filename, float scale)
{
	Reset();
#ifdef _CRT_SECURE_NO_WARNINGS
	FILE* fp = fopen(filename, "r");
	int v_index = 0, f_index = 0;
#else
	FILE* fp;
	fopen_s(&fp, filename, "r");
	int v_index = 0, f_index = 0;
#endif
	if(!fp)
	{
		printf("open %s failed\n", filename);
		exit(0);
	}
	char str[256];
	while(!feof(fp))
	{
		fgets(str, 255, fp);
		int i = skipSpace(str);
		if(i == -1 || str[i] == '\n' || str[i] == '#')
			continue;
		if(str[i] == 'v')
		{
			//LSPoint p;
			v_index++;
			if(isInVertexIndex(v_index-1))
				continue;
			LS_Vertex* v = new LS_Vertex();
#ifdef _CRT_SECURE_NO_WARNINGS
			sscanf(str+i+1, "%lf%lf%lf", &v->pos[0], &v->pos[1], &v->pos[2]);
#else
			sscanf_s(str+i+1, "%lf%lf%lf", &v->pos[0], &v->pos[1], &v->pos[2]);
#endif
			v->pos[0] *= scale;
			v->pos[1] *= scale;
			v->pos[2] *= scale;

			vertices.push_back(v);
			v->creationLevel = subdivisionLevel;
			v->m_index = vertices.size();
		}
		else if(str[i] = 'f')
		{
			f_index++;
			if(isInFaceIndex(f_index-1))
				continue;
			int v1, v2, v3;
#ifdef _CRT_SECURE_NO_WARNINGS
			sscanf(str+i+1, "%d%d%d", &v1, &v2, &v3);
#else
			sscanf_s(str+i+1, "%d%d%d", &v1, &v2, &v3);
#endif
			AddFaceOfIndex(toNewIndex(v1-1), toNewIndex(v2-1), toNewIndex(v3-1));
			//AddFaceOfIndex(v1-1, v2-1, v3-1);
		}
	}
	fclose(fp);
}
Ejemplo n.º 13
0
bool isForEnd(char *buf){
  skipSpace(&buf);
  if(buf[0] == '}'){
    return true;
  }
  return false;
}
Ejemplo n.º 14
0
/*
 * 简单判断是否是变量定义,只是判断开始是否为数据类型
 */
bool isVariableDef(char * buf){
    skipSpace(&buf);
    if(isDataType(buf) == true){
      return true;
    }
    return false;
}
Ejemplo n.º 15
0
float parseFloat(const char* str, size_t& pos)
{
    skipSpace(str,pos);
    size_t begin = pos;
    while (isdigit(str[pos]) || str[pos] == '.') pos++;
    return atof(str+begin);
}
Ejemplo n.º 16
0
/*
 * Evaluate string (string replacement)
 */
std::string	CTemplatizerEnv::eval(const std::string& text)
{
	std::string	res;
	const char*	ptr = text.c_str();

	while (*ptr != '\0')
	{
		if (ptr[0] == '$' && ptr[1] == '(')
		{
			ptr += 2;
			std::string	var;

			ptr = skipSpace(ptr);

			while (isalpha(*ptr) || *ptr == '/' || *ptr == '.')
				var += *(ptr++);

			while (*ptr != '\0' && *ptr != ')')
				++ptr;
			if (*ptr == ')')
				++ptr;

			res += get(var);
		}
		else if (*ptr != '\r')
		{
			res += *(ptr++);
		}
	}

	return res;
}
Ejemplo n.º 17
0
static void splitIntoWords( void ) {
    MSGSYM *m;
    WORD *w;
    WORDREF *r;
    WORDREF **a;
    char *p;

    for( m = messageSyms; m != NULL; m = m->next ) {
        p = m->lang_txt[LANG_English];
        a = &(m->words);
        for(;;) {
            if( p[0] && isspace( p[0] ) && isspace( p[1] ) ) {
                errorLocn( m->fname, m->line, "MSGSYM %s text has too many blanks '%s'\n",
                        m->name, p );
            }
            p = skipSpace( p );
            if( *p == '\0' ) break;
            p = skipNonSpace( word, p );
            w = addWord( m );
            r = malloc( sizeof( *r ) );
            r->word = w;
            r->next = NULL;
            *a = r;
            a = &(r->next);
        }
    }
}
Ejemplo n.º 18
0
/*
 * Directives are of the form:
 * -module(foo)
 * -define(foo, bar)
 * -record(graph, {vtab = notable, cyclic = true}).
 * -type some_type() :: any().
 * -opaque some_opaque_type() :: any().
 */
static void parseDirective (const unsigned char *cp, vString *const module)
{
	/*
	 * A directive will be either a record definition or a directive.
	 * Record definitions are handled separately
	 */
	vString *const directive = vStringNew ();
	const char *const drtv = vStringValue (directive);
	cp = parseIdentifier (cp, directive);
	cp = skipSpace (cp);
	if (*cp == '(')
		++cp;

	if (strcmp (drtv, "record") == 0)
		parseSimpleTag (cp, K_RECORD);
	else if (strcmp (drtv, "define") == 0)
		parseSimpleTag (cp, K_MACRO);
	else if (strcmp (drtv, "type") == 0)
		parseSimpleTag (cp, K_TYPE);
	else if (strcmp (drtv, "opaque") == 0)
		parseSimpleTag (cp, K_TYPE);
	else if (strcmp (drtv, "module") == 0)
		parseModuleTag (cp, module);
	/* Otherwise, it was an import, export, etc. */
	
	vStringDelete (directive);
}
Ejemplo n.º 19
0
int mp::HTMLParser::Rep::tagAttrs(HTMLParserEvent &event,
                                  const char *name, int len,
                                  const char *cp)
{
    int i = skipSpace(cp);
    while (cp[i] && !strchr("/><", cp[i]))
    {
        const char *attr_name = cp + i;
        int attr_len;
        const char *value;
        int val_len;
        int tr;
        char x[2];
        int nor = skipAttribute(event, cp+i, &attr_len, &value, &val_len, &tr);
        if (!nor)
            break;
        i += nor;

        x[0] = tr;
        x[1] = 0;
        if (m_verbose)
        {
            printf("------ attr %.*s", attr_len, attr_name);
            if (value)
                printf("=%.*s", val_len, value);
            printf("\n");
        }
        event.attribute(name, len, attr_name, attr_len, value, val_len, x);
    }
    return i;
}
Ejemplo n.º 20
0
QPair<QStringRef,QStringRef> QDeclarativeStyledTextPrivate::parseAttribute(const QChar *&ch, const QString &textIn)
{
    skipSpace(ch);

    int attrStart = ch - textIn.constData();
    int attrLength = 0;
    while (!ch->isNull()) {
        if (*ch == greaterThan) {
            break;
        } else if (*ch == equals) {
            ++ch;
            if (*ch != singleQuote && *ch != doubleQuote) {
                while (*ch != greaterThan && !ch->isNull())
                    ++ch;
                break;
            }
            ++ch;
            if (!attrLength)
                break;
            QStringRef attr(&textIn, attrStart, attrLength);
            QStringRef val = parseValue(ch, textIn);
            if (!val.isEmpty())
                return QPair<QStringRef,QStringRef>(attr,val);
            break;
        } else {
            ++attrLength;
        }
        ++ch;
    }

    return QPair<QStringRef,QStringRef>();
}
Ejemplo n.º 21
0
 std::string parseIdentifier(const char* str, size_t& pos) 
 {
   skipSpace(str,pos);
   size_t begin = pos;
   while (isalnum(str[pos]) || str[pos] == '_' || str[pos] == '.') pos++;
   return std::string(str+begin,str+pos);
 }
Ejemplo n.º 22
0
bool QDeclarativeStyledTextPrivate::parseCloseTag(const QChar *&ch, const QString &textIn)
{
    skipSpace(ch);

    int tagStart = ch - textIn.constData();
    int tagLength = 0;
    while (!ch->isNull()) {
        if (*ch == greaterThan) {
            QStringRef tag(&textIn, tagStart, tagLength);
            const QChar char0 = tag.at(0);
            if (char0 == QLatin1Char('b')) {
                if (tagLength == 1)
                    return true;
                else if (tag.at(1) == QLatin1Char('r') && tagLength == 2)
                    return true;
            } else if (char0 == QLatin1Char('i')) {
                if (tagLength == 1)
                    return true;
            } else if (tag == QLatin1String("font")) {
                return true;
            }
            return false;
        } else if (!ch->isSpace()){
            tagLength++;
        }
        ++ch;
    }

    return false;
}
Ejemplo n.º 23
0
 int parseInt(const char* str, size_t& pos) 
 {
   skipSpace(str,pos);
   size_t begin = pos;
   while (isdigit(str[pos])) pos++;
   return atoi(str+begin);
 }
Ejemplo n.º 24
0
vec Board::inputVec(){
  vec def(-1, -1);
  char* line = NULL;
  //size_t len = 0;
  if(turn){
    printf("white's turn : please input a vector (devided by ','): ");
  }
  else{
    printf("black's turn : please input a vector (devided by ','): ");
  }
  /*if(getline(&line, &len, stdin) == -1){
    fprintf(stderr, "get line %s error!\n", line);
    exit(1);
  }*/
  char* startp = line;
  char* endp;
  long num1 = strtol(startp, &endp, 10);
  if(endp == startp){
    fprintf(stderr, "no first number!\n");
    exit(1);
  }
  skipSpace(endp);
  endp++; // skip ','
  startp = endp;
  long num2 = strtol(startp, &endp, 10);
  if(endp == startp){
    fprintf(stderr, "no second number!\n");
    exit(1);
  }
  free(line);
  def.x = int(num1);
  def.y = int(num2);
  return def;
}
Ejemplo n.º 25
0
bool TScanner::nextToken()
{	
	skipSpace();	
	tokenCol=current-lineStart;
	tokenLine=line;
	if(current>=condition.length()){
		token=TToken::FILE_END;
		tokenText="";
		return false;
	}	

	QChar l_ch=condition.at(current);
	
	if(l_ch=='"'||l_ch=='\''){		
		return parseString(l_ch);
	} else if((l_ch>='a' && l_ch <='z') ||(l_ch>='A' && l_ch<='Z') || l_ch=='_'){
		return parseIdent();
	} 
	token=TToken::CHAR;
	tokenText=l_ch;
	current++;
	if(l_ch=='='){
		token=TToken::COND_EQUAL;
	} else if(l_ch=='>'){
		token=TToken::COND_BIGGER;		
		if(current<condition.length()){			
			if(condition.at(current)=='='){			
				token=TToken::COND_BE;
				tokenText=">=";
				current++;
			}
		}
	} else if(l_ch=='<'){
		token=TToken::COND_SMALLER;		
		if(current<condition.length()){
			if(condition.at(current)=='='){
				token=TToken::COND_SE;
				tokenText="<=";
				current++;
			}
		}
		
	} else if(l_ch=='!'){
		token=TToken::COND_NOT;		
		if(current<condition.length()){
			if(condition.at(current)=='='){
				token=TToken::COND_NE;
				tokenText="!=";
				current++;
			}
		}
		
	} else if(l_ch=='('){
		token=TToken::HOOK_L;		
	} else if(l_ch==')'){
		token=TToken::HOOK_R;		
	}
	return false;
}
		const std::string XSingleSource::getToSeparator(const char separator)
		{
			skipSpace();
			std::string result;
			while (!isSeparator() && !isSpace() && *m_iterator != separator)
				result += *m_iterator++;
			return result;
		}
		const std::string XSingleSource::get(const char separator1, const char separator2)
		{
			skipSpace();
			std::string result;
			while (*m_iterator != separator1 && *m_iterator != separator2)
				result += *m_iterator++;
			return result;
		}
Ejemplo n.º 28
0
static SECStatus
scanTag(const char **pbp, const char *endptr, char *tagBuf, int tagBufSize)
{
    const char *bp;
    char *tagBufp;
    int taglen;

    PORT_Assert(tagBufSize > 0);
    
    /* skip optional leading space */
    skipSpace(pbp, endptr);
    if (*pbp == endptr) {
	/* nothing left */
	return SECFailure;
    }
    
    /* fill tagBuf */
    taglen = 0;
    bp = *pbp;
    tagBufp = tagBuf;
    while (bp < endptr && !OPTIONAL_SPACE(*bp) && (*bp != C_EQUAL)) {
	if (++taglen >= tagBufSize) {
	    *pbp = bp;
	    return SECFailure;
	}
	*tagBufp++ = *bp++;
    }
    /* null-terminate tagBuf -- guaranteed at least one space left */
    *tagBufp++ = 0;
    *pbp = bp;
    
    /* skip trailing spaces till we hit something - should be an equal sign */
    skipSpace(pbp, endptr);
    if (*pbp == endptr) {
	/* nothing left */
	return SECFailure;
    }
    if (**pbp != C_EQUAL) {
	/* should be an equal sign */
	return SECFailure;
    }
    /* skip over the equal sign */
    (*pbp)++;
    
    return SECSuccess;
}
Ejemplo n.º 29
0
void MazeParser::parseTexture(int count, char *line)
{
   char *start, *end;
   char tex_name[MAX_LINE_SIZE];
   char arg[MAX_LINE_SIZE];

   end = findFirstSpace(line);
   copyString(arg, line, end);
   end = skipSpace(end);

   start = skipSpace(end);
   end = findFirstSpace(start);
   copyString(tex_name, start, end);

   scene->addTexture( new Texture(tex_name) );

   return;
}
Ejemplo n.º 30
0
/*
 * 解析变量定义,处理最简单的情况,只处理合理的变量定义
 */
void doVariableParse(char *buf){
  skipSpace(&buf);
  while(*buf != ' ') buf++;
  skipSpace(&buf);
  char * pCur = buf;
  while(*pCur != ' ' && *pCur != '=') pCur++;
  char var[16];
  memset(var,0,16);
  strncpy(var,buf,pCur-buf);
  printf("The var name is %s\n",var);
  while(*pCur != '=') pCur++;
  buf = ++pCur;
  skipSpace(&buf);
  pCur = buf;
  while(*pCur != ';' && *pCur != ' ') pCur++;
  strncpy(var,buf,pCur-buf);
  printf("The chushibianling is %s\n",var);
}