! ! MODULE contrl ( ! IDENT = '8.2' ) = BEGIN !++ ! Facility: ! ! BLISS Language Formatter. ! Abstract: ! ! This module contains routines which provide for optional control ! of PRETTY, by means of full-line comments of the form ! !. ! ! REVISION HISTORY ! ! 12-Feb-82 TT This reinstated Xport version had spelling ! mistakes in the macros for Noformat, Error, ! and Noerror in CTL$COMMAND. Noformat was not ! being recognized. Error seemed to work okay ! but it was fixed as well. ! ! 12-Feb-82 TT Set up to handle the new /LOG /NOLOG switch. ! ! END OF REVISION HISTORY !-- ! ! ! Table of contents: !-- FORWARD ROUTINE ctl$command : NOVALUE, ctl$init : NOVALUE, ctl$switch, get_dec; ! ! Include files: !-- REQUIRE 'BLFCSW'; ! Defines control switches, i.e. 'sw_...' REQUIRE 'BLFIOB'; ! XPORT i-o blocks REQUIRE 'BLFMAC'; ! Defines macros 'lex', 'msg', 'write' REQUIRE 'TOKTYP'; ! Defines 'token' and the token type values 's_...' REQUIRE 'UTLCOD'; ! Defines error codes, i.e. 'er_...' ! ! Macros: !-- ! ! Equated symbols: !-- LITERAL true = 1 EQL 1, false = 1 NEQ 1; ! ! Global storage !-- EXTERNAL log_flag; ! ! Own storage: !-- OWN !+ ! All the items here are initialized in ctl$init. !- debug_flag :, ! error, ! Flag for messages. macro_flag, ! Flag for macro-formatting page_width, ! Width of printed page plit_flag, ! Flag for PLIT-formatting rem_tabs, ! Number of tabs to remark column !+ ! The following two switches can take on the values ! 0 = No converison, 1 = Force lower case, 2 = Force upper case. ! 0 is the default value. !- user_case, ! Case switch for user names key_case; ! Case switch for keywords ! ! External references: !-- EXTERNAL ROUTINE lex$def_synonym, out$eject, out$ntbreak, out$set_tab, scn$fin_verb, scn$init, scn$set_in_unit, scn$strt_verb, utl$error; GLOBAL ROUTINE ctl$command (cp) : NOVALUE = ! !++ ! Functional description: ! ! This routine analyses input comments of the form ! ! ! which are used to provide controls to the Formatter. ! ! Formal parameters: ! ! None ! ! Implicit inputs: ! ! None ! ! Implicit outputs: ! ! None ! ! Routine value: ! ! None ! ! Side effects: ! ! None ! !-- ! BEGIN LOCAL ccp; ! Char pointer MACRO blf_text = '!'))) THEN user_case = key_case = sw_locase; END; !------------ IF CH$EQL (uc_text_len, .ccp, ! uc_text_len, CH$PTR (UPLIT(uc_text))) ! 'UPPERCASE' THEN BEGIN ccp = CH$PLUS (.ccp, uc_text_len); IF CH$EQL (key_text_len, .ccp, ! key_text_len, CH$PTR (UPLIT(key_text))) ! '_KEY' THEN key_case = sw_upcase; IF CH$EQL (user_text_len, .ccp, ! user_text_len, CH$PTR (UPLIT(user_text))) ! '_USER' THEN user_case = sw_upcase; IF CH$EQL (1, .ccp, 1, CH$PTR (UPLIT('>'))) THEN user_case = key_case = sw_upcase; END; !------------ IF CH$EQL (noc_text_len, .ccp, ! noc_text_len, CH$PTR (UPLIT(noc_text))) ! 'NOCASE' THEN BEGIN ccp = CH$PLUS (.ccp, noc_text_len); IF CH$EQL (key_text_len, .ccp, ! key_text_len, CH$PTR (UPLIT(key_text))) ! '_KEY' THEN key_case = sw_nocase; IF CH$EQL (user_text_len, .ccp, ! user_text_len, CH$PTR (UPLIT(user_text))) ! '_USER' THEN user_case = sw_nocase; IF CH$EQL (1, .ccp, 1, CH$PTR (UPLIT('>'))) THEN user_case = key_case = sw_nocase; END; END; ! End of routine 'ctl$command' GLOBAL ROUTINE ctl$init : NOVALUE = ! !++ ! Functional description: ! ! This routine initializes the default values of the control ! variables. ! Formal parameters: ! ! None ! ! Implicit inputs: ! ! None ! ! Implicit outputs: ! ! None ! ! Routine value: ! ! None ! ! Side effects: ! ! None ! !-- BEGIN debug_flag = false; error = true; rem_tabs = 6; page_width = 110; key_case = user_case = sw_nocase; macro_flag = false; plit_flag = false; END; ! End of routine 'ctl$init' GLOBAL ROUTINE ctl$switch (switch) = ! !++ ! Functional description: ! ! This routine returns the current value of the control ! switch specified in the argument. ! ! Formal parameters: ! ! Switch is the name of a control switch. ! Available options for switch are: ! sw_debug ! sw_error ! sw_key_case ! sw_user_case ! sw_rem_tabs ! sw_page_width ! sw_macro ! sw_log ! ! Implicit inputs: ! ! None ! ! Implicit outputs: ! ! None ! ! Routine value: ! ! None ! ! Side effects: ! ! None ! !-- BEGIN SELECTONE .switch OF SET [sw_debug] : RETURN .debug_flag; [sw_macro] : RETURN .macro_flag; [sw_error] : RETURN .error; [sw_key_case] : RETURN .key_case; [sw_user_case] : RETURN .user_case; [sw_plit] : RETURN .plit_flag; [sw_rem_tabs] : RETURN .rem_tabs; [sw_page_width] : RETURN .page_width; [sw_log] : RETURN .log_flag; TES; RETURN 0; ! Default END; ! End of routine 'ctl$switch' ROUTINE get_dec (cpin) = ! !++ ! FUNCTIONAL DESCRIPTION: ! ! This routine converts a digit string into a number. ! It is used in the interpretation of control commands ! for PRETTY. ! ! FORMAL PARAMETERS: ! ! cpin = the character pointer to the first (expected) digit. ! ! IMPLICIT INPUTS: ! ! NONE ! ! IMPLICIT OUTPUTS: ! ! NONE ! ! ROUTINE VALUE: ! ! The value in decimal of the digit string. ! ! SIDE EFFECTS: ! ! The character pointer is advanced beyond the first nondigit ! character encountered. ! !-- BEGIN LOCAL ch, num; num = 0; ch = CH$RCHAR_A (.cpin); WHILE .ch GEQ %C'0' AND ! .ch LEQ %C'9' DO BEGIN num = .num*10 + (.ch - %C'0'); ch = CH$RCHAR_A (.cpin); END; RETURN .num; END; ! End of routine 'get_dec' %TITLE 'Last page of CONTRL.BLI' END ! End of module 'contrl' ELUDOM