Re: [fpc-pascal] macros

2011-03-16 Thread Marcos Douglas
2011/3/16 Roland Schäfer : > Hi, > > INCLUDEs like these will insert the appropriate strings into your code: > > {$INCLUDE %DATE%} > {$INCLUDE %TIME%} > {$INCLUDE %FPCTARGETCPU%} > {$INCLUDE %FPCTARGETOS%} > {$INCLUDE %FPCVERSION%} > > There are more... AFAIK it's documented in the Programmer's Man

Re: [fpc-pascal] macros

2011-03-16 Thread Roland Schäfer
Hi, INCLUDEs like these will insert the appropriate strings into your code: {$INCLUDE %DATE%} {$INCLUDE %TIME%} {$INCLUDE %FPCTARGETCPU%} {$INCLUDE %FPCTARGETOS%} {$INCLUDE %FPCVERSION%} There are more... AFAIK it's documented in the Programmer's Manual. Cheers Roland On 3/16/2011 2:18 PM, Mar

[fpc-pascal] macros

2011-03-16 Thread Marcos Douglas
Hi, Some day I saw an example using "macros" on the code. I want to put the compiler version in an "about form"... I remember something like %fpcversion%... %date%...whatever. Marcos Douglas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org htt

Re: [fpc-pascal] macros with parameters

2006-09-19 Thread Marc Santhoff
Hi again, I've forgotten to give a pointer: {$define BYTE_ORDER(oc):=((oc)=OCODE_GNOP1 or (oc)=OCODE_GESD)} <---> Marc ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] macros with parameters

2006-09-19 Thread Marc Santhoff
Am Mittwoch, den 20.09.2006, 00:55 +0200 schrieb Michalis Kamburelis: > Marc Santhoff wrote: > > Hi, > > > > the docs only show examples of macros without any parameters. Is it > > possible to use them? > > > > Can I make this work anyhow: > > > > {$MACRO ON} > > {$define HOFFSET(rec,field) := p

[fpc-pascal] macros with more than one parameter

2006-09-19 Thread Marc Santhoff
Hi, how is the correct syntax for macros having more than one parameter? {$define HOFFSET(rec,field):=(pointer(@(rec).(field)) - pointer(@(rec)))} This does not work, even if there is a semicolon between the two parameter names. Trying to use it like this: i := HOFFSET(s1, a); { Line 42 }

Re: [fpc-pascal] macros with parameters

2006-09-19 Thread Michalis Kamburelis
Marc Santhoff wrote: > Hi, > > the docs only show examples of macros without any parameters. Is it > possible to use them? > > Can I make this work anyhow: > > {$MACRO ON} > {$define HOFFSET(rec,field) := pointer(@rec.field) - pointer(@rec)} > > type > s1_t = record > a: lon

[fpc-pascal] macros with parameters

2006-09-19 Thread Marc Santhoff
Hi, the docs only show examples of macros without any parameters. Is it possible to use them? Can I make this work anyhow: {$MACRO ON} {$define HOFFSET(rec,field) := pointer(@rec.field) - pointer(@rec)} type s1_t = record a: longint; b: single;

Re: [fpc-pascal]Macros in FPC

2003-02-10 Thread Anton Tichawa
Hello! > Hi, > > I was wondering if I could do something like this with a macro in FPC: > > const HASH_TABLE_MASK = $ff; > function GetHashIndex ( hash :dword) :integer; > begin >result := hash AND HASH_TABLE_MASK; > end; > > it's kind of a helper funcion so I don't want to perform the functio

[fpc-pascal]Macros in FPC

2003-02-10 Thread Iván Montes
Hi, I was wondering if I could do something like this with a macro in FPC: const HASH_TABLE_MASK = $ff; function GetHashIndex ( hash :dword) :integer; begin result := hash AND HASH_TABLE_MASK; end; it's kind of a helper funcion so I don't want to perform the function call in the code. Would t