Re: [fpc-pascal] Type-casting a class variable

2024-05-02 Thread Martin Frb via fpc-pascal
On 02/05/2024 08:32, Adriaan van Os via fpc-pascal wrote: Martin Frb via fpc-pascal wrote: Silly question, but did you assign the value to the variable? myClass := TWindow; That's what I did. TWindow(myClass).CreateNewWindow; And this is what crashes. I can report this, if the type-cast

Re: [fpc-pascal] Type-casting a class variable

2024-05-01 Thread Martin Frb via fpc-pascal
On 01/05/2024 16:28, Adriaan van Os via fpc-pascal wrote: Suppose I have a var myClass: TClass and (for example) a class function TWindow.CreateNewWindow( ) Now I want to call CreateNewWindow for var myClass. Of course, depending on the class, CreateNewWindow will behave

Re: [fpc-pascal] Strings greater than 255 characters

2023-12-19 Thread Martin Frb via fpc-pascal
On 19/12/2023 12:36, James Richters via fpc-pascal wrote: I did notice that I cannot have a file of Ansistrings… Myfile : File of Ansistring; Causes a compiler error: Error: Typed files cannot contain reference-counted types. A "file of" must have a fixed size type. "file of word",

Re: [fpc-pascal] method-definition

2023-12-15 Thread Martin Frb via fpc-pascal
On 15/12/2023 14:56, Adriaan van Os via fpc-pascal wrote: I am puzzled by the syntax rule in Chapter 6. Classes of the FreePascal Language Reference (version 3.2.0) Section 6.1 Class definitions has method-definition = [ "CLASS" ] ( function-header | procedure-header |

Re: [fpc-pascal] operator := in mode delphi?

2023-10-25 Thread Martin Frb via fpc-pascal
Thanks, but that isn't the part of the answer I was looking for I was looking for a global operaton := That could be used for an array (rather than just record/class). But according to the docs that I found that is not possible On 24/10/2023 23:51, Sven Barth via fpc-pascal wrote: Martin

[fpc-pascal] operator := in mode delphi?

2023-10-24 Thread Martin Frb via fpc-pascal
Is there a modeswitch to enable it? Because currently I am getting an error in mode delphi. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] All methods vitrual ?

2023-10-11 Thread Martin Frb via fpc-pascal
On 11/10/2023 16:46, Adriaan van Os via fpc-pascal wrote: I don't see any use in allowing or disallowing something. And with the current design, it is, as I said, impossible, without macros, to compile the same code with {$M+} and {$M-}. Use $IfOpt instead of macros? {$IfOpt M+} published

Re: [fpc-pascal] Parse unicode scalar

2023-07-02 Thread Martin Frb via fpc-pascal
On 02/07/2023 19:20, Nikolay Nikolov via fpc-pascal wrote: On 7/2/23 16:30, Hairy Pixels via fpc-pascal wrote: I'm interested in parsing unicode scalars (I think they're called) to byte sized values but I'm not sure where to start. First thing I did was choose the unicode scalar U+1F496 ().

Re: [fpc-pascal] 3123 inherited not supported inside inline

2023-06-24 Thread Martin Frb via fpc-pascal
On 24/06/2023 17:21, Hairy Pixels via fpc-pascal wrote: On Jun 24, 2023, at 10:11 PM, Hairy Pixels wrote: Doesn't this mean the compiler can dictate the binary size by inlining everything even if the programmer doesn't want that? and another thing, I have frequent problems with a crash

Re: [fpc-pascal] Error: Argument cannot be assigned to

2023-06-04 Thread Martin Frb via fpc-pascal
On 04/06/2023 17:49, Martin via fpc-pascal wrote: On 04/06/2023 15:04, Juha Manninen via fpc-pascal wrote: Why the following code fails to compile? MyObj.RecInstance.ii := 123; Technically you can modify the members of the temp record (just to have the work thrown away afterwards). So I

Re: [fpc-pascal] Error: Argument cannot be assigned to

2023-06-04 Thread Martin Frb via fpc-pascal
On 04/06/2023 15:04, Juha Manninen via fpc-pascal wrote: Why the following code fails to compile?   TMyRec = record ... property     RecInstance: TMyRec read fRecInstance;// write fRecInstance; ... MyObj.RecInstance.ii := 123; Access through property seems to be the problem. Accessing

Re: [fpc-pascal] Forking the GitLab FPC Source repository

2023-05-01 Thread Martin Frb via fpc-pascal
On 01/05/2023 20:02, Norman Dunbar via fpc-pascal wrote: On 1 May 2023 17:27:52 BST, Christo Crause via fpc-pascal wrote: > FWIW, there are currently 68 forks of > the FPC source repository on GitLab. ... I noticed that when I tried to fork it. Unfortunately I am not able to fork those now

Re: [fpc-pascal] pointer to char vs pchar

2023-03-24 Thread Martin Frb via fpc-pascal
On 24/03/2023 15:04, Benito van der Zander via fpc-pascal wrote: why is a pointer to a char not a pchar (for type helpers)? My guess: For the same reason that "p2" fails in the below. Distinct type. May be assignment compatible, but a type of it's own. Imagine you had a different helper, with

Re: [fpc-pascal] Downloaded cross-compiler from Sourceforge - wiki incorrect?

2023-03-24 Thread Martin Frb via fpc-pascal
On 24/03/2023 07:38, Bo Berglund via fpc-pascal wrote: On Thu, 23 Mar 2023 09:47:36 +0100, Martin Frb via fpc-pascal wrote: You need to change the CPU to i386 too OK, I thought that the current processor could be used since it can run both types of programs... Well no, and probably

Re: [fpc-pascal] Downloaded cross-compiler from Sourceforge - wiki incorrect?

2023-03-23 Thread Martin Frb via fpc-pascal
On 23/03/2023 09:25, Bo Berglund via fpc-pascal wrote: Then opened Lazarus 2.2.4 with my project and changed project options as follows: Compiler_Options/Config_and_Target/Target OS(-T): Win32 Everything else left as-is. You need to change the CPU to i386 too

Re: [fpc-pascal] Union followed by Property does not compile !

2022-08-03 Thread Martin Frb via fpc-pascal
On 03/08/2022 12:41, wkitty42--- via fpc-pascal wrote: On 8/2/22 5:12 AM, Michael Van Canneyt via fpc-pascal wrote: The variant part of a record must always come last. FWIW: is this documented somewhere easily found? google free pascal language reference

Re: [fpc-pascal] "Is nested" vs "of object" compatibility with global functions

2022-05-29 Thread Martin Frb via fpc-pascal
On 29/05/2022 07:21, Michael Van Canneyt via fpc-pascal wrote: On Sun, 29 May 2022, Hairy Pixels via fpc-pascal wrote: I’ve been testing out all the different function pointer types in FPC to test their compatibility with each other and I noticed that “is nested” can accept a global function

Re: [fpc-pascal] Element type of set at compile time

2022-05-15 Thread Martin Frb via fpc-pascal
On 15/05/2022 15:07, Hairy Pixels via fpc-pascal wrote: var I: ElementType(TMySet); begin for i := low(TMySet) to high(TMySet) do ; type   TMySet = set of (one,two,three); var   I: low(TMySet) .. high(TMySet) ; begin   for i := low(TMySet) to high(TMySet) do     ;

Re: [fpc-pascal] Feature announcement: implicit generic function specializations

2022-04-25 Thread Martin Frb via fpc-pascal
On 25/04/22 05:15, Hairy Pixels via fpc-pascal wrote: generic function Add(left, right: T): T; And the programmer intends to call it like: Add(1,1); Why should the programmer need to tell the compiler it’s dealing with Integer when it’s so obvious from the types being used?

Re: [fpc-pascal] Possible fpdebug issue

2022-04-24 Thread Martin Frb via fpc-pascal
Lazarus 2.2 or 2.3 ? In 2.3 some work has been started to debug into dll... Is there a way to reproduce this? Also try: lazarus.exe  --debug-log=c:\logfile.txt

Re: [fpc-pascal] Feature announcement: implicit generic function specializations

