Class ExternalDeclaration


public final class ExternalDeclaration extends Declaration

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
  • Constructor Details

    • ExternalDeclaration

      private ExternalDeclaration(String identifier, String extIdentitier)
      Create a new ExternalDeclaration.
      Parameters:
      identifier - the identifier.
      extIdentitier - the external identifier.
    • ExternalDeclaration

      private ExternalDeclaration()
      Private Constructor used by Attribute File I/O.
  • Method Details

    • expectExternalHead

      public static Vector<ExternalDeclaration> expectExternalHead(BlockDeclaration enclosure)

      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

      private static boolean checkJarFiles(File jarFile)
      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

      public String toString()
      Overrides:
      toString in class Object
    • writeObject

      public void writeObject(AttributeOutputStream oupt) throws IOException
      Description copied from class: SyntaxClass
      Write a SyntaxClass object to a AttributeOutputStream.
      Overrides:
      writeObject in class SyntaxClass
      Parameters:
      oupt - the AttributeOutputStream to write to.
      Throws:
      IOException - if something went wrong.
    • readObject

      public static ExternalDeclaration readObject(AttributeInputStream inpt) throws IOException
      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.