Module streamio

Index

Declarations

swint64.occ:46Process ss.write.int64

PROC ss.write.int64 (CHAN OF SS scrn, VAL INT64 number, VAL INT width )

Write to the given screen stream a 64-bit integer as decimal ASCII digits, padded out with leading spaces to the specified field width.

If the field width is too small for the number, then it is widened as necessary; a zero value for the field width will give minimum width; a negative field width is an error.

Parameters:

CHAN OF SS scrn for output
VAL INT64 number the 64-bit integer that is desired to be written
VAL INT width the desired field width of the string

swint64.occ:87Process ss.write.hex.int64

PROC ss.write.hex.int64 (CHAN OF SS scrn, VAL INT64 number, VAL INT width )

Write a 64-bit integer as hexadecimal ASCII characters preceded by the '#' character to the given screen stream.

Parameters:

CHAN OF SS scrn for output
VAL INT64 number the 64-bit integer to write out
VAL INT width the field width to use when writing the hex; if width is larger than the size of the number then the number is padded with leading 0's or F's as appropriate; if width is smaller than the size of the number then the number is truncated at the left to width characters; width does not take the '#' into account. A negative field width is an error.

keysink.occ:30Process ks.keystream.sink

PROC ks.keystream.sink (CHAN OF KS keys)

Read word length quantities from the given key stream until ft.terminated is received, at which point this procedure terminates.

Parameters:

CHAN OF KS keys for input

swint.occ:47Process ss.write.int

PROC ss.write.int (CHAN OF SS scrn, VAL INT number, width )

Write to the given screen stream an integer as decimal ASCII digits, padded out with leading spaces to the specified field width.

If the field width is too small for the number, then it is widened as necessary; a zero value for the field width will give minimum width; a negative field width is an error.

Parameters:

CHAN OF SS scrn for output
VAL INT number the integer that is desired to be written
VAL INT width the desired field width of the string

swint.occ:88Process ss.write.hex.int

PROC ss.write.hex.int (CHAN OF SS scrn, VAL INT number, width )

Write an integer as hexadecimal ASCII characters preceded by the '#' character to the given screen stream.

Parameters:

CHAN OF SS scrn for output
VAL INT number the integer to write out
VAL INT width the field width to use when writing the hex; if width is larger than the size of the number then the number is padded with leading 0's or F's as appropriate; if width is smaller than the size of the number then the number is truncated at the left to width characters; width does not take the '#' into account. A negative field width is an error.

toansi.occ:39Process so.scrstream.to.ANSI

PROC so.scrstream.to.ANSI (CHAN OF SP fs, ts, CHAN OF SS scrn)

Convert output in screen stream protocol to output using ANSI screen conventions.

Receipt of st.endstream will terminate this procedure. ANSI screen convertions are set out in ANSI X3.64-1979 "Additional controls for use with american national standard code for information interchange."

Parameters:

CHAN OF SP fs from server
CHAN OF SP ts to server
CHAN OF SS scrn for input

kstdin.occ:43Process so.keystream.from.stdin

PROC so.keystream.from.stdin (CHAN OF SP fs, ts, CHAN OF KS keys.out, BYTE result)

Read lines from standard input and output them on the given key stream channel.

The value ft.terminated is sent on keys.out on termination. Termination of this procedure is either when an error occurs or when all characters from standard input have been read, ie when end of file from standard input is read. A '*c' is output to terminate a text line.

Parameters:

CHAN OF SP fs from server
CHAN OF SP ts to server
CHAN OF KS keys.out for output
BYTE result spr.ok if the process was successful; otherwise >= spr.operation.failed meaning that reading standard input failed - see hostio.inc or iserver documentation for further details

keyscr.occ:38Process ks.keystream.to.scrstream

PROC ks.keystream.to.scrstream (CHAN OF KS keyboard, CHAN OF SS scrn)

Convert keystream protocol into screen stream protocol.

This procedure is terminated by the receipt of ft.terminated from the keyboard stream. For keystream values above ft.tag, only ft.tag + 1 to ft.tag + 8 are dealt with, values above ft.tag + 8, and ft.tag itself are translated into st.beep. Keystream values which are negative, other than ft.terminated, are ignored. Keystream values in the range [0, ft.tag) are passed straight through, other than '*c' which is translated into '*c' followed by '*n'.

Parameters:

CHAN OF KS keyboard for input
CHAN OF SS scrn for output

srreal64.occ:50Process ks.read.real64

