[Oberon] install

muller at inf.ethz.ch muller at inf.ethz.ch
Tue Jul 30 18:32:33 CEST 2002


"Pat Hacker" <pat at picoworks.com> wrote:
> I'm new to this mailing list.

Welcome!

> Perhaps this is in the documentation somewhere and I just haven't discovered
> it yet, is there a way to quickly map the import hierarchy for modules?
> It's always nice to have a map when entering new territory.

The Native Oberon release doesn't currently have a tool for this.  
Normally the programmer creates a .Tool text for every project, 
with the modules listed in topological order, typically in a 
ready-to-click Compiler.Compile command.  In the latest alpha
version all the modules of the system are listed in Native.Tool
in Build/SourceB.zip .

The Builder module has some functionality for scanning source files 
and creating a topologically sorted import hierarchy, but it isn't 
cleanly exported.

I poached the attached module from some old test code.  It shows the 
module import dependencies by dumping the loaded module descriptor list.
It may overstate the imports, since it also shows some hidden module 
dependencies created by the compiler.  It should work on 2.3.6, but 
I've only tested it on the latest Alpha.

-- Pieter

MODULE Temp;

IMPORT SYSTEM, Kernel, Modules, Texts, TextFrames, Oberon;

VAR
	W: Texts.Writer;
	
PROCEDURE ShowModules*;
VAR
	T: Texts.Text;
	M, N: Modules.Module;
	size, i: LONGINT;
BEGIN
	T := TextFrames.Text("");
	M := Kernel.modules;
	WHILE M # NIL DO
		SYSTEM.GET(SYSTEM.VAL(LONGINT, M.entries)-24, size);
		Texts.WriteString(W, M.name);  Texts.Write(W, 9X);
		Texts.WriteInt(W, size, 1);  Texts.Write(W, 9X);
		Texts.WriteInt(W, M.refcnt, 1);  Texts.Write(W, 9X);
		Texts.WriteHex(W, SYSTEM.ADR(M.code[0]));
		Texts.WriteString(W, "H");  Texts.Write(W, 9X);
		FOR i := 0 TO LEN(M.imports)-1 DO
			N := M.imports[i];
			Texts.Write(W, " ");  Texts.WriteString(W, N.name)
		END;
		Texts.WriteLn(W);
		M := M.next
	END;
	Texts.Append(T, W.buf);
	Oberon.OpenText("Modules|System.Close System.Free Edit.Search Edit.Store", T, 384, 300)
END ShowModules;

BEGIN
	Texts.OpenWriter(W)
END Temp.

--
Pieter Muller, Computer Systems Institute, ETH Zurich / MCT Lab, Zurich
Native Oberon OS: http://www.oberon.ethz.ch/native/



More information about the Oberon mailing list