2
0
Эх сурвалжийг харах

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 жил өмнө
parent
commit
9d3142c604

+ 5 - 6
source/ShellSerial.Mod

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