PROC ks.read.real64 (CHAN OF KS source, REAL64 number, INT char)

Read a double precision real number from the given keystream.

A distinction must be made here between a character held in a byte and a character held in a word length quantity. Here the former is referred to as a character and the latter as a 'character' ( note the quotes ). All input up to a plus sign, a minus sign or a decimal digit is skipped. The real is terminated when anything other than a valid real 'character' is encountered, and it is this 'character' that is returned in char if char is not set to ft.number.error.

Parameters:

CHAN OF KS source for input
REAL64 number if char on exit is not ft.number.error or less than zero then the real number read in double precision IEEE format; otherwise undefined
INT char on entry: the first 'character' from the input to be read; on exit: ft.number.error if the 'characters' read did not form an occam syntax real number ( with optional plus or minus sign as first 'character', and permissible INT 'e' rather than INT 'E' ) or there were more than 30 'characters' read or the 'characters' formed an infinity; less than zero ( other than ft.number.error ) if there was an input error ( eg end of file read ); otherwise it is the 'character' that terminated the sequence of 'characters' read

srreal64.occ:77Process get.real.string

PROC get.real.string (CHAN OF KS in, INT len, []BYTE str, INT char)

Read a string representing a real number from the given keystream.

All input up to a '+', '-', or a decimal digit is skipped. The string representing the real is terminated by a word length quantity that cannot form part of a real number. A lower case exponential symbol ( 'e' ) is alllowed.

Parameters:

CHAN OF KS in for input
INT len the number of characters in str
[]BYTE str the characters read, after initial skipping, are in the first len bytes of this variable, further bytes being undefined
INT char on entry: the first word length quantity of the input to be read; on exit: ft.number.error if the array str would have overflown; less than zero ( other than ft.number.error ) if there was an input error; otherwise the word length quantity that terminated the real number string

swreal64.occ:37Process ss.write.real64

PROC ss.write.real64 (CHAN OF SS scrn, VAL REAL64 number, VAL INT Ip, Dp)

Format into ASCII characters and then write to the given screen stream a double precision real number.

If Ip, Dp and number are such that the resulting formatted form is longer than 30 characters this procedure will act as an invalid process.

Parameters:

CHAN OF SS scrn for output
VAL REAL64 number the IEEE double precision real to format and write out
VAL INT Ip, Dp formatting values; see REAL64TOSTRING for their effect

srint.occ:53Process ks.read.int

PROC ks.read.int (CHAN OF KS source, INT number, char)

Read a decimal or hexadecimal integer from the given keystream.

