# HG changeset patch # User unc0rr # Date 1389118082 -14400 # Node ID 01e198990211ce3943425f8ff6e29f3c1a3bdf42 # Parent 12b0ed9910cd051892c9e94cb9a0e5ea388b9795 pas2c engine now writes debug log diff -r 12b0ed9910cd -r 01e198990211 hedgewars/options.inc --- a/hedgewars/options.inc Tue Jan 07 01:58:23 2014 +0400 +++ b/hedgewars/options.inc Tue Jan 07 22:08:02 2014 +0400 @@ -30,7 +30,7 @@ {$DEFINE USE_LUA_SCRIPT} {$IF DEFINED(WEBGL) AND NOT DEFINED(PAS2C)} -{$UNDEF WEBGL} +{$ERROR WEBGL defined, but PAS2C isn't} {$ENDIF} {$IFDEF WEBGL} diff -r 12b0ed9910cd -r 01e198990211 hedgewars/pas2cRedo.pas --- a/hedgewars/pas2cRedo.pas Tue Jan 07 01:58:23 2014 +0400 +++ b/hedgewars/pas2cRedo.pas Tue Jan 07 22:08:02 2014 +0400 @@ -48,7 +48,7 @@ Handle = integer; var - write, writeLn, read, readLn, flush: procedure; + write, writeLn, read, readLn, flush, CreateDir: procedure; halt:procedure; diff -r 12b0ed9910cd -r 01e198990211 hedgewars/uUtils.pas --- a/hedgewars/uUtils.pas Tue Jan 07 01:58:23 2014 +0400 +++ b/hedgewars/uUtils.pas Tue Jan 07 22:08:02 2014 +0400 @@ -351,6 +351,7 @@ procedure AddFileLogRaw(s: pchar); cdecl; begin s:= s; +{$IFNDEF PAS2C} {$IFDEF DEBUGFILE} {$IFDEF USE_VIDEO_RECORDING} EnterCriticalSection(logMutex); @@ -361,6 +362,7 @@ LeaveCriticalSection(logMutex); {$ENDIF} {$ENDIF} +{$ENDIF} end; function CheckCJKFont(s: ansistring; font: THWFont): THWFont; @@ -507,13 +509,16 @@ InitCriticalSection(logMutex); {$ENDIF} {$I-} +{$IFNDEF PAS2C} f:= stderr; // if everything fails, write to stderr +{$ENDIF} if (UserPathPrefix <> '') then begin + {$IFNDEF PAS2C} // create directory if it doesn't exist if not FileExists(UserPathPrefix + '/Logs/') then CreateDir(UserPathPrefix + '/Logs/'); - + {$ENDIF} // if log is locked, write to the next one i:= 0; while(i < 7) do diff -r 12b0ed9910cd -r 01e198990211 project_files/hwc/rtl/fileio.c --- a/project_files/hwc/rtl/fileio.c Tue Jan 07 01:58:23 2014 +0400 +++ b/project_files/hwc/rtl/fileio.c Tue Jan 07 22:08:02 2014 +0400 @@ -216,8 +216,7 @@ } void __attribute__((overloadable)) fpcrtl_flush(Text f) { - printf("flush not implemented\n"); - assert(0); + fflush(f->fp); } void __attribute__((overloadable)) fpcrtl_flush(FILE *f) { diff -r 12b0ed9910cd -r 01e198990211 tools/pas2c/PascalPreprocessor.hs --- a/tools/pas2c/PascalPreprocessor.hs Tue Jan 07 01:58:23 2014 +0400 +++ b/tools/pas2c/PascalPreprocessor.hs Tue Jan 07 22:08:02 2014 +0400 @@ -21,6 +21,7 @@ initDefines = Map.fromList [ ("FPC", "") , ("PAS2C", "") + , ("DEBUGFILE", "") -- , ("WEBGL", "") -- , ("AI_MAINTHREAD", "") , ("ENDIAN_LITTLE", "")