简体   繁体   中英

How to check if a file is already included?

I have a procedure structure like this:

<someprocedure.p>
    <randomCode>
    <INCLUDE standardIncludeFile.i>
</someprocedure>

The standardIncludeFile.i -include file can be used with any procedure files. However, it requires other include files to work. F.ex. stantarderror.i and standardconstants.i .

If the someprocedure.p already has included these 2 files, they shouldn't be included in the standardIncludeFile.i . If they're not, they should be included in the standardIncludeFile.i .

Can I use DEFINED inside the standardIncludeFile.i to check if those .i -files are already included in the someprocedure.p ?

If I use INCLUDE anyway without any conditions, the Eclipse Open-Edge editor gives me the setting to include once , but I'm not sure if that's a good way. The files are compiled on the server for production, anyway.

Currently stantarderror.i or standardconstants.i do not contain any GLOBAL-DEFINED constants, so I cannot check them that way with DEFINED .

Within your incldue file, do something like this

&IF DEFINED (stantarderror) EQ 0 &THEN
GLOBAL-DEFINE stantarderror stantarderror


// actual code here


&ENDIF

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM