Esempio n. 1
0
static void UI_ReportUserMessage(KonohaContext *kctx, kinfotag_t level, kfileline_t pline, const char *msg, int isNewLine)
{
    const char *beginTag = BeginTag(kctx, level);
    const char *endTag = EndTag(kctx, level);
    const char *kLF = isNewLine ? "\n" : "";
    if(pline > 0) {
        const char *file = KFileLine_textFileName(pline);
        PLATAPI printf_i("%s - (%s:%d) %s%s%s" , beginTag, PLATAPI shortFilePath(file), (kushort_t)pline, msg, kLF, endTag);
    }
    else {
        PLATAPI printf_i("%s%s%s%s", beginTag,  msg, kLF, endTag);
    }
}
Esempio n. 2
0
bool FbXmlHandler::NodeHandler::doEnd(const QString &name, bool & exists)
{
    if (m_handler) {
        bool found = exists || name == m_name;
        m_handler->doEnd(name, found);
        if (m_handler->m_closed) { delete m_handler; m_handler = NULL; }
        if (found) { exists = true; return true; }
    }
    bool found = name == m_name;
    m_closed = found || exists;
    if (m_closed) EndTag(m_name);
    exists = found;
    return true;
}
Esempio n. 3
0
bool KrEncoder::EndDat()
{
	StartTag( KYRATAG_END );
	EndTag();

	SDL_RWseek( stream, numRlePos, SEEK_SET );
	GLASSERT( numRGBA >= numSegment );
	//GLASSERT( numSegment >= numLine ); //maks: Is be possible (GE_N.bmp)
	SDL_WriteLE32( stream, numRGBA );
	SDL_WriteLE32( stream, numLine );
	SDL_WriteLE32( stream, numSegment );

	#ifdef DEBUG
		GLOUTPUT( "Tally count: rgba=%d line=%d segment=%d\n", numRGBA, numLine, numSegment );
	#endif

	cachedWrite.Flush();
	return true;
}
Esempio n. 4
0
static void UI_ReportCompilerMessage(KonohaContext *kctx, kinfotag_t taglevel, kfileline_t pline, const char *msg)
{
	const char *beginTag = BeginTag(kctx, taglevel);
	const char *endTag = EndTag(kctx, taglevel);
	PLATAPI printf_i("%s - %s%s\n", beginTag, msg, endTag);
}
Esempio n. 5
0
//int ExtractXMLData(char ch,_searchParameters* searchParam,_searchProperty *searchProperty, char* result);
int ExtractXMLData(char ch,_searchParameters* searchParam,_searchProperty *searchProperty, char* result, U16 resLen)
{
    switch(xmlState)
    {
    case PARSE_STATE_START:
        if(ch == '<')
        {
            buffIndex = 0;
            if(buffIndex < PARSER_BUFFER_LENGTH)
                pBuff[buffIndex++] = ch;
            xmlState = PARSE_STATE_READ;
        }
        if(activateStore)
        {
            if(ch >= ' ')
            {
                if(resIndex < resLen)
                    result[resIndex++]=ch;
                else
                    return -1;
            }
        }
        break;
    case PARSE_STATE_READ:
        if(buffIndex < PARSER_BUFFER_LENGTH)
        {
            pBuff[buffIndex++] = ch;
        }
        if(activateStore)
        {
            if(resIndex < resLen)
            {
                result[resIndex++]=ch;
            }
            else
                return -1;
        }
         if(ch == '>')
         {
			if(buffIndex < PARSER_BUFFER_LENGTH)
				pBuff[buffIndex]= '\0';
            buffIndex = 0;
            // Analyse the string starting from "<" to ">"
            int i,attFound;
            char attAndKey[50];
            // search for a stop block
            for(i=0; i< activeAtt ; i ++)
            {
                attFound = 1;
                if(searchParam[i].tag != NULL)
                     attFound &= (strstr(pBuff,EndTag(searchParam[i].tag))? 1:0);
                if(attFound)
                {
                    xmlState = PARSE_STATE_STOP_ANALYSE;
                    activeAtt = i;
                    break;
                }
            }
            // Search for a start block with right attributes
            for (i=0; (i< (activeAtt+1) && i<(searchProperty->noOfSearchParam)) ; i ++)
            {
                attFound = 1;
                if(searchParam[i].tag != NULL)
                    attFound &= (strstr(pBuff,searchParam[i].tag)? 1:0);
                // Concatenate attribute and key and search in pBuff.
                if(searchParam[i].attribute != NULL && searchParam[i].key != NULL)
                {
                    StrCopy(attAndKey, searchParam[i].attribute,50);
                    StrCat(attAndKey, searchParam[i].key ,50);
                    attFound &= (strstr(pBuff,attAndKey)? 1:0);
                }
                if((attFound == 1) &&
                   ((searchParam[i].tag != NULL) ||
                   ((searchParam[i].attribute!= NULL) &&
                   (searchParam[i].key != NULL))))
                {
                     xmlState = PARSE_STATE_START_ANALYSE;
                     activeAtt = i+1;
                     if(activeAtt == searchProperty->noOfSearchParam)
                     {
                        dataFound = 1;
                     }
                     break;
                }
            }
            // Check for comments and remove it from the result.
            char *pStr=NULL;
            pStr = strstr(result,"<!");
            if(pStr)
            {
                *pStr ='\0';
                resIndex = strlen(result);
            }
            if(xmlState == PARSE_STATE_READ)
                xmlState = PARSE_STATE_START;
         }
        break;
    case PARSE_STATE_START_ANALYSE:
        if(activeAtt == searchProperty->dataOfSearchParam)
        {
            resIndex = 0;
            if(searchProperty->resultType != XMLDATA_BODY )
            {
                if((resIndex + strlen(pBuff))< resLen)
                    StrCopy(result, pBuff,resLen);
                else
                    return -1;
                resIndex = strlen(result);
            }
            activateStore = 1;

            if(searchProperty->resultType == XMLDATA_TAG && resIndex <resLen)
            {
                result[resIndex]='\0';
                return 1;
            }
        }
        if(activateStore)
        {
            if(resIndex< resLen)
                result[resIndex++] = ch;
            else
                return -1;
        }
        if(buffIndex < PARSER_BUFFER_LENGTH)
			pBuff[buffIndex++]=ch;
        if(ch == '<')
            xmlState = PARSE_STATE_READ;
        else
            xmlState = PARSE_STATE_START;
        break;
    case PARSE_STATE_STOP_ANALYSE:
         if(activeAtt+1 == searchProperty->dataOfSearchParam)
         {
             activateStore = 0;
             if(dataFound && resIndex <resLen)
             {
                char *pStr=NULL;
                result[resIndex] = '\0';
                if(searchProperty->resultType == XMLDATA_BODY)
                {
                    pStr= strstr(result,EndTag(searchParam[activeAtt].tag));
                    *pStr='\0';
                }
                return 1;
             }
         }
        if(buffIndex < PARSER_BUFFER_LENGTH)
        	pBuff[buffIndex++]=ch;
        if(ch == '<')
            xmlState = PARSE_STATE_READ;
        else
            xmlState = PARSE_STATE_START;
        break;
    }
    return 0;
}