Results 1 to 8 of 8

Thread: Pass or change TYPE in other unit, possible?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    I guess you could try using includes and macros. Divide the thing into two files: one include file, which will contain the map code, and one (or more) files defining macros and including the map code.

    For example:
    map.inc
    Code:
    Type TMap = class
       { snip }
       Procedure Insert(Key: KEYTYPE ; Val : VALUETYPE );  
       Function Search(Key: KEYTYPE ): VALUETYPE ;
       { snip }
    map_blocks.pas
    Code:
    unit map_blocks;
    
    {$MACRO ON} {$DEFINE KEYTYPE:=TMyCoord} {$DEFINE VALUETYPE:=TMyBlock}
    
    {$INCLUDE map.inc}

  2. #2
    Macros are only in FPC it seems, sadly no such thing in D7.
    In FPC, i will try this of course..

    I once found even some IDE plugin or addon or something, that kinda tried to make things generic in old Delphi. D5 or something.
    You specified type you wanted and it generated another unit with this type and it used it..

    I must find it, it was interesting. Probably from archives, the website is gone.


    Can the "records" work with variants, i mean can they work together?
    Last edited by hwnd; 17-12-2013 at 10:29 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •