[fpc-pascal] Generic operator overload problem

2019-11-02 Thread Ryan Joseph via fpc-pascal
Is this a bug or did I do something wrong? The minus operator overload seems to be getting confused and I get a "Can't determine which overloaded function to call" error as a result. {$mode objfpc} {$modeswitch advancedrecords} program generic_vector; uses Math; type generic TVec2 = record

[fpc-pascal] Generic type conflicts

2019-11-02 Thread Ryan Joseph via fpc-pascal
I've wanted to make a generic version of a vector for a while but I always give up because it seems not very possible. It's probably not even a great idea because many methods don't translate between float and integer but I wanted to prevent other code duplication if possible. Here's an example

Re: [fpc-pascal] Generic type conflicts

2019-11-02 Thread Ryan Joseph via fpc-pascal
> On Nov 2, 2019, at 11:06 AM, Cyrax via fpc-pascal > wrote: > > You need to do a explicit typecasting. > > ... > fac:=Sqrt(Sqr(TScalar(x)) + Sqr(TScalar(y))); > ... > fac:=1.0/TScalar(fac); Doesn't work. Try running the example. Regards, Ryan Joseph ___

Re: [fpc-pascal] Generic type conflicts

2019-11-09 Thread Ryan Joseph via fpc-pascal
> On Nov 7, 2019, at 12:28 PM, Ben Grasset via fpc-pascal > wrote: > > {$IF GetTypeKind(T) in [tkInteger, tkInt64, tkQWord]} > Result := A div B > {$ELSEIF GetTypeKind(T) = tkFloat} > Result := A / B > {$ELSE} > Result := Default(T); > {$ENDIF} This is what I hinted in my

Re: [fpc-pascal] Generic operator overload problem

2019-11-09 Thread Ryan Joseph via fpc-pascal
> On Nov 8, 2019, at 5:32 PM, Sven Barth via fpc-pascal > wrote: > > This indeed appears to be a bug, but fixing it leads to some compilation > problems in Generics.Collections that need to be solved as well. So please > report this as a bug so that I don't forget it. Great, thanks. https:

[fpc-pascal] Generics in Objective-C mode bug?

2019-11-11 Thread Ryan Joseph via fpc-pascal
Is this a bug I should report? Knowing what I do about generics now I think the type check needs to be suspended until the type is actually specialized. {$mode objfpc} {$modeswitch objectivec2} program test; type generic TCocoaObject = objcclass (NSObject) // ERROR: The type "TCocoaObjec

Re: [fpc-pascal] Generics in Objective-C mode bug?

2019-11-11 Thread Ryan Joseph via fpc-pascal
> On Nov 11, 2019, at 1:25 PM, Sven Barth via fpc-pascal > wrote: > > Generics are not considered supported with Objective Pascal types. > There's really not any reason they shouldn't though. If you specialized with "string" for example that wouldn't be anything out of the ordinary so why

[fpc-pascal] Add API to official documentation search

2019-11-17 Thread Ryan Joseph via fpc-pascal
Could FPC make an API for the official documentation search at https://www.freepascal.org/docsearch/docsearch.var so we could make calls like: https://www.freepascal.org/docsearch/docsearch.var?word=List and get back a JSON object that had the search results? This is important for integration w

Re: [fpc-pascal] Add API to official documentation search

2019-11-18 Thread Ryan Joseph via fpc-pascal
> On Nov 17, 2019, at 5:20 PM, Michael Van Canneyt > wrote: > > That would be me. > > And there already is an API. How else ? This is Free Pascal ! Sorry for the late response. Nice this is exactly what I wanted. However when I started to look at the actual results I'm confused. For my exa

Re: [fpc-pascal] Add API to official documentation search

2019-11-18 Thread Ryan Joseph via fpc-pascal
> On Nov 18, 2019, at 1:15 PM, Michael Van Canneyt > wrote: > > As with all things FPC, the sources are available: > > svn co https://svn.freepascal.org/svn/html/docsearch docsearch > > Feel free to suggest improvements. It should be easy enough to add a first > element that contains an exac

[fpc-pascal] get_caller_frame

2019-11-19 Thread Ryan Joseph via fpc-pascal
I came across get_caller_frame in some unrelated code and I was just curious about this so I wanted to ask. What does get_caller_frame return exactly? Is this a pointer to a stack frame that could be copied to the heap? I'm still interested in how we could add some form of coroutine like behav

Re: [fpc-pascal] get_caller_frame

2019-11-20 Thread Ryan Joseph via fpc-pascal
> On Nov 20, 2019, at 1:56 AM, Sven Barth via fpc-pascal > wrote: > > It returns the address of the caller's frame pointer. See also > https://www.freepascal.org/docs-html/rtl/system/get_caller_frame.html > > It's mainly used in context of raising exceptions with the help of a second > func

Re: [fpc-pascal] Add API to official documentation search

