` Printed Icetips Article

Icetips Article



Templates: Extracting module names into variables
1998-10-22 -- Arnor Baldvinsson
 
Newsgroups: comp.lang.clarion


Hi frc,

On Wed, 21 Oct 1998 22:39:00 GMT, frc@frontiernet.net wrote:

>We wish to find a function or compiler pragma which can return the
>module name (e.g., 'PROG003.CLW') in which it executes, something like
>MSVC's __FILE__ and __LINE__ functions.
>
>Any help greatly appreciated! Thanks.

This is very easy to do with extremely simple template code:

#TEMPLATE(ModuleExtensionTemplate,'Module template')
#EXTENSION(ModuleNameExtension,'Module name into variable'),PROCEDURE
#LOCALDATA
Loc:MET:ModuleName    STRING(20)
#ENDLOCALDATA
#AT(%ProcedureInitialize)
  Loc:MET:ModuleName = '%Module'
#ENDAT

Tested and it works.

Best regards,


Arnor Baldvinsson



Printed November 21, 2024, 7:02 am
This article has been viewed/printed 35212 times.
Google search has resulted in 4 hits on this article since January 25, 2004.