[fpc-pascal] Trash variables (-gt) - Translation

2024-01-17 Thread LacaK via fpc-pascal
Hi *, I am translating "Trash variables" (from English to Slovak), but I can not find appropriate words. That's why I want to describe it in more words. Is this correct: "Initialize local variables with random values" ? Or better suggestion? Thanks -Laco.

Re: [fpc-pascal] no array support in sqldb/sqldbrestbridge?

2022-06-07 Thread LacaK via fpc-pascal
Hi, So, is there no array field support in sqldb and/or in sqldbrestbridge? there was added into DB.pas : TObjectField and TArrayField https://gitlab.com/freepascal.org/fpc/source/-/blob/main/packages/fcl-db/src/base/db.pas but implementation is incomplete. Methods in fields.inc are empty.

Re: [fpc-pascal] converting to UTF8

2022-03-23 Thread LacaK via fpc-pascal
procedure TestString; var   Original:string;   Converted:string; begin   original:='ESPA'#209'A'; //ESPAÑA WIN1252   Converted:=ansiToUtf8(original);  // converts to 'ESPA'#239#191#189'A'  // converted Should be 'ESPA'#195#145'A' end; I've tried playing with strings types, string,

Re: [fpc-pascal] Text Only printing on Windows.

2022-02-10 Thread LacaK via fpc-pascal
Look at TPrinter.RawMode : https://lazarus-ccr.sourceforge.io/docs/lcl/printers/tprinter.rawmode.html and TPrinter.Write  Printer.Title := 'xyz';  Printer.RawMode := True;  Printer.BeginDoc;  Printer.Write('^MTD'); //direct thermal media  Printer.EndDoc; L. Does anyone know of a way to just

Re: [fpc-pascal] Repost: TFieldType declaration change in FPC fixes_3_2 branch

2021-10-18 Thread LacaK via fpc-pascal
/Reposted with correct branch identifier/. I thought that a fixes branch was only for bug fixes and not for issuing non-backwards compatible changes. However, TFieldType in db.pas now has 6 extra elements. The result is that IBX no longer compiles with the fixes_3_2 branch. I have also

Re: [fpc-pascal] FreePascal and MySQL 8.0

2021-09-21 Thread LacaK via fpc-pascal
https://github.com/fpc/FPCSource/tree/main/packages/mysql I do not understand. I see a source file for mysql80dyn.pp, but shouldn't tthere also be a mysql80conn.pp? It is in https://github.com/fpc/FPCSource/tree/main/packages/fcl-db/src/sqldb/mysql L.

Re: [fpc-pascal] Conversion from C to Pascal - Left bit shift

2021-09-03 Thread LacaK via fpc-pascal
Can we say that in Pascal the result of:    E1 shl E2 is of same type as E1 ? (so if E1 is LongWord then result is LongWord also?) What if there is an expression on left side:    (E1*x) shl E2 Will E1*x promote to 64 bits (on 64 bit target)? See documentation on

Re: [fpc-pascal] Conversion from C to Pascal - Left bit shift

2021-09-03 Thread LacaK via fpc-pascal
Can we say that in Pascal the result of:   E1 shl E2 is of same type as E1 ? (so if E1 is LongWord then result is LongWord also?) What if there is an expression on left side:   (E1*x) shl E2 Will E1*x promote to 64 bits (on 64 bit target)? -Laco. Hello *, I have code in C like this:   E1 <<

[fpc-pascal] Conversion from C to Pascal - Left bit shift

2021-09-02 Thread LacaK via fpc-pascal
Hello *, I have code in C like this:   E1 << E2 If E1 is of unsigned type then "The value of E1 << E2 is E1 left-shifted E2 bit positions; vacated bits are zero-filled. If E1 has an unsigned type, the value of the result is E1 × 2^E2, reduced modulo one more than the maximum value

Re: [fpc-pascal] Raise exception in libray which will not halt host application

2021-08-26 Thread LacaK via fpc-pascal
Please note that you won't be able to catch such an exception with the type from within the application, e.g.: === code begin === try   SomeLibraryFunction; except   on e: TMyObject do Whatever;   else WhateverElse; end; === code end === The above code would go to the first

Re: [fpc-pascal] Raise exception in libray which will not halt host application

2021-08-26 Thread LacaK via fpc-pascal
Am 26.08.2021 um 10:10 schrieb LacaK via fpc-pascal: Thank you for both answers! Please note that you won't be able to catch such an exception with the type from within the application, e.g.: === code begin === try   SomeLibraryFunction; except   on e: TMyObject do Whatever;   else

Re: [fpc-pascal] Bookmark, TBookmarkStr, TBytes and BytesOf

2021-08-26 Thread LacaK via fpc-pascal
I have considered to convert the TBytes to AnsiString, but instead to doing a research about AnsiString internals, or creating a function that copies bytes in a loop, I supposed that there was already a function to do that. I found BytesOf

Re: [fpc-pascal] Raise exception in libray which will not halt host application