2022-04-22 Thread Martin Frb via fpc-pascal
Possible one more / Though more of an optimization. If the code has multiple     Add(Int64(0), Int64(0)); then they will all use the same procedure (just break in the debugger and check the CRC). But if  one specialization is explicit and the other implicit then 2 identical (as far as I can

Re: [fpc-pascal] Feature announcement: implicit generic function specializations

2022-04-22 Thread Martin Frb via fpc-pascal
On 22/04/2022 23:12, Sven Barth via fpc-pascal wrote: Am 22.04.2022 um 20:51 schrieb Martin Frb via fpc-pascal: So why does it generate "Add$1" if it does not use it? (Or rather why does it warn, if this is some internal details?) Add$1 is the symbol of the gene

Re: [fpc-pascal] Feature announcement: implicit generic function specializations

2022-04-22 Thread Martin Frb via fpc-pascal
On 20/04/2022 19:15, Sven Barth via fpc-pascal wrote: This feature allows you to use generic routines (functions, procedures, methods) without explicitely specializing them (“<…>” in Delphi modes and “specialize …<…>” in non-Delphi modes) as long as the compiler can determine the correct

Re: [fpc-pascal] RTLEventWaitFor

2022-04-05 Thread Martin Frb via fpc-pascal
On 05/04/2022 01:03, Mattias Gaertner via fpc-pascal wrote: Under Linux a RTLEventWaitFor(e,1) usually waits at most 1ms. But under Windows it usually waits at least 15ms. It seems to round to nearest 1/64 of a second. Has anyone an idea if this is normal on Windows and if there is an

Re: [fpc-pascal] Inactive account on GitLab

2021-09-10 Thread Martin Frb via fpc-pascal
On 10/09/2021 10:42, Luca Olivetti via fpc-pascal wrote: Not a biggie now that I know how to find my bugs, though I'd prefer to find them with the proper filter (the first one with author_username) and not with a full text search. Still a full search, but more precise:

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

2021-08-12 Thread Martin Frb via fpc-pascal
On 12/08/2021 22:08, Vojtěch Čihák via fpc-pascal wrote: Hi, my numbers of Lazarus on Linux, Qt (incl. binaries and *.ppu and *.o files) SVN: lazarus dir: 2.6 GB (4 files, 1300 dirs) .svn subdir: 1.6 GB (25000 files, 260 dirs) GIT: lazarus dir: 1 GB (15000 files, 950 dirs) .git

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

2021-08-12 Thread Martin Frb via fpc-pascal
On 12/08/2021 15:30, Martin Frb via fpc-pascal wrote: depth=1 gitlab also offers you a tar.gz (or zip, or...) https://gitlab.com/freepascal.org/lazarus/lazarus/-/archive/main/lazarus-main.tar.gz https://gitlab.com/freepascal.org/lazarus/lazarus/-/archive/lazarus_2_2_0_RC1/lazarus

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

2021-08-12 Thread Martin Frb via fpc-pascal
On 12/08/2021 15:11, Bo Berglund via fpc-pascal wrote: On Wed, 11 Aug 2021 23:13:28 +0200, Martin Frb via fpc-pascal wrote: Well I don't know your script, and I am not sure how exactly you do that in svn It is not done in SVN, instead I visit the (now removed) page https

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

2021-08-12 Thread Martin Frb via fpc-pascal
On 12/08/2021 15:04, Michael Van Canneyt via fpc-pascal wrote: If you do an update of an existing directory, instead of git clone http://theurl/ thesourcedirectory you must do cd thesourcedirectory git pull cd .. This will reduce the download size considerably. If he stays on the same

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

2021-08-12 Thread Martin Frb via fpc-pascal
On 11/08/2021 22:12, Bo Berglund via fpc-pascal wrote: Please advice how to: 1) Find which is the latest release tag of fpc and lazarus Well I don't know your script, and I am not sure how exactly you do that in svn Also I do not know, if this is for a once up setup (so you only wont

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

2021-08-12 Thread Martin Frb via fpc-pascal
On 12/08/2021 06:26, Michael Van Canneyt via fpc-pascal wrote: Well, sorry to say, but I don't understand this. What's so hard about it ? 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

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

2021-08-12 Thread Martin Frb via fpc-pascal
On 12/08/2021 10:53, Christo Crause via fpc-pascal wrote: On Thu, Aug 12, 2021 at 7:34 AM LacaK via fpc-pascal > wrote: I have related question: in SVN was possible to checkout specific sub-directory (for example if I am interested in fcl-db

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

2021-08-12 Thread Martin Frb via fpc-pascal
On 12/08/2021 02:02, Dennis Lee Bieber via fpc-pascal wrote: And... the local repository will add files for each committed change... https://www.dulwich.io/docs/tutorial/file-format.html """ If you change a single line, another blob will be generated by Git each time you successfully

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

2021-08-12 Thread Martin Frb via fpc-pascal
On 12/08/2021 06:26, Michael Van Canneyt via fpc-pascal wrote: Well, sorry to say, but I don't understand this. What's so hard about it ? 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

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

2021-08-12 Thread Martin Frb via fpc-pascal
On 11/08/2021 22:12, Bo Berglund via fpc-pascal wrote: Please advice how to: 1) Find which is the latest release tag of fpc and lazarus Well I don't know your script, and I am not sure how exactly you do that in svn Also I do not know, if this is for a once up setup (so you only wont

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

2021-08-12 Thread Martin Frb via fpc-pascal
On 12/08/2021 06:55, Dmitry Boyarintsev via fpc-pascal wrote: On Thu, Aug 12, 2021 at 12:27 AM Michael Van Canneyt via fpc-pascal > wrote: It's like switching car brands from a VW to an Audi or so. Some buttons are in different places, your key

Re: [fpc-pascal] FPC & Lazarus moving to gitlab

2021-07-04 Thread Martin Frb via fpc-pascal
On 04/07/2021 21:25, Bo Berglund via fpc-pascal wrote: Does this mean that the sources will disappear from SVN? From the current svn => yes. afaik I am using scripts to install FPC and Lazarus on new systems and these use svn co commands towards: https://svn.freepascal.org/svn/fpc/tags/

Re: [fpc-pascal] Option type

2021-06-02 Thread Martin Frb via fpc-pascal
On 01/06/2021 22:40, Sven Barth via fpc-pascal wrote: Am 01.06.2021 um 20:20 schrieb denisgolovan via fpc-pascal: I am trying to implement Option type in FPC. type    generic TOption = record case IsSome:boolean of true: ( some: T ); false: ();    end; Well as already

Re: [fpc-pascal] How to find where my app consumes CPU?

