Class ExternalDeclaration
External Declaration.
Simula Standard: 6.1 External declarations external-head = external-declaration ; { external-declaration ; } external-declaration = external-procedure-declaration | external-class-declaration
An 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-list
An 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
-
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
CHECKED, lineNumber, OBJECT_SEQU
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Private Constructor used by Attribute File I/O.private
ExternalDeclaration
(String identifier, String extIdentitier) Create a new ExternalDeclaration. -
Method Summary
Modifier and TypeMethodDescriptionprivate static boolean
checkJarFiles
(File jarFile) Check if the jarFile is already included.static Vector
<ExternalDeclaration> expectExternalHead
(BlockDeclaration enclosure) Parse an external declaration updating a declaration list.void
Read external Attribute file.static ExternalDeclaration
Read and return an object.toString()
void
Write a SyntaxClass object to a AttributeOutputStream.Methods inherited from class simula.compiler.syntaxClass.declaration.Declaration
acceptDeclaration, buildDeclaration, buildDeclarationCode, buildInitAttribute, checkAlreadyDefined, getFieldIdentifier, getJavaIdentifier, isCompatibleClasses, verifyTree
Methods inherited from class simula.compiler.syntaxClass.SyntaxClass
ASSERT_SEMANTICS_CHECKED, buildByteCode, doChecking, doDeclarationCoding, doJavaCoding, edIndent, edTreeIndent, IS_SEMANTICS_CHECKED, print, printTree, SET_SEMANTICS_CHECKED, setLineNumber, toJavaCode
-
Constructor Details
-
ExternalDeclaration
-
ExternalDeclaration
private ExternalDeclaration()Private Constructor used by Attribute File I/O.
-
-
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:
enclosure
- the BlockDeclaration which is updated- Returns:
- a Vector of ExternalDeclaration
-
checkJarFiles
Check if the jarFile is already included.- Parameters:
jarFile
- the jarFile.- Returns:
- false: if the jarFile is already included.
-
readExternalAttributeFile
public void readExternalAttributeFile()Read external Attribute file. -
toString
-
writeObject
Description copied from class:SyntaxClass
Write a SyntaxClass object to a AttributeOutputStream.- Overrides:
writeObject
in classSyntaxClass
- Parameters:
oupt
- the AttributeOutputStream to write to.- Throws:
IOException
- if something went wrong.
-
readObject
Read and return an object.- Parameters:
inpt
- the AttributeInputStream to read from- Returns:
- the object read from the stream.
- Throws:
IOException
- if something went wrong.
-