english
version "1.0"
identify "xyz"

#: Copyright (c) 2005 by Wayne C. Gramlich.
#, All rights reserved.

#: This module provides an interface to the Unix terminal I/O system.

module unix_termios

define termios				#: Terminal I/O block
    external


procedure field_lookup@termios
    takes
	name string
    returns unsigned
    external termios__field_lookup
    #: This procedure will return the field value associated with {name}.
    #, If {name} is not a valid {termios} field name, 0xffffffff is returned.



procedure allocate@termios
    takes_nothing
    returns termios
    external termios__allocate

    #: This prodedure allocate and return a new empty {termios} object.



procedure input_modes_get@termios
    takes
	termios termios
    returns unsigned
    external termios__input_modes_get

    #: This procedure will return the input modes for {termios}.



procedure output_modes_get@termios
    takes
	termios termios
    returns unsigned
    external termios__output_modes_get

    #: This procedure will return the output modes for {termios}.



procedure control_modes_get@termios
    takes
	termios termios
    returns unsigned
    external termios__control_modes_get

    #: This procedure will return the control modes for {termios}.



procedure local_modes_get@termios
    takes
	termios termios
    returns unsigned
    external termios__local_modes_get

    #: This procedure will return the local modes for {termios}.



procedure fetch1@termios
    takes
	termios termios
	index unsigned
    returns unsigned
    external termios__fetch1

    #: This procedure will return the {index}'th control character mode
    #, for {termios}.



procedure input_modes_set@termios
    takes
	termios termios
	input_modes unsigned
    returns unsigned
    external termios__input_modes_set

    #: This procedure will set the input modes for {termios} to {input_modes}.



procedure output_modes_set@termios
    takes
	termios termios
	output_modes unsigned
    returns unsigned
    external termios__output_modes_set

    #: This procedure will set the output modes for {termios}
    #, to {output_modes}.



procedure control_modes_set@termios
    takes
	termios termios
	control_modes unsigned
    returns unsigned
    external termios__control_modes_set

    #: This procedure will set the control modes for {termios}
    #, to {control_modes}.



procedure local_modes_set@termios
    takes
	termios termios
    returns unsigned
    external termios__local_modes_set

    #: This procedure will set the local modes for {termios} to {local_modes}.



procedure store1@termios
    takes
	termios termios
	index unsigned
	value unsigned
    returns_nothing
    external termios__store1

    #: This procedure will set the {index}'th control character mode
    #, for {termios} to {value}.



procedure input_speed_get@termios
    takes
	termios termios
    returns unsigned
    external termios__input_speed_get

    #: This procedure will return the input baud rate value for {termios}.



procedure output_speed_get@termios
    takes
	termios termios
    returns unsigned
    external termios__output_speed_get

    #: This procedure will return the output baud rate value for {termios}.



procedure input_speed_set@termios
    takes
	termios termios
	speed unsigned
    returns_nothing
    external termios__input_speed_set

    #: This procedure will set input baud rate value for {termios} to {value}.



procedure output_speed_set@termios
    takes
	termios termios
	speed unsigned
    returns_nothing
    external termios__output_speed_set

    #: This procedure will set the output baud rate value for {termios}
    #, to {value}.



procedure speed_set@termios
    takes
	termios termios
	speed unsigned
    returns_nothing
    external termios__speed_set

    #: This procedure will set the input and output speed of {termios}
    #, to {value}.



procedure attributes_get@termios
    takes
	termios termios
	file_descriptor unsigned
    returns integer
    external termios__attributes_get
    #: This procedure will read the attributes for {termios} into {fd}.



procedure attributes_set@termios
    takes
	termios termios
	file_descriptor unsigned
	optional_actions unsigned
    returns integer
    external termios__attributes_set

    #: This procedure will set attributes for {fd} to {termios} with
    #, {optional_actions}.



procedure make_raw@termios
    takes
	termios termios
    returns integer
    external termios__make_raw

    #: This procedure will set {termios} to {raw} mode.  This procedure
    #, returns 0 on success and -1 on failure.



procedure send_break@termios
    takes
	file_descriptor unsigned
	duration integer
    returns integer
    external termios__send_break

    #: This procedure will send a break of {duration} to {fd}.



procedure drain@termios
    takes
	file_descriptor unsigned
    returns integer
    external termios__drain

    #: This procedure will drain {fd}.



procedure flush@termios
    takes
	file_descriptor unsigned
	queue_selector unsigned
    returns integer
    external termial__flush

    #: This procedure will flush {fd} using {queue_selector}.



procedure flow@termios
    takes
	file_descriptor unsigned
	action unsigned
    returns integer
    external termios__flush

    #: This procedure will flow {fd} using {action}.



procedure print@termios
    takes
	termios termios
	out_stream out_stream
    returns_nothing

    #: This procedure will print {termios} to {out_stream}.


procedure process_group_get@termios
    takes
	file_descriptor unsigned
    returns integer
    external termios__process_group_get

    #: This procedure will return the process group for {fd}.



procedure process_group_set@termios
    takes
	file_descriptor unsigned
	process_group integer
    returns integer
    external termios__process_group_get

    #: This procedure will set the process group for {fd} to {process_group}.



procedure terminal_open@termios
    takes
	path_name string
	baud_rate unsigned
	non_blocking logical
    returns unsigned

    #: This procedure will open {path_name} as a terminal in raw
    #, mode at speed {baud_rate}.  If {non_blocking} is {true},
    #, the terminal is opened in non-blocking mode.  0xffffffff
    #, is returned if the open fails.  0xfffffffe is returned if
    #, the baud rate is not supported.  0xfffffffd is returned if
    #, the terminal attribute set fails.  0xfffffffc is returned if
    #, the flush operation fails.   0xfffffffb is returned if the
    #, make raw fails.  On success, a file descriptor number less
    #, than 0x10000 is returned.