Uniface Underground -> Undocumented.Features.Only. Go Home

In version 7.2.04, the precompiler directives #define and #undefine work for in-line declarations of constants.

For example, I have an include proc which does most of the context-sensitive error handling. I have other include procs and global procs within which I would like to use the error handling block.

I do something like this in the error handling include:

#ifnotdefined ERROR_HANDLER
entry L_ERROR

end ; L_ERROR
#define ERROR_HANDLER 1

That way, I can include the error handler anywhere I want without worrying about duplicate definitions.
P.S. - This will be supported/documented in 7.2.05

Unfortunately, the scope of these #define and #undefine statements seem to be restricted to the module in which they are defined. To use them, simply put them on a line by themselves, such as, lets say, in the component's local proc module trigger:

#define COMP_LIB system_library
; Now every reference to will compile to 'system_library'

#include :L_ERROR
; local error handler

#include :utilities
; several general purpose local procs

If you wish to change the library that these include procs come from, just change the #define above to something else:

#define COMP_LIB special_library

Any use that you can think of for a constant can use constants defined in this manner - it doesn't matter whether you're using them in other pre-compiler directives like the #include or #ifdefined, or whether you're using them in the code itself, eg;

#define ENT1 people
...
retrieve/e ""
; this will compile as
; retrieve/e "people"

Just remember - these locally defined constants seem to only exist within the trigger in which they are defined.

Constants defined at the component level in one trigger are not available in other triggers, nor are they inherited at entity or field level.

Update : Fixed in later versions of Uniface. These constants have component, entity and field scope.

More undocumented precompiler directives (form/xml) (Uniface 8.x) Download here !



Copyright © 1999-2000  $UUU  All rights reserved.
Disclaimer. | Site Comments.