A distinction must be made here between a character held in a byte and a character held in a word length quantity. Here the former is referred to as a character and the latter as a 'character' ( note the quotes ). Upper and lower case letters are permissible in a hexadecimal integer. All input up to a plus sign, a minus sign, a hash symbol, decimal digit, or a negative valued word is skipped. If it is the hash that is encountered first then it is a hexadecimal integer ( in two's complement form ) that is expected. If it is a negative valued word that is encountered then an input error has occurred and that value is returned in char. The integer is terminated when anything other than a valid digit ( hex and/or decimal, as the case may be ) is read, and it is this terminating quantity that is returned in char if the integer read is not invalid.

Parameters:

CHAN OF KS source for input
INT number if char is not ft.number.error or negative, the value of the integer read; otherwise undefined
INT char on entry: the first 'character' from the input to be read; on exit: ft.number.error if the integer read overflowed the range of INT; a negative value ( other than ft.number.error ) indicating an input error; otherwise the 'character' that terminated the integer

kkbd.occ:42Process so.keystream.from.kbd

PROC so.keystream.from.kbd (CHAN OF SP fs, ts, CHAN OF KS keys.out, CHAN OF BOOL stopper, VAL INT ticks.per.poll)

Read keys from the keyboard at full speed if they are available, otherwise waiting a given interval between polls of the keyboard, and output them as integers on the given key stream.

On termination, ft.terminated is sent on keys.out.

Parameters:

CHAN OF SP fs from server
CHAN OF SP ts to server
CHAN OF KS keys.out for output
CHAN OF BOOL stopper for input; FALSE or TRUE received on this channel terminates this procedure
VAL INT ticks.per.poll this procedure polls the keyboard at intervals of ticks.per.poll low priority transputer clock cycles if keys are not available; a value of less than or equal to zero is an error

srint64.occ:53Process ks.read.int64

PROC ks.read.int64 (CHAN OF KS source, INT64 number, INT char)

Read a 64-bit decimal or hexadecimal integer from the given keystream.

A distinction must be made here between a character held in a byte and a character held in a word length quantity. Here the former is referred to as a character and the latter as a 'character' ( note the quotes ). Upper and lower case letters are permissible in a hexadecimal integer. All input up to a plus sign, a minus sign, a hash symbol, decimal digit, or a negative valued word is skipped. If it is the hash that is encountered first then it is a hexadecimal integer ( in two's complement form ) that is expected. If it is a negative valued word that is encountered then an input error has occurred and that value is returned in char. The integer is terminated when anything other than a valid digit ( hex and/or decimal, as the case may be ) is read, and it is this terminating quantity that is returned in char if the integer read is not invalid.

Parameters:

CHAN OF KS source for input
INT64 number if char is not ft.number.error, the value of the integer read; otherwise undefined
INT char on entry: the first 'character' from the input to be read; on exit: ft.number.error if the integer read overflowed the range of INT64; otherwise the 'character' that terminated the integer

sfile.occ:49Process so.scrstream.to.file

PROC so.scrstream.to.file (CHAN OF SP fs, ts, CHAN OF SS scrn, VAL []BYTE filename, BYTE result)

Write the data sent on the given screen stream to a file.

This routine terminates on receipt of st.endstream on scrn. What is written to the file is the bytes that follow tags ( for those tags that have them ), with the exception that the st.out.int tag has its following INT32 truncated to a BYTE.

Parameters:

CHAN OF SP fs from server
CHAN OF SP ts to server
CHAN OF SS scrn for input
VAL []BYTE filename the name of the file to be write to. The name of the file must fit exactly into filename, i.e. there are (SIZE filename) characters in the name of the file. A directory specification may form part of filename. If a file of the same name exists it is overwritten.
BYTE result spr.ok if the data sent on scrn was successfully written to the file filename; otherwise it takes on a value indicating what went wrong: spr.bad.packet.size filename too large (SIZE filename) > sp.max.openname.size spr.bad.name null file name >=spr.operation.failed see hostio.inc or iserver documentation for further details

sstdout.occ:43Process so.scrstream.to.stdout

PROC so.scrstream.to.stdout (CHAN OF SP fs, ts, CHAN OF SS scrn, BYTE result)

Write the data sent on the given screen stream to standard out.

This routine terminates on receipt of st.endstream on scrn. What is written to the file is the bytes that follow tags ( for those tags that have them ), with the exception that the st.out.int tag has its following INT32 truncated to a BYTE, and that the st.beep tag is transformed into '*#07'.

Parameters:

CHAN OF SP fs from server
CHAN OF SP ts to server
CHAN OF SS scrn for input
BYTE result spr.ok if the data sent on scrn was successfully written to standard out; otherwise is >= spr.operation.failed in which case see hostio.inc or iserver documentation for further details

srreal32.occ:50Process ks.read.real32

PROC ks.read.real32 (CHAN OF KS source, REAL32 number, INT char)

Read a single precision real number from the given keystream.

A distinction must be made here between a character held in a byte and a character held in a word length quantity. Here the former is referred to as a character and the latter as a 'character' ( note the quotes ). All input up to a plus sign, a minus sign or a decimal digit is skipped. The real is terminated when anything other than a valid real 'character' is encountered, and it is this 'character' that is returned in char if char is not set to ft.number.error.

Parameters:

CHAN OF KS source for input
REAL32 number if char on exit is not ft.number.error or less than zero then the real number read in single precision IEEE format; otherwise undefined
INT char on entry: the first 'character' from the input to be read; on exit: ft.number.error if the 'characters' read did not form an occam syntax real number ( with optional plus or minus sign as first 'character', and permissible INT 'e' rather than INT 'E' ) or there were more than 24 'characters' read or the 'characters' formed an infinity; less than zero ( other than ft.number.error ) if there was an input error ( eg end of file read ); otherwise it is the 'character' that terminated the sequence of 'characters' read

srreal32.occ:77Process get.real.string

PROC get.real.string (CHAN OF KS in, INT len, []BYTE str, INT char)

Read a string representing a real number from the given keystream.

All input up to a plus sign, a minus sign, or a decimal digit is skipped. The string representing the real is terminated by a word length quantity that cannot form part of a real number. A lower case exponential symbol ( 'e' ) is alllowed.

Parameters:

CHAN OF KS in for input
INT len the number of characters in str
[]BYTE str the characters read, after initial skipping, are in the first len bytes of this variable, further bytes being undefined
INT char on entry: the first word length quantity of the input to be read; on exit: ft.number.error if the array str would have overflown; less than zero ( other than ft.number.error ) if there was an input error; otherwise the word length quantity that terminated the real number string

scrtfarr.occ:71Process ss.scrstream.to.array

PROC ss.scrstream.to.array (CHAN OF SS scrn, []BYTE buffer)

Put the data received on given screen stream channel into given array.

This procedure terminates when st.endstream is read on channel scrn. This terminating st.endstream is stored in buffer as tt.endstream.

Parameters:

CHAN OF SS scrn for input
[]BYTE buffer the array to which the data received on scrn is placed; the data is stored in the form of TDS2 tt. tags followed as necessary by further data bytes; if buffer overflows then this procedure acts as an invalid process

scrtfarr.occ:209Process ss.scrstream.from.array

PROC ss.scrstream.from.array (CHAN OF SS scrn, VAL []BYTE buffer)

Output the data in the given array on the given screen stream channel.

This procedure terminates when tt.endstream is found in buffer. This tt.endstream is not sent out ( as st.endstream or anything else ).

Parameters:

CHAN OF SS scrn for output
VAL []BYTE buffer the array from which the data is to be sent on scrn; the data should be in the form of TDS2 tt. tags, followed as necessary by further data bytes.

scrcont.occ:29Process ss.clear.eol

PROC ss.clear.eol (CHAN OF SS scrn)

scrcont.occ:32Process ss.clear.eos

PROC ss.clear.eos (CHAN OF SS scrn)

scrcont.occ:35Process ss.beep

PROC ss.beep (CHAN OF SS scrn)

scrcont.occ:38Process ss.up

PROC ss.up (CHAN OF SS scrn)

scrcont.occ:41Process ss.down

PROC ss.down (CHAN OF SS scrn)

scrcont.occ:44Process ss.left

PROC ss.left (CHAN OF SS scrn)

scrcont.occ:47Process ss.right

PROC ss.right (CHAN OF SS scrn)

scrcont.occ:50Process ss.insert.char

PROC ss.insert.char (CHAN OF SS scrn, VAL BYTE ch)

scrcont.occ:53Process ss.delete.chr

PROC ss.delete.chr (CHAN OF SS scrn)

scrcont.occ:56Process ss.delete.chl

PROC ss.delete.chl (CHAN OF SS scrn)

scrcont.occ:61Process ss.ins.line

PROC ss.ins.line (CHAN OF SS scrn)

scrcont.occ:64Process ss.del.line

PROC ss.del.line (CHAN OF SS scrn)

scrfan.occ:35Process ss.scrstream.fan.out

PROC ss.scrstream.fan.out (CHAN OF SS scrn, screen.out1, screen.out2)

Copy everything received on the given screen stream input channel to both of the given screen stream output channels.

Receipt of st.endstream on scrn will terminate this procedure, without sending the stream terminator on.

Parameters:

CHAN OF SS scrn for input
CHAN OF SS screen.out1 for output
CHAN OF SS screen.out2 for output

kfile.occ:49Process so.keystream.from.file

PROC so.keystream.from.file (CHAN OF SP fs, ts, CHAN OF KS keys.out, VAL []BYTE filename, BYTE result)

Read lines from a text file and output them on the given key stream channel.

The value ft.terminated is sent on keys.out on termination. Termination of this procedure is either when an error occurs or when all characters in the file have been read. A '*c' is output to terminate a text line.

Parameters:

CHAN OF SP fs from server
CHAN OF SP ts to server
CHAN OF KS keys.out for output
VAL []BYTE filename the name of the file to be opened. The name of the file must fit exactly into filename, i.e. there are (SIZE filename) characters in the name of the file. A directory specification may form part of filename.
BYTE result spr.ok if the process was successful; otherwise it takes on a value indicating what went wrong: spr.bad.packet.size filename too large: (SIZE filename) > sp.max.openname.size spr.bad.name null file name >=spr.operation.failed the open failed or reading the file failed - see hostio.inc or iserver documentation for further details

scrmux.occ:45Process ss.scrstream.multiplexor

PROC ss.scrstream.multiplexor ([]CHAN OF SS screen.in, CHAN OF SS screen.out, CHAN OF INT stopper)

Multiplex up to 256 screen stream channels onto a single such channel.

It is an error if there are more than 256 channels in screen.in. It is permissible for screen.in to be a null array. Each change of input channel directs output to the next line of the screen, and each such line is annotated at the left with the array index of the channel used followed by '>'. The tag st.endstream is ignored. To attempt some degree of fairness, let the implementation give priority in a heirarchy from screen.in with index i for SIZE screen.in, using modulo SIZE screen.in on the indexes; starting from 0 and incrementing it by one after each input accepted.

Parameters:

[]CHAN OF SS screen.in an array of input channels
CHAN OF SS screen.out the single output channel
CHAN OF INT stopper input to this routine; any integer received on this channel will terminate this routine; this channel has highest priority

totvi.occ:36Process so.scrstream.to.TVI920

PROC so.scrstream.to.TVI920 (CHAN OF SP fs, ts, CHAN OF SS scrn)

Convert output in screen stream protocol to output using TVI920 screen conventions.

Receipt of st.endstream will terminate this procedure.

Parameters:

CHAN OF SP fs from server
CHAN OF SP ts to server
CHAN OF SS scrn for input

srchar.occ:36Process ks.read.char

PROC ks.read.char (CHAN OF KS source, INT char)

Obtain the value of the next word length quantity from the given keystream channel.

Parameters:

CHAN OF KS source for input
INT char the value of the word obtained

srchar.occ:56Process ks.read.line

PROC ks.read.line (CHAN OF KS source, INT len, []BYTE line, INT char)

Read a line of text from the given keystream channel.

Although characters ( ie BYTE's ) are inserted into line, it is word length quantities that are read from source. The line of text is deemed to be terminated by INT '*c' or any negative value. The word that terminated the line is not included in line. Any word read with a value greater than 255 ( the maximum that a byte can hold ) is ignored. Any '*n' read is ignored. If the array line is filled before a valid termination character is encountered, then all further words are ignored.

Parameters:

CHAN OF KS source for input
INT len the number of characters that have been put into line
[]BYTE line the line that was read is [ line FROM 0 FOR len ]
INT char the word that terminated the line

swreal32.occ:37Process ss.write.real32

PROC ss.write.real32 (CHAN OF SS scrn, VAL REAL32 number, VAL INT Ip, Dp)

Format into ASCII characters and then write to the given screen stream a single precision real number.

If Ip, Dp and number are such that the resulting formatted form is longer than 24 characters this procedure will act as an invalid process.

Parameters:

CHAN OF SS scrn for output
VAL REAL32 number the IEEE single precision real to format and write out
VAL INT Ip, Dp formatting values; see REAL32TOSTRING for their effect

scrsink.occ:30Process ss.scrstream.sink

PROC ss.scrstream.sink (CHAN OF SS scrn)

Ignore all but st.endstream of screen stream protocol, and to terminate when it does receive st.endstream.

Parameters:

CHAN OF SS scrn for input

scrcopy.occ:33Process ss.scrstream.copy

PROC ss.scrstream.copy (CHAN OF SS scrn.in, scrn.out)

Copy the output of one screen stream to the input of another.

Receipt of st.endstream on scrn.in will terminate this procedure, without the stream terminator being passed on.

Parameters:

CHAN OF SS scrn.in for input
CHAN OF SS scrn.out for output

swsimple.occ:32Process ss.write.char

PROC ss.write.char (CHAN OF SS scrn, VAL BYTE char)

Send a character to the given screen stream.

Parameters:

CHAN OF SS scrn for output
VAL BYTE char the byte to send on the channel

swsimple.occ:43Process ss.write.string

PROC ss.write.string (CHAN OF SS scrn, VAL []BYTE str)

Send the given string on the given screen stream.

Parameters:

CHAN OF SS scrn for output
VAL []BYTE str a string all the characters of which are sent on scrn.

swsimple.occ:51Process ss.write.nl

PROC ss.write.nl (CHAN OF SS scrn)

Send "*c*n" on the given screen stream.

Parameters:

CHAN OF SS scrn for output

swsimple.occ:62Process ss.write.endstream

PROC ss.write.endstream (CHAN OF SS scrn)

Write a st.endstream tag on the given screen stream

Parameters:

CHAN OF SS scrn for output

swsimple.occ:76Process ss.write.text.line

PROC ss.write.text.line (CHAN OF SS scrn, VAL []BYTE str)

Send a text line on the given screen stream.

Parameters:

CHAN OF SS scrn for output
VAL []BYTE str the string of characters to send. This string may be terminated by '*c' or not, but in either case, the last two characters written are "*c*n".