2021-05-18 Thread Martin Frb via fpc-pascal
On 19/05/2021 00:29, Bo Berglund via fpc-pascal wrote: While not (bSTerm or bSInt or bsHup) do begin //Here is where the server runs as defined elsewhere //Eternal loop to wait for system messages Sleep(1); //To not hog the CPU CheckSynchronize;

Re: [fpc-pascal] [fpc-devel] Nested function closures

2021-04-28 Thread Martin Frb via fpc-pascal
On 28/04/2021 18:43, Graeme Geldenhuys via fpc-pascal wrote: Hello Sven, On 28/04/2021 6:32 am, Sven Barth via fpc-pascal wrote: Second: the syntax is required for Delphi compatibility anyway Couldn't such verbose syntax be limited to {$mode delphi} behaviour, and then leave {$mode objfpc}

Re: [fpc-pascal] lazarus ide space/dot display

2021-04-06 Thread Martin Frb via fpc-pascal
On 06/04/2021 18:26, jean-françois Jouvet via fpc-pascal wrote: does anyone knows how avoid display dot point for space between 2 words? Thanks in advance Menu: Tools > Options Page: Editor > General > Miscellaneous: Turn off "Show special characters" That will turn off tabs and spaces

Re: [fpc-pascal] Pull request for fphttpclient.pp in git mirror repo

2021-03-16 Thread Martin Frb via fpc-pascal
On 16/03/2021 22:21, Graeme Geldenhuys via fpc-pascal wrote: https://github.com/graemeg/freepascal/pull/18 Review instructions: For none git users, githup offers patch/diff https://github.com/graemeg/freepascal/compare/master...billyeatcookies:patch-1.diff

Re: [fpc-pascal] Unicode chars losing information

2021-03-08 Thread Martin Frb via fpc-pascal
On 08/03/2021 23:26, Tomas Hajny via fpc-pascal wrote: On 2021-03-08 21:36, Martin Frb via fpc-pascal wrote: I can think of 2 groups already. 1) Conversion due to explicit declared different encoding.    AnAnsiString := SomeWideString;   AnAsciiString := AnUtf8String; // declared as "

Re: [fpc-pascal] Unicode chars losing information

2021-03-08 Thread Martin Frb via fpc-pascal
On 08/03/2021 20:49, Jonas Maebe via fpc-pascal wrote: On 08/03/2021 19:16, Ryan Joseph via fpc-pascal wrote: I agree it would be nice to have some warning that indexing the unicodeString wouldn't work as expected. Then the compiler would have to give a warning for any indexing of

Re: [fpc-pascal] Traits Proposal

2021-02-18 Thread Martin Frb via fpc-pascal
On 18/02/2021 23:47, Ryan Joseph via fpc-pascal wrote: On Feb 18, 2021, at 12:33 PM, Martin Frb via fpc-pascal wrote: TMyFoo = class(specialize TTrait) procedure Foo; end; Of course that can get out of hand, if you want to include many traits. I'm not really understand

Re: [fpc-pascal] Traits Proposal

2021-02-18 Thread Martin Frb via fpc-pascal
On 18/02/2021 22:42, Sven Barth wrote: You need to constrain T as a TObject, then it works. Ah that works. With 2 restrictions TBase can be any class, since a trait can be applied to any class. So the only known common base is TObject. (restriction 1) But "TBase: TObject" means that the

Re: [fpc-pascal] Traits Proposal

2021-02-18 Thread Martin Frb via fpc-pascal
On 18/02/2021 18:46, Ryan Joseph via fpc-pascal wrote: On Feb 18, 2021, at 10:40 AM, Benito van der Zander via fpc-pascal wrote: Traits are like reverse type helpers. With the type helper you first declare the class and then the extending helper. Indeed, but with the crucial distinction

Re: [fpc-pascal] Traits Proposal

2021-02-14 Thread Martin Frb via fpc-pascal
On 14/02/2021 18:20, Sven Barth via fpc-pascal wrote:    TTest = class(TObject, ITest)    private fTest: TTestImpl;    public property Test: TTestImpl read fTest implements ITest; default;    end; Well there is a difference there. Interfaces are essentially inheritance. One can

Re: [fpc-pascal] Windows Defender considers fp.exe a malicious program

2021-02-13 Thread Martin Frb via fpc-pascal
On 13/02/2021 16:52, Ched via fpc-pascal wrote: Hello, For one software I compile with fpc, Avast always complained. But only when compiled for debugging. That exe was sent to the false positive departement, and it toke about _one mounth_ to have a corrected version of the AV. Afterwhat, he

Re: [fpc-pascal] Windows Defender considers fp.exe a malicious program

2021-02-13 Thread Martin Frb via fpc-pascal
On 13/02/2021 03:55, Travis Siegel via fpc-pascal wrote: that if you have any timing routines in your code, it tends to get flagged by virus scanners.  No clue why, but I've run afoul of that issue more than once. I read somewhere that some viruses have a build in wait, to evade sandbox

Re: [fpc-pascal] Windows Defender considers fp.exe a malicious program

