Jelajahi Sumber

AddSearchPath

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@7072 8c9fc860-2736-0410-a75d-ab315db34111
felixf 8 tahun lalu
induk
melakukan
3ce2d2facf
5 mengubah file dengan 85 tambahan dan 7 penghapusan
  1. 15 0
      source/Files.Mod
  2. 3 2
      source/Release.Tool
  3. 30 4
      source/StdIOShell.Mod
  4. 18 1
      source/Unix.UnixFiles.Mod
  5. 19 0
      source/Win32.WinFS.Mod

+ 15 - 0
source/Files.Mod

@@ -1110,6 +1110,21 @@ BEGIN
 	RETURN FALSE;
 END Exists;
 
+(* add a search path to the system *)
+PROCEDURE AddSearchPath*(context: Commands.Context);
+VAR cmd: ARRAY 32 OF CHAR; msg: ARRAY 256 OF CHAR;  res: LONGINT;
+BEGIN
+	(* preliminary implementation until we know how to solve this generically *)
+	IF Modules.ModuleByName("WinFS") # NIL THEN 
+		cmd := "WinFS.AddSearchPath";
+	ELSIF Modules.ModuleByName("UnixFiles") # NIL THEN 
+		cmd := "UnixFiles.AddSearchPath";
+	END;
+	IF cmd # "" THEN 
+		Commands.Activate(cmd, context, {Commands.Wait}, res, msg);
+		IF res # 0 THEN context.error.String(msg); context.error.Ln; END;
+	END
+END AddSearchPath;
 (* Find an open file. *)
 
 PROCEDURE FindOpenFile(enum: FileSearcher; fs: FileSystem; key: LONGINT): File;

+ 3 - 2
source/Release.Tool

@@ -50,7 +50,8 @@
 #	Release.Build WinAosNewObjectFile ~
 #	StaticLinker.Link --fileFormat=PE32 --fileName=A2.exe --extension=GofW --displacement=401000H --path="../obg/" Runtime Trace Kernel32 Machine Heaps Modules Objects Kernel KernelLog Streams Commands Files WinFS Clock Dates Reals Strings Diagnostics BitSets StringPool ObjectFile GenericLinker Reflection  GenericLoader  BootConsole ~
 #  Do not forget to add the object file path to the path and to add ObjectFileExtension= ".ObfW" to your .ini file in order to configure the loader.
-# 
+# 	Command line shell:
+# StaticLinker.Link  --fileFormat=PE32CUI --fileName=oberon.exe --extension=GofW --displacement=401000H Runtime Trace Kernel32 Machine Heaps Modules Objects Kernel KernelLog Streams Commands Files  WinFS Clock Dates Reals Strings Diagnostics BitSets StringPool ObjectFile GenericLinker Reflection GenericLoader WinTrace StdIO  Runtime Traps RelativeFileSystem GenericLoader WMDefaultFont SystemTools StdIOShell ~
 #
 # LinuxAOS Generic
 #	Release.Build Linux32G ~
@@ -484,7 +485,7 @@ PACKAGE System ARCHIVE "System.zip" SOURCE "SystemSrc.zip" DESCRIPTION "System"
 	NATIVE,WIN { BootConsole.Mod }
 	UNIX { Unix.BootConsole.Mod }
 
-	UNIXG, WIN32G { Shell.Mod StdIOShell.Mod }
+	UNIXG,WINGEN { Shell.Mod StdIOShell.Mod }
 
 	Displays.Mod
 

+ 30 - 4
source/StdIOShell.Mod

@@ -16,11 +16,13 @@ BEGIN
 	ELSIF (str="i") OR (str = "interpreter") THEN str := "InterpreterShell.Start"
 	ELSIF (str = "run") OR (str="r") THEN str := "SystemTools.DoFile"
 	END;
-
+	
 	Commands.Activate(str, context, {Commands.Wait}, res, msg);
 	IF res # 0 THEN context.error.String(msg); context.error.Ln; END;
 END Execute;
 
