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

How to check if a file is already included?

我有这样一个程序结构:

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

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

如果someprocedure.p已经包含了这2个文件,它们不应该在standardIncludeFile.iincluded。如果不是,它们应该在 standardIncludeFile.i.

included

我可以在 standardIncludeFile.i 中使用 DEFINED 来检查那些 .i 文件是否已经 includedsomeprocedure.p 中吗?

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

目前 stantarderror.istandardconstants.i 不包含任何 GLOBAL-DEFINED 常量,所以我无法用 DEFINED.

那样检查它们

在你的包含文件中,做这样的事情

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


// actual code here


&ENDIF