Parcourir la source

fixed raw SET I/O

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@8645 8c9fc860-2736-0410-a75d-ab315db34111
eth.guenter il y a 6 ans
Parent
commit
2a2615f043
3 fichiers modifiés avec 79 ajouts et 13 suppressions
  1. 27 5
      source/IO64.Streams.Mod
  2. 26 4
      source/Streams.Mod
  3. 26 4
      source/Streams64.Mod

+ 27 - 5
source/IO64.Streams.Mod

@@ -188,11 +188,21 @@ TYPE
 		END Net8;
 
 	(** Write a SET. *)
-		PROCEDURE RawSet* ( x: SET ); (*! 64 bits *)
+		PROCEDURE RawSet* ( x: SET ); (*! note: in case of -bits=64 only 32 bits are written ! *)
 		BEGIN
-			Bytes( SYSTEM.VAL( Bytes4, x ), 0, 4 );
+			RawSet32( SET32( x ) );
 		END RawSet;
-
+		
+		PROCEDURE RawSet32* ( x: SET32 ); 
+		BEGIN
+			Bytes( SYSTEM.VAL( Bytes4, x ), 0, 4 );
+		END RawSet32;
+		
+		PROCEDURE RawSet64* ( x: SET64 ); 
+		BEGIN
+			Bytes( SYSTEM.VAL( Bytes8, x ), 0, 8 );
+		END RawSet64;
+		
 	(** Write a BOOLEAN. *)
 		PROCEDURE RawBool* ( x: BOOLEAN );
 		BEGIN
@@ -617,11 +627,23 @@ TYPE
 		END Net8;
 
 	(** Read a SET. *)
-		PROCEDURE RawSet* ( VAR x: SET );
+		PROCEDURE RawSet* ( VAR x: SET ); (*! note: in case of -bits=64 only 32 bits are read ! *)
+		VAR lx: SET32;
+		BEGIN
+			RawSet32( lx ); x := lx
+		END RawSet;
+		
+		PROCEDURE RawSet32* ( VAR x: SET32 );
 		VAR ignore: SIZE;
 		BEGIN
 			Bytes( SYSTEM.VAL( Bytes4, x ), 0, 4, ignore )
-		END RawSet;
+		END RawSet32;
+		
+		PROCEDURE RawSet64* ( VAR x: SET64 );
+		VAR ignore: SIZE;
+		BEGIN
+			Bytes( SYSTEM.VAL( Bytes8, x ), 0, 8, ignore )
+		END RawSet64;
 
 	(** Read a BOOLEAN. *)
 		PROCEDURE RawBool* ( VAR x: BOOLEAN );

+ 26 - 4
source/Streams.Mod

@@ -183,10 +183,20 @@ TYPE
 		END Net8;
 
 	(** Write a SET. *)
-		PROCEDURE RawSet*( x: SET );
+		PROCEDURE RawSet* ( x: SET ); (*! note: in case of -bits=64 only 32 bits are written ! *)
 		BEGIN
-			Bytes( SYSTEM.VAL( Bytes4, x ), 0, 4 )
+			RawSet32( SET32( x ) );
 		END RawSet;
+		
+		PROCEDURE RawSet32* ( x: SET32 ); 
+		BEGIN
+			Bytes( SYSTEM.VAL( Bytes4, x ), 0, 4 );
+		END RawSet32;
+		
+		PROCEDURE RawSet64* ( x: SET64 ); 
+		BEGIN
+			Bytes( SYSTEM.VAL( Bytes8, x ), 0, 8 );
+		END RawSet64;
 
 	(** Write a BOOLEAN. *)
 		PROCEDURE RawBool*( x: BOOLEAN );
@@ -611,11 +621,23 @@ TYPE
 		END Net8;
 
 	(** Read a SET. *)
-		PROCEDURE RawSet*( VAR x: SET );
+		PROCEDURE RawSet* ( VAR x: SET ); (*! note: in case of -bits=64 only 32 bits are read ! *)
+		VAR lx: SET32;
+		BEGIN
+			RawSet32( lx ); x := lx
+		END RawSet;
+		
+		PROCEDURE RawSet32* ( VAR x: SET32 );
 		VAR ignore: LONGINT;
 		BEGIN
 			Bytes( SYSTEM.VAL( Bytes4, x ), 0, 4, ignore )
-		END RawSet;
+		END RawSet32;
+		
+		PROCEDURE RawSet64* ( VAR x: SET64 );
+		VAR ignore: LONGINT;
+		BEGIN
+			Bytes( SYSTEM.VAL( Bytes8, x ), 0, 8, ignore )
+		END RawSet64;
 
 	(** Read a BOOLEAN. *)
 		PROCEDURE RawBool*( VAR x: BOOLEAN );

+ 26 - 4
source/Streams64.Mod

@@ -183,10 +183,20 @@ TYPE
 		END Net8;
 
 	(** Write a SET. *)
-		PROCEDURE RawSet*( x: SET );
+		PROCEDURE RawSet* ( x: SET ); (*! note: in case of -bits=64 only 32 bits are written ! *)
 		BEGIN
-			Bytes( SYSTEM.VAL( Bytes4, x ), 0, 4 )
+			RawSet32( SET32( x ) );
 		END RawSet;
+		
+		PROCEDURE RawSet32* ( x: SET32 ); 
+		BEGIN
+			Bytes( SYSTEM.VAL( Bytes4, x ), 0, 4 );
+		END RawSet32;
+		
+		PROCEDURE RawSet64* ( x: SET64 ); 
+		BEGIN
+			Bytes( SYSTEM.VAL( Bytes8, x ), 0, 8 );
+		END RawSet64;
 
 	(** Write a BOOLEAN. *)
 		PROCEDURE RawBool*( x: BOOLEAN );
@@ -631,11 +641,23 @@ TYPE
 		END Net8;
 
 	(** Read a SET. *)
-		PROCEDURE RawSet*( VAR x: SET );
+		PROCEDURE RawSet* ( VAR x: SET ); (*! note: in case of -bits=64 only 32 bits are read ! *)
+		VAR lx: SET32;
+		BEGIN
+			RawSet32( lx ); x := lx
+		END RawSet;
+		
+		PROCEDURE RawSet32* ( VAR x: SET32 );
 		VAR ignore: BufferOffset;
 		BEGIN
 			Bytes( SYSTEM.VAL( Bytes4, x ), 0, 4, ignore )
-		END RawSet;
+		END RawSet32;
+		
+		PROCEDURE RawSet64* ( VAR x: SET64 );
+		VAR ignore: BufferOffset;
+		BEGIN
+			Bytes( SYSTEM.VAL( Bytes8, x ), 0, 8, ignore )
+		END RawSet64;
 
 	(** Read a BOOLEAN. *)
 		PROCEDURE RawBool*( VAR x: BOOLEAN );