2021-08-26 Thread LacaK via fpc-pascal
Thank you for both answers! L. On Thu, 26 Aug 2021, LacaK via fpc-pascal wrote: Hello, is there way how to raise exception in library without using SysUtils? Raise TMyObject.Create() Where TMyObject does not descend from Exception. Sysutils is needed for the definition of the Exception

[fpc-pascal] Raise exception in libray which will not halt host application

2021-08-26 Thread LacaK via fpc-pascal
Hello, is there way how to raise exception in library without using SysUtils? Now I call System.RunError() in case unexpected situation occurs in library (DLL), but this exits also application which links library. Is there way how to exit library in a way that application can catch exception

[fpc-pascal] Conditional compilation using {$IFOPT ...} and {$IF OPTION(...)}

2021-08-25 Thread LacaK via fpc-pascal
Hello, looking at https://www.freepascal.org/docs-html/prog/progsu126.html#x139-142.4.1 There is mentioned "OPTION(opt)" with comment: "evaluates to TRUE if a compiler option is set (mode MacPas only). It is equivalent to the {$IFOPT } directive." 1. What is equivalent usage for

Re: [fpc-pascal] How to get fpc and lazarus sources when svn has shut down?

2021-08-11 Thread LacaK via fpc-pascal
It's like switching car brands from a VW to an Audi or so. Some buttons are in different places, your key will maybe look different, but that's it. It's a car, it brings you from a to b. It's not switching brands, it's switching the type of the car. from a passenger i.e. to

Re: [fpc-pascal] Will the size of an executable depend on the uses clause

2021-06-16 Thread LacaK via fpc-pascal
Since the final binary size after using strip -s on the exe file is 271 kb it seems a bit big! Or is there a lot behind the scenes I have missed? Classes is a hog. I had a look, and only tthreadlist (and with that tlist) were instantiated in the startupcode. There are also global variables,

Re: [fpc-pascal] Will the size of an executable depend on the uses clause

2021-06-16 Thread LacaK via fpc-pascal
Since the final binary size after using strip -s on the exe file is 271 kb it seems a bit big! Or is there a lot behind the scenes I have missed? Classes is a hog. If you want smallest executable size you must get rid of SysUtils also. And you must call platform dependent OS API ... L.

Re: [fpc-pascal] non-virtual class methods called from virtual regular method

2021-04-29 Thread LacaK via fpc-pascal
Dňa 29.4.2021 o 9:26 Michael Van Canneyt via fpc-pascal napísal(a): On Thu, 29 Apr 2021, LacaK via fpc-pascal wrote: Hi *, consider the following example T1 = class   class procedure CP1;   procedure P1; virtual; end; T2 = class(T1)   class procedure CP1; end; procedure T1.P1; begin

[fpc-pascal] non-virtual class methods called from virtual regular method

2021-04-29 Thread LacaK via fpc-pascal
Hi *, consider the following example T1 = class   class procedure CP1;   procedure P1; virtual; end; T2 = class(T1)   class procedure CP1; end; procedure T1.P1; begin   CP1; // here is called allways T1.CP1, right?   // if I want call T2.CP1 then class procedure CP1 must be also virtual,

[fpc-pascal] Inline assembler m32 source operand

2021-04-12 Thread LacaK via fpc-pascal
Hi, how can I address m32 source operand in inline assembler instruction like : asm   ...   VBROADCASTSS m32, %xmm1;   ... end; if I would like broadcast to %xmm10 single 32bit value at given memory location in: const SI:single=0.1; or var SI:single=0.1; Now I do it by (it works): asm  

Re: [fpc-pascal] Minimal size of compiled library (DLL under Windows)

2021-04-06 Thread LacaK via fpc-pascal
May be, that important word is here "referenced" code. Once some code (procedure, class) is referenced then this code is linked / included. It does not play role if it is really required by program / library ... right? L. So we see that classes like TComponent and also interfaces are

Re: [fpc-pascal] Minimal size of compiled library (DLL under Windows)

2021-04-06 Thread LacaK via fpc-pascal
I am guessing, that there must be something in initialization sections of units (SysUtils and Classes), which cause that some code is included, right? Can I somehow to avoid this grow of size (for example I need from Classes only TFPList)? Not in an easy way at the moment, I don't expect

[fpc-pascal] Minimal size of compiled library (DLL under Windows)

2021-04-03 Thread LacaK via fpc-pascal
Hi,I did small test project for library:(with -CX -WR -O3 -Xs -XX options set)library library1;{$mode objfpc}{$H+}uses  SysUtils, Classes;beginend.  Compilation produces DLL with size 200+ KB.When in uses is only SysUtils then size is under 100 KB.Whene there are not units in uses clause then size

Re: [fpc-pascal] Smart-linking versus Whole Program Optimization

2021-03-10 Thread LacaK via fpc-pascal
It will be nice have this in documentation. For example in https://www.freepascal.org/docs-html/prog/progse30.html#x195-207.3 At least explain: - relation of -CX and -XX Indeed. - what is to be removed: non-referenced non-virtual methods, global variables, and regular

Re: [fpc-pascal] Smart-linking versus Whole Program Optimization

2021-03-10 Thread LacaK via fpc-pascal
be some infos about behavior on various targets) -Laco. On 10/03/2021 13:17, Yuriy Sydorov via fpc-pascal wrote: On 10.03.2021 11:34, LacaK via fpc-pascal wrote: A.) I compile my (units) program/library with -CX -XX (set in Project Options) Just a small note: -CX -XX are not needed

[fpc-pascal] Smart-linking versus Whole Program Optimization

2021-03-10 Thread LacaK via fpc-pascal
Hi, my goal is DO NOT include unused procedures, methods in final program/library on Win32 target exe/dll. A.) I compile my (units) program/library with -CX -XX (set in Project Options) B.) I did also experiments with WPO: -OWall -FWprogram.wpo -Xs- (plus -Owall -Fwprogram.wpo)

Re: [fpc-pascal] Cannot write datetime field on sqlite3 database on ARM

2021-03-09 Thread LacaK via fpc-pascal
Dňa 9.3.2021 o 15:34 Toru Takubo via fpc-pascal napísal(a): On 2021/03/09 18:11, LacaK via fpc-pascal wrote: I did run test program on RaspberryPI: Linux+ARM and results are as expected. (FPC 3.2.0) -Laco. Thank you for your reproduction test. It may be a good news that the problem would

Re: [fpc-pascal] Cannot write datetime field on sqlite3 database on ARM

2021-03-09 Thread LacaK via fpc-pascal
I did run test program on RaspberryPI: Linux+ARM and results are as expected. (FPC 3.2.0) -Laco. Dňa 9.3.2021 o 1:47 Toru Takubo via fpc-pascal napísal(a): On 2021/03/08 16:54, Michael Van Canneyt via fpc-pascal wrote: On Mon, 8 Mar 2021, Toru Takubo via fpc-pascal wrote: Hi, I am

[fpc-pascal] Initialization of constant pointer type - bug? [was: Re: Initialization of constant record member of pointer type]

2020-12-16 Thread LacaK via fpc-pascal
Hello, this compiles under FPC 3.0.4 const   s: AnsiString = 'abc';   p: pointer = @s[1]; but not under FPC 3.2.0 (I checked old Delphi XE and there it does not compile also) Is it regression bug or not? -Laco. Thank you, yes it works. I have used: const    MyConst1: AnsiString =

Re: [fpc-pascal] Initialization of constant record member of pointer type

2020-12-14 Thread LacaK via fpc-pascal
Because MyConst1 is not an *untyped* constant. Only untyped constants can be used in constant expressions (a pointer to something can be considered an untyped constant). The following might work though I did not test it: === code begin === const    MyStr = 'abc'    MyConst1: AnsiString =

Re: [fpc-pascal] Initialization of constant record member of pointer type

2020-12-14 Thread LacaK via fpc-pascal
Thank you, yes it works. I have used: const    MyConst1: AnsiString = 'abc'    MyConst2: TMyRec = (a: @MyConst1[1]); It doesn't compile with fpc 3.2.0 (I'm trying, without success so far, your open62541 translation). Yes, you are right. That ^ compiles under FPC 3.0 but not under FPC

Re: [fpc-pascal] Initialization of constant record member of pointer type

2020-12-04 Thread LacaK via fpc-pascal
Dňa 2.12.2020 o 16:09 Tomas Hajny via fpc-pascal napísal(a): On 2020-12-02 16:01, LacaK via fpc-pascal wrote: Dňa 2.12.2020 o 13:55 Tomas Hajny via fpc-pascal napísal(a): On 2020-12-01 11:39, Ladislav Karrach via fpc-pascal wrote: Because MyConst1 is not an *untyped* constant. Only untyped

Re: [fpc-pascal] Initialization of constant record member of pointer type

2020-12-02 Thread LacaK via fpc-pascal
Dňa 2.12.2020 o 13:55 Tomas Hajny via fpc-pascal napísal(a): On 2020-12-01 11:39, Ladislav Karrach via fpc-pascal wrote: Because MyConst1 is not an *untyped* constant. Only untyped constants can be used in constant expressions (a pointer to something can be considered an untyped constant).

Re: [fpc-pascal] Initialization of constant record member of pointer type

2020-12-01 Thread LacaK via fpc-pascal
Dňa 30.11.2020 o 23:26 Sven Barth via fpc-pascal napísal(a): Am 30.11.2020 um 13:20 schrieb LacaK via fpc-pascal: Hi, is there a way how to initialize record member of pointer type (other than PChar) in the following example: type   TMyRec=record     a: PByte; // if I change PByte

[fpc-pascal] Initialization of constant record member of pointer type

2020-11-30 Thread LacaK via fpc-pascal
Hi, is there a way how to initialize record member of pointer type (other than PChar) in the following example: type   TMyRec=record     a: PByte; // if I change PByte to PAnsiChar then it works   end; const   MyConst: TMyRec = (a: 'abcd'); // I want to a points to static memory where

