Simula Standard: 6.1 External declarations external-head = external-declaration ; { external-declaration ; } external-declaration = external-procedure-declaration | external-class-declarationAn external declaration is a substitute for a complete introduction of the corresponding source module referred to, including its external head. In the case where multiple but identical external declarations occur as a consequence of this rule, this declaration will be incorporated only once. External Class Declaration
external-class-declaration = EXTERNAL CLASS external-listAn implementation may restrict the number of block levels at which an external class declaration may occur.
Note: As a consequence of 5.5.1 all classes belonging to the prefix chain of a separately compiled class must be declared in the same block as this class. However, this need not be done explicitly; an external declaration of a separately compiled class implicitly declares all classes in its prefix chain (since these will be declared in the external head of the class in question). External procedure declaration
external-procedure-declaration = EXTERNAL [ kind ] [ type ] PROCEDURE external-list | EXTERNAL kind PROCEDURE external-item IS procedure-declaration external-list = external-item { , external-item } external-item = identifier [ "=" external-identification ] kind = identifier // E.g. FORTRAN, JAVA, ... external-identification = string // E.g a file-name
The kind of an external procedure declaration may indicate the source language in which the separately compiled procedure is written (e.g assembly, Cobol, Fortran, PL1 etc.). The kind must be empty if this language is Simula. The interpretation of kind (if given) is implementation-dependent.
If an external procedure declaration contains a procedure specification, the procedure body of the procedure declaration must be empty. This specifies a procedure whose actual body, which embodies the algorithm required, is supplied in a separate (non-Simula) module. The procedure heading of the procedure declaration will determine the procedure identifier (function designator) to be used within the source module in which the external declaration occurs, as well as the type, order, and transmission mode of the parameters.
A non-Simula procedure cannot be used as an actual parameter corresponding to a formal procedure.
Link to GitHub: Source File.
- Author:
- SIMULA Standards Group, Øystein Myhre Andersen
-
Nested Class Summary
Nested classes/interfaces inherited from class simula.compiler.syntaxClass.declaration.Declaration
Declaration.Kind
-
Field Summary
Fields inherited from class simula.compiler.syntaxClass.declaration.Declaration
declarationKind, declaredIn, externalIdent, identifier, isProtected, type
Fields inherited from class simula.compiler.syntaxClass.SyntaxClass
lineNumber
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate static void
expandJarEntries
(JarFile jarFile, File destDir) Expand .jar file entries into the given directory.static void
expectExternalHead
(DeclarationList declarationList) Parse an external declaration updating a declaration list.private static File
findJarFile
(String identifier, Token externalIdentifier) Find the .jar file containing an external class or procedure.private static Type
readAttributeFile
(String identifier, File file, DeclarationList declarationList) Read an attribute file.Methods inherited from class simula.compiler.syntaxClass.declaration.Declaration
getJavaIdentifier, isCompatibleClasses, modifyIdentifier, parseDeclaration
Methods inherited from class simula.compiler.syntaxClass.SyntaxClass
ASSERT_SEMANTICS_CHECKED, doChecking, doDeclarationCoding, doJavaCoding, edIndent, edTreeIndent, IS_SEMANTICS_CHECKED, print, printTree, SET_SEMANTICS_CHECKED, toJavaCode
-
Constructor Details
-
ExternalDeclaration
private ExternalDeclaration()Create a new ExternalDeclaration.
-
-
Method Details
-
expectExternalHead
Parse an external declaration updating a declaration list.external-head = external-declaration ; { external-declaration ; } external-class-declaration = EXTERNAL CLASS external-list external-procedure-declaration = EXTERNAL [ kind ] [ type ] PROCEDURE external-list | EXTERNAL kind PROCEDURE external-item IS procedure-declaration
Precondition: EXTERNAL is already read.- Parameters:
declarationList
- the declaration list which is updated
-
findJarFile
Find the .jar file containing an external class or procedure.- Parameters:
identifier
- class or procedure identifierexternalIdentifier
- the external identifier if any- Returns:
- the resulting File
-
readAttributeFile
private static Type readAttributeFile(String identifier, File file, DeclarationList declarationList) Read an attribute file.- Parameters:
identifier
- class or procedure identifierfile
- the file to readdeclarationList
- the declaration list to update- Returns:
- the module type
-
expandJarEntries
Expand .jar file entries into the given directory.- Parameters:
jarFile
- the .jar filedestDir
- the output directory- Throws:
IOException
- if something went wrong
-