Kaynağa Gözat

use standard error codes for context.result

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@8410 8c9fc860-2736-0410-a75d-ab315db34111
eth.morozova 6 yıl önce
ebeveyn
işleme
9d3142c604
1 değiştirilmiş dosya ile 5 ekleme ve 6 silme
  1. 5 6
      source/ShellSerial.Mod

+ 5 - 6
source/ShellSerial.Mod

@@ -63,7 +63,7 @@ BEGIN
 	IF context.arg.Available() # 0 THEN (* port settings are specified *)
 		Serials.GetPortParameters(context.arg, portNbr, bps, data, parity, stop, params, res);
 		IF res # 0 THEN
-			context.result := 2;
+			context.result := Commands.CommandParseError;
 			context.error.String("Invalid port settings, res="); context.error.Int(res,0); context.error.Ln;
 			RETURN;
 		END;
@@ -81,7 +81,7 @@ BEGIN
 			portNbr := i+1;
 			bps := -1;
 		ELSE
-			context.result := 3;
+			context.result := Commands.CommandError;
 			context.error.String("port number is not specified"); context.error.Ln;
 			RETURN;
 		END;
@@ -89,7 +89,7 @@ BEGIN
 
 	port := Serials.GetPort(portNbr);
 	IF port = NIL THEN
-		context.result := 4;
+		context.result := Commands.CommandError;
 		context.error.String("Cannot find port "); context.error.Int(portNbr, 0); context.error.Ln;
 		RETURN;
 	END;
@@ -109,8 +109,7 @@ BEGIN
 	port.Open(bps, data, parity, stop, res);
 	IF res # Serials.Ok THEN
 
-		context.result := 5;
-
+		context.result := Commands.CommandError;
 		context.error.String("Could not open port "); context.error.Int(portNbr, 0);
 		context.error.String(", res="); context.error.Int(res,0);
 		context.error.Ln;
@@ -155,7 +154,7 @@ BEGIN
 		context.out.String(" done.");
 		context.out.Ln;
 	ELSE
-		context.result := 6;
+		context.result := Commands.CommandError;
 		context.error.String("error "); context.error.Int(receiveRes,0); context.error.Ln;
 	END;
 END ModemReceive;