Re: [fpc-pascal] -Fu unit search path and network paths

2020-09-22 Thread LacaK via fpc-pascal
are supported in -Fu (unit search path) networks paths? i.e. -Fu\\server\share -Fu\\server\share\path ? Correction: unit cannot be found only if it is placed in "share root" \\server\share ! When is placed in \\server\share\path then it is found. Why? Possibly Share vs directory.   A

Re: [fpc-pascal] -Fu unit search path and network paths

2020-09-21 Thread LacaK via fpc-pascal
Dňa 21.9.2020 o 12:35 Marco van de Voort via fpc-pascal napísal(a): Op 2020-09-21 om 08:57 schreef LacaK via fpc-pascal: Hi *, are supported in -Fu (unit search path) networks paths? i.e. -Fu\\server\share -Fu\\server\share\path ? Correction: unit cannot be found only if it is placed

Re: [fpc-pascal] -Fu unit search path and network paths

2020-09-21 Thread LacaK via fpc-pascal
Hi *, are supported in -Fu (unit search path) networks paths? i.e. -Fu\\server\share -Fu\\server\share\path ? Correction: unit cannot be found only if it is placed in "share root" \\server\share ! When is placed in \\server\share\path then it is found. Addition: when I use in *uses*

Re: [fpc-pascal] -Fu unit search path and network paths

2020-09-21 Thread LacaK via fpc-pascal
Hi *, are supported in -Fu (unit search path) networks paths? i.e. -Fu\\server\share -Fu\\server\share\path ? Correction: unit cannot be found only if it is placed in "share root" \\server\share ! When is placed in \\server\share\path then it is found. Why? When I am compiling project,

[fpc-pascal] -Fu unit search path and network paths