+(* do not add commands here -- the module loader does not finish here and they will not become available *)
+
 BEGIN
 	Execute(StdIO.env);
 	Modules.Shutdown(Modules.PowerDown);
@@ -37,6 +39,7 @@ SystemTools.DoCommands
 		StaticLinker
 		FoxOberonFrontend
 		FoxAMDBackend
+		FoxARMBackend
 		FoxGenericObjectFile
 		InterpreterShell
 		SystemTools
@@ -49,10 +52,33 @@ SystemTools.DoCommands
 		~
 		FSTools.CloseFiles oberon ~
 		~
-TODOS:
-	- check linux file system (new files dot not work)
-	- add interpreter to linked image
 
+SystemTools.DoCommands
+	StaticLinker.Link  --fileFormat=PE32CUI --fileName=oberon.exe --extension=GofW --displacement=401000H
+		Runtime Trace Kernel32 Machine Heaps Modules Objects Kernel KernelLog Streams Commands Files 
+		WinFS Clock Dates Reals Strings Diagnostics BitSets StringPool ObjectFile GenericLinker Reflection GenericLoader
+		WinTrace StdIO 
+
+		Runtime  Traps RelativeFileSystem GenericLoader
+		WMDefaultFont
+		StdIOShell
+		Compiler
+		StaticLinker
+		FoxOberonFrontend
+		FoxAMDBackend
+		FoxARMBackend
+		FoxGenericObjectFile
+		InterpreterShell
+		SystemTools
+		FSTools
+		PCAAMD64
+		BootManager
+		VirtualDisks
+		DiskFS
+		Partitions
+		~
+		FSTools.CloseFiles oberon.exe ~
+		~
 
 (** LINUX **)
 

+ 18 - 1
source/Unix.UnixFiles.Mod

@@ -4,7 +4,7 @@ MODULE UnixFiles;   (** AUTHOR "gf"; PURPOSE "Unix file systems" *)
 
 (*  derived fron (SPARCOberon) Files.Mod by J. Templ 1.12. 89/14.05.93 *)
 
-IMPORT S := SYSTEM, Unix, Kernel, Modules, Log := KernelLog, Files;
+IMPORT S := SYSTEM, Unix, Kernel, Modules, Log := KernelLog, Files, Commands;
 
 
 CONST
@@ -1108,6 +1108,23 @@ TYPE
 		tempno := 1;  openfiles := 0;  
 		Modules.InstallTermHandler( Finalization )	
 	END Initialize;
+	
+	PROCEDURE AddSearchPath*(context: Commands.Context);
+	VAR name: Files.FileName; i,j: LONGINT; ch : CHAR;
+	BEGIN
+		IF context.arg.GetString(name) THEN
+			i := 0; j := 0;
+			WHILE(searchPath[i] # 0X) DO
+				INC(i);
+			END;
+			searchPath[i] := " ";INC(i);
+			REPEAT
+				ch := name[j];
+				searchPath[i] := name[j];
+				INC(j);INC(i);
+			UNTIL ch = 0X;
+		END;
+	END AddSearchPath;
 
 	PROCEDURE Finalization;
 	VAR ft: Files.FileSystemTable;  i: LONGINT;

+ 19 - 0
source/Win32.WinFS.Mod

@@ -1211,6 +1211,25 @@ VAR
 
 		notifications := NIL;
 	END Init;
+	
+	PROCEDURE AddSearchPath*(context: Commands.Context);
+	VAR name: FileName; i,j: LONGINT; ch : CHAR;
+	BEGIN
+		IF context.arg.GetString(name) THEN
+			i := 0; j := 0;
+			ConvertChar( name, Files.PathDelimiter, PathDelimiter );
+			WHILE(searchPath[i] # 0X) DO
+				INC(i);
+			END;
+			searchPath[i] := ";";INC(i);
+			REPEAT
+				ch := name[j];
+				searchPath[i] := name[j];
+				INC(j);INC(i);
+			UNTIL ch = 0X;
+		END;
+	END AddSearchPath;
+	
 
 	PROCEDURE Mount*(context : Commands.Context);
 	VAR diskname: ARRAY 256 OF CHAR;