equal
deleted
inserted
replaced
194 end; |
194 end; |
195 |
195 |
196 function StrToInt(s: shortstring): LongInt; |
196 function StrToInt(s: shortstring): LongInt; |
197 var c: LongInt; |
197 var c: LongInt; |
198 begin |
198 begin |
199 val(s, StrToInt, c) |
199 val(s, StrToInt, c); |
|
200 {$IFDEF DEBUGFILE} |
|
201 if c <> 0 then |
|
202 writeln(f, 'Error at position ' + IntToStr(c) + ' : ' + s[c]) |
|
203 {$ENDIF} |
200 end; |
204 end; |
201 |
205 |
202 function FloatToStr(n: hwFloat): shortstring; |
206 function FloatToStr(n: hwFloat): shortstring; |
203 begin |
207 begin |
204 FloatToStr:= cstr(n) + '_' + inttostr(Lo(n.QWordValue)) |
208 FloatToStr:= cstr(n) + '_' + inttostr(Lo(n.QWordValue)) |
472 logfileBase:= 'preview'; |
476 logfileBase:= 'preview'; |
473 {$IFDEF USE_VIDEO_RECORDING} |
477 {$IFDEF USE_VIDEO_RECORDING} |
474 InitCriticalSection(logMutex); |
478 InitCriticalSection(logMutex); |
475 {$ENDIF} |
479 {$ENDIF} |
476 {$I-} |
480 {$I-} |
477 {$IFDEF MOBILE} |
481 f:= stderr; // if everything fails, write to stderr |
478 {$IFDEF IPHONEOS} Assign(f, UserPathPrefix + '/hw-' + logfileBase + '.log'); {$ENDIF} |
|
479 {$IFDEF ANDROID} Assign(f, pathPrefix + '/' + logfileBase + '.log'); {$ENDIF} |
|
480 i:= i; // avoid hint |
|
481 {$ELSE} |
|
482 f:= stdout; // if everything fails, write to stderr |
|
483 if (UserPathPrefix <> '') then |
482 if (UserPathPrefix <> '') then |
484 begin |
483 begin |
|
484 // create directory if it doesn't exist |
485 if not FileExists(UserPathPrefix + '/Logs/') then |
485 if not FileExists(UserPathPrefix + '/Logs/') then |
486 CreateDir(UserPathPrefix + '/Logs/'); |
486 CreateDir(UserPathPrefix + '/Logs/'); |
|
487 |
|
488 // if log is locked, write to the next one |
487 i:= 0; |
489 i:= 0; |
488 while(i < 7) do |
490 while(i < 7) do |
489 begin |
491 begin |
490 assign(f, UserPathPrefix + '/Logs/' + logfileBase + inttostr(i) + '.log'); |
492 assign(f, UserPathPrefix + '/Logs/' + logfileBase + inttostr(i) + '.log'); |
491 if IOResult = 0 then |
493 if IOResult = 0 then |
492 break; |
494 break; |
493 inc(i) |
495 inc(i) |
494 end; |
496 end; |
495 end; |
497 end; |
496 {$ENDIF} |
|
497 Rewrite(f); |
498 Rewrite(f); |
498 {$I+} |
499 {$I+} |
499 {$ENDIF} |
500 {$ENDIF} |
500 |
501 |
501 end; |
502 end; |