2020-09-21 Thread LacaK via fpc-pascal
Hi *, are supported in -Fu (unit search path) networks paths? i.e. -Fu\\server\share -Fu\\server\share\path ? When I am compiling project, which is located on local drive, but uses units from network, error is raised while compiling project file .lpr "Cannot find XYZ used by ..." (when I map

Re: [fpc-pascal] String literals and code page of .pas source file

2020-09-13 Thread LacaK via fpc-pascal
<<< text/html;charset=utf-8: Unrecognized >>> ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Sending Hex codes over TCP/IP

2020-09-13 Thread LacaK via fpc-pascal
Dňa Fri, 11 Sep 2020 19:13:38 -0400 James Richters via fpc-pascal napísal:> What I'm trying to do is control some different ethernet relays. > They use> MODBUS TCP. I'm trying to keep it as simple as possible. I found >a modbus> library for Pascal but it was way over complicated for that I

Re: [fpc-pascal] String literals and code page of .pas source file

2020-09-10 Thread LacaK via fpc-pascal
> .>>> The implicit conversion is explicitly expected by the user>>> in this case if I understand it correctly (source in CP1250), right?>> >> If you mean the "non implicit conversion" requires explicit>> conversion by the user, then yes.> > No, I mean that the original poster explicitly

Re: [fpc-pascal] String literals and code page of .pas source file

2020-09-09 Thread LacaK via fpc-pascal
in that case compiler does not insert conversion code. StringCodePage(c4)=1250 (also StringCodePage(c2)=1250) so dynamic code page is right, but when assigning to TLabel.Caption current dynamic code page is not taken into account For LacaK I recommend using UTF-8 encoding as much as possible. The

Re: [fpc-pascal] String literals and code page of .pas source file

2020-09-09 Thread LacaK via fpc-pascal
attached simple Lazarus compilable project (one Form). ... type   String1250 = type AnsiString(1250); const   c2: AnsiString = 'áéíóčž';   c3: WideString = 'áéíóčž';   c4: String1250 = 'áéíóčž'; { TForm1 } procedure TForm1.FormShow(Sender: TObject); begin   label1.Caption:='áéíóčž'; //

Re: [fpc-pascal] String literals and code page of .pas source file

2020-09-07 Thread LacaK via fpc-pascal
Hello Jonas, attached simple Lazarus compilable project (one Form). ... type   String1250 = type AnsiString(1250); const   c2: AnsiString = 'áéíóčž';   c3: WideString = 'áéíóčž';   c4: String1250 = 'áéíóčž'; { TForm1 } procedure TForm1.FormShow(Sender: TObject); begin  

Re: [fpc-pascal] String literals and code page of .pas source file

2020-09-03 Thread LacaK via fpc-pascal
Hi *, I would like to have source file in Windows-1250 encoding, where are stored literal strings like 'áéíóčž' in Windows-1250 encoding (I share this one file between FPC/Lazarus and Delphi 7). Windows-1250 is also ANSI code page of my Windows OS. In source file I have: {$IFDEF FPC}  

[fpc-pascal] String literals and code page of .pas source file

2020-09-02 Thread LacaK via fpc-pascal
Hi *, I would like to have source file in Windows-1250 encoding, where are stored literal strings like 'áéíóčž' in Windows-1250 encoding (I share this one file between FPC/Lazarus and Delphi 7). Windows-1250 is also ANSI code page of my Windows OS. In source file I have: {$IFDEF FPC}  

Re: [fpc-pascal] Lazarus 2.0.10 FPC 3.2.0 TFPHTTPClient no longer supports https

2020-08-05 Thread LacaK
After upgrading to Lazarus 2.0.10 FPC 3.2.0 , my existing code using TFPHTTPClient.Get('https://api.telegram.org/bot') returns the error "No SSL Socket support compiled in" How can I fix it? Simply add one of the units opensslsockets or gnutlssockets to the uses clause of the program.

Re: [fpc-pascal] Lazarus 2.0.10 FPC 3.2.0 TFPHTTPClient no longer supports https

2020-08-04 Thread LacaK
After upgrading to Lazarus 2.0.10 FPC 3.2.0 , my existing code using TFPHTTPClient.Get('https://api.telegram.org/bot') returns the error "No SSL Socket support compiled in" How can I fix it? Simply add one of the units opensslsockets or gnutlssockets to the uses clause of the program.

Re: [fpc-pascal] FPC_CURRENCY_IS_INT64

2019-10-14 Thread LacaK
>> what is the meaning of this compiler define?>> I am expecting, that Currency datatype is internaly stored using >>Int64>> datatype (*1).>> This compiler define is set for Win64, but not for Win32.>> Does it means, that on Win32 there is Currency internaly represented>> using another data

[fpc-pascal] FPC_CURRENCY_IS_INT64

2019-10-14 Thread LacaK
Hi, what is the meaning of this compiler define? I am expecting, that Currency datatype is internaly stored using Int64 datatype (*1). This compiler define is set for Win64, but not for Win32. Does it means, that on Win32 there is Currency internaly represented using another data type?

Re: [fpc-pascal] Overloading Inc and Dec procedures?

2019-09-18 Thread LacaK
Hi *, seems, that overloading of Inc, Dec internal compiler procedures is not allowed. Is it by intention or can it be fixed (adding overload keyword to system function definitions?). Yes, this is by intention and no, it can't be fixed. Thank you! Can it be

[fpc-pascal] Overloading Inc and Dec procedures?

2019-09-18 Thread LacaK
Hi *, seems, that overloading of Inc, Dec internal compiler procedures is not allowed. Is it by intention or can it be fixed (adding overload keyword to system function definitions?). I would like to add support for:   procedure Inc(var a: integer; b: single); overload; inline;   begin    

Re: [fpc-pascal] Generics: Error: Can't determine which overloaded function to call

2019-09-18 Thread LacaK
Work-around which produces good assembler without writting/reading intermediate variables: class function T2DPoint.Sqr(value: T): T; static; inline; begin   Result := value*value; end; function T2DPoint.Distance(P: T2DPoint): Single; inline; begin   Result := Sqrt(Sqr(x-P.x) + Sqr(y-P.y));

[fpc-pascal] Generics: Error: Can't determine which overloaded function to call

2019-09-18 Thread LacaK
Hi *, I have generics record, where one method computes distance between 2 points: function T2DPoint.Distance(P: T2DPoint): Single; begin   Result := Sqrt(Sqr(x-P.x) + Sqr(y-P.y)); end; But this does not compile as there are many versions of Sqr() in the scope Sqr(longint), Sqr(QWord),

Re: [fpc-pascal] Read lines into UnicodeString variable from UCS2 (UTF-16) encoded text file

2019-09-16 Thread LacaK
Yes, GetTextBOM/SetTextBOM as described above make sense, good idea. Just to be clear - I don't have capacity to work on the implementation myself, unfortunately this is also my case for now your potential contribution would be appreciated. maybe sometime later I will take the time to

Re: [fpc-pascal] Read lines into UnicodeString variable from UCS2 (UTF-16) encoded text file

2019-09-16 Thread LacaK
Hi *, As promised, I discussed the idea of adding support for UTF-16 encoded text files (and preferably UTF-32 as well while at it) to the RTL with other core team members. Overall, I didn't come across anybody oposing this idea, the only (logical) requirement is taking care of the

Re: [fpc-pascal] Read lines into UnicodeString variable from UCS2 (UTF-16) encoded text file

2019-09-05 Thread LacaK
wledge of RTL internals so it is reason why also others core developers should step in) L. On 2019-09-05 13:04, Joost van der Sluis wrote: Op 05-09-19 om 12:06 schreef Tomas Hajny: On 2019-09-05 09:00, LacaK wrote: Is there consensus/demand on such solution and any patch in this direction will be

Re: [fpc-pascal] Read lines into UnicodeString variable from UCS2 (UTF-16) encoded text file

