View Issue Details

IDProjectCategoryView StatusLast Update
0037733pas2jstranspilerpublic2020-09-16 23:55
Reporterhenrique Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
PlatformPas2JsOSWindows 
Summary0037733: Log configuration
DescriptionI created a procedure to configure the encoding that the log should be generated in the DLL.
TagsNo tags attached.
Fixed in Revision
Attached Files

Activities

henrique

2020-09-10 23:22

reporter  

Log.patch (3,663 bytes)   
From 58d42d2c2e847f4ce3263aae287f9cf08a82f3b0 Mon Sep 17 00:00:00 2001
From: Henrique Gottardi Werlang <henriquewerlang@hotmail.com>
Date: Thu, 10 Sep 2020 18:20:20 -0300
Subject: [PATCH] =?UTF-8?q?Adicionado=20fun=C3=A7=C3=A3o=20para=20configur?=
 =?UTF-8?q?ar=20o=20log.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 packages/pastojs/src/pas2jslibcompiler.pp | 19 +++++++++++++++++++
 utils/pas2js/pas2jslib.pp                 |  3 ++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/packages/pastojs/src/pas2jslibcompiler.pp b/packages/pastojs/src/pas2jslibcompiler.pp
index 80f66f8756..6f3b377a25 100644
--- a/packages/pastojs/src/pas2jslibcompiler.pp
+++ b/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.
 
diff --git a/utils/pas2js/pas2jslib.pp b/utils/pas2js/pas2jslib.pp
index f0376e38dd..0657b571db 100644
--- a/utils/pas2js/pas2jslib.pp
+++ b/utils/pas2js/pas2jslib.pp
@@ -17,7 +17,8 @@ exports
   AddPas2JSDirectoryEntry,
   SetPas2JSUnitAliasCallBack,
   SetPas2JSCompilerLogCallBack,
-  GetPas2JSCompilerLastError;
+  GetPas2JSCompilerLastError,
+  SetPas2JSLogEncoding;
 
 end.
 
-- 
2.28.0.windows.1

Log.patch (3,663 bytes)   

Issue History

Date Modified Username Field Change
2020-09-10 23:22 henrique New Issue
2020-09-10 23:22 henrique File Added: Log.patch
2020-09-16 23:55 Michael Van Canneyt Assigned To => Michael Van Canneyt
2020-09-16 23:55 Michael Van Canneyt Status new => assigned