2017-01-24 62 views
2

我有一個過程的結構是這樣的:如何檢查文件是否已包含在內?

<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來檢查它們。

回答

5

在您incldue文件,做這樣的事情

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


// actual code here 


&ENDIF 
相關問題