Re: [fpc-pascal] Selecting Records with a variable

2020-12-20 Thread Sven Barth via fpc-pascal
Am 20.12.2020 um 05:26 schrieb Jean SUZINEAU via fpc-pascal: I know you don't like objects, but maybe something like : Using modeswitch AdvancedRecords that also works with record types. And I'd suggest a case-statement as well. Anything else will only be slower or just as fragile. Regard

Re: [fpc-pascal] callback from c with varargs

2020-12-20 Thread Luca Olivetti via fpc-pascal
El 19/12/20 a les 23:15, Jonas Maebe via fpc-pascal ha escrit: On 19/12/2020 22:35, Luca Olivetti via fpc-pascal wrote: I'm trying to use a c library where I can define a logging plugin. The c prototype for the callback is     void (*log)(void *logContext, UA_LogLevel level, UA_LogCategory ca

Re: [fpc-pascal] Initialization of constant record member of pointer type

2020-12-20 Thread Sven Barth via fpc-pascal
Am 14.12.2020 um 09:08 schrieb Marc Weustink via fpc-pascal: On 4-12-2020 13:01, LacaK via fpc-pascal wrote: Dňa 2.12.2020 o 16:09 Tomas Hajny via fpc-pascal napísal(a): On 2020-12-02 16:01, LacaK via fpc-pascal wrote: Dňa 2.12.2020 o 13:55 Tomas Hajny via fpc-pascal napísal(a): On 2020-12

Re: [fpc-pascal] callback from c with varargs

2020-12-20 Thread Jonas Maebe via fpc-pascal
On 20/12/2020 13:01, Luca Olivetti via fpc-pascal wrote: > El 19/12/20 a les 23:15, Jonas Maebe via fpc-pascal ha escrit: >> It is indeed not possible to implement a function with C varargs in FPC. > > I was afraid that's the answer :-( > > as an ugly workaround, I wrote a c library that vsnprint

Re: [fpc-pascal] callback from c with varargs

2020-12-20 Thread Tomas Hajny via fpc-pascal
On 2020-12-20 14:00, Jonas Maebe via fpc-pascal wrote: On 20/12/2020 13:01, Luca Olivetti via fpc-pascal wrote: El 19/12/20 a les 23:15, Jonas Maebe via fpc-pascal ha escrit: It is indeed not possible to implement a function with C varargs in FPC. I was afraid that's the answer :-( as an ugl

Re: [fpc-pascal] Selecting Records with a variable

2020-12-20 Thread Tomas Hajny via fpc-pascal
On 2020-12-20 11:56, Sven Barth via fpc-pascal wrote: Am 20.12.2020 um 05:26 schrieb Jean SUZINEAU via fpc-pascal: I know you don't like objects, but maybe something like : Using modeswitch AdvancedRecords that also works with record types. And I'd suggest a case-statement as well. Anything

Re: [fpc-pascal] callback from c with varargs

2020-12-20 Thread Jonas Maebe via fpc-pascal
On 20/12/2020 14:43, Tomas Hajny via fpc-pascal wrote: > On 2020-12-20 14:00, Jonas Maebe via fpc-pascal wrote: >> On 20/12/2020 13:01, Luca Olivetti via fpc-pascal wrote: >>> El 19/12/20 a les 23:15, Jonas Maebe via fpc-pascal ha escrit: It is indeed not possible to implement a function with

Re: [fpc-pascal] Selecting Records with a variable

2020-12-20 Thread wkitty42--- via fpc-pascal
On 12/19/20 10:02 PM, James Richters wrote: No, this is just a simplified example.. ok... The procedure will be working with dozens of records, so I need a way to call the procedure and specify which element of all the records to use... it will not be called for every element. in that case, t

Re: [fpc-pascal] Selecting Records with a variable

