Including a file in the program source code

!include

Include a named file in the current source code


SYNTAX

!includefilename” | filename | <filename>

An !include declaration is replaced by the entire content of the named file, at the point of the declaration. The included file is compiled as though it were physically part of the current source file. This enables the use of standard subroutine libraries across applications, thereby simplifying standardisation and modification.

filename” | filename | <filename>

If filename is enclosed in angled brackets ( <> ), this indicates that the file is located in the standard SCULPTOR include directory $SCULPTOR/include.

If filename is not enclosed, or is enclosed in double quotes ( “” ) then the normal path searching rules apply. An unenclosed filename may have components in its path replaced by !define. This will not work for a filename enclosed in quotes, as characters between quotes are ignored by !define.


NOTES

  • A separate !include declaration is required for every file to be included.

  • Include files may be nested indefinitely, and may include any valid type of program code, such as declarations, options and subroutines.

  • The contents of the included file should be relevant to the position of the declaration.

  • If the named file cannot be found, then compilation is aborted and an operating system error returned.

  • If +|–window constructs are to be included in a program by means of !include, then each such window must reside entirely within one source file. This enables the screen design tool to update the source code.

  • Environment variables may be used within an include file definition.

  • The file <sculptor.h> should be included at the start of all Sculptor programs.


EXAMPLE

!include <errors.h>
!include "$INCLUDE/windef.i"

!ifdef DEBUG
     !include "sys/include/debug.win"
!endif
     DisplayMessage(Msg)
!else
     PrintMessage(Msg)
!endif

RELATED TOPICS

Standard include files

!define

!ifdef