2021-02-12 Thread Martin Frb via fpc-pascal
On 12/02/2021 22:48, James Richters via fpc-pascal wrote: I have no idea how to register a legitimate program as not having a virus. I've had this issue before but managed to track down the section of code that caused it... after a completely exhaustive search. Anti virus providers

Re: [fpc-pascal] Traits Proposal

2021-02-10 Thread Martin Frb via fpc-pascal
On 11/02/2021 04:13, Ryan Joseph via fpc-pascal wrote: On Feb 10, 2021, at 7:47 PM, Martin Frb via fpc-pascal wrote: In that case IIRC, it was said traits are not allowed constructors. Why? Traits are meant to be a way to import fields/methods and is based off of "object"

Re: [fpc-pascal] Traits Proposal

2021-02-10 Thread Martin Frb via fpc-pascal
On 11/02/2021 04:20, Ryan Joseph via fpc-pascal wrote: On Feb 10, 2021, at 7:47 PM, Martin Frb via fpc-pascal wrote: I understand it is for conflict resolution only. But see my example => as soon as you need to repeat a trait with just a change in name, you always need conflict resolut

Re: [fpc-pascal] Traits Proposal

2021-02-10 Thread Martin Frb via fpc-pascal
On 11/02/2021 03:07, Ryan Joseph via fpc-pascal wrote: We get the shared namespace So basically, we get the compiler to automatically create forwarder methods for us (or at least that behaviour). And that is all there is. right? In that case IIRC, it was said traits are not allowed

Re: [fpc-pascal] Traits Proposal

2021-02-10 Thread Martin Frb via fpc-pascal
On 10/02/2021 21:17, Ryan Joseph via fpc-pascal wrote: On Feb 10, 2021, at 12:40 PM, Martin Frb via fpc-pascal wrote: type TSomeTrait = trait public procedure DoTraitFoo; end; TSomeClass = class(TObject) private trait: TSomeTrait; // whatever syntax is used so

Re: [fpc-pascal] Traits Proposal

2021-02-10 Thread Martin Frb via fpc-pascal
On 10/02/2021 20:17, Ryan Joseph via fpc-pascal wrote: On Feb 10, 2021, at 11:09 AM, Ryan Joseph wrote: type TSomeTrait = trait public parent: TObject; procedure DoThis; end; procedure TSomeTrait .DoThis; begin // ??? here is our issue. Is this good enough to call the

Re: [fpc-pascal] Traits Proposal

2021-02-10 Thread Martin Frb via fpc-pascal
On 10/02/2021 16:59, Ryan Joseph via fpc-pascal wrote: • PHP (trait): https://www.php.net/manual/en/language.oop5.traits.php The example exposes another aspect: |trait SayWorld { public function sayHello() { parent::sayHello();| |In this case the trait has access to the object/class

Re: [fpc-pascal] GetClipboardFormatName causing an Error 216

2020-12-31 Thread Martin Frb via fpc-pascal
On 31/12/2020 18:11, James Richters via fpc-pascal wrote: Thanks for the info on SynEdit. Where can I find the synedit source related to the clipboard? I think the link you indtended ater 'See the code at.' Didn't come though, can you pleaese send it again? Sorry, I assumed SynEdit would

Re: [fpc-pascal] GetClipboardFormatName causing an Error 216

