Beispiel #1
0
/* include import 加载文件 */
static int LoadFile (char *filename)
{
    /* 如果文件存在,
     * 保存以前的Input 信息
     * 读取新的文件 */
    if (FileExist (filename)) {
        
        Include p;
        CALLOC (p);

        p->PreInput = Input;
        p->isDef = false;
        ReadSourceFile (filename);
        p->PreTokenCoord = TokenCoord;
        p->endifCnt = endifCnt;
        INSERT_ITEM (InLink, p);

        TokenCoord.filename = filename;
        TokenCoord.line = TokenCoord.col = TokenCoord.ppline = 1;
        endifCnt = 0;
        INFO (4, "load %s file.", filename);

        return 1;
    }
    return 0;
}
Beispiel #2
0
void LexTest (char *filename)
{
    ReadSourceFile (filename);

    PRINT ("LexTest start... \n");
    SetupLexer ();
    int tok = 0;

    SkipWhiteSpace ();
    while (1) {

        tok = Scanners[*CURRENT]();
        if (TK_END == tok) break;
        
            PRINT ("%-8s|(%d, %d) ", TokenString[tok], 
            TokenCoord.line, TokenCoord.col);
            if (TK_ID == tok) 
                PRINT ("%s", (char*)TokenValue.p);
            PRINT ("\n");
    }

    PRINT ("词法分析结束\n");
    PRINT ("LexTest end... \n");

    CloseSourceFile ();
}
Beispiel #3
0
int GLSL_FS::ReadSource(const char* _filename) {

char * pointeur_source;
const char * constFS;

	if (ReadSourceFile(_filename, &pointeur_source) > 0) {
		constFS = pointeur_source;
		glShaderSource(idfs, 1, &constFS, NULL);
		delete [] pointeur_source;
	}

return 0;
}
void ICrashDebugHelper::AddSourceToReport()
{
	if( CrashInfo.SourceFile.Len() > 0 && CrashInfo.SourceLineNumber != 0 )
	{
		TArray<FString> Lines;
		ReadSourceFile( Lines );

		const uint32 MinLine = FMath::Clamp( CrashInfo.SourceLineNumber - 15, (uint32)1, (uint32)Lines.Num() );
		const uint32 MaxLine = FMath::Clamp( CrashInfo.SourceLineNumber + 15, (uint32)1, (uint32)Lines.Num() );

		for( uint32 Line = MinLine; Line < MaxLine; Line++ )
		{
			if( Line == CrashInfo.SourceLineNumber - 1 )
			{
				CrashInfo.SourceContext.Add( FString::Printf( TEXT( "%5u ***** %s" ), Line, *Lines[Line] ) );
			}
			else
			{
				CrashInfo.SourceContext.Add( FString::Printf( TEXT( "%5u       %s" ), Line, *Lines[Line] ) );
			}
		}
	}
}