2019-11-20 Thread Ryan Joseph via fpc-pascal
> On Nov 20, 2019, at 5:25 AM, Anthony Walter via fpc-pascal > wrote: > > You said, "but its got bugs and I haven't been able to contact the developer > to fix them" > > What are the bugs you want fixed? There you are. ;) There are stray tags which are messing things up. For example: http

[fpc-pascal] cvar external symbol name

2019-11-21 Thread Ryan Joseph via fpc-pascal
Do cvars not allow external symbol names like functions do? With function I can declare a name but for cvar I'm getting an error. PyBaseString_Type:PPyTypeObject; cvar; external name 'somename'; Regards, Ryan Joseph ___ fpc-pascal maillist

Re: [fpc-pascal] get_caller_frame

2019-11-21 Thread Ryan Joseph via fpc-pascal
> On Nov 21, 2019, at 1:41 AM, Sven Barth via fpc-pascal > wrote: > > No. On x86 it's essentially the content of the EBP/RBP register which is > (assuming no optimizations are done) essentially the ESP/RSP register of the > calling function. This is only used by the exception handling to hav

Re: [fpc-pascal] cvar external symbol name

2019-11-21 Thread Ryan Joseph via fpc-pascal
> On Nov 21, 2019, at 3:40 PM, Jonas Maebe wrote: > > The only thing cvar does is to mangle symbol name using the default > C-style name mangling. Specifying an explicit symbol name would just > overwrite whatever effect "cvar" has, so combining both is useless and > rejected. Thanks I see now

Re: [fpc-pascal] How to translate C macros which use stringification?

2019-11-23 Thread Ryan Joseph via fpc-pascal
> On Nov 23, 2019, at 2:47 AM, Gabor Boros wrote: > > Can I do the same thing with FPC in a simple way? I translate some C source > to FPC and try to follow the original code. 99% certain this can't be done. I don't even think there's RTTI for local variable names but I could be wrong. Rega

[fpc-pascal] Pre-allocated TFPGList or similar

2019-11-23 Thread Ryan Joseph via fpc-pascal
I need a pre-grown list which I can put (not insert!) items into at indexes without getting "List index out of bounds" errors. For example I want to start with a list that has 10 empty indexes: list := TList.Create(10); // 10 empty slots! list[5] := someItem; Is this possible using any list ty

[fpc-pascal] Variant part in objects?

2019-11-24 Thread Ryan Joseph via fpc-pascal
Is there a reason that objects don't support variant sections like with records? Maybe they mess with the VMT table when virtual methods are added? I just posted my "advanced objects" patch (https://bugs.freepascal.org/view.php?id=36350) and all it does is add "class operators" to objects but I

Re: [fpc-pascal] Pre-allocated TFPGList or similar

2019-11-24 Thread Ryan Joseph via fpc-pascal
> On Nov 24, 2019, at 3:57 AM, Sven Barth via fpc-pascal > wrote: > > What you're looking for is the Count property. Setting it is supported by the > untyped lists in Classes, the generic ones in FGL as well as those in > Generics.Collections. > > === code begin === > > list := TList.Creat

[fpc-pascal] Static linking to C library on Linux

2019-11-27 Thread Ryan Joseph via fpc-pascal
I'm trying to link to a static library (built from Python sources) in Pascal and having troubles on Linux. On Mac where I have experience I successfully link and every works as expected but on Linux I get slews of linker errors in what appear to be standard C library functions. For example: /u

Re: [fpc-pascal] Static linking to C library on Linux

2019-11-27 Thread Ryan Joseph via fpc-pascal
> On Nov 27, 2019, at 11:25 AM, Karoly Balogh (Charlie/SGR) > wrote: > > Yes. By Default, FPC doesn't link against libc on Linux by default, only > when some more advanced things, say, threading is used. To the contrary on > Darwin (macOS), we always link against libc. There comes your differe

Re: [fpc-pascal] Static linking to C library on Linux