2019-09-05 Thread LacaK
You may be able to improve on this using system.BlockRead. Probably yes, but then I must read in local buffer and examine buffer for CR/LF. And return from my function UCS2ReadLn() only portion of string up to CR/LF and rest of string return on next call to my function. (so I must keep

Re: [fpc-pascal] Read lines into UnicodeString variable from UCS2 (UTF-16) encoded text file

2019-09-04 Thread LacaK
unprocessed part in global buffer) Also, you are assuming low order byte first which may not be portable. Yes, In my case LE is sufficient as far as I check presence of BOM $FF$FE L. On 04/09/2019 11:14, LacaK wrote: Nice! Thank you very much. As an alternative for F:TextFile I am using

Re: [fpc-pascal] Read lines into UnicodeString variable from UCS2 (UTF-16) encoded text file

2019-09-04 Thread LacaK
Nice! Thank you very much. As an alternative for F:TextFile I am using: procedure UCS2ReadLn(var F: TextFile; out s: String); var   c: record   case boolean of    false: (a: array[0..1] of AnsiChar);    true : (w: WideChar); end; begin   s:='';   while not Eof(F) do begin    

Re: [fpc-pascal] Read lines into UnicodeString variable from UCS2 (UTF-16) encoded text file

2019-09-04 Thread LacaK
is there any smart way how to read string data line by line from UCS2 encoded text files (lines delimited by $0A00). So, some LoadFromFile with a stream is no option for you? It should be an option, but AFAIK LoadFromFile with optional TEncoding is not a part of FPC 3.0.4 It is only in

[fpc-pascal] Read lines into UnicodeString variable from UCS2 (UTF-16) encoded text file

2019-09-03 Thread LacaK
Hi *, is there any smart way how to read string data line by line from UCS2 encoded text files (lines delimited by $0A00). Using ReadLn(TextFile, UnicodeStringVariable) does not work as per comment in text.inc: // all standard input is assumed to be ansi-encoded Nor reading into WideChar

[fpc-pascal] Open file for append when exists else create new one

