control.sa


Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
 
------------------------->  GNU Sather - sourcefile  <-------------------------
-- Copyright (C) 2000 by K Hopper, University of Waikato, New Zealand        --
-- This file is part of the GNU Sather library. It is free software; you may --
-- redistribute  and/or modify it under the terms of the GNU Library General --
-- Public  License (LGPL)  as published  by the  Free  Software  Foundation; --
-- either version 2 of the license, or (at your option) any later version.   --
-- This  library  is distributed  in the  hope that it will  be  useful, but --
-- WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See Doc/LGPL for more details.       --
-- The license text is also available from:  Free Software Foundation, Inc., --
-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA                     --
-------------->  Please email comments to <bug-sather@gnu.org>  <--------------


immutable class CONTROL_CODES

immutable class CONTROL_CODES is -- This class defines the constants and predicates required to determine -- whether an encoding has a control function or not as defined in ISO/IEC -- 6429. -- Version 1.1 Aug 97. Copyright K Hopper,U of Waikato -- Development History -- ------------------- -- Date Who By Detail -- ---- ------ ------ -- 11 Nov 96 kh Original from ISO/IEC 6429 -- 21 Aug 97 kh Now a total class include AVAL{OCTET} asize -> ; private const asize : CARD := 4 ; -- all 'chars' are 'full-size'! const NUL : SAME := create(0) ; const START_OF_HEADING : SAME := create(1) ; const START_OF_TEXT : SAME := create(2) ; const END_OF_TEXT : SAME := create(3) ; const END_OF_TRANSMISSION : SAME := create(4) ; const ENQUIRY : SAME := create(5) ; const ACKNOWLEDGE : SAME := create(6) ; const ALERT : SAME := create(7) ; const BACKSPACE : SAME := create(8) ; const HORIZONTAL_TAB : SAME := create(9) ; const LINE_FEED : SAME := create(10) ; const VERTICAL_TAB : SAME := create(11) ; const FORM_FEED : SAME := create(12) ; const CARRIAGE_RETURN : SAME := create(13) ; const SHIFT_OUT : SAME := create(14) ; const SHIFT_IN : SAME := create(15) ; const DATA_LINK_ESCAPE : SAME := create(16) ; const DC1 : SAME := create(17) ; const DC2 : SAME := create(18) ; const DC3 : SAME := create(19) ; const DC4 : SAME := create(20) ; const NEGATIVE_ACKNOWLEDGE : SAME := create(21) ; const SYNCHRONOUS_IDLE : SAME := create(22) ; const END_OF_TRANSMISSION_BLOCK : SAME := create(23) ; const CANCEL : SAME := create(24) ; const END_OF_MEDIUM : SAME := create(25) ; const SUBSTITUTE : SAME := create(26) ; const ESCAPE : SAME := create(27) ; const FILE_SEPARATOR : SAME := create(28) ; const GROUP_SEPARATOR : SAME := create(29) ; const RECORD_SEPARATOR : SAME := create(30) ; const UNIT_SEPARATOR : SAME := create(31) ; const DELETE : SAME := create(127) ; const PADDING_CHARACTER : SAME := create(128) ; const HIGH_OCTET_PRESET : SAME := create(129) ; const BREAK_PERMITTED_HERE : SAME := create(130) ; const NO_BREAK_HERE : SAME := create(131) ; const INDEX : SAME := create(132) ; const NEXT_LINE : SAME := create(133) ; const START_OF_SELECTED_AREA : SAME := create(134) ; const END_OF_SELECTED_AREA : SAME := create(135) ; const CHARACTER_TABULATION_SET : SAME := create(136) ; const CHARACTER_TABULATION_WITH_JUSTIFICATION : SAME := create(137) ; const LINE_TABULATION_SET : SAME := create(138) ; const PARTIAL_LINE_FORWARD : SAME := create(139) ; const PARTIAL_LINE_BACKWARD : SAME := create(140) ; const REVERSE_LINE_FEED : SAME := create(141) ; const SINGLE_SHIFT_TWO : SAME := create(142) ; const SINGLE_SHIFT_THREE : SAME := create(143) ; const DEVICE_CONTROL_STRING : SAME := create(144) ; const PRIVATE_USE_ONE : SAME := create(145) ; const PRIVATE_USE_TWO : SAME := create(146) ; const SET_TRANSMIT_STATE : SAME := create(147) ; const CANCEL_CHARACTER : SAME := create(148) ; const MESSAGE_WAITING : SAME := create(149) ; const START_OF_GUARDED_AREA : SAME := create(150) ; const END_OF_GUARDED_AREA : SAME := create(151) ; const START_OF_STRING : SAME := create(152) ; const SINGLE_GRAPHIC_CHARACTER_INTRODUCER : SAME := create(153) ; const SINGLE_CHARACTER_INTRODUCER : SAME := create(154) ; const CONTROL_SEQUENCE_INTRODUCER : SAME := create(155) ; const STRING_TERMINATOR : SAME := create(156) ; const OPERATING_SYSTEM_COMMAND : SAME := create(157) ; const PRIVACY_MESSAGE : SAME := create(158) ; const APPLICATION_PROGRAM_COMMAND : SAME := create(159) ; private const First_Range_Low : CARD := NUL.card ; private const First_Range_High : CARD := UNIT_SEPARATOR.card ; private const Second_Range_Low : CARD := 127 ; private const Second_Range_High : CARD := 159 ; is_valid( val : CARD ) : BOOL is -- This predicate returns true if and only if the argument would be -- valid as a control code. return (val <= First_Range_High) or ((val >= Second_Range_Low) and (val <= Second_Range_High)) end ; create( code_val : CARD ) : SAME pre is_valid(code_val) post (result.card = code_val) is -- This routine returns the code corresponding to the given numeric -- value if it is valid! This implementation is built-in to the compiler. builtin CARD_QUAD end ; card : CARD is -- This routine returns the numeric value of the encoding self. builtin QUAD_CARD end ; is_space : BOOL is -- This predicate returns true if and only if the value is a code -- indicating that a rendering engine is to produce some form of spacing -- action, otherwise false. return (card >= BACKSPACE.card) and (card <= CARRIAGE_RETURN.card) end ; end ; -- CONTROL_CODES