2019-11-27 Thread Ryan Joseph via fpc-pascal
> On Nov 27, 2019, at 2:22 PM, Jonas Maebe wrote: > > There is no tool that can show this, because a static library is just a > collection of random object files. It does not contain any metadata > about where these symbols are supposed to come from (and they could o, > fact come from anywhere,

[fpc-pascal] Static linking to C library on Windows

2019-11-27 Thread Ryan Joseph via fpc-pascal
Moving on to Windows now and more basic problems. I've built from Python sources again but I'm not sure about static libraries on Windows. There is a .dll which is a dynamic library and .lib which I assume is the static library. Again I link using: {$linklib python37.lib} But I get: "Error: In

[fpc-pascal] Two possible generics bugs

2019-11-28 Thread Ryan Joseph via fpc-pascal
Testing on 3.3.1. Are these both bugs? I wanted to ask first before filing a report. {$mode objfpc} program test; uses FGL; // No Error specializing TFPGList in parameter list... generic function CopyList(source: specialize TFPGList): specialize TFPGList; begin end; // ... but getting an er

Re: [fpc-pascal] Two possible generics bugs

2019-11-28 Thread Ryan Joseph via fpc-pascal
> On Nov 28, 2019, at 6:38 PM, Sven Barth via fpc-pascal > wrote: > > TFPGObjectList has a constraint to class types, so you need to constrain your > T as well using ": class". > > Please note however that you'll likely encounter another bug then once you > move your function to a unit: ht

Re: [fpc-pascal] Two possible generics bugs

2019-11-29 Thread Ryan Joseph via fpc-pascal
> On Nov 29, 2019, at 2:00 AM, Sven Barth via fpc-pascal > wrote: > > Why? It does say that a class type is expected. And the column of the error > should point to the correct location. > That's the same error you'd get when specializing outside of a generic with a > non-class type. I thi

Re: [fpc-pascal] Two possible generics bugs

2019-12-01 Thread Ryan Joseph via fpc-pascal
> On Nov 30, 2019, at 1:04 PM, Sven Barth via fpc-pascal > wrote: > > Well, if you want you can find any place where the _SPECIALIZE and _GENERIC > tokens are used and checked against mode Delphi to check against a new > modeswitch instead ("GENERICKEYWORDS") which must be enabled by default

Re: [fpc-pascal] Two possible generics bugs

2019-12-01 Thread Ryan Joseph via fpc-pascal
> On Nov 30, 2019, at 12:58 PM, Sven Barth via fpc-pascal > wrote: > > This can't work. ClassType is of type TClass and TClass.Create calls > TObject.Create, *not* the constructor of your list type, cause the > constructor chain is not virtual. Ok, so if the constructor was virtual this wou

Re: [fpc-pascal] Two possible generics bugs

2019-12-01 Thread Ryan Joseph via fpc-pascal
> On Nov 30, 2019, at 12:58 PM, Sven Barth via fpc-pascal > wrote: > > This can't work. ClassType is of type TClass and TClass.Create calls > TObject.Create, *not* the constructor of your list type, cause the > constructor chain is not virtual. > > What you can do is this: > > === code beg

[fpc-pascal] Confusing crash in System.WaitFree

2019-12-02 Thread Ryan Joseph via fpc-pascal
I have a crash that I'm not able to replicate in a simple program and appears to be related to threading. All I have to go on is this back trace but it doesn't give any context into the calling code, just that it's in the FPC system unit. Does anyone have any idea what this may be related to so

Re: [fpc-pascal] Interface delegates and the implements property specifier

2019-12-21 Thread Ryan Joseph via fpc-pascal
> On Dec 21, 2019, at 10:49 AM, Adriaan van Os wrote: > > I had hoped that procedure IMyInterface2.P2 would now be visible as a method > of TMyClass. This would be quite helpful in implementing > multiple-inheritance. But no, the implements specifier completely hides it. I > assume this has

Re: [fpc-pascal] Interface delegates and the implements property specifier

2019-12-22 Thread Ryan Joseph via fpc-pascal
> On Dec 22, 2019, at 5:26 AM, Sven Barth via fpc-pascal > wrote: > > You don't seem to understand what implementing an interface means in Object > Pascal. It means that a class can be cast to an interface. It does *not* mean > that the interface's methods are available from that class. I g

Re: [fpc-pascal] Interface delegates and the implements property specifier

2019-12-23 Thread Ryan Joseph via fpc-pascal
> On Dec 23, 2019, at 2:02 AM, Sven Barth via fpc-pascal > wrote: > > What might be more interesting in this context than multiple inheritance is > the concept of aspects (aka aspect oriented programming though you might also > want to look for "mixin"; there's an old thread about that: > h

Re: [fpc-pascal] Interface delegates and the implements property specifier

2019-12-23 Thread Ryan Joseph via fpc-pascal
> On Dec 23, 2019, at 7:57 PM, Ryan Joseph wrote: > > I never heard of "mixin" before but I'll study the wiki. > > I assume that the compiler team has decided multiple inheritance is a bad > idea correct? Personally I don't have enough experience to know but I see > there is a need to deleg

Re: [fpc-pascal] Interface delegates and the implements property specifier

2019-12-26 Thread Ryan Joseph via fpc-pascal
> On Dec 24, 2019, at 1:16 AM, Sven Barth via fpc-pascal > wrote: > > Basically, yes, though of course syntax, implementation and behavior need to > be nicely defined first. For example there is the difference whether > something is added at declaration time of the class or the creation time

Re: [fpc-pascal] Interface delegates and the implements property specifier

2019-12-27 Thread Ryan Joseph via fpc-pascal
> On Dec 27, 2019, at 8:21 AM, Adriaan van Os wrote: > > The code of a "mixin" or "trait" or "delegate" (or whatever > implementing-something) can be referenced and it can put virtually into the > namespace of an object. The one thing you cannot do however, is copy the > code, because then t

Re: [fpc-pascal] Interface delegates and the implements property specifier

2019-12-27 Thread Ryan Joseph via fpc-pascal
> On Dec 27, 2019, at 10:01 AM, Sven Barth via fpc-pascal > wrote: > > To be clear: with declaration time I mean when the type is written (" = class > ... end") versus creation time (either "var x: tmyclass" or "x := tmyclass > .create"). The difference would be that the user of the class wo

Re: [fpc-pascal] Interface delegates and the implements property specifier

2019-12-27 Thread Ryan Joseph via fpc-pascal
> On Dec 27, 2019, at 10:29 AM, Ryan Joseph wrote: > > It's really just about the namespace and avoiding deeply nested this.that.do > kind of syntax. We could accomplish this using just plain records, no need to > even get involved with the complicated interface syntax. According to the > wi

Re: [fpc-pascal] Interface delegates and the implements property specifier

2019-12-27 Thread Ryan Joseph via fpc-pascal
> On Dec 27, 2019, at 1:39 PM, Adriaan van Os wrote: > > etcetera. The disadvantage of this approach is that for example a default > DoKeyCommand must be written three times, for TApplication, TDocument and > TView, where the code for TDocument.DoKeyCommand and TView.DoKeyCommand is > identi

[fpc-pascal] Error format changes between compilers

2019-12-30 Thread Ryan Joseph via fpc-pascal
Notice how the format of the error changes between ppcrossx64 (built for iPhone simulator) and ppcx64. Is this a bug? It broke my regex for capturing errors and that's why I'm asking btw. Ryans-MacBook-Pro-2:fpc-git ryanjoseph$ /usr/local/lib/fpc/3.3.1/ppcrossx64 -Tiphonesim -vbr /Users/ryanj

[fpc-pascal] Calling function pointer to main program

2020-01-02 Thread Ryan Joseph via fpc-pascal
I need to override the main program function and then call back the main program later. I know I can use -XM to set another function name besides "main" but then how do I call back the original function "main" later? Regards, Ryan Joseph ___ f

Re: [fpc-pascal] Calling function pointer to main program

2020-01-02 Thread Ryan Joseph via fpc-pascal
> On Jan 2, 2020, at 2:51 PM, Sven Barth via fpc-pascal > wrote: > > What exactly are you trying to accomplish on which platform with which > version? > I'm making an iOS platform layer in the style of SDL which needs to use iOS's main loop which never returns until the program stops exec

Re: [fpc-pascal] Calling function pointer to main program

2020-01-03 Thread Ryan Joseph via fpc-pascal
> On Jan 2, 2020, at 2:57 PM, Ryan Joseph wrote: > > extern C_LINKAGE int SDL_main(int argc, char *argv[]); > > which they call from within the iOS event loop and that calls the programs > main functions which was defined using -XMSDL_main I still can't figure out how -XM works. Can anyone p

Re: [fpc-pascal] Calling function pointer to main program

2020-01-03 Thread Ryan Joseph via fpc-pascal
> On Jan 3, 2020, at 11:35 AM, Jonas Maebe wrote: > > Additionally, you will also have to link in an object/library that does > define a regular "main" function. And note that this will only work on > libc-based targets (afaik only Darwin, Solaris, and AIX at this point). So there needs to be

Re: [fpc-pascal] Calling function pointer to main program

2020-01-03 Thread Ryan Joseph via fpc-pascal
> On Jan 3, 2020, at 12:29 PM, Jonas Maebe wrote: > > So add 'cdecl; public;" to its declaration and definition. Nice the demo program compiles now. Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://li

[fpc-pascal] -WP compiler macro?

2020-01-06 Thread Ryan Joseph via fpc-pascal
Is there a compiler macro which is set to the value of -WP? It would be useful to know which SDK I'm targeted while compiling so I can omit certain code at compile time. Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepa

[fpc-pascal] Delphi generics bug?

2020-01-14 Thread Ryan Joseph via fpc-pascal
Is this a bug or intended behavior? I would think there should a type mismatch. {$mode delphi} program test; type TFooA = class end; type TFooB = class end; type TList = class procedure Foo; end; procedure TList.Foo; begin end; begin end. Regards, Ryan Joseph ___

Re: [fpc-pascal] Delphi generics bug?

2020-01-14 Thread Ryan Joseph via fpc-pascal
> On Jan 14, 2020, at 8:04 PM, Sven Barth via fpc-pascal > wrote: > > It's a bug because constraints should not be allowed in definitions, only in > declarations. > ok, I'll file a report if you want me to. I'll just leave it as it is for the constants because the fix will probably encomp

Re: [fpc-pascal] Delphi generics bug?

2020-01-14 Thread Ryan Joseph via fpc-pascal
> On Jan 14, 2020, at 11:44 PM, Sven Barth via fpc-pascal > wrote: > > Indeed. And yes, please file a bug. > https://bugs.freepascal.org/view.php?id=36584 Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org h

[fpc-pascal] Interface type error

2020-02-01 Thread Ryan Joseph via fpc-pascal
Why doesn't this compile? IClassName2 descends from IClassName1 so shouldn't TClassName be compatible with IClassName1? {$mode objfpc} {$interfaces corba} program test; type IClassName1 = interface end; IClassName2 = interface(IClassName1) end;

Re: [fpc-pascal] Interface type error

2020-02-02 Thread Ryan Joseph via fpc-pascal
> On Feb 2, 2020, at 3:23 PM, Sven Barth via fpc-pascal > wrote: > > As I had explained in the other thread some months ago interfaces in Object > Pascal mean literally that the type can be cast to the specified interfaces. > Parent interfaces are *not* part of this. If you want this you nee

[fpc-pascal] Property write access on records

2020-03-01 Thread Ryan Joseph via fpc-pascal
In the snippet below why isn't it an error to write to a field of the read-only property? I was hoping this would give me some type safety but it just writes to a temp variable and does nothing. Not very helpful if you ask me. = type TSheet = record m_tableSize:

[fpc-pascal] Objective-C mode switch overrides open arrays?

2020-03-04 Thread Ryan Joseph via fpc-pascal
The for loop thinks the open array of NSObject is an ObjectiveC array and thus gives me an error. Is this a bug? = {$mode objfpc} {$modeswitch objectivec2} program test; uses CocoaAll; procedure Test(input: array of NSObject); var obj: NSObject; begin // Incompatible

[fpc-pascal] Passing static arrays to open arrays

2020-03-04 Thread Ryan Joseph via fpc-pascal
Here's another issue I found with open arrays. Why isn't the static array of NSArray compatible with "array of pointer"? You can assign NSArray to pointer so why is the open array different? === {$mode objfpc} {$modeswitch objectivec2} program test; uses CocoaAll; procedure Test(inp

Re: [fpc-pascal] Property write access on records

2020-03-04 Thread Ryan Joseph via fpc-pascal
I didn't get this reply on the mail list and just looked on the mail list archive and found it! Not sure what happened or if it's going to happen again. Sven's reply: === I assume you mean "sheet.TableSize.x"? Otherwise your example makes no sense... In that case: you are working

[fpc-pascal] Cannot find system type "__m64"

2020-03-05 Thread Ryan Joseph via fpc-pascal
I'm continuing this from the bug tracker. Also please note that for some reason the mail list server has stopped sending me replies to gmail so I need to look at https://lists.freepascal.org/pipermail/fpc-pascal/ for replies until this get fixed. Maybe time to get rid of gmail? My private web ho

Re: [fpc-pascal] Property write access on records

2020-03-05 Thread Ryan Joseph via fpc-pascal
> On Mar 5, 2020, at 2:24 PM, Ryan Joseph wrote: > > Can we consider changing this behavior? from https://lists.freepascal.org/pipermail/fpc-pascal/2020-March/057434.html On 05/03/2020 08:24, Ryan Joseph via fpc-pascal wrote: > Yes, it's a temporary variable but doesn&#

Re: [fpc-pascal] Cannot find system type "__m64"

2020-03-06 Thread Ryan Joseph via fpc-pascal
> On Mar 6, 2020, at 2:04 PM, Sven Barth via fpc-pascal > wrote: > > Yes, that is the problem. When Florian had merged the SIMD intriniscs branch > those types were enabled, but they weren't ready yet. Thus he disabled them > later on again (a day or two later). If you had compiled trunk dur

Re: [fpc-pascal] Property write access on records

2020-03-06 Thread Ryan Joseph via fpc-pascal
> On Mar 7, 2020, at 5:15 AM, Sven Barth wrote: > > I've found two bug reports related to this (I searched for "property" and > only those reports that are neither closed nor resolved): > - https://bugs.freepascal.org/view.php?id=23620 > - https://bugs.freepascal.org/view.php?id=14534 > > And

Re: [fpc-pascal] Property write access on records

2020-03-07 Thread Ryan Joseph via fpc-pascal
> On Mar 7, 2020, at 3:39 PM, Sven Barth wrote: > > Helpers indeed don't help there (pun intended :P). Please report, yes. And > add a reference to the two bug reports I mentioned. > https://bugs.freepascal.org/view.php?id=36768 Regards, Ryan Joseph ___

Re: [fpc-pascal] modeswitch multihelpers precedence problem

2020-03-10 Thread Ryan Joseph via fpc-pascal
> On Mar 10, 2020, at 11:57 AM, Anthony Walter via fpc-pascal > wrote: > > To demonstrate, if I have MyUnit.pas that defines a string type helper with > EndsWith() and an IntToStr() function then consider the following code: > > program Test; > > uses > MyUnit, SysUtils; > > begin > 'h

Re: [fpc-pascal] modeswitch multihelpers precedence problem

2020-03-10 Thread Ryan Joseph via fpc-pascal
> On Mar 10, 2020, at 8:09 PM, Anthony Walter wrote: > > An issue has been submitted here > https://bugs.freepascal.org/view.php?id=36783 under the FPC compiler with > tags "type helpers". Can you make up an example that doesn't use SysUtils? Here's something I made up really quick but I d

[fpc-pascal] Error format in trunk changed (again)

2020-03-14 Thread Ryan Joseph via fpc-pascal
Here's an example of 2 error formats which changed across compiler version (I think -vbr gives the gcc style output). The first format is the one I thought was standard but the last time I updated trunk it changed to the second format (line:column:). Was this a mistake or did I mess something up

[fpc-pascal] Pass open array to static array?

2020-03-15 Thread Ryan Joseph via fpc-pascal
Why doesn't it compile to pass an open array to a static array of the same size? That would nice if this worked since it makes assigning values so easy. program test; var data: array[0..2] of integer; begin // Incompatible types: got "{Array Of Const/Constant Open} Array of ShortInt" expecte

[fpc-pascal] Killing the mail list

2020-03-15 Thread Ryan Joseph via fpc-pascal
It's 2020 and the mail list is starting to really show its age. I don't get first messages from gmail and my personal web host is whitelisted, messages bounce when I use the wrong account by accident, hard to search the archives, can't post images and code easily (big problem!), messages gets lo

Re: [fpc-pascal] Pass open array to static array?

2020-03-15 Thread Ryan Joseph via fpc-pascal
> On Mar 15, 2020, at 8:53 PM, Howard Page-Clark via fpc-pascal > wrote: > > > With recent FPCs you can however do this: > > program test; > var > data: array[0..2] of Integer; > tmp: array of Integer = Nil; > begin > tmp := [1,2,3]; > Move(tmp[0], data[0], SizeOf(data)); > end. yea

Re: [fpc-pascal] Killing the mail list

2020-03-15 Thread Ryan Joseph via fpc-pascal
> On Mar 16, 2020, at 12:36 AM, fredvs via fpc-pascal > wrote: > > Hello. > > You may use http://free-pascal-general.1045716.n5.nabble.com/ > > This forum is an archive for the mailing list > fpc-pascal@lists.freepascal.org > > Fre;D Looks like everyone here likes the mailing list. Very w

Re: [fpc-pascal] Pass open array to static array?

2020-03-15 Thread Ryan Joseph via fpc-pascal
Ok, that makes sense now. Dynamic arrays can't be passed to static arrays. I remember when I tried to make aligned dynamic arrays I got to look around in the code and it seems plausible you could just make a memcpy call in the RTL for dynamic arrays being passed to static arrays. Seems deceptively

Re: [fpc-pascal] Killing the mail list

2020-03-17 Thread Ryan Joseph via fpc-pascal
> On Mar 18, 2020, at 1:31 AM, Kevin Monceaux wrote: > >> It's 2020 and the mail list is starting to really show its age. > > With age comes wisdom. No need to discuss this further, everyone loves the mail list. I'll try using the forums instead. Regards, Ryan Joseph __

[fpc-pascal] sizeof TTypeKind?

2020-03-20 Thread Ryan Joseph via fpc-pascal
Are there any functions in the RTL to get the sizeof the type specified in TTypeKind? https://www.freepascal.org/docs-html/rtl/typinfo/ttypekind.html I'm truing to use record RTTI and I needed to know the size of the field in the record. Regards, Ryan Joseph ___

Re: [fpc-pascal] sizeof TTypeKind?

2020-03-20 Thread Ryan Joseph via fpc-pascal
I'm going to loop through the fields of the record and get the size of each field so I can serialize the record. Am I not on the right track? - Regards, Ryan Joseph -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ fpc-pa

Re: [fpc-pascal] sizeof TTypeKind?

2020-03-21 Thread Ryan Joseph via fpc-pascal
> On Mar 21, 2020, at 9:39 AM, Ryan Joseph via fpc-pascal > wrote: > > I'm going to loop through the fields of the record and get the size of each > field so I can serialize the record. Am I not on the right track? No answers on this so I'm thinking maybe I

Re: [fpc-pascal] sizeof TTypeKind?

2020-03-21 Thread Ryan Joseph via fpc-pascal
> On Mar 21, 2020, at 10:05 AM, Anthony Walter via fpc-pascal > wrote: > > I think what Ryan is asking about is how to find the size of the variant part > of TTypeData as used in the "case TTypeKind of" section. As in: Yes. It says a field is "tkInteger" but what size is that? I know it's 4

Re: [fpc-pascal] sizeof TTypeKind?

2020-03-21 Thread Ryan Joseph via fpc-pascal
> On Mar 21, 2020, at 10:15 PM, Sven Barth via fpc-pascal > wrote: > > For the primitve types you need to know the sizes at compile time (e.g. > SizeOf(Word), SizeOf(LongInt), etc.) and check what type the field has using > the field list in the record's RTTI. You also have to keep in mind t

[fpc-pascal] Chaining method calls

2020-03-23 Thread Ryan Joseph via fpc-pascal
Is it possible to achieve this dynamically without resorting to type casting? It feels like classes should have a builtin type for each class, like TClassType, which similar to TObject.ClassType but is a compile time type. = {$mode objfpc} program test; type TBase = class // TCl

Re: [fpc-pascal] Chaining method calls

2020-03-24 Thread Ryan Joseph via fpc-pascal
Free Pascal - General mailing list wrote > Is it possible to achieve this dynamically without resorting to type > casting? It feels like classes should have a builtin type for each class, > like TClassType, which similar to TObject.ClassType but is a compile time > type. I didn't think enough befo

Re: [fpc-pascal] Chaining method calls

2020-03-24 Thread Ryan Joseph via fpc-pascal
> On Mar 24, 2020, at 8:39 PM, Michal Wallace via fpc-pascal > wrote: > > Hi Ryan, > > It's possible. Just change your declaration of `c`: > > var c: TBase; > > It still prints TMyClass at the end. > > Of course, you're only going to have access to methods that are declared in > TBase. >

Re: [fpc-pascal] generic proc inference

2020-03-30 Thread Ryan Joseph via fpc-pascal
I hope you're all having a lovely Coronavirus lockdown-vacation and keeping safe. :) I finally got around to the overhaul of {$modeswitch implicitfunctionspecialization} as according to feedback in this thread. I attached a patch in the bug tracker which should apply without conflicts. In part

Re: [fpc-pascal] Pass open array to static array?

2020-04-02 Thread Ryan Joseph via fpc-pascal
> On Mar 16, 2020, at 5:40 AM, Sven Barth wrote: > > The message of the compiler is a bit misleading. It's a *dynamic* array that > is created there, not an *open* array. Open arrays only exist when being > passed directly to a parameter. I forgot to ask. Are open arrays constants, or are t

Re: [fpc-pascal] Pass open array to static array?

2020-04-03 Thread Ryan Joseph via fpc-pascal
> On Apr 3, 2020, at 3:43 PM, Sven Barth wrote: > > They are neither. They are simply a pointer to the first element and a hidden > size argument. For the pointer it is not important where it comes from: a > single element, a dynamic array, a static array. > Ah, I see. In the example belo

Re: [fpc-pascal] Pass open array to static array?

2020-04-03 Thread Ryan Joseph via fpc-pascal
> On Apr 3, 2020, at 10:09 PM, Sven Barth wrote: > > No. The "[...]" for an open array parameter means "open array constructer" > *not* "dynamic array constructor". And this on-the-fly open array is in fact > constructed on the stack. Ok, I see now. Excellent. I thought this was another dyn

[fpc-pascal] Error format question

2020-04-10 Thread Ryan Joseph via fpc-pascal
Sorry to ask this yet again but I keep forgetting or remembering wrong. I thought this was a one time error that was fixed but I'm still getting different error formats with the trunk (as of today) vs 3.0.4. Can anyone please confirm which it the correct format I should rely on? Ryans-MacBook-

Re: [fpc-pascal] Error format question

2020-04-10 Thread Ryan Joseph via fpc-pascal
> On Apr 11, 2020, at 1:17 PM, Michael Van Canneyt > wrote: > > My guess is you have a config file lying around that causes this to look > different (-Fr option?), or you have a custom-made errore.msg file built-in. Interesting, so I overrode the default format in the trunk somehow. I can't

Re: [fpc-pascal] Error format question

2020-04-11 Thread Ryan Joseph via fpc-pascal
> On Apr 11, 2020, at 8:12 PM, Florian Klämpfl wrote: > > I fixed this for trunk. You can very easily test and see what gcc outputs to > verify what's correct. Thanks, I could swear this was a bug that was already fixed but I'll rebuild the compiler tomorrow and see if it went away. Regards

Re: [fpc-pascal] Error format question

2020-04-11 Thread Ryan Joseph via fpc-pascal
> On Apr 11, 2020, at 9:50 PM, Ryan Joseph wrote: > > Thanks, I could swear this was a bug that was already fixed but I'll rebuild > the compiler tomorrow and see if it went away. I just did svn up and got r44689, rebuilt the compiler but I still get the same error format. Was it supposed t

Re: [fpc-pascal] Error format question

2020-04-11 Thread Ryan Joseph via fpc-pascal
> On Apr 12, 2020, at 11:16 AM, Ryan Joseph wrote: > > I just did svn up and got r44689, rebuilt the compiler but I still get the > same error format. Was it supposed to be changed? ok, I think we're confused here. Just actually tested gcc and got this format: /Users/ryanjoseph/Developer/Pr

Re: [fpc-pascal] Pass open array to static array?

2020-04-12 Thread Ryan Joseph via fpc-pascal
I just came across another related issue to this thread. Is it not possible to init dynamic arrays from static arrays? I remember there being more compatibility between the 2 types but I may have forgotten. var a: array[0..1] of integer; d: array of integer; begin d := a; end. Regards,

Re: [fpc-pascal] Pascal Language Server

2020-04-22 Thread Ryan Joseph via fpc-pascal
yes! Pascal *badly* needs this to be productive outside of Lazarus. I use Sublime Text and frequently now VSCode but not having good code tools is getting painful. In fact I already started a language server some months ago (and since been busy with out stuff) but I think you've made more progr

Re: [fpc-pascal] Pascal Language Server

2020-04-23 Thread Ryan Joseph via fpc-pascal
> On Apr 23, 2020, at 2:08 PM, Michael Van Canneyt > wrote: > > VSCode has omnipascal ? > (The TMS Web core VS Code studio plugin uses this, and it seems pretty > complete) yes it does but they don't support ObjFPC mode syntax very well which means things like the "generic" keyword and "is

Re: [fpc-pascal] Pascal Language Server

2020-04-23 Thread Ryan Joseph via fpc-pascal
Arjan, I briefly skimmed over your code and it looks like instead of using the "DocParser" unit that I was using the parse the files, you're directly using the Lazarus "CodeToolBoss" which I don't have any experience with. I think it was Michael actually who instructed me to use this parser but

Re: [fpc-pascal] Pascal Language Server

2020-04-23 Thread Ryan Joseph via fpc-pascal
> On Apr 23, 2020, at 3:00 PM, Michael Van Canneyt > wrote: > > I think the decision to use the codetoolboss is the best, see above as to why. Very well. I assume the code tools parses the entire project and keeps the symbols in a database? That was something I was going to have to implement

Re: [fpc-pascal] Pascal Language Server

2020-04-23 Thread Ryan Joseph via fpc-pascal
> On Apr 23, 2020, at 3:49 PM, Mattias Gaertner via fpc-pascal > wrote: > >> >> 3) Class/record member completions. > > I guess you mean identifier completion after a dot. Exactly. Fields or methods and helpers even if possible. I assume that exists. Btw, the names you're giving like "Find

Re: [fpc-pascal] Pascal Language Server

2020-04-23 Thread Ryan Joseph via fpc-pascal
> On Apr 23, 2020, at 6:29 PM, Arjan Adriaanse wrote: > > Also, any feedback on my existing code is welcome, especially since > this is my first Pascal project. You did a nice job structuring it I think and providing a template to scale up from. What language(s) are you coming from and why di

Re: [fpc-pascal] Pascal Language Server

2020-04-23 Thread Ryan Joseph via fpc-pascal
> On Apr 23, 2020, at 8:20 PM, Arjan Adriaanse wrote: > > Perhaps not all the used generics features are available yet in older > FPC versions. I use the most recent release candidate from > ftp://ftp.freepascal.org/pub/fpc/beta/3.2.0-rc1/ [2], but will > investigate if older versions also wor

Re: [fpc-pascal] Pascal Language Server

2020-04-23 Thread Ryan Joseph via fpc-pascal
> On Apr 23, 2020, at 9:11 PM, Mattias Gaertner via fpc-pascal > wrote: > > If LSP updates parser_test.pas, then codetools will notice. > > If LSP only sends changes, then you have to apply these changes to > codetools codebuffers: > Code.Insert/Delete/Replace/Move > > Modified codebuffers a

Re: [fpc-pascal] Pascal Language Server

2020-04-23 Thread Ryan Joseph via fpc-pascal
> On Apr 23, 2020, at 9:11 PM, Arjan Adriaanse wrote: > > The CodeToolBoss actually keeps a cache of files which are loaded at > the 'textDocument/didOpen' notification. When the user changes text at > the client side, even without saving, a 'textDocument/didChange' > notification is sent which

Re: [fpc-pascal] Pascal Language Server

2020-04-23 Thread Ryan Joseph via fpc-pascal
> On Apr 23, 2020, at 9:11 PM, Arjan Adriaanse wrote: > > lazbuild --compiler=/usr/lib/fpc/3.2.0/ppcx64 pasls.lpi is there a macOS installer for 3.2? I found a link to a FTP server but I don't see this exists. Maybe fix that bug in trunk is the better idea. My lazarus sources are old also so

Re: [fpc-pascal] Pascal Language Server

2020-04-23 Thread Ryan Joseph via fpc-pascal
I just tried update my lazarus sources using "svn up" and now I'm getting another strange error when using lazbuild. /Users/ryanjoseph/Developer/lazarus/components/ideintf/ideintf.pas:11:3: fatal: Can't find unit LazarusPackageIntf used by IDEIntf Do I need to do something else to get the sour

Re: [fpc-pascal] Pascal Language Server

2020-04-23 Thread Ryan Joseph via fpc-pascal
> On Apr 23, 2020, at 9:51 PM, Mattias Gaertner via fpc-pascal > wrote: > > You have old ppu files. > > For example: > make distclean all ok, did this and now getting: /Users/ryanjoseph/Developer/lazarus/components/lazdebuggergdbmi/gdbmidebugger.pp(63,16) Fatal: (10022) Can't find unit Pro

  1   2   3   4   5   >