Hello, have 2 questions regarding active oberon: 1. I suppose built-in procedure AWAIT( some condition ) checks periodically if condition is not met. What is the checking time period? Can I change it? 2. What is the proper way to write/read whole RECORDs to file at once through Streams.Writer Streams.Reader ? I tried this but it generates exceptions: TYPE something = RECORD a : ARRAY 30 OF CHAR; b : LONGINT; END; ArrayOfChar = POINTER TO ARRAY OF CHAR; PROCEDURE test; VAR writer : Streams.Writer; reader : Streams.Reader; s : something; b : ArrayOfChar; BEGIN ... want to write and read s to file b := SYSTEM.VAL(ArrayOfChar, ADDRESSOF(s) ); writer.Bytes( b^, 0, SIZEOF(something) ); ... and then reader.Bytes( b^, 0, SIZEOF(something) ); zdenek
have 2 questions regarding active oberon:
1. I suppose built-in procedure AWAIT( some condition ) checks periodically if condition is not met. What is the checking time period? Can I change it?
It is re-evaluated everytime an EXCLUSIVE block is left. There is no
time-based component.
2. What is the proper way to write/read whole RECORDs to file at once through Streams.Writer Streams.Reader ? I tried this but it generates exceptions:
TYPE something = RECORD a : ARRAY 30 OF CHAR; b : LONGINT; END;
ArrayOfChar = POINTER TO ARRAY OF CHAR;
PROCEDURE test; VAR writer : Streams.Writer; reader : Streams.Reader; s : something; b : ArrayOfChar; BEGIN ... want to write and read s to file
b := SYSTEM.VAL(ArrayOfChar, ADDRESSOF(s) ); writer.Bytes( b^, 0, SIZEOF(something) );
... and then reader.Bytes( b^, 0, SIZEOF(something) );
If you persist the data I would suggest to explicitly serialize the fields (for forward compatibility). If you need it only temporarily your solution should be fine.
--Thomas
zdenek
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
I don't know anything about 'Stream Reader/Writer' re. Oberon; but if it needed special handling for records, compared to 2 bytes, it would be no good. On 2/6/14, Zdenek <oberon@moravcik.info> wrote:
Hello,
have 2 questions regarding active oberon:
1. I suppose built-in procedure AWAIT( some condition ) checks periodically if condition is not met. What is the checking time period? Can I change it?
2. What is the proper way to write/read whole RECORDs to file at once through Streams.Writer Streams.Reader ? I tried this but it generates exceptions:
TYPE something = RECORD a : ARRAY 30 OF CHAR; b : LONGINT; END;
ArrayOfChar = POINTER TO ARRAY OF CHAR;
PROCEDURE test; VAR writer : Streams.Writer; reader : Streams.Reader; s : something; b : ArrayOfChar; BEGIN ... want to write and read s to file
b := SYSTEM.VAL(ArrayOfChar, ADDRESSOF(s) ); writer.Bytes( b^, 0, SIZEOF(something) );
... and then reader.Bytes( b^, 0, SIZEOF(something) );
zdenek
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
participants (3)
-
eas lab -
Thomas Frey -
Zdenek