瀏覽代碼

* Patch from Henrique Werlang to allow setting log config page

git-svn-id: trunk@47052 -
(cherry picked from commit a8bc2f6947005f5988b1bd233d7b5028934d46fc)
michael 4 年之前
父節點
當前提交
a3d5b9532e
共有 2 個文件被更改,包括 21 次插入1 次删除
  1. 19 0
      packages/pastojs/src/pas2jslibcompiler.pp
  2. 2 1
      utils/pas2js/pas2jslib.pp

+ 19 - 0
packages/pastojs/src/pas2jslibcompiler.pp

@@ -67,6 +67,8 @@ Type
     FOnWriteJSCallBack: TWriteJSCallBack;
     FOnWriteJSData: Pointer;
     FReadBufferLen: Cardinal;
+    function GetLogEncoding: String;
+    procedure SetLogEncoding(AValue: String);
   Protected
     Function DoWriteJSFile(const DestFilename: String; aWriter: TPas2JSMapper): Boolean; override;
     Procedure GetLastError(AError : PAnsiChar; Var AErrorLength : Longint;
@@ -80,6 +82,7 @@ Type
     Function LibraryRun(ACompilerExe, AWorkingDir : PAnsiChar; CommandLine : PPAnsiChar; DoReset : Boolean) :Boolean; {$IFDEF UseCDecl}cdecl{$ELSE}stdcall{$ENDIF};
     Property LastError : String Read FLastError Write FLastError;
     Property LastErrorClass : String Read FLastErrorClass Write FLastErrorClass;
+    property LogEncoding: String  read GetLogEncoding write SetLogEncoding;
     Property OnLibLogCallBack : TLibLogCallBack Read FOnLibLogCallBack Write FOnLibLogCallBack;
     Property OnLibLogData : Pointer Read FOnLibLogData Write FOnLibLogData;
     Property OnWriteJSCallBack : TWriteJSCallBack Read FOnWriteJSCallBack Write FOnWriteJSCallBack;
@@ -107,6 +110,7 @@ Function RunPas2JSCompiler(P : PPas2JSCompiler; ACompilerExe, AWorkingDir : PAns
 Procedure FreePas2JSCompiler(P : PPas2JSCompiler); {$IFDEF UseCDecl}cdecl{$ELSE}stdcall{$ENDIF};
 Function GetPas2JSCompiler : PPas2JSCompiler; {$IFDEF UseCDecl}cdecl{$ELSE}stdcall{$ENDIF};
 Procedure GetPas2JSCompilerLastError(P : PPas2JSCompiler; AError : PAnsiChar; Var AErrorLength : Longint; AErrorClass : PAnsiChar; Var AErrorClassLength : Longint); {$IFDEF UseCDecl}cdecl{$ELSE}stdcall{$ENDIF};
+procedure SetPas2JSLogEncoding(P : PPas2JSCompiler; Enconding: PAnsiChar); {$IFDEF UseCDecl}cdecl{$ELSE}stdcall{$ENDIF};
 
 implementation
 
@@ -120,6 +124,16 @@ begin
     Result:=OnReadDir(FOnReadDirData,Dir,PAnsiChar(Dir.Path));
 end;
 
+function TLibraryPas2JSCompiler.GetLogEncoding: String;
+begin
+  Result := Log.Encoding;
+end;
+
+procedure TLibraryPas2JSCompiler.SetLogEncoding(AValue: String);
+begin
+  Log.Encoding := AValue;
+end;
+
 function TLibraryPas2JSCompiler.DoWriteJSFile(const DestFilename: String; aWriter: TPas2JSMapper): Boolean;
 
 Var
@@ -344,5 +358,10 @@ begin
   TLibraryPas2JSCompiler(P).GetLastError(AError,AErrorLength,AErrorClass,AErrorClassLength);
 end;
 
+procedure SetPas2JSLogEncoding(P : PPas2JSCompiler; Enconding: PAnsiChar); {$IFDEF UseCDecl}cdecl{$ELSE}stdcall{$ENDIF};
+begin
+  TLibraryPas2JSCompiler(P).LogEncoding := Enconding;
+end;
+
 end.
 

+ 2 - 1
utils/pas2js/pas2jslib.pp

@@ -17,7 +17,8 @@ exports
   AddPas2JSDirectoryEntry,
   SetPas2JSUnitAliasCallBack,
   SetPas2JSCompilerLogCallBack,
-  GetPas2JSCompilerLastError;
+  GetPas2JSCompilerLastError,
+  SetPas2JSLogEncoding;
 
 end.