On 22/04/2022 17:13, Rainer Stratmann via fpc-pascal wrote:
Am Freitag, 22. April 2022, 17:27:33 CEST schrieb Hairy Pixels via fpc-pascal:
On Apr 22, 2022, at 8:48 PM, Rainer Stratmann via fpc-pascal
From assembly to high-level language there is a huge step.
From high-level language to implici
On 29/12/2021 11:22, wkitty42--- via fpc-pascal wrote:
On 12/29/21 4:54 AM, Michael Van Canneyt via fpc-pascal wrote:
Translated to RPC: if you want speed, don't use HTTP or JSON. WST
offers a
binary protocol and plain TCP channel, it's bound to be much faster.
i'm sorry... what is WST? googl
On 29/10/2020 18:27, Ryan Joseph via fpc-pascal wrote:
Is it possible that the TypeInfo intrinsic could work with generic template types or is
this a bug? I get "Illegal qualifier" in the procedure below.
generic procedure DoThis(a: array of T);
begin
writeln(TypeInfo(T)^.name);
end;
Regar
On 21/10/2020 21:34, Ryan Joseph via fpc-pascal wrote:
I thought default would just return the first value in the enum but I guess
it's just zeros. Maybe we need a better default for objfpc mode.
The first element is returned by Low(TEnum), and the first value by
Ord(Low(TEnum)).
On 04/10/2020 20:58, James Richters via fpc-pascal wrote:
I’m wondering if there is a way to pass an array of values to a
Procedure without defining an array variable….
For example, if I have a Procedure:
Procedure DoSomething(X :Byte);
Then I can call it with a specific a variable like thi
On 25/03/2020 17:46, wkitt...@windstream.net wrote:
On 3/24/20 6:58 PM, Sven Barth via fpc-pascal wrote:
wkitt...@windstream.net schrieb am Di., 24. März 2020, 18:37:
you should figure out why typed constants are not being allowed/used
in your setup...
Typed constants can not be used to init
On 15/03/2020 12:06, Ryan Joseph via fpc-pascal wrote:
program test;
var
data: array[0..2] of integer;
begin
// Incompatible types: got "{Array Of Const/Constant Open} Array of ShortInt" expected
"Array[0..2] Of LongInt"
data := [1,2,3];
end.
With recent FPCs you can however do this:
On 03/02/2020 13:17, Sven Barth via fpc-pascal wrote:
Howard Page-Clark via fpc-pascal <mailto:fpc-pascal@lists.freepascal.org>> schrieb am Mo., 3. Feb.
2020, 11:22:
FPC 3.0.4 compiles this code excerpt without a murmur:
== code ==
{$mode objfpc}{$H+}
type
T
FPC 3.0.4 compiles this code excerpt without a murmur:
== code ==
{$mode objfpc}{$H+}
type
TSheetInfo = record
name: String;
tab: String;
title: String;
kind: TSheetKind; // an enumeration
color: TColor;
end;
TBaseSheet = class(TTabSheet)
protected
FSheetInfo:
On 30/07/17 19:55, Marcos Douglas B. Santos wrote:
I would like to instantiate my attribute only once inside constructor
and then it will be "const" or "final", I mean, immutable.
Today it is not possible, right? Any thoughts to the future?
It is not what you are asking for, but you can do this:
On 04/04/17 05:25, Ryan Joseph wrote:
Is it possible use FillChar on a multidimensional arrays?
arr: array of array of array of integer.
SetLength(arr, 3, 3, 3);
FillChar(arr[0], (3*3*3)*sizeof(integer), false);
I’m just getting crashes.
You can always use FillChar and its kin on specific 'ne
Consider this program, which returns False:
program Project1;
uses sysutils;
var
&begin: boolean;
begin
&begin:=IsValidIdent('&begin');
WriteLn('IsValidIdent(''&begin'') evaluates to ', &begin);
end.
Should sysutils.IsValidIdent() be updated to return True in this case?
___
On 23/12/16 08:14, Bo Berglund wrote:
Is there a quick way to split a string of whitespace separated values
into the separate members?
It is possible that a custom string parser (something along these lines)
might improve your processing speed:
type
TDoubleArray = array of Double;
functio
On 23/12/2015 11:40, Santiago A. wrote:
It's an object, not a class inherited from Tobject, so it hasn't create
constructor.
Try this:
program simpleObjConsole;
type
{ TSimpleArrayString }
TSimpleArrayString=object
public
List:array of String;
constructor Init;
destructo
On 28/03/2015 08:31, Sven Barth wrote:
Am 28.03.2015 06:51 schrieb "Howard Page-Clark" mailto:h...@talktalk.net>>:
>
> The following program, compiles and runs as expected using a
shortstring declaration in the TExample record.
> Could someone explain how to adapt i
The following program, compiles and runs as expected using a shortstring
declaration in the TExample record.
Could someone explain how to adapt it to cope with a TExample record
containing ansistrings?
Howard
== code ==
program Project1;
{$mode objfpc}{$H+}
{$ModeSwitch advancedrecords}
use
On 20/03/2015 07:25, Torsten Bonde Christiansen wrote:
Hi.
Is there method in fpc to find the highest common class-type of two
derived classes?
I do not know of such a routine, though there may well be one somewhere.
I would have said that the highest common class would always be TObject,
be
On 19/01/2015 13:29, Dmitry Boyarintsev wrote:
Not sure which pascal its inherited from... but Delphi 7 does
compile it too.
It was certainly a feature of the first TurboPascal, and perhaps was in
even earlier Pascal compilers, enabling simple insertion of control
characters from the
On 13/12/2014 02:50, silvioprog wrote:
...
for i := 1 to c do
getenumname(typeinfo(tenum), integer(en));
...
I think for a fairer comparison with WriteStr the compared GetEnumName
call should be
...
for i := 1 to c do
s := GetEnumName(TypeInfo(tenum), integer(en));
...
Mind you, on m
On 11/12/2014 21:07, Mark Morgan Lloyd wrote:
I've been doing a bulk replace of 'case..else' to 'case..otherwise' to
eliminate possible ambiguities that have bitten me in the past, and have
noticed something interesting under 2.6.4 on x86 Linux.
How can "else" be ambiguous within a case stateme
On 15/07/2014 19:56, rupert THURNER wrote:
type
TForm1 = class(TForm)
procedure SpeedButton1Click(Sender: TObject);
procedure TForm1.SpeedButton1Click(Sender: TObject);
procedure TForm1.CreateButton(t: Integer;l: Integer;btext: String; machine:
String);
var
button: TSpeedButton;
beg
On 07/06/2014 15:49, Michael Van Canneyt wrote:
On Sat, 7 Jun 2014, Krzysztof wrote:
Hi,
I need to analyze a lot of big objects (a lot of properties, global
vars etc). Looking for easy way to print object info in
format:
TObject
Property/VarName = value
end;
It should also step into subo
On 19/03/2014 22:01, Timothy Groves wrote:
Is there a drop-dead simple way to clone an object?
The convention established in Delphi for TPersistent descendants is to
provide an Assign method to do this, so for TPersistent descendants
(components, controls etc.) you can just override this meth
On 01/02/2014 18:54, Sven Barth wrote:
On 01.02.2014 19:10, Howard Page-Clark wrote:
In a situation where
PPropInfo^.PropType^.Kind=tkMethod
does RTTI enable you to determine the number and/or types of the
parameters that method uses (if any)?
Yes, please take a look at the tkMethod part
In a situation where
PPropInfo^.PropType^.Kind=tkMethod
does RTTI enable you to determine the number and/or types of the
parameters that method uses (if any)?
If not, is there a programmatic way to determine that information apart
from parsing the source?
Howard
___
On 26/01/2014 21:20, Fred van Stappen wrote:
Does it exist a option to compile fpc without Delphi compatibility ?
If no, what do you think about that ?
I know, it will be lot of work (like create a Delhi_Compatiblizer
class...) but it could be great for people who want a "lighter"
compiler...(l
On 21/01/2014 17:33, Jürgen Hestermann wrote:
I always wondered why I get a compiler message for the following code
...
if i+length(M)
Length is declared in the compiler/RTL to return an integer result.
Howard
___
fpc-pascal maillist - fpc-pascal
I recently wrote code that produced this Warning
... Warning: compiler switches aren't supported in \ styled comments
Should this not read as follows?
Warning: compiler switches aren't supported in / styled comments
___
fpc-pascal maillist - fpc-pa
On 08/01/2014 20:01, Sven Barth wrote:
On 08.01.2014 19:40, Howard Page-Clark wrote:
On 08/01/2014 18:16, Jürgen Hestermann wrote:
Today I found this type definition in some FreePascal sources:
TypeReal =type Double;
I wondered what the second “type” keyword means here (I have never seen
On 08/01/2014 18:16, Jürgen Hestermann wrote:
Today I found this type definition in some FreePascal sources:
TypeReal =type Double;
I wondered what the second “type” keyword means here (I have never seen
this before).
You are being rather obtuse.
Ignore the diagrams in the docs if they don't
The following program:
program Project1;
{$mode objfpc}{$H+}
var
s:ansistring;
begin
WriteLn('s <',s,'> always seems to be initialized to ');
end.
produces a Warning
Warning: Variable "s" does not seem to be initialized
Can this Warning be disabled for compiler-managed variables?
H
On 06/09/2013 14:10, Mark Morgan Lloyd wrote:
I'm sure there isn't a single "right" answer to this question, but if
transferring Pascal source to a system that enforces short lines (e.g.
78 chars + CRLF) what's the best automatic breaking rule?
One possibility is obviously to break after the rig
I've been exploring interfaces a bit, and fail to understand when
automatic destruction of an object is precipitated by the compiler, and
when not.
Consider the lifetime of the two instances i1 and i2 in the following
program. It seems that i2 (called in a method of i1) is freed
automatically,
On 06/06/2013 08:32, Mark Morgan Lloyd wrote:
Reinier Olislagers wrote:
On 6-6-2013 7:52, Florian Klämpfl wrote:
Reinier Olislagers
schrieb:
On 5-6-2013 22:02, Florian Klämpfl wrote:
I'am opposed to an LLVM backend but if Jonas implements one I can and
will not influence this :)
That's cle
On 14/03/13 7:59, Mattias Gaertner wrote:
Xiangrong wanted to know if the above array is initialized.
If you want to test that then you have to either single step via
the debugger or to compare the allocated memory before and after.
The problem is that you do not know the memory position before
On 13/03/13 9:50, Mattias Gaertner wrote:
On Wed, 13 Mar 2013 09:35:43 +
Howard Page-Clark wrote:
On 12/03/13 8:30, Xiangrong Fang wrote:
TMyClass = class
myarray: array[0..100] of Integer;
end;
You could answer such questions yourself:
Not with this simple test.
[...]
my
On 12/03/13 8:30, Xiangrong Fang wrote:
TMyClass = class
myarray: array[0..100] of Integer;
end;
You could answer such questions yourself:
program Project1;
{$mode objfpc}
type
TMyClass = class
myarray: array of Integer;
end;
var my:TMyClass;
begin
my:=TMyClass.Create;
try
wri
On 10/03/13 2:12, Jonas Maebe wrote:
There is a already a test for larger set support:
http://svn.freepascal.org/svn/fpc/trunk/tests/test/tset6.pp
Nobody has worked yet on implementing it, but if anyone thinks it's easy to do,
please go ahead. For larger sets,
especially if they are sparse,
On 04/03/13 10:33, José Mejuto wrote:
The code that makes me wonder something is wrong is this one:
---
{$mode objfpc}
{$h+}
procedure TheB(var aTheA: string);
begin
aTheA:=aTheA+'A';
end;
function TheA(): string;
begin
//Result:='';
TheB(Result);
en
On 04/03/13 8:23, Juha Manninen wrote:
On Mon, Mar 4, 2013 at 9:21 PM, José Mejuto wrote:
What's the expected output of this code ?
function TheA(): string;
begin
Result:=Result+'A';
end;
writeln(TheA());
I thought that when the result type is an automated one its value gets
initialized..
On 01/03/13 5:34, John Lee wrote:
Think I'm missing something! I need the/a fpc registry unit - I can't
seem to find it on svn - lots of references to it! Pls send or point me
to it.
If you use Lazarus, just make sure FCL is a declared dependency in your
project, and add
uses registry;
to
On 28/02/13 12:19, Marcos Douglas wrote:
Very good!
But I'm afraid if someone thinking if Pascal is just for kids 5-9
years old... not here, but out there! :)
Thank you for share it.
"Year 5-9" kids refers to their school year, not their calendar age. In
the UK a Year 9 teenager is 13 or 14
FPC allows the Delphi-compatible "class abstract" syntax, but does not
seem to prevent instantiation of such a class.
The following code compiles and runs satisfactorily (FPC version 2.6.0)
Does trunk prevent this compiling?
program Project1;
{$mode objfpc}{$H+}
type
TAbstractClass = class a
On 08/1/13 11:48, Michael Fuchs wrote:
program AbstractTest;
{$MODE ObjFpc}{$H+}
uses Classes;
type
TAbstractClass = class abstract(TObject)
end;
var
MyAbstractClass: TAbstractClass = nil;
begin
MyAbstractClass := TAbstractClass.Create;
MyAbstractClass.Free;
end.
'Casting' a
On 07/1/13 2:42, Paul Ishenin wrote:
You don't understand.
Class destructor is called automatically like finalization section of a
unit. You can't call it directly.
Thanks for the clarification. I was confused by the fact that the
writeln called in the class destructor is not displayed. But I
The following program compiles and gives output as expected, but if the
lines that call the class destructor are uncommented it fails to compile
with the error "identifier idents no member "Finalise"
program classConstructor;
{$mode objfpc}
uses Classes;
type
TXClass = class
cl
On 18/12/12 10:56, Mattias Gaertner wrote:
Looking through some of the codetools sources makes me wonder if the
codetools overlooks some C-style FPC operators.
KeywordFuncLists.pas, for instance, seems not to know about >>, <<,
+=, -=, *=, /=.
I added the << and >>.
The others are assignment
Looking through some of the codetools sources makes me wonder if the
codetools overlooks some C-style FPC operators.
KeywordFuncLists.pas, for instance, seems not to know about >>, <<,
+=, -=, *=, /=.
Or are these operators are catered for elsewhere in the codetools?
Howard
___
On 07/12/12 2:50, Krzysztof wrote:
Hi,
Interfaces can have aliases for functions:
Function MyOtherFunction : Integer;
Function IMyInterface.MyFunc = MyOtherFunction;
Can normal object have aliases for properties? For example,
TControl.Caption. I would like to publish this property in
Describing the Case statement The FPLanguageReference.pdf 10.2.2 says:
The constants appearing in the various case parts must be known at
compile-time, and can be of the following types : enumeration types,
Ordinal types (except boolean), and chars.
Why the "except boolean"? I find the compil
On 21/11/12 7:49, Kenneth Cochran wrote:
Yes.
type newString = type string;
Any function that accepts newString as a parameter will cause a
compilation error if you try to pass a normal string. You'll have to
cast it to newString first.
This is not the case, as the following program demonstra
On 22/10/12 3:17, Graeme Geldenhuys wrote:
On 2012-10-22 14:59, Vincent Snijders wrote:
I am more optimistic than Michael. Because the same source is used,
the CRC is the same and no recompile is done.
Thanks Vincent, things are looking better and better.
You might be interested to follow
On 14/9/12 2:43, Mattias Gaertner wrote:
> > c: set of Char = ['<','>',':','"','/','\','|','?','*', '%', '.'];
> But several of those are fine in filenames- just inadvisable since they
> need special quoting/escaping to get past the shell. As does ' ' which
> isn't in your list :-)
And i
On 13/8/12 9:56, Jürgen Hestermann wrote:
I am not able to use this function:
http://www.freepascal.org/docs-html/rtl/dos/weekday.html
nor can I find it in the sources.
Does it still exist?
If yes, how to use it? Which unit? DOS does not work.
You will find what you need at unit dateutils.
Wh
There is a typo in this documentation. The Description field refers to
get_caller_frame when get_caller_addr is surely meant.
Howard
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
On 07/8/12 1:10, Jürgen Hestermann wrote:
When I want to add a graphic element like TFileNameEdit which I have
already
used in other programs in the form editor I don't know how to find it in
the menu.
Although this is the fpc list you mention a LCL component and the form
editor, so I presume
On 06/8/12 3:26, Rainer Stratmann wrote:
procedure p1;
begin
...
end;
How to get all caller adresses of p1 in a program before p1 is executed?
For example p1 is called from 20 different places in a program.
Then I need the 20 caller adresses.
if by address you mean line number, then use t
On 06/8/12 1:32, leledumbo wrote:
Minor amendment needed to leledumbo's code to give Friday, and a five
year range:
uses SysUtils;
const startYr: word = 2012;
var dt: TDateTime;
year, month: word;
begin
for year in [0..4] do
for month in [1..12] do
begin
dt := EncodeDate(
On 24/4/12 5:25, Jürgen Hestermann wrote:
I wanted to write a program that has no window but may show messages to
the user.
I have lots of such programs written with Virtual Pascal but I am
struggling
to do the same with Free Pascal/Lazarus.
A simple test program would look like this:
-
On 06/4/12 7:38, Juha Manninen wrote:
Now I am looking for a proper XML parser for Delphi, for big XML files.
The default Delphi parser, using MS DOM, chokes badly. 4 GB memory is
not enough for it.
Another option is kbmMW from
http://www.components4programmers.com/products/index.htm
The ent
On 23/2/12 4:17, Everton Vieira wrote:
Is there any plans to implement public procedures/function of a class
that can be used without been necessary to create the class?
I presume you know about class methods such as TObject's
class function ClassName : shortstring;
that you can use like this
On 09/2/12 5:17, Zaher Dirkey wrote:
Hi,
TInfo=record
s: string;
i: integer;
end;
function func1(a: array of TInfo);
how can i pass the parameter to that function?
You have to declare the parameter type independently of the function
declaration. You can also do it without declaring an
On 17/1/12 9:47, ik wrote:
var
a : procedure(var x : TOrdinal);
b : procedure(var x : integer);
begin
a := @inc;
b := @dec;
Why doesn't the compiler like the above code ?
Inc and Dec are internal compiler routines, more like macros than true
functions. They are not coded as li
On 05/1/12 8:37, Graeme Geldenhuys wrote:
Thanks Paul. I'm almost ready to push the new website live. I'll make
sure I update your embedded section.
Regarding your previous message about documentation. My goal this year
is to complete the API documentation, and also start writing a free
"Devel
On 25/12/11 10:07, Jiří Pavlovský wrote:
What do you mean ?
I mean the code below works ok, so I don't undestand why it doesn't
compile when I use similar construct inside a function.
const ranges: array [1..2] of TMyRec =
(
(Start:0;Stop:3),
(Start:4;
On 18/12/11 5:07, David Emerson wrote:
1. Is it possible to make an alias to a function ... so rather than just
re-calling with the same parameters, it's actually the same thing? like the way
we can do, e.g., type natural = cardinal, or const GG = 6, but with a function?
There's always the simp
On 04/7/11 7:16, Calinov Valentin wrote:
Hi,
I need to display pseudo-graphic characters on Windows XP (English
version) using video unit
from fpc-2.4.4 .
When I use "Raster Fonts" they are displayed correctly
but when I use "Lucida Console" font, small squares are displayed instead.
The current
On 24/5/11 4:22, Luis Fernando Del Aguila Mejía wrote:
I know that you can use dynamic arrays (array of). Is better.
But this does not understand and confuse me.
Why to create an array of 3 elements (ANSIString) with GetMem, I have to
put a size of 15 bytes (5*3) and not 12 bytes (4*3).?
The prog
On 28/4/11 10:00, Jürgen Hestermann wrote:
Darius Blaszyk schrieb:
Is there any way to initialize object variables, other than writing an
init method?
So something like:
myobj = object
myvar: word = $;
end;
I don't think so.
An object is a pointer to a data structure on the heap.
At compi
On 06/2/11 1:55, Mark Morgan Lloyd wrote:
Given one or more lines of text which are known at compilation time, and
without the requirement to internationalize (these are, by RFC, US
ASCII), what is the best way to get them into a TStringList?
Perhaps there are better ways than the straightforwa
On 06/1/11 2:49, Gene Buckle wrote:
On Wed, 5 Jan 2011, leledumbo wrote:
If you want something fast, pyacc and plex distributed with fpc can be an
option. But I suggest writing your own since that way you'll have a full
control of its features.
Is there an fpc version of TIniFile?
g.
look
On 30/12/10 7:40, David Emerson wrote:
I'd like to use a constant record as a default parameter. Is there some way to
do this? Here's my use case:
type
lt_ints = record
left, top : longint;
end;
const
lt_zero : lt_ints = (left:0; top:0);
procedure do_something (const offset_lt
On 22/12/10 1:15, Torsten Bonde Christiansen wrote:
type
TMyType = (a, b, c ,d);
TMyTypes = set of TMyTypes;
const
SetX:TMyTypes = (a, b);
SetY:TMyTypes = (c, d);
SetCombined: TMyTypes = SetX + SetY; // this gives me an "Error: Illegal
expression"
Because you
Does this mean that to be able to define a literal value like "byteset := [0, 3,
101]"
>for a set (and probably for an array) I must have defined a custom
type for it; correct?
> (It's the only difference I see with my trials: numbers in my code is
not of a custom type but simply a var of typ
On 19/4/10 3:50, spir ☣ wrote:
Hello,
Total Pascal newbie here. Looked for answers in various references and
tutorials, but cannot find.
Fore-question: Is there a (free)pascal teaching/learning mailing list? (Like python's
"tutor" list.) If not, is this one a proper place?
* How does one dec
On 14/3/10 11:52, Frank Church wrote:
Your suggestion worked - what is the secret?
Does the array[0..0 have some relevance here?]
On 14 March 2010 23:01, Howard Page-Clark wrote:
On 14/3/10 6:11, Frank Church wrote:
Hi guys,
I am trying to compile the TVersionInfo component by Anders
On 14/3/10 6:11, Frank Church wrote:
Hi guys,
I am trying to compile the TVersionInfo component by Anders Melander
at http://melander.dk/articles/versioninfo/.
It defines the structure below
type
TTranslationRec = packed record
case Integer of
0: (
LanguageID: WORD;
On Sat, 28 Nov 2009 12:10:48 -0500
Anthony Walter wrote:
> procedure InitMyVariable(Value: T);
> function MyVariable: T;
>
> implementation
>
> var
> PrivateMyVariable: T;
> PrivateMyVariableSet: Boolean;
>
> procedure InitMyVariable(Value: T);
> begin
> if not PrivateMyVariableSet then
On Sat, 28 Nov 2009 15:07:42 +0100
Mattias Gaertner wrote:
> On Sat, 28 Nov 2009 14:58:26 +0100
> Jürgen Hestermann wrote:
>
> > > is it possible to set a variable in a programm as a readonly variable?
> Use the following:
>
> property MyVar: integer read FMyVar write SetMyVar;
>
> And in Se
On Wed, 4 Mar 2009 20:42:14 +0100
Aurélie de LUCA wrote:
> Hy everybody,
>
> I'm trying to use the TFileStream class to read a file with a record,
> and I obtain this message when I execute my application : Access
> violation. You can find my code in the following :
>
> type
> DmatLine= rec
On Sat, 13 Dec 2008 17:17:31 +0100
Mattias Gaertner wrote:
> Thanks for all the hints.
>
> At the moment I have the attached function.
> It returns only 4 on a 2 x quad core Mac.
> Maybe someone can test under windows?
The function returns 2 on my Pentium 4 (Win XP)
Ho
Felipe Monteiro de Carvalho wrote:
Here is my database file:
ID,NAMEEN,NAMEPT,HEIGHT,WIDTH,PINS,DRAWINGCODE
1,resistor,resistor,1,1,1,LINE
2,capacitor,capacitor,1,1,1,LINE
When listing the value of the NAMEEN field it will show: NAMEEN,
resistor, resistor (yes, resistor again!)
The correct sho
82 matches
Mail list logo