program @@fragment foo; import bar1; bar3 (baz1 => glork1) in 'baz.pas'; bar2 only (baz2, baz3 => glork2); bar4 qualified; [...]
module @@fragment Bar; import bar1; bar3 (baz1 => glork1) in 'baz.pas'; bar2 only (baz2, baz3 => glork2); bar4 qualified; [...]
The reserved word import in the import part of a program makes the program import an interface.
The in above tells GPC to look for the module in the specified file; otherwise the file name is derived from the name of the interface by adding first .p, then .pas – which only works if the name of the exported interface coincides with the file name.
The symbol => denotes import renaming: The entity which is exported under the name baz1 by the interface bar3 will be known under the new name glork1 in the program.
The only qualifier means that only the listed identifiers will be imported from the interface. Renaming works together with only, too.
The qualified qualifier means “qualified import”: The imported identifiers will be accessible only trough a “qualified name”. The entity which is exported under the name baz2 by the interface bar4 will be accessible as bar4.baz2.
There must be at most one import part at the begining of a block. Each module or function/procedure (and also main program) can have its own import part. A single import part can import arbitrarly many interfaces.
The interfaces needn't be exported by Extended Pascal modules but may be UCSD/Borland Pascal units as well. GPC also allows import parts in units.
import and modules in general are an ISO 10206 Extended Pascal extension.
Keywords, module, unit, uses.