2020-12-30 Thread Martin Frb via fpc-pascal
I missed you have FN:=StrAlloc (255); in that case see Alexanders response. On 31/12/2020 02:00, Martin Frb via fpc-pascal wrote: FN must point to an existing buffer (allocated mem) that receives the result. FN : Array [0..255]of Byte; GotLen := GetClipboardFormatName(Format_Id, LPTSTR(@FN

Re: [fpc-pascal] GetClipboardFormatName causing an Error 216

2020-12-30 Thread Martin Frb via fpc-pascal
On 31/12/2020 01:09, James Richters via fpc-pascal wrote: Var FN : LPTSTR; Begin FN:=''; Writeln(Format_ID); GetClipboardFormatName(Format_Id,FN,250); Check the msdn help.

Re: [fpc-pascal] GetClipboardFormatName causing an Error 216

2020-12-30 Thread Martin Frb via fpc-pascal
On 31/12/2020 01:09, James Richters via fpc-pascal wrote: I'm trying to write a programs to get data from the windows clipboard that was put into it with Notepad++ using vertical editing. Just for Info, SynEdit (trunk) can handle notepad++ column selection See the code at. There are 2 common

[fpc-pascal] Off topic Re: TurboVision is reborn as FOSS (again)

2020-12-22 Thread Martin Frb via fpc-pascal
On 21/12/2020 10:26, Markus Greim via fpc-pascal wrote: Hello Nikolay, I am a German - so may be we are both "lost in translation" Sent from Front English and German tenses are very much alike. Except for English having the progressive forms, which do not exist in German (...ing form) past

Re: [fpc-pascal] How to implement a circular buffer object in pascal?

2020-09-03 Thread Martin Frb via fpc-pascal
On 03/09/2020 17:44, Martin Frb via fpc-pascal wrote: type   TMyData = class       FData: array of byte;    end;   TMyThreadedQueue = specialize TLazThreadedQueue; Of course you can do   TMyData = array of byte;  // or record end if you want   TMyThreadedQueue = specialize

Re: [fpc-pascal] How to implement a circular buffer object in pascal?

2020-09-03 Thread Martin Frb via fpc-pascal
On 03/09/2020 16:36, Bo Berglund via fpc-pascal wrote: A "simplest case" usage example would be nice to have. True. Once you got enough info from this thread, please write one. I still when looking at the sources have no clue as to how it would be used... It seems to me like at the very

Re: [fpc-pascal] How to implement a circular buffer object in pascal?

2020-09-03 Thread Martin Frb via fpc-pascal
On 03/09/2020 14:54, Bo Berglund via fpc-pascal wrote: Now to my question: Is there some *example* around for using TLazThreadedQueue as a circular buffer? In the examples dir are only examples for LazUnicode and LookUpStringList... And when reading the sources I cannot really say I understand

Re: [fpc-pascal] How to implement a circular buffer object in pascal?

2020-09-03 Thread Martin Frb via fpc-pascal
On 03/09/2020 10:09, Bo Berglund via fpc-pascal wrote: I would like to create a buffer into which a thread can push incoming data and the main thread can extract it for processing. Data are coming from the serial port in a worker thread and should be consumed by the main thread. The data is a

[fpc-pascal] properties // Re: fpDebug function-call proof-of-concept

2020-07-07 Thread Martin Frb
On 07/07/2020 15:04, Joost van der Sluis wrote: Op 07-07-2020 om 12:41 schreef Christo Crause via fpc-pascal: Great news! I guess this is a step towards evaluating object properties via get methods? That is the final goal, yes. For this, we will need to start looking at improving the

Re: [fpc-pascal] FpDebug hands-on: AnsiStrings

2020-05-21 Thread Martin Frb
On 21/05/2020 20:19, Joost van der Sluis wrote: Might be, you could see this as a saveguard. But my goal is to cut-out the middle part of the string. That's formatting Well, we should have the safeguard. And make it configurable. ... See below Part 2 is formatting related  In most

Re: [fpc-pascal] FpDebug hands-on: AnsiStrings

2020-05-21 Thread Martin Frb
On 21/05/2020 17:29, Joost van der Sluis wrote: I've added codepage-support for ansistrings, compiled with -gw3. This is done in the TFpValueDwarfV3FreePascalString class, which does the heavy work regarding the formatting of strings. Although there is also some code in

Re: [fpc-pascal] fpDebug extension for Visual Studio Code

2020-05-20 Thread Martin Frb
Ok, here are some of my ideas/hopes/dreams/wishes for the IDE They are all "ideas only", with on knowledge of when/if they may be done. I provide them, in the hope they will help choosing a path for the backend. The IDE should receive a "TWatchWhateverValue" from any of the backend, that

Re: [fpc-pascal] fpDebug extension for Visual Studio Code

2020-05-20 Thread Martin Frb
On 20/05/2020 19:54, Martin Frb wrote: If you look at using FpDebug directly, then you use TFpValue. (returned by PascalParser, or any Parser you want to add) All you need is to encapsulate PascalBuilder into a class. And stick the value and the builder into yet another object, holding both

Re: [fpc-pascal] fpDebug extension for Visual Studio Code

2020-05-20 Thread Martin Frb
On 20/05/2020 17:50, Joost van der Sluis wrote: I was very disappointed when i (re?)-discovered that fpDebug has a dependency on DebuggerIntf. It is a bit of a catch22: - On the one hand, FpDebug is/should be stand alone. - On the other hand, it would be a pity to have to copy all the used

Re: [fpc-pascal] fpDebug extension for Visual Studio Code

2020-05-19 Thread Martin Frb
On 19/05/2020 15:55, Joost van der Sluis wrote: On 5/19/20 12:59 PM, Martin Frb wrote: Where is that documented? Assuming this is part of the API? E.g. what goes into Flags/AdditionalInfo? You misunderstood me. The class above is my own design. The variable-definition of DAB is even simpler

Re: [fpc-pascal] fpDebug extension for Visual Studio Code

2020-05-19 Thread Martin Frb
On 19/05/2020 12:59, Martin Frb wrote: Where is that documented? Assuming this is part of the API? The closest I could find: https://microsoft.github.io/debug-adapter-protocol/specification#Types_Variable I would much prefer if "Flags: TStringArray" could be a "set of (...)&qu

Re: [fpc-pascal] fpDebug extension for Visual Studio Code

2020-05-19 Thread Martin Frb
On 19/05/2020 10:42, Joost van der Sluis wrote: Yes, you write about it earlier. Now it's time to discuss things. Looking at the DAB-protocol I came to some new insights. Microsoft managed to create a simple interface which makes it possible for all kinds of debuggers to work with the same

Re: [fpc-pascal] fpDebug extension for Visual Studio Code

2020-05-18 Thread Martin Frb
On 18/05/2020 23:43, Joost van der Sluis wrote: All the basics should work, if someone could test it a bit that would be nice. Threading-support is still very lacking, and how variables are presented is not really nice. I'll be working on that. While this can be changed in PascalBuilder,

Re: [fpc-pascal] Debug-Adapter-Protocol support for fpDebug

2020-04-26 Thread Martin Frb
On 26/04/2020 20:58, Mattias Gaertner via fpc-pascal wrote: On Sat, 25 Apr 2020 15:49:30 +0200 Martin Frb wrote: On 23/04/2020 22:10, Joost van der Sluis wrote: But maybe it should become a separate package now. Lazarus can use is as a dependency. We'll see. That would then reverse

Re: [fpc-pascal] Debug-Adapter-Protocol support for fpDebug

2020-04-25 Thread Martin Frb
On 25/04/2020 16:07, Ryan Joseph via fpc-pascal wrote: On Apr 24, 2020, at 3:10 AM, Joost van der Sluis wrote: I'm working on the support of the debug-adapter-protocol for fpDebug. It's quite easy to implement, as there already is a json-based tcp/ip interface.

Re: [fpc-pascal] Debug-Adapter-Protocol support for fpDebug

2020-04-25 Thread Martin Frb
On 23/04/2020 22:10, Joost van der Sluis wrote: But maybe it should become a separate package now. Lazarus can use is as a dependency. We'll see. That would then reverse the burden As it is part of bigide, it must be shipped with the installer. And also having it in the Lazarus repro

Re: [fpc-pascal] Prevent full unit path in ppu files? together with -Ur

2020-04-12 Thread Martin Frb
On 12/04/2020 16:31, Martin wrote: When building packages for an installer, one uses -Ur. Yet (on Windows) I noted, that the ppu contain the full path to the source file used to build that ppu. Not a major issue, but slightly awkward. - The files (ppu, and maybe sources) will be packed into

Re: [fpc-pascal] Compatibility problems with fpc > 3.3.1 rev 42375

2020-02-01 Thread Martin Frb
On 02/02/2020 04:22, fredvs via fpc-pascal wrote: Hello everybody. Good time to go back with that problem and fix it forever the right way! The problem is isolated and is fixed "hardcoded". From rev 42375, in msegui function dynarrayelesize(const typinfo: pdynarraytypeinfo): sizeint; inline;

Re: [fpc-pascal] Very vague gettickcount64 description?

2019-09-07 Thread Martin Frb
On 08/09/2019 02:07, Alexander Grotewohl wrote: but the resolution is not a ms at all. every call to gettickcount is something like 10-15ms or so off. you'd be lucky to call it a ms after it was updated by the os. do we document that too? As I said: "The minimum resolution may vary, and may be

Re: [fpc-pascal] Very vague gettickcount64 description?

2019-09-07 Thread Martin Frb
On 07/09/2019 21:42, Zoe Peterson wrote: GetTickCount and GetTickCount64 are Windows API functions that are explicitly documented as returning milliseconds, and FPC on Unix up to now is has matched that. Why in the world would you think that changing that behavior would be a good idea,

Re: [fpc-pascal] specify variable name with string variable

2019-07-08 Thread Martin Frb
On 08/07/2019 14:09, James Richters wrote: I'm on windows Generics.Collections seems to be something that was added after 3.0.4, I've downloaded the current FPC source code, but I’m not sure how to build it.. can someone point me in the right direction on how to compile the current

Re: [fpc-pascal] specify variable name with string variable

2019-07-08 Thread Martin Frb
On 08/07/2019 14:09, James Richters wrote: I'm on windows Generics.Collections seems to be something that was added after 3.0.4, I've downloaded the current FPC source code, but I’m not sure how to build it.. can someone point me in the right direction on how to compile the current

Re: [fpc-pascal] Lazarus Release 2.0.2 - suggestions

2019-04-16 Thread Martin Frb
On 16/04/2019 22:17, Ralf Quint wrote: On 4/16/2019 1:11 PM, Martin Frb wrote: On 16/04/2019 22:03, Ralf Quint wrote: Schwachfug. (Bollocks for the Anglophiles around here) And for those with American English: B*S* But I really dont see where to put 2nd, let alone a 3rd  50 inch screen

Re: [fpc-pascal] Lazarus Release 2.0.2 - suggestions

2019-04-16 Thread Martin Frb
On 16/04/2019 22:03, Ralf Quint wrote: Schwachfug. (Bollocks for the Anglophiles around here) And for those with American English: B*S* But I really dont see where to put 2nd, let alone a 3rd  50 inch screen. ;) ;) ;) ... not (unfortunately) SCNR