2019-07-09 Thread LacaK
Hi, I want to achieve this: If file with given name already exists then open it for append else create new one and open it for append. I use something like:   FileName:='FileName'+formatdatetime('yymmdd',date)+'.log';   if FileExists(FileName) then F:=FileOpen(FileName,

Re: [fpc-pascal] Compile for WinCE 7, target ARM, CPU Cortex-A9

2019-04-09 Thread LacaK
Note that you probably don't need two different cross compilers if your cpu-OS target is the same Target CPU family is same: "arm", but Target processor is not the same: "ARMv4" versus "ARMv7" ... So I do not know if this requires two

Re: [fpc-pascal] Compile for WinCE 7, target ARM, CPU Cortex-A9

2019-04-05 Thread LacaK
Note that you probably don't need two different cross compilers if your cpu-OS target is the same Target CPU family is same: "arm", but Target processor is not the same: "ARMv4" versus "ARMv7" ... So I do not know if this requires two pre-compiled cross-compilers

Re: [fpc-pascal] Compile for WinCE 7, target ARM, CPU Cortex-A9

2019-04-05 Thread LacaK
Drawback is that I must now maintain 2 FPC installations/cross-compilers (Win32-WinCE): one for targer WinCE 5,6 with CPUs ARMv5 and another for WinCE 7 with ARMv7 CPU (It is not sufficient to setup build modes in project ... also all units must be pre-compiled ... at

Re: [fpc-pascal] Compile for WinCE 7, target ARM, CPU Cortex-A9

2019-04-04 Thread LacaK
Hi, Is there needed something special to setup when I want compile for my Symbol MC9200 device, which has Windows Embedded Compact 7 and Dual core 1GHz OMAP 4 processor (ARM Cortex-A9). When I set up simplest project with only few lines of code and compile for OS="WinCE", CPU family="arm"

[fpc-pascal] Compile for WinCE 7, target ARM, CPU Cortex-A9

2019-04-03 Thread LacaK
Hi, Is there needed something special to setup when I want compile for my Symbol MC9200 device, which has Windows Embedded Compact 7 and Dual core 1GHz OMAP 4 processor (ARM Cortex-A9). When I set up simplest project with only few lines of code and compile for OS="WinCE", CPU family="arm"

Re: [fpc-pascal] fpPDF and support of Latin2 charset

2019-03-22 Thread LacaK
(I am asking because in future probably in our company we will need generate PDF invoices which should be digitaly signed) I've looked at the documentation and it is quite doable to implement this. Could be a nice task, but it will and somewhere at the bottom of my to-do list until I

Re: [fpc-pascal] fpPDF and support of Latin2 charset

2019-03-22 Thread LacaK
(but looking into PDF there is still in FontDescriptor wrong MissingWidth attribute, which does not goes into play AFAICS) What do you think is wrong with it? Look into test-noembed.pdf which I have attached to prior email. There is: 10 0 obj << /Type /FontDescriptor /FontName /Courier#20New

Re: [fpc-pascal] fpPDF and support of Latin2 charset

2019-03-22 Thread LacaK
I attached 2 patches to the bug tracker which solves the problem for me. 1. I can confirm, that in my case it is fixed for NO-embedded case only. For embedded fonts case there is still small issue (some characters are okay, some are shifted) - see attachments (but looking into PDF there is

Re: [fpc-pascal] fpPDF and support of Latin2 charset

2019-03-21 Thread LacaK
I am trying work with fpPDF. I can create PDF document, but character out of ASCII range are displayed wrong (in PDF file they are stored as UTF8). First things first... what version of FPC are you using? FPC 3.0.4 or FPC 3.1.1 - just so I know what code to look at. I tried both versions

Re: [fpc-pascal] fpPDF and support of Latin2 charset

2019-03-20 Thread LacaK
Is there way how to get correct PDF file WITHOUT embedding full Courier font? You can embed only the needed characters for every font ? Probably yes, but fpPDF will not handle this automatically? AFAIK I can not control this. But why I get unreadable characters? What I am doing wrong

Re: [fpc-pascal] fpPDF and support of Latin2 charset

2019-03-20 Thread LacaK
Is there way how to get correct PDF file WITHOUT embedding full Courier font? You can embed only the needed characters for every font ? Probably yes, but fpPDF will not handle this automatically? AFAIK I can not control this. But why I get unreadable characters? What I am doing wrong ?

Re: [fpc-pascal] fpPDF and support of Latin2 charset

2019-03-19 Thread LacaK
Is there way how to get correct PDF file WITHOUT embedding full Courier font? You can embed only the needed characters for every font ? Probably yes, but fpPDF will not handle this automatically? AFAIK I can not control this. But why I get unreadable characters? What I am doing wrong ?

Re: [fpc-pascal] fpPDF and support of Latin2 charset

2019-03-19 Thread LacaK
Hi, I am trying work with fpPDF. I can create PDF document, but character out of ASCII range are displayed wrong (in PDF file they are stored as UTF8). Probably it is because I use standard Courier font, which is expecting only "Latin characters" ? I use: FontIndex :=

[fpc-pascal] fpPDF and support of Latin2 charset

2019-03-19 Thread LacaK
Hi, I am trying work with fpPDF. I can create PDF document, but character out of ASCII range are displayed wrong (in PDF file they are stored as UTF8). Probably it is because I use standard Courier font, which is expecting only "Latin characters" ? I use: FontIndex :=

[fpc-pascal] Conversion of buffer of UnicodeChars to AnsiString

2019-01-22 Thread LacaK
Hi, is there smarter way how to convert buffer of UnicodeChars to AnsiString taking into account codepage conversion as: as := String(UnicodeCharLenToString(buffer, buflen shr 1)); ? And second question if I want to avoid warnings: "Implicit conversion from WideString to AnsiString ..." in

Re: [fpc-pascal] Small typo in User_Changes_Trunk ?

2019-01-07 Thread LacaK
> Am Mo., 7. Jan. 2019, 08:33 hat LacaK <mailto:la...@zoznam.sk>> geschrieben: > > Hi, > > reading > > http://wiki.freepascal.org/User_Changes_Trunk#Modeswitch_TypeHelpers_in_Delphi_modes_enables_type_helper-syntax > there is: > >

[fpc-pascal] Small typo in User_Changes_Trunk ?

2019-01-06 Thread LacaK
Hi, reading http://wiki.freepascal.org/User_Changes_Trunk#Modeswitch_TypeHelpers_in_Delphi_modes_enables_type_helper-syntax there is: Remedy: The only problems arise if one disabled the modeswitch on purpose which now longer disallows the extension of primitive types. Is there missing "no"?:

Re: [fpc-pascal] Can't determine which overloaded function to call

2018-12-05 Thread LacaK
>> helps, but why is it not needed in Win32? Why for Win32 >> "integer"-"integer" is considered as "integer" so compiler can determine >> which overloaded function to call and for Win64 compiler compiler can >> NOT determine which overloaded function to call? > > It is because as documented at >

Re: [fpc-pascal] Can't determine which overloaded function to call

2018-12-04 Thread LacaK
> >> Hi *, >> >> this code compiles for target Win32 but does not compile for >> Win64/x86-64. Why? Is there workaround? >> (Error: Can't determine which overloaded function to call) >> Thank you > For me, in win32 works fine Yes in Win32 works also for me. And this is my question why it does

[fpc-pascal] Can't determine which overloaded function to call

2018-12-04 Thread LacaK
Hi *, this code compiles for target Win32 but does not compile for Win64/x86-64. Why? Is there workaround? (Error: Can't determine which overloaded function to call) Thank you -Laco. === code sample ===   TRec1 = record     x,y: integer;     function Offset(const Ax,Ay: integer): TRec1;

Re: [fpc-pascal] Firebird vs. SQLite vs. PosgreSQL

2018-11-06 Thread LacaK
Hi, Comparasion of some basic features between database engines you can find at: https://en.wikipedia.org/wiki/Comparison_of_relational_database_management_systems L. > Hi, > This isn't a Free Pascal question but I wanted to ask about the > Firebird database [1] because it seems as the Free

Re: [fpc-pascal] Regression in StrToDateTime()

2018-06-14 Thread LacaK
can prepare think about patch, but I must know what situations, formats must be supported by SplitDateTimeStr() and what is expected output. (this should be documented is source code) L. On Thu, 14 Jun 2018, LacaK wrote: Hi, now I am migrating my applications from FPC 2.6.4 to FPC 3.0.4

[fpc-pascal] Regression in StrToDateTime()

2018-06-14 Thread LacaK
Hi, now I am migrating my applications from FPC 2.6.4 to FPC 3.0.4 and I noticed that logic in function StrToDateTime() was changed. In 2.6.4 there was first detected position of first TimeSeparator and then walking back to first occurence of WhiteSpace. This approach allows DateSeparator='.

Re: [fpc-pascal] Currency and Int64 casting

2018-05-18 Thread LacaK
Moreover: var c: currency; i1: int64; i2: int64 absolute c; begin c := 68719476736; i1 := Trunc(c*1); writeln(c,', ',i1,', ',i2); readln; end. Win32 (as expected): 6.8719476736E+10, 68719476736, 68719476736 Win64 (wrong) :

Re: [fpc-pascal] Currency and Int64 casting

2018-05-18 Thread LacaK
. __ > Od: LacaK <la...@zoznam.sk> > Komu: fpc-pascal@lists.freepascal.org > Datum: 18.05.2018 07:54 > Předmět: Re: [fpc-pascal] Currency and Int64 casting > Linux 64-bit Lazarus 1.9.0 r57948M FPC 3.1.1 x86_64-linux-qt gives 1.00E+00 1 What is dissassem

Re: [fpc-pascal] Currency and Int64 casting

2018-05-18 Thread LacaK
across platforms. I just noticed that you wrote you are expecting 1000. You should expect 1 since currency has four decimals. Yes, it was typo. Of course I expect 1 L. V. __ > Od: LacaK <la...@zoznam.sk> > Komu

Re: [fpc-pascal] Currency and Int64 casting

2018-05-17 Thread LacaK
,%rdx 000115DC 4889152daa0300 mov %rdx,0x3aa2d(%rip) # 0x10003c010 L. __ > Od: LacaK <la...@zoznam.sk> > Komu: FPC-Pascal users discussions <fpc-pascal@lists.freepascal.org> > Datum: 17.05

[fpc-pascal] Currency and Int64 casting

2018-05-17 Thread LacaK
Hi, consider following program: var c: currency; begin c := 1; writeln(c,' ',Int64(c)); readln; end. FPC 3.0.4 On Win32/x86 I get: 1, 1000 (what I am expecting) On Win64/x86_64 I get: 1, 1 Is is as expected ? Is there safe way for both platforms how to get 1000 (beside that I can

Re: [fpc-pascal] Multiple active class helpers at same time

2018-04-23 Thread LacaK
Is planned support for multiple class(objet, record) helpers in a way, that all class helpers can be used in parallel not only one? Yes, it is planned. Main problem currently (aside from time) is to define when a method hides the method of another helper, especially when

Re: [fpc-pascal] Multiple active class helpers at same time

2018-04-23 Thread LacaK
Dňa 23.4.2018 o 13:52 Maciej Izak napísal(a): 2018-04-23 13:45 GMT+02:00 Maciej Izak >: https://github.com/maciej-izak/PascalSmartPointers/tree/master/examples

[fpc-pascal] Multiple active class helpers at same time

2018-04-23 Thread LacaK
Hi , I am sure that this was already discussed, but I can not find any conclusion. Is planned support for multiple class(objet, record) helpers in a way, that all class helpers can be used in parallel not only one? My use case is: In unit A I have declared base class. In unit B I have

Re: [fpc-pascal] FPC attributes / annotations support

2017-11-29 Thread LacaK
the idea) a rewrite of a multi-million lines of code project into C#, rather than move to open source development tools where they can keep the huge code base, the same language and reuse the same development skills. How weird?? Have corporates lost their minds. I believe that the real problem

Re: [fpc-pascal] Callbacks as nested functions

2017-10-23 Thread LacaK
Btw there is long-time open ... may be related bug https://bugs.freepascal.org/view.php?id=18702 L. Dňa 23.10.2017 o 16:42 Michael Van Canneyt napísal(a): On Mon, 23 Oct 2017, Ryan Joseph wrote: On Oct 23, 2017, at 9:05 PM, Michael Van Canneyt wrote: It is

Re: [fpc-pascal] TBufDataset vs TClientDataset

2017-10-10 Thread LacaK
Also, what's the difference between TBufDataset and TMemDataset? Aren't they both in-memory datasets? If so, why do we have two different components for the same thing? As Michael wrote TMemDataSet is older. And I add that it is also much "lighter". So for somebody who does not need

  1   2   3   >