Prechádzať zdrojové kódy

Added basic support for echoed standard IO

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@8578 8c9fc860-2736-0410-a75d-ab315db34111
negelef 6 rokov pred
rodič
commit
4a7ffdeed5

+ 8 - 1
source/Shell.Mod

@@ -674,7 +674,14 @@ TYPE
 		NEW(shell, context.in, context.out, context.error, FALSE, ">");
 		shell.AwaitDeath()
 	END Start;
-	
+
+	PROCEDURE StartEchoed*(context: Commands.Context);
+	VAR shell: Shell;
+	BEGIN
+		NEW(shell, context.in, context.out, context.error, TRUE, ">");
+		shell.AwaitDeath()
+	END StartEchoed;
+
 END Shell.
 
 System.Free Shell ~

+ 3 - 3
source/StdIOShell.Mod

@@ -19,11 +19,11 @@ PROCEDURE Execute(context: Commands.Context): BOOLEAN;
 VAR str: ARRAY 256 OF CHAR;
 BEGIN
 	IF ~context.arg.GetString(str) THEN  
-		context.out.String("Critical error: no arg"); 
+		context.error.String("Critical error: no arg"); context.error.Update;
 		RETURN FALSE;
 	END;
-	IF ~context.arg.GetString(str) THEN 
-		str := "Shell.Start";
+	IF ~context.arg.GetString(str) THEN
+		IF StdIO.Echo THEN str := "Shell.StartEchoed" ELSE str := "Shell.Start" END;
 	ELSIF (str = "compile") THEN str := "Compiler.Compile";
 	ELSIF (str = "link") THEN str := "Linker.Link";
 	ELSIF (str = "interpreter") OR (str = "i") THEN str := "InterpreterShell.Start";

+ 2 - 2
source/Unix.StdIO.Mod

@@ -8,8 +8,8 @@ IMPORT SYSTEM, Modules, Commands, Streams,Pipes , Unix;
 	IMPORT Activities, Counters, Environment;
 #END
 
-CONST 
-	AddrSize = SIZEOF( ADDRESS );
+CONST
+	Echo* = FALSE;
 TYPE
 	String=POINTER TO ARRAY OF CHAR;
 VAR 

+ 1 - 1
source/Windows.StdIO.Mod

@@ -5,7 +5,7 @@ MODULE StdIO;	(** AUTHOR gf;  PURPOSE "Unix standard IO and argument channels *)
 IMPORT S := SYSTEM, Modules, Commands, Streams, Pipes, WinTrace, Kernel32;
 
 CONST 
-	AddrSize = SIZEOF( ADDRESS );
+	Echo* = FALSE;
 TYPE
 	String=POINTER TO ARRAY OF CHAR;
 VAR