Re: [fpc-pascal] Case statement for class introspection

2022-01-19 Thread Ryan Joseph via fpc-pascal
Ok I got this almost done (mirroring is great I didn't know I could do that) and did the rebase which shows the linear history now. First a question, do I need to do the "rebase main" again before I push to remote or does it stay this way now? Problem is I go to push the changes to the my remo

Re: [fpc-pascal] Case statement for class introspection

2022-01-19 Thread Ryan Joseph via fpc-pascal
> On Jan 19, 2022, at 8:14 PM, Ryan Joseph wrote: > > Ok I got this almost done (mirroring is great I didn't know I could do that) > and did the rebase which shows the linear history now. > > First a question, do I need to do the "rebase main" again before I push to > remote or does it stay

Re: [fpc-pascal] Case statement for class introspection

2022-01-20 Thread Ryan Joseph via fpc-pascal
> On Jan 20, 2022, at 9:11 AM, Ryan Joseph wrote: > > The problem was my remote for the branch got lost after rebasing but I think > I fixed it by re-pulling. > > It looks like some unrelated commits are included in my merge request but > maybe that happened because I rebased the repo after

Re: [fpc-pascal] Case statement for class introspection

2022-01-20 Thread Ryan Joseph via fpc-pascal
> On Jan 20, 2022, at 8:10 PM, Ryan Joseph wrote: > > I just check at https://gitlab.com/freepascal.org/fpc/source/-/merge_requests > and I don't see my merge request appeared. If it were GitHub I would expect > to see it there. What did I do wrong? So what I did was created a merge request

[fpc-pascal] Macro expanding error

2022-01-25 Thread Ryan Joseph via fpc-pascal
I have this macro: {$define TCallback := TCallback2} which gives a long list of these errors. warning: Expanding of macros exceeds a depth of 16. What does this warning mean and how can I resolve it? Regards, Ryan Joseph ___ fpc-pascal maill

Re: [fpc-pascal] Macro expanding error

2022-01-27 Thread Ryan Joseph via fpc-pascal
> On Jan 27, 2022, at 12:10 AM, Pierre Muller via fpc-pascal > wrote: > > You should probably try to look for another define somewhere else! Thanks I found it. The error was misleading as it directed me the first occurrence when it was the second one that did it. I think using undef would

[fpc-pascal] $PASCALMAINNAME error with SDL/IPhone

2022-01-30 Thread Ryan Joseph via fpc-pascal
I thought I had this working some years ago but I'm confused again. :) When trying to use SDL on iPhone I include: {$PASCALMAINNAME SDL_main} But when I compile I get a linker error: Undefined symbols for architecture x86_64: "_main", referenced from: implicit entry/start for main execu

Re: [fpc-pascal] $PASCALMAINNAME error with SDL/IPhone

2022-01-31 Thread Ryan Joseph via fpc-pascal
> On Feb 1, 2022, at 3:15 AM, Jonas Maebe via fpc-pascal > wrote: > > It only works in your main program, not in a unit or so. Maybe that's the > reason? The linker wants me to redefine "main" to clear the error but this doesn't make sense and the app crashes when launched. I.e.: function

Re: [fpc-pascal] $PASCALMAINNAME error with SDL/IPhone

2022-02-01 Thread Ryan Joseph via fpc-pascal
> On Feb 1, 2022, at 9:34 AM, Ryan Joseph wrote: > > My only guess is that the linker can't find the SDL main function in the > framework, even though everything else links properly. If anyone understands SDL I figured out how to get around this missing main linker error and program runs but

Re: [fpc-pascal] $PASCALMAINNAME error with SDL/IPhone

2022-02-02 Thread Ryan Joseph via fpc-pascal
> On Feb 1, 2022, at 9:22 PM, Ryan Joseph wrote: > > > If anyone understands SDL I figured out how to get around this missing main > linker error and program runs but then crashes. I've reported to SDL at > https://discourse.libsdl.org/t/crash-in-uitextfield/34711 (along with my > program i

Re: [fpc-pascal] bug or feature?

2022-02-12 Thread Ryan Joseph via fpc-pascal
> On Feb 12, 2022, at 11:40 PM, Jonas Maebe via fpc-pascal > wrote: > > I wouldn't consider this to be working by design, but rather because of > implementation limitations. I agree and it should be fixed probably. Regards, Ryan Joseph __

[fpc-pascal] Caller agnostic procedure variables

2022-02-14 Thread Ryan Joseph via fpc-pascal
This has been a constant problem for me with FPC and wanted to make a formal post with code examples since I've only mentioned it in passing before. How can it be achieved to have a caller agnostic procedure variables? I've tried making some big crazy dispatch record that uses generics but becau

Re: [fpc-pascal] Caller agnostic procedure variables

2022-02-14 Thread Ryan Joseph via fpc-pascal
> On Feb 15, 2022, at 2:09 PM, Michael Van Canneyt via fpc-pascal > wrote: > > I've answered this question before: > > The "Reference to procedure" that will be part of anonymous functionswill do > this for you. I'm sorry I forgot! This thing keeps coming up for me and driving me nuts but I

Re: [fpc-pascal] Caller agnostic procedure variables

2022-02-15 Thread Ryan Joseph via fpc-pascal
> On Feb 15, 2022, at 3:32 PM, Michael Van Canneyt via fpc-pascal > wrote: > > I requested that this: > > procedure TMyObject.Demo; > > Procedure DoSub; > begin >Writeln('Sub'); > end; > > begin > DoTest(DoSub); > end; So that means "reference to procedure" is not compatible with "

Re: [fpc-pascal] Caller agnostic procedure variables

2022-02-15 Thread Ryan Joseph via fpc-pascal
> On Feb 15, 2022, at 5:15 PM, Sven Barth wrote: > > It contains a capture object that backs the method. > If nothing is captured and the right hand side is a direct function or method > pointer then the compiler could in principle create something that is > essentially static to avoid alloc

Re: [fpc-pascal] Caller agnostic procedure variables

2022-02-15 Thread Ryan Joseph via fpc-pascal
> On Feb 15, 2022, at 7:10 PM, Michael Van Canneyt > wrote: > > In Delphi it is not. In FPC it should be :-) Indeed should be but that's what I'm trying to figure out with how this is implemented. Why wouldn't Delphi be able to do this I wonder. The calling mechanism in this object is not

Re: [fpc-pascal] Caller agnostic procedure variables

2022-02-15 Thread Ryan Joseph via fpc-pascal
> On Feb 15, 2022, at 8:32 PM, Sven Barth via fpc-pascal > wrote: > > A function reference is simply an interface of which the Invoke method can be > called on the instance instead of manually doing "Foo.Invoke". > > The real "magic" is when the compiler generates the *implementation* of sai

Re: [fpc-pascal] Caller agnostic procedure variables

2022-02-15 Thread Ryan Joseph via fpc-pascal
> On Feb 15, 2022, at 8:26 PM, Sven Barth via fpc-pascal > wrote: > > It's relatively "easy" to implement assigning a nested function to function > references. However assigning a nested function variable to a function > reference is much harder. > Assigning a function reference to a nested

Re: [fpc-pascal] Caller agnostic procedure variables

2022-02-15 Thread Ryan Joseph via fpc-pascal
> On Feb 16, 2022, at 2:46 AM, Sven Barth via fpc-pascal > wrote: > > // nested function/procedure/routine variable > type > TFoobarNested = function: LongInt is nested; > > var >f: TFoobarFuncRef; > begin > // anonymous function/procedure/routine > f := function: LongInt >

Re: [fpc-pascal] Caller agnostic procedure variables

2022-02-15 Thread Ryan Joseph via fpc-pascal
> On Feb 15, 2022, at 11:09 PM, Sven Barth via fpc-pascal > wrote: > > For a global function the compiler has to generate a wrapper that gets rid of > the Self parameter of the interface. > The compiler generates this interface at compile time right? And then when the scope of the calling

Re: [fpc-pascal] Caller agnostic procedure variables

2022-02-15 Thread Ryan Joseph via fpc-pascal
> On Feb 16, 2022, at 12:18 AM, Thomas Kurz via fpc-pascal > wrote: > > What release are anonymous functions planed for? FPC 3.4.0? They aren't even in trunk yet. Could be months or years. Regards, Ryan Joseph ___ fpc-pascal maillist - f

[fpc-pascal] Bit manipulation helpers

2022-02-21 Thread Ryan Joseph via fpc-pascal
I tried to use the bit helpers like https://www.freepascal.org/docs-html/rtl/sysutils/twordhelper.testbit.html but the bit to test is 0..15. I expected this to work like https://wiki.freepascal.org/Bit_manipulation but that doesn't seem to be the case. Does there exist bit helpers like GetBi

Re: [fpc-pascal] Bit manipulation helpers

2022-02-21 Thread Ryan Joseph via fpc-pascal
> On Feb 21, 2022, at 7:01 PM, Michael Van Canneyt via fpc-pascal > wrote: > > Yes, this is testbit. > > Why do you say it does not work ? Oh my, I was confusing my terms I think. I wanted to do bit masking (I think it's called). I was expecting there to be something like TestFlag in the RT

Re: [fpc-pascal] Bit manipulation helpers

2022-02-21 Thread Ryan Joseph via fpc-pascal
> On Feb 21, 2022, at 7:31 PM, Michael Van Canneyt via fpc-pascal > wrote: > > Hm. I'm not sure that this code does what you need. > > But masking is indeed not in the helpers. > Try it yourself, it does indeed work. How else are you supposed to test these kinds of bit flag APIs where all

<    1   2   3   4   5