[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
> This is a bit counter intuitive to me. It is explained here: https://wiki.freepascal.org/Unicode_Support_in_Lazarus IMO "c4" case (c4: String1250 = 'áéíóčž';) is not fully explained. Probably what here happens is, that declared code page of c4 = source file code page and in that case

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}