INTERFACE************************************************************************* Copyright (C) Olivetti 1989 All Rights reserved Use and copy of this software and preparation of derivative works based upon this software are permitted to any person, provided this same copyright notice and the following Olivetti warranty disclaimer are included in any copy of the software or any modification thereof or derivative work therefrom made by any person. This software is made available AS IS and Olivetti disclaims all warranties with respect to this software, whether expressed or implied under any law, including all implied warranties of merchantibility and fitness for any purpose. In no event shall Olivetti be liable for any damages whatsoever resulting from loss of use, data or profits or otherwise arising out of or in connection with the use or performance of this software. *************************************************************************M3CGoList ;
IMPORT M3AST_AS; IMPORT M3CUnit, M3Context, M3Conventions; PROCEDURE CompileUnitsInContext( VAR (*inout*) context: M3Context.T; READONLY interfaces, modules, pathNames: ARRAY OF TEXT; VAR (*inout*) phases: M3CUnit.Status; headerOnly := FALSE; setPrimarySource := TRUE; setCompTime: BOOLEAN := FALSE ) RAISES {};
(Try to) compile all the units in the arraysinterfaces
andmodules
, andpathNames
. Any imported/exported units will be looked for incontext
first, which is created if it is NIL. If any notification callbacks have been registered, they will be called just before a unit is compiled and just after; any error messages will already have been generated. If a unit cannot be found an error message will be generated, and the notifications are not called. The value ofphases
controls exactly which phases are run - the usual value isAllPhases
, but it can be convenient to restrict to just parsing, for example.phases
is always updated with any error flags that occur, which provides a cheap check for a clean compilation.
interfaces
andmodules
are expect to contain unit names, which are searched for on the search path.pathNames
are treated literally and, if they have M3 source extensions, are opened and compiled.
headerOnly
causes parsing to abort after parsing the exports and import clauses, which is to support fast dependency analysis.setPrimarySource
causesM3Conventions.PrimarySource
to be set in thefe_status
field of all the modules and interfaces that were explicitly compiled (i.e. those ininterfaces
+modules
).setCompTime = TRUE
, causes anM3Conventions.CompTime
record to be created for each unit compiled, which will be passed to anynotify
methods.
CONST AllPhases = M3CUnit.AllPhases; (* convenience re-export *) PROCEDURE Current(): M3AST_AS.Compilation_Unit RAISES {};
This procedure returns the compilation unit which is currently being compiled.
TYPE NotifyMode = {Before, After}; Notification <: Notification_public; Notification_public = OBJECT METHODS notify( context: M3Context.T; nm: NotifyMode; name: TEXT; ut: M3CUnit.Type; uf: M3CUnit.Form; cu: M3AST_AS.Compilation_Unit; compTime: M3Conventions.CompTime := NIL ) RAISES {}; END; PROCEDURE AddNotification(e: Notification) RAISES {};
Registere.notify
to be called for each compiled unit resulting from a call ofM3CGoList.CompileInContext
.e.notify
is called just before and just after the compilation (cu = NIL
at before). IfsetCompTime = TRUE
, on the call toCompileUnitsInContext
, then theM3Conventions.CompTime
record created for this unit is passed tonotify
, else it gets NIL. The notifications are called in the order that they were added.
PROCEDURE RemoveNotification(e: Notification) RAISES {};
Remove notification e
.
END M3CGoList.