Re: [fpc-pascal] Subclassing generic records?
> On Jul 17, 2017, at 10:58 AM, Sven Barth via fpc-pascal > wrote: > > I'll need to check whether Delphi allows that for helpers (doesn't matter > whether the extended type is a specialization or not). > > Thanks Sven. Records/objects/classes in Pascal feel very confused right now. Records are moving in the direction of legacy style “objects” which are allocated on the stack so I wonder why objects just don’t replace records already? Having said that why don’t classes just replace records/objects except they allocate on the stack? These 3 distinct constructs don’t really make sense more imo. Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Subclassing generic records?
Am 17.07.2017 18:24 schrieb "Ryan Joseph" : > > I’m trying to find a way to extend generic records since (as far as I know) there is no subclassing of records. I could use variant records here but these don’t work with generics so I tried record helpers and properties to basically rename the x/y variables in TVec2 but I get errors on the width/height properties. Is there a workaround for this? > > type > generic TVec2 = record > public > x, y: T; > end; > type > TSize = specialize TVec2; > type > TVec2Size = record helper for TSize > property Width: TFloat read x write x; > property Height: TFloat read y write y; > end; I'll need to check whether Delphi allows that for helpers (doesn't matter whether the extended type is a specialization or not). Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Subclassing generic records?
I’m trying to find a way to extend generic records since (as far as I know) there is no subclassing of records. I could use variant records here but these don’t work with generics so I tried record helpers and properties to basically rename the x/y variables in TVec2 but I get errors on the width/height properties. Is there a workaround for this? type generic TVec2 = record public x, y: T; end; type TSize = specialize TVec2; type TVec2Size = record helper for TSize property Width: TFloat read x write x; property Height: TFloat read y write y; end; Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] C to Pascal conversion - Help request
Thank you Dmitry for your clarification. Best regards. Sandro Cumerlato On 17 July 2017 at 14:26, Dmitry Boyarintsev wrote: > > > On Mon, Jul 17, 2017 at 7:17 AM, Sandro Cumerlato < > sandro.cumerl...@gmail.com> wrote: > >> Hello, >> can someone please help me converting the folowing C types to Pascal? >> > SF_CUE_POINT is simple, but I'm not sure how to convert SF_CUES_VAR(count) >> ad SF_CUES. >> >> > type >SF_CUES = record > cue_count : cuint32 ; // declared in "ctypes" > cue_points : array [0..100-1] of SF_CUE_POINT; >end; > > > going forward in C translation, any time you find SF_CUES_VAR (xxx) used, > you'll have to declare a new type (with the proper "count" used) or reuse > an existing type, if it already exists. > > > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal > ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] C to Pascal conversion - Help request
On Mon, Jul 17, 2017 at 7:17 AM, Sandro Cumerlato < sandro.cumerl...@gmail.com> wrote: > Hello, > can someone please help me converting the folowing C types to Pascal? > SF_CUE_POINT is simple, but I'm not sure how to convert SF_CUES_VAR(count) > ad SF_CUES. > > type SF_CUES = record cue_count : cuint32 ; // declared in "ctypes" cue_points : array [0..100-1] of SF_CUE_POINT; end; going forward in C translation, any time you find SF_CUES_VAR (xxx) used, you'll have to declare a new type (with the proper "count" used) or reuse an existing type, if it already exists. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] C to Pascal conversion - Help request
Hello, can someone please help me converting the folowing C types to Pascal? SF_CUE_POINT is simple, but I'm not sure how to convert SF_CUES_VAR(count) ad SF_CUES. Thank you in advance! Sandro Cumerlato typedef struct { int32_t indx ; uint32_t position ; int32_t fcc_chunk ; int32_t chunk_start ; int32_t block_start ; uint32_t sample_offset ; char name [256] ; } SF_CUE_POINT ; #define SF_CUES_VAR(count) \ struct \ { uint32_t cue_count ; \ SF_CUE_POINT cue_points [count] ; \ } typedef SF_CUES_VAR (100) SF_CUES ; ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal