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}
{$COD
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}
{$C
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
label1.Caption:='áéíóč
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:='áéíóčž'; //
> 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 comp
> .>>> 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 mentioned
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 need
<<< text/html;charset=utf-8: Unrecognized >>>
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/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
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, wh
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* cla
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 in
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 dir
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 'abcd'
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 to
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).
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
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 3.2
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 =
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 = 'abc'
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 develo
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
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)
Questions
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 for the
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 procedures/function
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
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 i
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 touched
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
...
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, righ
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
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.
___
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,
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 a
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 {$IFOPT
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 (wi
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
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
https://www.freepascal.org/docs-html/rtl/sysutils/
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;
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 branc
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 representabl
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 << E
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 a
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.
___
/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 hea
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
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, rawstring,ans
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.
A
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.
https://www.freepascal.org/docs-html/
49 matches
Mail list logo