如何检查文件是否已包含在内?

问题描述:

我有一个过程的结构是这样的:如何检查文件是否已包含在内?

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

standardIncludeFile.i -include文件可以用任何程序文件中使用。但是,它需要其他包含文件才能工作。 F.ex. stantarderror.istandardconstants.i

如果someprocedure.p已包含这2个文件,则standardIncludeFile.i中不应该是included。如果他们不是,他们应该是includedstandardIncludeFile.i

我可以使用DEFINEDstandardIncludeFile.i里面,以检查是否这些.i -files已经在someprocedure.pincluded

如果我在没有任何条件的情况下使用INCLUDE,Eclipse Open-Edge编辑器会将设置设置为include once,但我不确定这是否是一种好方法。无论如何,这些文件都在服务器上编译生成。

当前stantarderror.istandardconstants.i不包含任何GLOBAL-DEFINED常数,所以我不能用DEFINED来检查它们。

在您incldue文件,做这样的事情

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


// actual code here 


&ENDIF