Re: [fpc-pascal] Lazarus Release 2.0.2 - suggestions (screen reader)

2019-04-16 Thread Martin Frb
About ctrl+shift+arrow key: Do you know any documentation on how to implement this. What API to call, to let the screen reader know? Also for other modifications needed, any documentation? -- On 16/04/2019 14:31, Mgr. Janusz Chmiel wrote: For now, I would like to thank you, that you have

[fpc-pascal] MacOS wrong timestamp in debug map object file

2019-04-15 Thread Martin Frb
I don't know the Mac well enough... What could cause the below? From https://forum.lazarus.freepascal.org/index.php/topic,44950.msg317604.html#msg317604 The logfile tells that the units have been compiled right before lldb was launched. So the date 15.4 should be correct. LLDB complains

Re: [fpc-pascal] class contracts [[was: Re: Optional param modifier]]

2019-04-15 Thread Martin Frb
On 15/04/2019 09:41, Sven Barth via fpc-pascal wrote: Am 14.04.2019 um 23:48 schrieb Martin Frb: As for "documentation". I disagree with the way it is done in oxygen. But I am not sure I have any good alternative. For me a class contract (require/ensure) is part of the interface.

[fpc-pascal] class contracts [[was: Re: Optional param modifier]]

2019-04-15 Thread Martin Frb
On 15/04/2019 09:41, Sven Barth via fpc-pascal wrote: Am 14.04.2019 um 23:48 schrieb Martin Frb: type   TFoo= class function DoTheFooThing(Foo1, Foo2: TFoo): Tbar;     requires    assigned(Foo1) or assigned(Foo2): 'Need at least 1 foo, for the connection';     guarantees

Re: [fpc-pascal] Optional param modifier

2019-04-14 Thread Martin Frb
On 15/04/2019 01:19, Ryan Joseph wrote: On Apr 14, 2019, at 7:08 PM, Martin Frb wrote: Almost. assert takes the condition itself assert(condition_that_must_be_true, 'error message') so it would be assert(name<>'', 'requires "name <> " failed for CreateHero');

Re: [fpc-pascal] Optional param modifier

2019-04-14 Thread Martin Frb
On 15/04/2019 00:53, Ryan Joseph wrote: Here’s what I imagine that would look like: procedure CreateHero (name: string; hp: integer); requires name <> ''; (hp > 0) and (hp < 100); begin // compilers parses the conditions and inserts as if statements: // if name <> ‘’ then //

Re: [fpc-pascal] Optional param modifier

2019-04-14 Thread Martin Frb
On 14/04/2019 22:08, Ryan Joseph wrote: function FindThing: TThing; optional; means you MUST check for nil. If the value is nil that’s not an error. “optional” is probably a bad name for this I know. function MakeThing: TThing; this means maybe check for nil or maybe not

Re: [fpc-pascal] Optional param modifier

2019-04-14 Thread Martin Frb
On 14/04/2019 23:48, Martin Frb wrote: I admit the contract/assert stuff may have made it seem different. But that is because this approach does not hold up (IMHO). And therefore the closest alternative was presented. In the very end it is to avoid crashing on nil de-ref. And the contract

Re: [fpc-pascal] Optional param modifier

2019-04-14 Thread Martin Frb
On 14/04/2019 22:08, Ryan Joseph wrote: Per my example, currently we know that GetThing() COULD return nil so unless we know what the function does by reading the documentation or looking at the implementation we need to test for nil. Right? I suggest the modifier simply to enforce that

Re: [fpc-pascal] Optional param modifier

2019-04-14 Thread Martin Frb
On 14/04/2019 19:53, Ryan Joseph wrote: On Apr 14, 2019, at 1:38 PM, Sven Barth via fpc-pascal wrote: As already said by Martin: the compiler *can not* determine all cases whether the parameter is Nil or not, so it *must* be done at runtime to ensure this. Otherwise the feature is just as

Re: [fpc-pascal] Optional param modifier

2019-04-14 Thread Martin Frb
On 14/04/2019 18:04, Martin Frb wrote: On 14/04/2019 16:05, Ryan Joseph wrote: On Apr 14, 2019, at 3:15 AM, Sven Barth via fpc-pascal wrote: Your idea requires exceptions as well. The compiler is not capable checking whether valid entries are passed in at compile time except for simple

Re: [fpc-pascal] Optional param modifier

2019-04-14 Thread Martin Frb
On 14/04/2019 16:05, Ryan Joseph wrote: On Apr 14, 2019, at 3:15 AM, Sven Barth via fpc-pascal wrote: Your idea requires exceptions as well. The compiler is not capable checking whether valid entries are passed in at compile time except for simple, constant cases, so runtime checks are

Re: [fpc-pascal] Optional param modifier

2019-04-13 Thread Martin Frb
On 14/04/2019 00:01, Sven Barth via fpc-pascal wrote: Well, there is Oxygene's concept of Class Contracts (see https://docs.elementscompiler.com/Concepts/ClassContracts/ ), so if anything in that direction would be done I'd be inclined towards their syntax (and I've played with the idea to

  1   2   >