(*
  Title:	GenGraph
  $Header: GenGraph.def,v 1.2 85/01/04 10:37:43 mjj Exp $
  		Copyright (C) 1984 by Acorn Research Centre
*)

DEFINITION MODULE GenGraph;

IMPORT HashStrings;
IMPORT Strings;

EXPORT QUALIFIED
  Directory, M2Module, Imports, ModuleInstance, ImportedBy, Class,
  ModuleName, Build, moduleList, directoryList, moduleTable, verbose,
  parseRemote;

TYPE
    Directory = POINTER TO DirectoryData;
    M2Module = POINTER TO M2ModuleData;
    Imports = POINTER TO ImportsData;
    ModuleInstance = POINTER TO ModuleInstanceData;
    ImportedBy = POINTER TO ImportedByData;
    ModuleName = HashStrings.HashId;
    
    DirectoryData =
        RECORD                  
            next: Directory;
            uniqId: INTEGER;      (* unique id *)
            pathName: Strings.String;     (* directory name *)
            isCurrent: BOOLEAN;   (* marks current working directory *)
            scanned: BOOLEAN;     (* scanned already? *)
            toParse: BOOLEAN;     (* parse here? *)
            target: BOOLEAN;      (* make targets for objects in here? *)
        END;

    Class = (Def, Impl, Prog, Obj, Sym, Exe);    (* module classes *)

    ImportedByData = RECORD
        next: ImportedBy;
        importingModule: M2Module;
      END;

    ModuleInstanceData = RECORD
        next:       ModuleInstance;
        fileName:   Strings.String;       (* within directory *)
        directory:  Directory;    (* where stored *)
        m2Module:   M2Module;     (* back pointer *)
        imports:    Imports;      (* all explicitly imported modules *)
        ignore:     BOOLEAN;      (* cos its duff! *)
        marked:     BOOLEAN;
        class:      Class;
      END;

    M2ModuleData = RECORD
        next: M2Module;
        moduleName: ModuleName;       
        instances: ModuleInstance;
        importedBy: ImportedBy;   (* all modules which import this *)
      END;

    ImportsData = RECORD          
          next: Imports;
          m2Module: M2Module;
        END;

VAR
  moduleList: M2Module;                (* all known modules *)
  directoryList: Directory;            (* all known directories *)
  moduleTable: HashStrings.HashTable;  (* for module names *)
  verbose: BOOLEAN;                    (* for debugging *)
  parseRemote: BOOLEAN; 

PROCEDURE Build;
(* for all the directories on 'directoryList', discover
all the Modula-2 source files and generate 'moduleList'
and the related dependency graph encoded in the 'imports'
and 'importedBy' lists.
*)


END GenGraph.

(*
$Log:	GenGraph.def,v $
Revision 1.2  85/01/04  10:37:43  mjj
Change 'target' field to mean "a directory from which to make targets
of everything", and add 'isCurrent' field to mark the current directory.

Revision 1.1  84/11/30  16:04:52  mjj
Initial revision

*)