2020-12-20 Thread Sven Barth via fpc-pascal
Am 20.12.2020 um 14:47 schrieb Tomas Hajny via fpc-pascal: On 2020-12-20 11:56, Sven Barth via fpc-pascal wrote: Am 20.12.2020 um 05:26 schrieb Jean SUZINEAU via fpc-pascal: I know you don't like objects, but maybe something like : Using modeswitch AdvancedRecords that also works with recor

Re: [fpc-pascal] Selecting Records with a variable

2020-12-20 Thread James Richters via fpc-pascal
What I’m hopping to accomplish isn't to get it to work... it's to consolidate a whole bunch of functions and procedures that are all exactly the same except for which axis I am working with... I have 9 possible Axis, X,Y,Z,W,L.R,A,B,C And I have Procedures: Procedure Move_X; Begin DoSomethi

Re: [fpc-pascal] Selecting Records with a variable

2020-12-20 Thread Luca Olivetti via fpc-pascal
El 20/12/20 a les 16:02, James Richters via fpc-pascal ha escrit: What I’m hopping to accomplish isn't to get it to work... it's to consolidate a whole bunch of functions and procedures that are all exactly the same except for which axis I am working with... I have 9 possible Axis, X,Y,Z,W,L.R

Re: [fpc-pascal] Selecting Records with a variable

2020-12-20 Thread James Richters via fpc-pascal
Thank you Luca, that will work much better for me! James -Original Message- From: fpc-pascal On Behalf Of Luca Olivetti via fpc-pascal Sent: Sunday, December 20, 2020 10:11 AM To: fpc-pascal@lists.freepascal.org Cc: Luca Olivetti Subject: Re: [fpc-pascal] Selecting Records with a var

Re: [fpc-pascal] callback from c with varargs

2020-12-20 Thread Luca Olivetti via fpc-pascal
El 20/12/20 a les 14:00, Jonas Maebe via fpc-pascal ha escrit: On 20/12/2020 13:01, Luca Olivetti via fpc-pascal wrote: El 19/12/20 a les 23:15, Jonas Maebe via fpc-pascal ha escrit: It is indeed not possible to implement a function with C varargs in FPC. I was afraid that's the answer :-( a

Re: [fpc-pascal] Selecting Records with a variable

2020-12-20 Thread Ralf Quint via fpc-pascal
On 12/20/2020 7:11 AM, Luca Olivetti via fpc-pascal wrote: Then change your data model. Instead of Axis_record = record   X,Y,Z,A,B,C    : Double; End; use AxisName = (X,Y,Z,A,B,C); Axis_record = array[AxisName] of double; then it's easy to do what you want. procedure DoSomething(var Axis:

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

2020-12-20 Thread Nikolay Nikolov via fpc-pascal
On 12/19/20 6:35 PM, Liam Proven via fpc-pascal wrote: https://github.com/magiblot/tvision Someone enterprising could make a TurboPascal clone out of FPC. :-) Meh. FPC has had a Turbo Pascal-like console IDE for many years. It uses Free Vision, which is a pascal port of the C++ version of Tur

Re: [fpc-pascal] Selecting Records with a variable

2020-12-20 Thread James Richters via fpc-pascal
Yes, I was trying to keep my data structure, because there were thousands of occurrences .. This project has had that structure since Turbo Pascal back in the 80s when it only had 3 axis It seemed like a good way to have variables all with the same name, and back then it wasn't so bad to have

Re: [fpc-pascal] Selecting Records with a variable

2020-12-20 Thread Stefan V. Pantazi via fpc-pascal
James, I remember going through some similar motions as you are. Looks like you are searching for a form of indexing your record fields. So many good suggestions, I had to join the fray and try something... My preferred approach would also be an ordinal type for the axes and a record variant, as al

Re: [fpc-pascal] Selecting Records with a variable

2020-12-20 Thread Jean SUZINEAU via fpc-pascal
Le 20/12/2020 à 16:02, James Richters via fpc-pascal a écrit : If I need a bunch of case statements, it's atcually worse than if I just have separate procedures. No, in fact the case statement is written only once, in the implementation of TAxisRecord, and in procedure Move_It(Axis_Letter:Ch