home *** CD-ROM | disk | FTP | other *** search
Text File | 1988-05-03 | 192.9 KB | 4,116 lines |
- --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- --crtibm
- --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- --$$$+ CRTIBM
-
- --
- -- File 004
- --
- -- Editor Written By Robert S. Cymbalski
- -- Science Applications International Corporation
- -- Energy Systems Group
- -- Ada Software Development Project Team
- -- 2280 U.S. Highway 19 North, Suite 120
- -- Clearwater, Florida 33575
- --
- -- Program Revised from text Copyright (c) 1984 , R.S.Cymbalski
-
- with string_library ;
- use string_library ;
-
- with basic_io_system ;
- use basic_io_system ;
-
- package crt_customization is
-
- package CRT is
-
- type SPECIAL_KEYS is ( KEY_ILLEGAL, KEY_CHARACTER, KEY_END_OF_TEXT,
- KEY_ESCAPE, KEY_TAB_FORWARD, KEY_HOME,
- KEY_LINE_FEED , KEY_CARRIAGE_RETURN ,
- KEY_TAB_BACKWARD, KEY_BACKSPACE, KEY_UP, KEY_DOWN,
- KEY_RIGHT, KEY_LEFT, KEY_DELETE, KEY_FUNCTION,
- KEY_ALTERNATE );
-
- type CRT_COLOR is (BLACK,RED,BLUE,GREEN,PURPLE,YELLOW,LIGHT_BLUE,WHITE);
- type CHAR_ATTRIBUTES is (NORMAL, BLINK, UNDERLINE, OTHER_INTENSITY );
- type CRT_CONTROL is (COLD_INIT, WARM_INIT, ERASE_ALL, ERASE_EOL,
- ERASE_EOS, INSERT_LINE, DELETE_LINE,REVERSE_VIDEO,
- CRT_HOME, CRT_UP, CRT_DOWN, CRT_RIGHT, CRT_LEFT,
- scroll_middle_screen_up , scroll_entire_screen_up ,
- scroll_partial_screen_up ,
- scroll_middle_screen_down , scroll_entire_screen_down ,
- scroll_partial_screen_down ,
- CURSOR_ON, CURSOR_OFF, EXTRA_DISPLAY_ON,
- EXTRA_DISPLAY_OFF, KEYBOARD_INPUT_ON,
- KEYBOARD_INPUT_OFF, PROGRAM_TERMINATION );
-
- CRT_ATTRIBUTE_1 : CHAR_ATTRIBUTES := NORMAL ;
- CRT_ATTRIBUTE_2 : CHAR_ATTRIBUTES := NORMAL ;
- CRT_ATTRIBUTE_3 : CHAR_ATTRIBUTES := NORMAL ;
-
- CURRENT_CRT_COLOR : CRT_COLOR := GREEN ; -- holds current color
- DEFAULT_CRT_COLOR : CRT_COLOR := GREEN ; -- is standard I/O color
- CURRENT_BACKGROUND_COLOR : CRT_COLOR := BLACK ;
- DEFAULT_BACKGROUND_COLOR : CRT_COLOR := BLACK ;--standard background color
-
- NUM_KEY_TYPES : constant integer := 5 ;
- NUM_KEYS_WITHIN_TYPE : constant integer := 16 ;
- type type_of_key_change is record
- KEY : extended_character;
- SPECIAL_MEANING: SPECIAL_KEYS ;
- FINAL_KEY : extended_character;
- end record;
- type ARRAY_TYPE_OF_KEY_CHANGE is
- array ( 1 .. NUM_KEYS_WITHIN_TYPE ) of type_of_key_change ;
- type KEY_SET is record
- LEAD_IN_LENGTH : INTEGER ;
- LEAD_IN : STRING(1 .. 5);
- FOLLOW_REMOVE : INTEGER ;
- EACH_KEY : ARRAY_TYPE_OF_KEY_CHANGE ;
- end record;
- type ALL_KEYS is array ( 1..NUM_KEY_TYPES ) of KEY_SET ;
-
- KEY_MAP : ALL_KEYS;
- REAL_KEY_ON_INPUT : array ( 0..255 ) of extended_character ;
- SPECIAL_MEANING_ON_INPUT : array ( 0..255 ) OF SPECIAL_KEYS ;
-
- -- Now, we need the CRT handler routines
-
- procedure GOTOXY(COL : in A_SCREEN_COLUMN_NUMBER;
- LINE : in A_SCREEN_LINE_NUMBER);
-
- function CRT_HAS( CONTROL : in CRT_CONTROL ) return BOOLEAN;
-
- procedure DO_CRT( CONTROL : in CRT_CONTROL );
-
- procedure CHANGE_CRT( TO : in CHAR_ATTRIBUTES ;
- ALSO : in CHAR_ATTRIBUTES := normal ;
- AND_ALSO : in CHAR_ATTRIBUTES := NORMAL );
-
- procedure CHANGE_COLOR( TEXT_COLOR : in CRT_COLOR ;
- BACKGROUND_COLOR : in CRT_COLOR := black);
-
- procedure scroll_up_middle_screen (
- first_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_up_entire_screen (
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_up_partial_screen (
- first_line_to_scroll : a_screen_line_number ;
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_down_middle_screen (
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_down_entire_screen (
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_down_partial_screen (
- first_line_to_scroll : a_screen_line_number ;
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- end CRT ;
-
- package editor_customization is
-
- type crt_editor_command is ( up_command , down_command ,
- right_command , left_command ,
-
- advance_character_command ,
- advance_word_command ,
- advance_tab_command ,
- advance_line_command ,
- advance_paragraph_command ,
- advance_page_command ,
- advance_infinity_command ,
-
- forward_character_command ,
- backward_character_command ,
- forward_word_command , backward_word_command ,
- forward_tab_command , backward_tab_command ,
- forward_line_command , backward_line_command ,
- forward_paragraph_command ,
- backward_paragraph_command ,
- forward_page_command , backward_page_command ,
-
- home_command ,
- move_to_first_line_position_command ,
- move_to_last_line_position_command ,
- jump_to_first_position_command ,
- jump_to_last_position_command ,
-
- jump_to_marked_position_command ,
-
- set_forward_direction ,
- set_backward_direction ,
-
- shift_screen_right , shift_screen_left ,
-
- adjust_command ,
- copy_command ,
- start_deletion_command,
- find_command ,
- help_command ,
- insert_command ,
- jump_command ,
- kill_command ,
- print_screen_command ,
- re_margin_command ,
- quit_command ,
- replace_command ,
- set_stuff_command ,
- verify_screen_command ,
- enter_exchange_mode ,
- zap_command ,
-
- accept_command ,
- reject_command ,
- word_processor_command,
- digit_command ,
- infinity_command ,
- show_other_prompt_command ,
- illegal_command ) ;
-
- Main_Command_Prompt : string (1..71) ;
- Alternate_Command_Prompt : string (1..71) ;
- Adjust_Command_Prompt : string (1..69) ;
- Copy_Command_Prompt : string (1..46) ;
- Delete_Command_Prompt : string (1..69) ;
- Find_Command_Prompt : string (1.. 7) ;
- Help_Command_Prompt : string (1..29) ;
- Insert_Command_Prompt : string (1..63) ;
- Jump_Command_Prompt : string (1..55) ;
- Kill_Command_Prompt : string (1..78) ;
- Line_Printer_Command_Prompt : string (1..66) ;
- Margin_Command_Prompt : string (1.. 1) ;
- Quit_Command_Prompt : string (1..20) ;
- Replace_Command_Prompt : string (1..10) ;
- Set_Command_Prompt : string (1..69) ;
- eXchange_Command_Prompt : string (1..65) ;
- Zap_Command_Prompt : string (1..47) ;
- Enter_Input_File_Name_Prompt : string (1..57) ;
- Enter_Copied_In_File_Name_Prompt : string (1..49) ;
-
- procedure translate( ch : in character ;
- special : in crt.special_keys ;
- new_ch : out character ;
- edit_special : out crt_editor_command ) ;
-
- max_wp_command_length : constant integer := 20 ;
-
- word_processor_command_string_length : integer ;
-
- word_processor_command_string : string ( 1 .. max_wp_command_length ) ;
-
- end;
-
- end crt_customization ;
-
- package body crt_customization is
-
- package body CRT is
-
- procedure GOTOXY( COL : in A_SCREEN_COLUMN_NUMBER ;
- LINE : in A_SCREEN_LINE_NUMBER ) is
- A_COL, A_LINE : NATURAL;
- begin
- A_COL := COL ;
- A_LINE := LINE ;
- if A_COL > TOTAL_CRT_COL then
- A_COL := TOTAL_CRT_COL ;
- end if;
- if A_LINE > TOTAL_CRT_LINE then
- A_LINE := TOTAL_CRT_LINE ;
- end if;
- CRT_COL := A_COL ;
- CRT_LINE := A_LINE ;
- put_transparent(ASCII.ESC);
- put_transparent("[");
- put_transparent(A_LINE);
- put_transparent(';');
- put_transparent(A_COL);
- put_transparent('H');
- end;
-
- function CRT_HAS( CONTROL : in CRT_CONTROL ) return BOOLEAN is
- ok : BOOLEAN ;
- begin
- case CONTROL is
- when COLD_INIT => ok := TRUE ; -- Required
- when WARM_INIT => ok := TRUE ; -- Required
- when ERASE_ALL => ok := TRUE ; -- Required
- when ERASE_EOL => ok := TRUE ;
- when ERASE_EOS => ok := TRUE ;
- when INSERT_LINE => ok := FALSE ;
- when DELETE_LINE => ok := FALSE ;
- when CRT_HOME => ok := TRUE ; -- Required
- when CRT_UP => ok := TRUE ;
- when CRT_DOWN => ok := TRUE ;
- when CRT_RIGHT => ok := TRUE ;
- when CRT_LEFT => ok := TRUE ;
- when REVERSE_VIDEO => ok := TRUE ;
- when scroll_middle_screen_up => ok := false ;
- when scroll_entire_screen_up => ok := true ; -- required
- when scroll_partial_screen_up => ok := false ;
- when scroll_middle_screen_down => ok := false ;
- when scroll_entire_screen_down => ok := false ;
- when scroll_partial_screen_down => ok := false ;
- when CURSOR_ON => ok := FALSE ;
- when CURSOR_OFF => ok := FALSE ;
- when EXTRA_DISPLAY_ON => ok := FALSE ;
- when EXTRA_DISPLAY_OFF => ok := FALSE ;
- when KEYBOARD_INPUT_ON => ok := FALSE ;
- when KEYBOARD_INPUT_OFF => ok := FALSE ;
- when PROGRAM_TERMINATION=> ok := TRUE ; -- Required
- end case;
- return ok ;
- end;
-
- procedure new_attributes(new_text_color ,
- new_background_color : crt_color;
- new_crt_atr_1 , new_crt_atr_2 , new_crt_atr_3 : char_attributes) is
- screen_color : crt_color ;
-
- procedure new_attr( atr : char_attributes ) is
- begin
- case atr is
- when other_intensity => put_transparent("1;");
- when blink => put_transparent("5;");
- when underline => null ;
- when normal => null ; -- No need to do anything...
- end case;
- end;
-
- begin
- -- First, turn off all old settings
- put_transparent(ASCII.ESC);
- put_transparent("[0m");
- -- Now, remember the new settings
- CRT_ATTRIBUTE_1 := new_crt_atr_1 ;
- CRT_ATTRIBUTE_2 := new_crt_atr_2 ;
- CRT_ATTRIBUTE_3 := new_crt_atr_3 ;
- CURRENT_CRT_COLOR := new_text_color ;
- CURRENT_BACKGROUND_COLOR := new_background_color ;
- -- Now, do the new attribute settings
- put_transparent(ASCII.ESC);
- put_transparent("[");
- new_attr(crt_attribute_1);
- new_attr(crt_attribute_2);
- new_attr(crt_attribute_3);
- -- Now, see if this is reverse video...
- if ( current_background_color /= black )
- and ( current_crt_color = black ) then
- put_transparent("7;");
- screen_color := current_background_color;
- else
- screen_color := current_crt_color;
- end if;
- -- Finally, do the color settings
- case screen_color is
- when black => put_transparent("30m");
- when red => put_transparent("31m");
- when blue => put_transparent("34m");
- when purple => put_transparent("35m"); -- magenta
- when green => put_transparent("32m");
- when yellow => put_transparent("33m");
- when light_blue => put_transparent("36m"); -- cyan
- when white => put_transparent("37m");
- end case ;
- end;
-
- procedure CHANGE_CRT( TO : in CHAR_ATTRIBUTES ;
- ALSO : in CHAR_ATTRIBUTES := normal ;
- AND_ALSO : in CHAR_ATTRIBUTES := NORMAL ) is
- begin
- new_attributes( current_crt_color , current_background_color ,
- to , also , and_also );
- end;
-
- procedure CHANGE_COLOR( TEXT_COLOR : in CRT_COLOR ;
- BACKGROUND_COLOR : in CRT_COLOR := black) is
- begin
- new_attributes( text_color , background_color ,
- crt_attribute_1 , crt_attribute_2 , crt_attribute_3 );
- end;
-
- procedure KEYBOARD_INITIALIZE;
-
- procedure DO_CRT( CONTROL : in CRT_CONTROL ) is
- begin
- case CONTROL is
- when COLD_INIT => TOTAL_CRT_COL := 80 ;
- TOTAL_CRT_LINE:= 24 ;
- KEYBOARD_INITIALIZE;
- DO_CRT(WARM_INIT);
- when WARM_INIT => CHANGE_CRT( NORMAL ) ;
- CHANGE_COLOR( GREEN ) ;
- DO_CRT(ERASE_ALL);
- DO_CRT(CURSOR_ON);
- DO_CRT(EXTRA_DISPLAY_ON);
- DO_CRT(KEYBOARD_INPUT_ON);
- when ERASE_ALL => put_transparent(ASCII.ESC);
- put_transparent("[" & "2J");
- when ERASE_EOL => put_transparent(ASCII.ESC);
- put_transparent("[" & "k") ;
- when ERASE_EOS => put_transparent(ASCII.ESC);
- put_transparent("[" & "0J") ; -- ?????
- when INSERT_LINE => null ;
- when DELETE_LINE => null ;
- when CRT_HOME => GOTOXY(1,1);
- when CRT_UP => if CRT_LINE > 1 then
- CRT_LINE := CRT_LINE - 1 ;
- put_transparent(ASCII.ESC);
- put_transparent("[" & "1A");
- -- else do nothing...
- end if ;
- when CRT_DOWN => if CRT_LINE < TOTAL_CRT_LINE then
- CRT_LINE := CRT_LINE + 1 ;
- put_transparent(ASCII.ESC);
- put_transparent("[" & "1B");
- -- else do nothing...
- end if ;
- when CRT_RIGHT => if CRT_COL < TOTAL_CRT_COL then
- CRT_COL := CRT_COL + 1 ;
- put_transparent(ASCII.ESC);
- put_transparent("[" & "1C");
- -- else do nothing...
- end if ;
- when CRT_LEFT => if CRT_COL > 1 then
- CRT_COL := CRT_COL - 1 ;
- put_transparent(ASCII.ESC);
- put_transparent("[" & "1D") ;
- -- Else, we do nothing...
- end if ;
- when REVERSE_VIDEO=> null ;
- when scroll_middle_screen_up => null ; -- handled separately
- when scroll_entire_screen_up => scroll_up_entire_screen(1);
- when scroll_partial_screen_up => null ; -- handled separately
- when scroll_middle_screen_down => null ; -- handled separately
- when scroll_entire_screen_down => scroll_down_entire_screen(1);
- when scroll_partial_screen_down => null ; -- handled separately
- when CURSOR_ON => null ;
- when CURSOR_OFF => null ;
- when EXTRA_DISPLAY_ON => null ;
- when EXTRA_DISPLAY_OFF => null ;
- when KEYBOARD_INPUT_ON => null ;
- when KEYBOARD_INPUT_OFF => null ;
- when PROGRAM_TERMINATION=> do_crt(warm_init) ;
- put(" Type A Key ") ;
- terminate_basic_io_system ;
- do_crt(warm_init) ;
- end case;
- end;
-
- procedure scroll_up_middle_screen (
- first_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_up_middle_screen
- null ;
- end scroll_up_middle_screen ;
-
- procedure scroll_up_entire_screen (
- number_of_lines_to_scroll : a_screen_line_number ) is
- lines_so_far : integer := 0 ;
- begin -- scroll_up_entire_screen
- gotoxy(1,total_crt_line);
- loop
- put_transparent( ascii.lf ) ;
- lines_so_far := lines_so_far + 1 ;
- exit when lines_so_far >= number_of_lines_to_scroll ;
- end loop ;
- end scroll_up_entire_screen ;
-
- procedure scroll_up_partial_screen (
- first_line_to_scroll : a_screen_line_number ;
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_up_partial_screen
- null ;
- end scroll_up_partial_screen ;
-
- procedure scroll_down_middle_screen (
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_down_middle_screen
- null ;
- end scroll_down_middle_screen ;
-
- procedure scroll_down_entire_screen (
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_down_entire_screen
- null ;
- end scroll_down_entire_screen ;
-
- procedure scroll_down_partial_screen (
- first_line_to_scroll : a_screen_line_number ;
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_down_partial_screen
- null ;
- end scroll_down_partial_screen ;
-
- function CTRL( A_CHARACTER : in CHARACTER ) return INTEGER is
- begin
- return CHARACTER'POS(A_CHARACTER) mod 32; -- Strip off high bits
- end;
-
- procedure KEYBOARD_INITIALIZE is
-
- procedure set_em( place:integer; c_val: integer; new_key: special_keys) is
- begin -- set_em
- real_key_on_input ( place ) := extended_character ( c_val ) ;
- special_meaning_on_input ( place ) := new_key ;
- end set_em ;
-
- procedure SET_KEY_MAPPINGS is
- begin
- -- First, do the normal mappings
- for C_NUMBER in 0..255 loop
- set_em ( c_number , c_number , key_character ) ;
- end loop;
- -- Then, change the characters which are to be treated specially...
- set_em ( ctrl('A') , 0 , key_up ) ;
- set_em ( ctrl('B') , 0 , key_down ) ;
- set_em ( ctrl('F') , 0 , key_right ) ;
- set_em ( ctrl('D') , 0 , key_left ) ;
- set_em ( ctrl('E') , 0 , key_home ) ;
- --
- set_em ( ctrl('V') , 0 , key_end_of_text ) ;
- set_em ( 27 , 0 , key_escape ) ;
- set_em ( ctrl('I') , 0 , key_tab_forward ) ;
- set_em ( ctrl('H') , 0 , key_backspace ) ;
- set_em ( ctrl('J') , 0 , key_line_feed ) ;
- set_em ( ctrl('M') , 0 , key_carriage_return ) ;
- set_em ( 127 , 0 , key_delete ) ;
- end;
-
- procedure SET_MEMORY_FUNCTION_KEYS is
- begin
- put_transparent(ascii.esc) ;
- put_transparent("[0;72;01;p") ; -- Cursor Up to control A
- put_transparent(ascii.esc) ;
- put_transparent("[0;80;02;p") ; -- Cursor Down to control B
- put_transparent(ascii.esc) ;
- put_transparent("[0;77;06;p") ; -- Cursor Right to control F
- put_transparent(ascii.esc) ;
- put_transparent("[0;75;04;p") ; -- Cursor Left to control D
- put_transparent(ascii.esc) ;
- put_transparent("[0;71;05;p") ; -- Home to control E
- put_transparent(ascii.esc) ;
- put_transparent("[0;59;27;97;p") ; -- F1 to a
- put_transparent(ascii.esc) ;
- put_transparent("[0;60;27;98;p") ; -- F2 to b
- put_transparent(ascii.esc) ;
- put_transparent("[0;61;27;99;p") ; -- F3 to c
- put_transparent(ascii.esc) ;
- put_transparent("[0;62;27;100;p") ; -- F4 to d
- put_transparent(ascii.esc) ;
- put_transparent("[0;63;27;101;p") ; -- F5 to e
- put_transparent(ascii.esc) ;
- put_transparent("[0;64;27;102;p") ; -- F6 to f
- put_transparent(ascii.esc) ;
- put_transparent("[0;65;27;103;p") ; -- F7 to g
- put_transparent(ascii.esc) ;
- put_transparent("[0;66;27;104;p") ; -- F8 to h
- put_transparent(ascii.esc) ;
- put_transparent("[0;67;27;105;p") ; -- F9 to i
- put_transparent(ascii.esc) ;
- put_transparent("[0;68;27;106;p") ; -- F10 to j
- put_transparent(ascii.esc) ;
- put_transparent("[0;73;27;107;p") ; -- Page Up to k
- put_transparent(ascii.esc) ;
- put_transparent("[0;79;27;108;p") ; -- End to 1
- put_transparent(ascii.esc) ;
- put_transparent("[0;81;27;109;p") ; -- Page Down to m
- put_transparent(ascii.esc) ;
- put_transparent("[0;82;27;110;p") ; -- INS to n
- put_transparent(ascii.esc) ;
- put_transparent("[0;83;27;111;p") ; -- DEL to o
- put_transparent(ascii.esc) ;
- end;
-
- procedure MAP_FUNCTION_KEYS is
-
- function make_key( in_character : in character ;
- out_meaning : in special_keys ;
- out_character: in integer )
- return type_of_key_change is
- t : type_of_key_change ;
- begin
- t.key := extended_character( CHARACTER'POS( in_character ) ) ;
- t.special_meaning := out_meaning ;
- t.final_key := extended_character( out_character ) ;
- return t;
- end;
-
- begin
- -- Initialize to nothing...
- for A_KEY_TYPE in 1..NUM_KEY_TYPES loop
- KEY_MAP(A_KEY_TYPE).LEAD_IN_LENGTH := 0 ;
- KEY_MAP(A_KEY_TYPE).LEAD_IN := " ";
- KEY_MAP(A_KEY_TYPE).FOLLOW_REMOVE := 0 ;
- for A_SINGLE_KEY in 1..NUM_KEYS_WITHIN_TYPE loop
- KEY_MAP(A_KEY_TYPE).EACH_KEY(A_SINGLE_KEY)
- := make_key( CHARACTER'VAL(0) , key_illegal , 0 );
- end loop;
- end loop;
- KEY_MAP(1).LEAD_IN_LENGTH := 0 ;
- KEY_MAP(1).FOLLOW_REMOVE := 0 ;
- KEY_MAP(1).EACH_KEY(01) := make_key('a',key_function,1);
- KEY_MAP(1).EACH_KEY(02) := make_key('b',key_function,2);
- KEY_MAP(1).EACH_KEY(03) := make_key('c',key_function,3);
- KEY_MAP(1).EACH_KEY(04) := make_key('d',key_function,4) ;
- KEY_MAP(1).EACH_KEY(05) := make_key('e',key_function,5) ;
- KEY_MAP(1).EACH_KEY(06) := make_key('e',key_function,6) ;
- KEY_MAP(1).EACH_KEY(07) := make_key('e',key_function,7) ;
- KEY_MAP(1).EACH_KEY(08) := make_key('e',key_function,8) ;
- KEY_MAP(1).EACH_KEY(09) := make_key('e',key_function,9) ;
- KEY_MAP(1).EACH_KEY(10) := make_key('e',key_function,10);
- KEY_MAP(1).EACH_KEY(11) := make_key('f',key_function,11);
- KEY_MAP(1).EACH_KEY(12) := make_key('g',key_function,12) ;
- KEY_MAP(2).LEAD_IN_LENGTH := 0 ;
- KEY_MAP(2).FOLLOW_REMOVE := 0 ;
- KEY_MAP(2).EACH_KEY(01) := make_key('m',key_function,13);
- KEY_MAP(2).EACH_KEY(02) := make_key('n',key_function,14);
- KEY_MAP(2).EACH_KEY(03) := make_key('o',key_function,15);
- key_map(3).lead_in_length := 1 ;
- key_map(3).lead_in(1) := ascii.esc ;
- key_map(3).follow_remove := 0 ;
- key_map(3).each_key(01) := make_key(ascii.esc,key_escape,0);
- -- The last maps <esc><esc> to a single escape
- end;
-
- begin -- Keyboard_initialize
- set_key_mappings ; -- Set up the special 1 to 1 mappings
- set_memory_function_keys ; -- Initialize the memory for fn keys
- map_function_keys ; -- ready the memory map to read keys
- end KEYBOARD_INITIALIZE;
-
- begin -- CRT
- -- CRT by SAIC/Clearwater IBM PC PC-DOS Routines 07 Jan 85
- do_crt(cold_init);
- --
- end CRT;
-
- package body editor_customization is
-
- maximum_function_keys : constant integer := 10 ;
- maximum_alternate_keys: constant integer := 10 ;
-
- type command_pair is
- record
- c : character ;
- command : crt_editor_command ;
- end record ;
-
- function_key : array ( 1 .. maximum_function_keys ) of command_pair ;
- alternate_key: array ( 1 .. maximum_alternate_keys) of command_pair ;
-
- type a_wp_command is
- record
- len : integer ;
- str : string ( 1 .. max_wp_command_length ) ;
- end record ;
-
- word_processor_command_list : array ( 1 .. 10 ) of a_wp_command ;
-
- Physical_Tran : array ( crt.special_keys ) of command_pair ;
-
- c_to_command : array ( 0 .. 255 ) of command_pair ;
-
- procedure set_c ( in_char ,
- out_char : in character ;
- out_meaning : in crt_editor_command ) is
- begin -- set_c
- c_to_command( character'pos( in_char ) ) := ( out_char , out_meaning) ;
- end set_c ;
-
- procedure initialize_translate_tables is
-
- use crt ;
-
- begin -- initialize_translate_tables
- -- First , make everything Illegal
- for indx in 1 .. maximum_function_keys loop
- function_key ( indx ) := ( ascii.nul , illegal_command ) ;
- end loop ;
- for indx in 1 .. maximum_alternate_keys loop
- alternate_key ( indx ) := ( ascii.nul , illegal_command ) ;
- end loop ;
- for indx in crt.special_keys'first .. crt.special_keys'last loop
- Physical_Tran( indx ) := ( ascii.nul , illegal_command ) ;
- end loop ;
- for indx in 0 .. 255 loop
- c_to_command ( indx ) := ( ascii.nul , illegal_command ) ;
- end loop ;
- function_key ( 1 ) := ( ascii.nul , accept_command ) ;
- function_key ( 2 ) := ( ascii.nul , reject_command ) ;
- function_key (11 ) := ( ascii.nul , reject_command ) ;
- function_key (12 ) := ( ascii.nul , advance_word_command ) ;
- function_key (13 ) := ( ascii.nul , advance_line_command ) ;
- function_key (14 ) := ( ascii.nul , accept_command ) ;
- function_key (15 ) := ( ascii.nul , backward_line_command ) ;
- Physical_Tran ( key_end_of_text ) := ( ascii.nul , accept_command) ;
- Physical_Tran ( key_escape ) := ( ascii.nul , reject_command) ;
- Physical_Tran ( key_line_feed ) := ( ascii.nul , down_command ) ;
- Physical_Tran ( key_carriage_return):=(ascii.nul , advance_line_command);
- Physical_Tran ( key_tab_forward ) := ( ascii.nul , advance_tab_command );
- Physical_Tran ( key_home ) := ( ascii.nul , home_command ) ;
- Physical_Tran ( key_backspace ) := ( ascii.nul ,
- backward_character_command ) ;
- Physical_Tran ( key_up ) := ( ascii.nul , up_command ) ;
- Physical_Tran ( key_down ) := ( ascii.nul , down_command ) ;
- Physical_Tran ( key_right ) := ( ascii.nul , right_command ) ;
- Physical_Tran ( key_left ) := ( ascii.nul , left_command ) ;
- Physical_Tran ( key_delete ) := ( ascii.nul , backward_line_command);
- -- Max wp command length is 20 , so initialize to that length
- for posn in 1 .. 10 loop
- alternate_key(posn) := ( character'val(posn), word_processor_command ) ;
- end loop ;
- word_processor_command_list( 1) :=
- ( 8 , ascii.cr & ".add 1" & ascii.cr & " " ) ;
- word_processor_command_list( 2) :=
- ( 7 , ascii.cr & ".bold " & " " ) ;
- word_processor_command_list( 3) :=
- ( 9 , ascii.cr & ".shadow " & " " ) ;
- word_processor_command_list( 4) :=
- ( 11 , ascii.cr & ".end_page" & ascii.cr & " " ) ;
- word_processor_command_list( 5) :=
- ( 4 , " on" & ascii.cr & " ") ;
- word_processor_command_list( 6) :=
- ( 5 , " off" & ascii.cr & " " ) ;
- word_processor_command_list( 7) :=
- ( 9 , ascii.cr & ".indent " & " " ) ;
- word_processor_command_list( 8) :=
- ( 12 , ascii.cr & ".underline " & " " ) ;
- word_processor_command_list( 9) :=
- ( 14 , ascii.cr & ".ucontinuous " & " " ) ;
- word_processor_command_list(10) :=
- ( 1 , ascii.cr & " " ) ;
- -- the last is the soft carriage return
- -- key_character is handled next
- set_c ( 'A' , 'A' , adjust_command ) ;
- set_c ( 'B' , 'B' , move_to_first_line_position_command ) ;
- set_c ( 'C' , 'C' , copy_command ) ;
- set_c ( 'D' , 'D' , start_deletion_command ) ;
- set_c ( 'E' , 'E' , move_to_last_line_position_command ) ;
- set_c ( 'F' , 'F' , find_command ) ;
- set_c ( 'H' , 'H' , help_command ) ;
- set_c ( 'I' , 'I' , insert_command ) ;
- set_c ( 'J' , 'J' , jump_command ) ;
- set_c ( 'K' , 'K' , kill_command ) ;
- set_c ( 'L' , 'L' , print_screen_command ) ;
- set_c ( 'M' , 'M' , re_margin_command ) ;
- set_c ( 'P' , 'P' , advance_page_command ) ;
- set_c ( 'Q' , 'Q' , quit_command ) ;
- set_c ( 'R' , 'R' , replace_command ) ;
- set_c ( 'S' , 'S' , set_stuff_command ) ;
- set_c ( 'V' , 'V' , verify_screen_command ) ;
- set_c ( 'W' , 'W' , advance_word_command ) ;
- set_c ( 'X' , 'X' , enter_exchange_mode ) ;
- set_c ( 'Y' , 'Y' , advance_paragraph_command ) ;
- set_c ( 'Z' , 'Z' , zap_command ) ;
- set_c ( 'a' , 'a' , adjust_command ) ;
- set_c ( 'b' , 'b' , move_to_first_line_position_command ) ;
- set_c ( 'c' , 'c' , copy_command ) ;
- set_c ( 'd' , 'd' , start_deletion_command ) ;
- set_c ( 'e' , 'e' , move_to_last_line_position_command ) ;
- set_c ( 'f' , 'f' , find_command ) ;
- set_c ( 'h' , 'h' , help_command ) ;
- set_c ( 'i' , 'i' , insert_command ) ;
- set_c ( 'j' , 'j' , jump_command ) ;
- set_c ( 'k' , 'k' , kill_command ) ;
- set_c ( 'l' , 'l' , print_screen_command ) ;
- set_c ( 'm' , 'm' , re_margin_command ) ;
- set_c ( 'p' , 'p' , advance_page_command ) ;
- set_c ( 'q' , 'q' , quit_command ) ;
- set_c ( 'r' , 'r' , replace_command ) ;
- set_c ( 's' , 's' , set_stuff_command ) ;
- set_c ( 'v' , 'v' , verify_screen_command ) ;
- set_c ( 'w' , 'w' , advance_word_command ) ;
- set_c ( 'x' , 'x' , enter_exchange_mode ) ;
- set_c ( 'y' , 'y' , advance_paragraph_command ) ;
- set_c ( 'z' , 'z' , zap_command ) ;
- set_c ( '?' , '?' , help_command ) ;
- set_c ( ' ' , ' ' , advance_character_command ) ;
- set_c ( ',' , ',' , set_backward_direction ) ;
- set_c ( '<' , '<' , set_backward_direction ) ;
- set_c ( '.' , '.' , set_forward_direction ) ;
- set_c ( '>' , '>' , set_forward_direction ) ;
- set_c ( '+' , '+' , shift_screen_right ) ;
- set_c ( ';' , ';' , shift_screen_right ) ;
- set_c ( '-' , '-' , shift_screen_left ) ;
- set_c ( '!' , '!' , show_other_prompt_command ) ;
- set_c ( '/' , '/' , infinity_command ) ;
- set_c ( '=' , '=' , jump_to_marked_position_command);
- for cc in '0' .. '9' loop
- set_c ( cc , cc , digit_command ) ;
- end loop ;
- -- key_macro ( all ) is handled in the lower levels
- end initialize_translate_tables ;
-
- procedure initialize_prompt_lines is
- begin
- Main_Command_Prompt :=
- " Edit: A(djst C(opy D(elete F(ind H(elp I(nsrt Q(uit R(place eX(chg '!'" ;
- Alternate_Command_Prompt :=
- " Edit: H(elp J(ump K(ill L(inePrntr M(argin P(age S(et V(erify Z(ap '!'" ;
- Adjust_Command_Prompt:=
- " Adjust: L(just R(just C(ent <left,right,up,down> [<ACCEPT> to leave]" ;
- Copy_Command_Prompt :=
- " Copy: B(uffer, F(ile, or <Reject> to abort ? " ;
- Delete_Command_Prompt:=
- " Delete: < > <Moving Commands>, <Append Toggle>, <Accept>, <Reject> " ;
- Find_Command_Prompt := " Find: " ;
- Help_Command_Prompt := " Help: Prompt not defined...." ;
- Insert_Command_Prompt:=
- " Insert: Text [<bs> a char,<del> a line][<Accept> or <Reject>] " ;
- Jump_Command_Prompt :=
- " Jump to B(egin, E(nd, M(arker, or <Reject> to abort ? " ;
- Kill_Command_Prompt :=
- "!KILLING! - - Are You Really Sure You Want To Kill All Following Text "
- & "(Y/N) ? " ;
- Line_Printer_Command_Prompt :=
- "!PRINTING! - - Are You Sure You Want To Print This Screen (Y/N) ? " ;
- Margin_Command_Prompt:= " " ;
- Quit_Command_Prompt := " Quit Options: " ;
- Replace_Command_Prompt := " Replace: " ;
- Set_Command_Prompt :=
- " Set: E(nvironment, M(arker, T(abs, Z(ap Marker, H(elp or <Reject> ? " ;
- eXchange_Command_Prompt :=
- " eXchange TEXT [<bs> a char] [<reject> escapes, <accept> accepts]" ;
- Zap_Command_Prompt :=
- " WARNING! Are you sure you wish to zap ? (y/n) " ;
- Enter_Input_File_Name_Prompt:=
- " Enter Input File Name ( or <return> for a new file ) => " ;
- Enter_Copied_In_File_Name_Prompt :=
- " Copy: from what file ( or <return> to skip ) => " ;
- end initialize_prompt_lines ;
-
- procedure translate( ch : in character ;
- special : in crt.special_keys ;
- new_ch : out character ;
- edit_special : out crt_editor_command ) is
- -- translate an input character and special meaning pair to
- -- an internal editor character representation and editor
- -- special meaning pair
- temp_new_ch : character ;
- temp_special: crt_editor_command ;
- begin -- translate
- case special is
- when crt.key_function =>
- if character'pos(ch) <= maximum_function_keys then
- temp_new_ch := function_key ( character'pos(ch) ).c ;
- temp_special := function_key ( character'pos(ch) ).command ;
- else
- temp_new_ch := ascii.nul ;
- temp_special := illegal_command ;
- end if ;
- when crt.key_alternate =>
- if character'pos(ch) <= maximum_alternate_keys then
- temp_new_ch := alternate_key ( character'pos(ch) ).c ;
- temp_special := alternate_key ( character'pos(ch) ).command ;
- else
- temp_new_ch := ascii.nul ;
- temp_special := illegal_command ;
- end if ;
- when crt.key_character =>
- temp_new_ch := c_to_command ( character'pos(ch) ).c ;
- temp_special := c_to_command ( character'pos(ch) ).command ;
- when others =>
- temp_new_ch := physical_tran ( special ).c ;
- temp_special := physical_tran ( special ).command ;
- end case ;
- if temp_special = word_processor_command then
- word_processor_command_string_length :=
- word_processor_command_list(character'pos(temp_new_ch)).len ;
- word_processor_command_string :=
- word_processor_command_list(character'pos(temp_new_ch)).str ;
- end if ;
- new_ch := temp_new_ch ;
- edit_special := temp_special ;
- end translate ;
-
- begin -- editor_customization
- -- EDITVT10 by SAIC/Clearwater Editor Customization VT100 07 Jan 85
- initialize_translate_tables ;
- initialize_prompt_lines ; -- can't put into constants at top because
- -- of initialization code limitation on wicat
- end editor_customization ;
-
- begin -- crt_customization
- -- CRTIBM by SAIC/Clearwater CRT Customization for IBM PC 07 Jan 85
- null ;
- end crt_customization ;
-
- --$$$- CRTIBM
-
- --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- --crtvt100
- --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- --$$$+ CRTVT100
-
- -- File 003a
- --
- -- Editor Written By Robert S. Cymbalski
- -- Science Applications International Corporation
- -- Energy Systems Group
- -- Ada Software Development Project Team
- -- 2280 U.S. Highway 19 North, Suite 120
- -- Clearwater, Florida 33575
- --
- -- CRT Manager Revised from text Copyright (c) 1984 , R.S.Cymbalski
- --
- -- Program for CRT I/O for the VT100 in ANSI mode with 80 column screen
-
- with string_library ;
- use string_library ;
-
- with basic_io_system ;
- use basic_io_system ;
-
- package crt_customization is
-
- package CRT is
-
- type SPECIAL_KEYS is ( KEY_ILLEGAL, KEY_CHARACTER, KEY_END_OF_TEXT,
- KEY_ESCAPE, KEY_TAB_FORWARD, KEY_HOME,
- KEY_LINE_FEED , KEY_CARRIAGE_RETURN ,
- KEY_TAB_BACKWARD, KEY_BACKSPACE, KEY_UP, KEY_DOWN,
- KEY_RIGHT, KEY_LEFT, KEY_DELETE, KEY_FUNCTION,
- KEY_ALTERNATE );
-
- type CRT_COLOR is (BLACK,RED,BLUE,GREEN,PURPLE,YELLOW,LIGHT_BLUE,WHITE);
- type CHAR_ATTRIBUTES is (NORMAL, BLINK, UNDERLINE, OTHER_INTENSITY );
- type CRT_CONTROL is (COLD_INIT, WARM_INIT, ERASE_ALL, ERASE_EOL,
- ERASE_EOS, INSERT_LINE, DELETE_LINE,REVERSE_VIDEO,
- CRT_HOME, CRT_UP, CRT_DOWN, CRT_RIGHT, CRT_LEFT,
- scroll_middle_screen_up , scroll_entire_screen_up ,
- scroll_partial_screen_up ,
- scroll_middle_screen_down , scroll_entire_screen_down ,
- scroll_partial_screen_down ,
- CURSOR_ON, CURSOR_OFF, EXTRA_DISPLAY_ON,
- EXTRA_DISPLAY_OFF, KEYBOARD_INPUT_ON,
- KEYBOARD_INPUT_OFF, PROGRAM_TERMINATION );
-
- CRT_ATTRIBUTE_1 : CHAR_ATTRIBUTES := NORMAL ;
- CRT_ATTRIBUTE_2 : CHAR_ATTRIBUTES := NORMAL ;
- CRT_ATTRIBUTE_3 : CHAR_ATTRIBUTES := NORMAL ;
- CURRENT_CRT_COLOR : CRT_COLOR := GREEN ; -- holds current color
- DEFAULT_CRT_COLOR : CRT_COLOR := GREEN ; -- is standard I/O color
- CURRENT_BACKGROUND_COLOR : CRT_COLOR := BLACK ;
- DEFAULT_BACKGROUND_COLOR : CRT_COLOR := BLACK ;--standard background color
-
- NUM_KEY_TYPES : constant integer := 5 ;
- NUM_KEYS_WITHIN_TYPE : constant integer := 16 ;
- type type_of_key_change is record
- KEY : extended_character;
- SPECIAL_MEANING: SPECIAL_KEYS ;
- FINAL_KEY : extended_character;
- end record;
- type ARRAY_TYPE_OF_KEY_CHANGE is
- array ( 1 .. NUM_KEYS_WITHIN_TYPE ) of type_of_key_change ;
- type KEY_SET is record
- LEAD_IN_LENGTH : INTEGER ;
- LEAD_IN : STRING(1 .. 5);
- FOLLOW_REMOVE : INTEGER ;
- EACH_KEY : ARRAY_TYPE_OF_KEY_CHANGE ;
- end record;
- type ALL_KEYS is array ( 1..NUM_KEY_TYPES ) of KEY_SET ;
- KEY_MAP : ALL_KEYS;
- REAL_KEY_ON_INPUT : array ( 0..255 ) of extended_character ;
- SPECIAL_MEANING_ON_INPUT : array ( 0..255 ) OF SPECIAL_KEYS ;
-
- -- Now, we need the CRT handler routines
-
- procedure GOTOXY(COL : in A_SCREEN_COLUMN_NUMBER;
- LINE : in A_SCREEN_LINE_NUMBER);
- -- Positions the cursor to COL,LINE on the screen; changing COL
- -- and LINE to maximum allowable column or line if they are in error.
- -- This could be done with SET_COL/SET_LINE but this is one call
-
- function CRT_HAS( CONTROL : in CRT_CONTROL ) return BOOLEAN;
- -- Returns true if CRT has the ability to perform the given crt
- -- control function, false otherwise.
-
- procedure DO_CRT( CONTROL : in CRT_CONTROL );
- -- Performs the given crt control function; if the crt does not have
- -- the ability to perform the crt control, nothing is done.
-
- procedure CHANGE_CRT( TO : in CHAR_ATTRIBUTES ;
- ALSO : in CHAR_ATTRIBUTES := normal ;
- AND_ALSO : in CHAR_ATTRIBUTES := NORMAL );
- -- Changes the crt attributes to one, two or three new attributes
-
- procedure CHANGE_COLOR( TEXT_COLOR : in CRT_COLOR ;
- BACKGROUND_COLOR : in CRT_COLOR := black);
- -- Changes the crt color to the new text and background colors
-
- procedure scroll_up_middle_screen (
- first_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_up_entire_screen (
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_up_partial_screen (
- first_line_to_scroll : a_screen_line_number ;
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_down_middle_screen (
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_down_entire_screen (
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_down_partial_screen (
- first_line_to_scroll : a_screen_line_number ;
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- end CRT ;
-
- package editor_customization is
-
- type crt_editor_command is ( up_command , down_command ,
- right_command , left_command ,
-
- advance_character_command ,
- advance_word_command ,
- advance_tab_command ,
- advance_line_command ,
- advance_paragraph_command ,
- advance_page_command ,
- advance_infinity_command ,
-
- forward_character_command ,
- backward_character_command ,
- forward_word_command , backward_word_command ,
- forward_tab_command , backward_tab_command ,
- forward_line_command , backward_line_command ,
- forward_paragraph_command ,
- backward_paragraph_command ,
- forward_page_command , backward_page_command ,
-
- home_command ,
- move_to_first_line_position_command ,
- move_to_last_line_position_command ,
- jump_to_first_position_command ,
- jump_to_last_position_command ,
-
- jump_to_marked_position_command ,
-
- set_forward_direction ,
- set_backward_direction ,
-
- shift_screen_right , shift_screen_left ,
-
- adjust_command ,
- copy_command ,
- start_deletion_command,
- find_command ,
- help_command ,
- insert_command ,
- jump_command ,
- kill_command ,
- print_screen_command ,
- re_margin_command ,
- quit_command ,
- replace_command ,
- set_stuff_command ,
- verify_screen_command ,
- enter_exchange_mode ,
- zap_command ,
-
- accept_command ,
- reject_command ,
- word_processor_command,
- digit_command ,
- infinity_command ,
- show_other_prompt_command ,
- illegal_command ) ;
-
- Main_Command_Prompt : string (1..71) ;
- Alternate_Command_Prompt : string (1..71) ;
- Adjust_Command_Prompt : string (1..69) ;
- Copy_Command_Prompt : string (1..46) ;
- Delete_Command_Prompt : string (1..69) ;
- Find_Command_Prompt : string (1.. 7) ;
- Help_Command_Prompt : string (1..29) ;
- Insert_Command_Prompt : string (1..63) ;
- Jump_Command_Prompt : string (1..55) ;
- Kill_Command_Prompt : string (1..78) ;
- Line_Printer_Command_Prompt : string (1..66) ;
- Margin_Command_Prompt : string (1.. 1) ;
- Quit_Command_Prompt : string (1..20) ;
- Replace_Command_Prompt : string (1..10) ;
- Set_Command_Prompt : string (1..69) ;
- eXchange_Command_Prompt : string (1..65) ;
- Zap_Command_Prompt : string (1..47) ;
- Enter_Input_File_Name_Prompt : string (1..57) ;
- Enter_Copied_In_File_Name_Prompt : string (1..49) ;
-
- procedure translate( ch : in character ;
- special : in crt.special_keys ;
- new_ch : out character ;
- edit_special : out crt_editor_command ) ;
- -- translate an input character and special meaning pair to
- -- an internal editor character representation and editor
- -- special meaning pair
-
- max_wp_command_length : constant integer := 20 ;
-
- word_processor_command_string_length : integer ;
- -- The length of the word processor command string for the
- -- key just pressed
-
- word_processor_command_string : string ( 1 .. max_wp_command_length ) ;
- -- The string of characters associated with the function key hit
- -- If the first character is ascii.cr, then start a new line at
- -- column 1. If the length is greater than 1 and then the last
- -- character is ascii.cr, then end by starting a new line and
- -- indenting to the old indentation from before the command key.
- -- If the first character is a space, then, only put the space in
- -- if the last character was not a space
-
- end;
-
- end crt_customization ;
-
- package body crt_customization is
-
- package body CRT is
-
- procedure GOTOXY( COL : in A_SCREEN_COLUMN_NUMBER ;
- LINE : in A_SCREEN_LINE_NUMBER ) is
- A_COL, A_LINE : NATURAL;
- begin
- A_COL := COL ;
- A_LINE := LINE ;
- if A_COL > TOTAL_CRT_COL then
- A_COL := TOTAL_CRT_COL ;
- end if;
- if A_LINE > TOTAL_CRT_LINE then
- A_LINE := TOTAL_CRT_LINE ;
- end if;
- CRT_COL := A_COL ;
- CRT_LINE := A_LINE ;
- put_transparent(ASCII.ESC);
- put_transparent("[");
- put_transparent(A_LINE);
- put_transparent(';');
- put_transparent(A_COL);
- put_transparent('H');
- end;
-
- function CRT_HAS( CONTROL : in CRT_CONTROL ) return BOOLEAN is
- ok : BOOLEAN ;
- begin
- case CONTROL is
- when COLD_INIT => ok := TRUE ; -- Required
- when WARM_INIT => ok := TRUE ; -- Required
- when ERASE_ALL => ok := TRUE ; -- Required
- when ERASE_EOL => ok := TRUE ;
- when ERASE_EOS => ok := TRUE ;
- when INSERT_LINE => ok := FALSE ;
- when DELETE_LINE => ok := FALSE ;
- when REVERSE_VIDEO => ok := TRUE ;
- when CRT_HOME => ok := TRUE ; -- Required
- when CRT_UP => ok := TRUE ;
- when CRT_DOWN => ok := TRUE ;
- when CRT_RIGHT => ok := TRUE ;
- when CRT_LEFT => ok := TRUE ;
- when scroll_middle_screen_up => ok := true ;
- when scroll_entire_screen_up => ok := true ; -- required
- when scroll_partial_screen_up => ok := false ;
- when scroll_middle_screen_down => ok := false ;
- when scroll_entire_screen_down => ok := false ;
- when scroll_partial_screen_down => ok := false ;
- when CURSOR_ON => ok := FALSE ;
- when CURSOR_OFF => ok := FALSE ;
- when EXTRA_DISPLAY_ON => ok := FALSE ;
- when EXTRA_DISPLAY_OFF => ok := FALSE ;
- when KEYBOARD_INPUT_ON => ok := FALSE ;
- when KEYBOARD_INPUT_OFF => ok := FALSE ;
- when PROGRAM_TERMINATION=> ok := TRUE ; -- Required
- end case;
- return ok ;
- end;
-
- procedure new_attributes(new_text_color ,
- new_background_color : crt_color;
- new_crt_atr_1 , new_crt_atr_2 , new_crt_atr_3 : char_attributes) is
- screen_color : crt_color ;
-
- procedure new_attr( atr : char_attributes ) is
- begin
- case atr is
- when other_intensity => put_transparent("7;");
- when blink => put_transparent("5;");
- when underline => put_transparent("4;");
- when normal => null ;
- end case;
- end;
-
- begin
- -- First, turn off all old settings
- put_transparent(ASCII.ESC);
- put_transparent("[0m");
- CRT_ATTRIBUTE_1 := new_crt_atr_1 ;
- CRT_ATTRIBUTE_2 := new_crt_atr_2 ;
- CRT_ATTRIBUTE_3 := new_crt_atr_3 ;
- CURRENT_CRT_COLOR := new_text_color ;
- CURRENT_BACKGROUND_COLOR := new_background_color ;
- put_transparent(ASCII.ESC);
- put_transparent("[");
- new_attr(crt_attribute_1);
- new_attr(crt_attribute_2);
- new_attr(crt_attribute_3);
- -- reverse video ?
- if ( current_background_color /= black )
- and ( current_crt_color = black ) then
- put_transparent("7;");
- screen_color := current_background_color;
- else
- screen_color := current_crt_color;
- end if;
- put_transparent("m");
- end;
-
- procedure CHANGE_CRT( TO : in CHAR_ATTRIBUTES ;
- ALSO : in CHAR_ATTRIBUTES := normal ;
- AND_ALSO : in CHAR_ATTRIBUTES := NORMAL ) is
- begin
- new_attributes( current_crt_color , current_background_color ,
- to , also , and_also );
- end;
-
- procedure CHANGE_COLOR( TEXT_COLOR : in CRT_COLOR ;
- BACKGROUND_COLOR : in CRT_COLOR := black) is
- begin
- new_attributes( text_color , background_color ,
- crt_attribute_1 , crt_attribute_2 , crt_attribute_3 );
- end;
-
- procedure KEYBOARD_INITIALIZE;
-
- procedure DO_CRT( CONTROL : in CRT_CONTROL ) is
- begin
- case CONTROL is
- when COLD_INIT => TOTAL_CRT_COL := 80 ;
- TOTAL_CRT_LINE:= 24 ;
- KEYBOARD_INITIALIZE;
- DO_CRT(WARM_INIT);
- when WARM_INIT => CHANGE_CRT( NORMAL ) ;
- CHANGE_COLOR( GREEN ) ;
- DO_CRT(ERASE_ALL);
- DO_CRT(CURSOR_ON);
- DO_CRT(EXTRA_DISPLAY_ON);
- DO_CRT(KEYBOARD_INPUT_ON);
- when ERASE_ALL => put_transparent(ASCII.ESC);
- put_transparent("[" & "2J");
- DO_CRT(CRT_HOME) ; -- This is not done
- -- automatically, but
- -- ERASE_ALL always
- --provides this service
- when ERASE_EOL => put_transparent(ASCII.ESC);
- put_transparent("[" & "0K") ;
- when ERASE_EOS => put_transparent(ASCII.ESC);
- put_transparent("[" & "0J") ;
- when INSERT_LINE => null ;
- when DELETE_LINE => null ;
- when REVERSE_VIDEO=> null ;
- when CRT_HOME => GOTOXY(1,1);
- when CRT_UP => if CRT_LINE > 1 then
- CRT_LINE := CRT_LINE - 1 ;
- put_transparent(ASCII.ESC);
- put_transparent("[" & "1A");
- -- else do nothing...
- end if ;
- when CRT_DOWN => if CRT_LINE < TOTAL_CRT_LINE then
- CRT_LINE := CRT_LINE + 1 ;
- put_transparent(ASCII.ESC);
- put_transparent("[" & "1B");
- -- else do nothing...
- end if ;
- when CRT_RIGHT => if CRT_COL < TOTAL_CRT_COL then
- CRT_COL := CRT_COL + 1 ;
- put_transparent(ASCII.ESC);
- put_transparent("[" & "1C");
- -- else do nothing...
- end if ;
- when CRT_LEFT => if CRT_COL > 1 then
- CRT_COL := CRT_COL - 1 ;
- put_transparent(ASCII.ESC);
- put_transparent("[" & "1D") ;
- -- Else, we do nothing...
- end if ;
- when scroll_middle_screen_up => null ;
- when scroll_entire_screen_up => scroll_up_entire_screen(1);
- when scroll_partial_screen_up => null ;
- when scroll_middle_screen_down => null ;
- when scroll_entire_screen_down => scroll_down_entire_screen(1);
- when scroll_partial_screen_down => null ;
- when CURSOR_ON => null ;
- when CURSOR_OFF => null ;
- when EXTRA_DISPLAY_ON => null ;
- when EXTRA_DISPLAY_OFF => null ;
- when KEYBOARD_INPUT_ON => null ;
- when KEYBOARD_INPUT_OFF => null ;
- when PROGRAM_TERMINATION=> do_crt(warm_init) ;
- put(" Type A Key ") ;
- terminate_basic_io_system ;
- do_crt(warm_init) ;
- end case;
- end;
-
- procedure scroll_up_middle_screen (
- first_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_up_middle_screen
- gotoxy(1,first_line_to_scroll);
- put_transparent(ASCII.ESC);
- put_transparent("[");
- put_transparent(number_of_lines_to_scroll);
- put_transparent("M");
- end scroll_up_middle_screen ;
-
- procedure scroll_up_entire_screen (
- number_of_lines_to_scroll : a_screen_line_number ) is
- lines_so_far : integer := 0 ;
- begin -- scroll_up_entire_screen
- gotoxy(1,total_crt_line);
- loop
- put_transparent( ascii.lf ) ;
- lines_so_far := lines_so_far + 1 ;
- exit when lines_so_far >= number_of_lines_to_scroll ;
- end loop ;
- end scroll_up_entire_screen ;
-
- procedure scroll_up_partial_screen (
- first_line_to_scroll : a_screen_line_number ;
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_up_partial_screen
- null ;
- end scroll_up_partial_screen ;
-
- procedure scroll_down_middle_screen (
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_down_middle_screen
- null ;
- end scroll_down_middle_screen ;
-
- procedure scroll_down_entire_screen (
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_down_entire_screen
- null ;
- end scroll_down_entire_screen ;
-
- procedure scroll_down_partial_screen (
- first_line_to_scroll : a_screen_line_number ;
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_down_partial_screen
- null ;
- end scroll_down_partial_screen ;
-
- -- Finally, we need the Keyboard handler routines
-
- function CTRL( A_CHARACTER : in CHARACTER ) return INTEGER is
- begin
- return CHARACTER'POS(A_CHARACTER) mod 32; -- Strip off high bits
- end;
-
- procedure KEYBOARD_INITIALIZE is
- -- Set up for the input of special keys.
- -- Program the function keys
-
- procedure set_em( place:integer; c_val: integer; new_key: special_keys) is
- begin -- set_em
- real_key_on_input ( place ) := extended_character ( c_val ) ;
- special_meaning_on_input ( place ) := new_key ;
- end set_em ;
-
- procedure SET_KEY_MAPPINGS is
- -- Set up the mappings of keys to new meanings
- begin
- -- First, do the normal mappings
- for C_NUMBER in 0..255 loop
- set_em ( c_number , c_number , key_character ) ;
- end loop;
- -- Then, change the characters which are to be treated specially...
- set_em ( ctrl('A') , 0 , key_home ) ;
- set_em ( ctrl('U') , 0 , key_up ) ;
- set_em ( ctrl('D') , 0 , key_down ) ;
- set_em ( ctrl('R') , 0 , key_right ) ;
- set_em ( ctrl('L') , 0 , key_left ) ;
- set_em ( ctrl('V') , 0 , key_end_of_text ) ;
- set_em ( 27 , 0 , key_escape ) ;
- set_em ( ctrl('I') , 0 , key_tab_forward ) ;
- set_em ( ctrl('H') , 0 , key_backspace ) ;
- set_em ( ctrl('J') , 0 , key_line_feed ) ;
- set_em ( ctrl('M') , 0 , key_carriage_return ) ;
- set_em ( 127 , 0 , key_delete ) ;
- end;
-
- procedure MAP_FUNCTION_KEYS is
-
- function make_key( in_character : in character ;
- out_meaning : in special_keys ;
- out_character: in integer )
- return type_of_key_change is
- t : type_of_key_change ;
- begin
- t.key := extended_character( CHARACTER'POS( in_character ) ) ;
- t.special_meaning := out_meaning ;
- t.final_key := extended_character( out_character ) ;
- return t;
- end;
-
- begin
- -- Initialize
- for A_KEY_TYPE in 1..NUM_KEY_TYPES loop
- KEY_MAP(A_KEY_TYPE).LEAD_IN_LENGTH := 0 ;
- KEY_MAP(A_KEY_TYPE).LEAD_IN := " ";
- KEY_MAP(A_KEY_TYPE).FOLLOW_REMOVE := 0 ;
- for A_SINGLE_KEY in 1..NUM_KEYS_WITHIN_TYPE loop
- KEY_MAP(A_KEY_TYPE).EACH_KEY(A_SINGLE_KEY)
- := make_key( CHARACTER'VAL(0) , key_illegal , 0 );
- end loop;
- end loop;
- KEY_MAP(1).LEAD_IN_LENGTH := 2 ;
- KEY_MAP(1).LEAD_IN(1..2) := " [" ;
- KEY_MAP(1).LEAD_IN(1) := ASCII.ESC ;
- KEY_MAP(1).FOLLOW_REMOVE := 0 ;
- KEY_MAP(1).EACH_KEY(01) := make_key('A',KEY_UP, 0);
- KEY_MAP(1).EACH_KEY(02) := make_key('B',KEY_DOWN, 0);
- KEY_MAP(1).EACH_KEY(03) := make_key('C',KEY_RIGHT, 0);
- KEY_MAP(1).EACH_KEY(04) := make_key('D',KEY_LEFT, 0);
- KEY_MAP(2).LEAD_IN_LENGTH := 2 ;
- KEY_MAP(2).LEAD_IN(1..2) := " O" ;
- KEY_MAP(2).LEAD_IN(1) := ASCII.ESC ;
- KEY_MAP(2).FOLLOW_REMOVE := 0 ;
- KEY_MAP(2).EACH_KEY(01) := make_key('P',key_function, 1);
- KEY_MAP(2).EACH_KEY(02) := make_key('Q',key_function, 2);
- KEY_MAP(2).EACH_KEY(03) := make_key('R',key_function, 3);
- KEY_MAP(2).EACH_KEY(04) := make_key('S',key_function, 4);
- key_map(3).lead_in_length := 1 ;
- key_map(3).lead_in(1) := ascii.esc ;
- key_map(3).follow_remove := 0 ;
- key_map(3).each_key(01) := make_key(ascii.esc,key_escape,0);
- -- map <esc><esc> to a single escape
- key_map(3).each_key(02) := make_key('1',key_alternate, 1);
- key_map(3).each_key(03) := make_key('2',key_alternate, 2);
- key_map(3).each_key(04) := make_key('3',key_alternate, 3);
- key_map(3).each_key(05) := make_key('4',key_alternate, 4);
- key_map(3).each_key(06) := make_key('5',key_alternate, 5);
- key_map(3).each_key(07) := make_key('6',key_alternate, 6);
- key_map(3).each_key(08) := make_key('7',key_alternate, 7);
- key_map(3).each_key(09) := make_key('8',key_alternate, 8);
- key_map(3).each_key(10) := make_key('9',key_alternate, 9);
- key_map(3).each_key(11) := make_key('0',key_alternate,10);
- end;
-
- begin -- Keyboard_initialize
- set_key_mappings ; -- Set up the special 1 to 1 mappings
- map_function_keys ; -- ready the memory map to read keys
- end KEYBOARD_INITIALIZE;
-
- begin -- CRT
- -- CRT by SAIC/Clearwater VT100 ANSI I/O Routines 07 Jan 85
- do_crt(cold_init);
- --
- end CRT;
-
- package body editor_customization is
-
- maximum_function_keys : constant integer := 10 ;
- maximum_alternate_keys: constant integer := 10 ;
-
- type command_pair is
- record
- c : character ;
- command : crt_editor_command ;
- end record ;
-
- function_key : array ( 1 .. maximum_function_keys ) of command_pair ;
- alternate_key: array ( 1 .. maximum_alternate_keys) of command_pair ;
-
- type a_wp_command is
- record
- len : integer ;
- str : string ( 1 .. max_wp_command_length ) ;
- end record ;
-
- word_processor_command_list : array ( 1 .. 10 ) of a_wp_command ;
-
- Physical_Tran : array ( crt.special_keys ) of command_pair ;
-
- c_to_command : array ( 0 .. 255 ) of command_pair ;
-
- procedure set_c ( in_char ,
- out_char : in character ;
- out_meaning : in crt_editor_command ) is
- begin -- set_c
- c_to_command( character'pos( in_char ) ) := ( out_char , out_meaning) ;
- end set_c ;
-
- procedure initialize_translate_tables is
-
- use crt ;
-
- begin -- initialize_translate_tables
- -- First , make everything Illegal
- for indx in 1 .. maximum_function_keys loop
- function_key ( indx ) := ( ascii.nul , illegal_command ) ;
- end loop ;
- for indx in 1 .. maximum_alternate_keys loop
- alternate_key ( indx ) := ( ascii.nul , illegal_command ) ;
- end loop ;
- for indx in crt.special_keys'first .. crt.special_keys'last loop
- Physical_Tran( indx ) := ( ascii.nul , illegal_command ) ;
- end loop ;
- for indx in 0 .. 255 loop
- c_to_command ( indx ) := ( ascii.nul , illegal_command ) ;
- end loop ;
- -- We have 4 function keys on the VT 100 Terminal
- -- This mapping set is called when the input key type is key_function
- -- Note that we could have another set called if we needed to work
- -- with key_alternate
- function_key ( 1 ) := ( ascii.nul , accept_command ) ;
- function_key ( 2 ) := ( ascii.nul , home_command ) ;
- function_key ( 3 ) := ( ascii.nul , advance_paragraph_command ) ;
- function_key ( 4 ) := ( ascii.nul , reject_command ) ;
- -- The following is the physical to editor logical key mapping
- Physical_Tran ( key_end_of_text ) := ( ascii.nul , accept_command) ;
- Physical_Tran ( key_escape ) := ( ascii.nul , reject_command) ;
- Physical_Tran ( key_line_feed ) := ( ascii.nul , down_command ) ;
- Physical_Tran ( key_carriage_return):=(ascii.nul , advance_line_command);
- Physical_Tran ( key_tab_forward ) := ( ascii.nul , advance_tab_command );
- Physical_Tran ( key_home ) := ( ascii.nul , home_command ) ;
- -- Physical_Tran ( key_tab_backward) := ( ascii.nul , ) ;
- Physical_Tran ( key_backspace ) := ( ascii.nul ,
- backward_character_command ) ;
- Physical_Tran ( key_up ) := ( ascii.nul , up_command ) ;
- Physical_Tran ( key_down ) := ( ascii.nul , down_command ) ;
- Physical_Tran ( key_right ) := ( ascii.nul , right_command ) ;
- Physical_Tran ( key_left ) := ( ascii.nul , left_command ) ;
- Physical_Tran ( key_delete ) := ( ascii.nul , backward_line_command);
- -- Max wp command length is 20 , so initialize to that length
- for posn in 1 .. 10 loop
- alternate_key(posn) := ( character'val(posn), word_processor_command ) ;
- end loop ;
- word_processor_command_list( 1) :=
- ( 8 , ascii.cr & ".add 1" & ascii.cr & " " ) ;
- word_processor_command_list( 2) :=
- ( 7 , ascii.cr & ".bold " & " " ) ;
- word_processor_command_list( 3) :=
- ( 9 , ascii.cr & ".shadow " & " " ) ;
- word_processor_command_list( 4) :=
- ( 11 , ascii.cr & ".end_page" & ascii.cr & " " ) ;
- word_processor_command_list( 5) :=
- ( 4 , " on" & ascii.cr & " ") ;
- word_processor_command_list( 6) :=
- ( 5 , " off" & ascii.cr & " " ) ;
- word_processor_command_list( 7) :=
- ( 9 , ascii.cr & ".indent " & " " ) ;
- word_processor_command_list( 8) :=
- ( 12 , ascii.cr & ".underline " & " " ) ;
- word_processor_command_list( 9) :=
- ( 14 , ascii.cr & ".ucontinuous " & " " ) ;
- word_processor_command_list(10) :=
- ( 1 , ascii.cr & " " ) ;
- -- the last is the soft carriage return
- -- key_character is handled next
- set_c ( 'A' , 'A' , adjust_command ) ;
- set_c ( 'B' , 'B' , move_to_first_line_position_command ) ;
- set_c ( 'C' , 'C' , copy_command ) ;
- set_c ( 'D' , 'D' , start_deletion_command ) ;
- set_c ( 'E' , 'E' , move_to_last_line_position_command ) ;
- set_c ( 'F' , 'F' , find_command ) ;
- set_c ( 'H' , 'H' , help_command ) ;
- set_c ( 'I' , 'I' , insert_command ) ;
- set_c ( 'J' , 'J' , jump_command ) ;
- set_c ( 'K' , 'K' , kill_command ) ;
- set_c ( 'L' , 'L' , print_screen_command ) ;
- set_c ( 'M' , 'M' , re_margin_command ) ;
- set_c ( 'P' , 'P' , advance_page_command ) ;
- set_c ( 'Q' , 'Q' , quit_command ) ;
- set_c ( 'R' , 'R' , replace_command ) ;
- set_c ( 'S' , 'S' , set_stuff_command ) ;
- set_c ( 'V' , 'V' , verify_screen_command ) ;
- set_c ( 'W' , 'W' , advance_word_command ) ;
- set_c ( 'X' , 'X' , enter_exchange_mode ) ;
- set_c ( 'Y' , 'Y' , advance_paragraph_command ) ;
- set_c ( 'Z' , 'Z' , zap_command ) ;
- set_c ( 'a' , 'a' , adjust_command ) ;
- set_c ( 'b' , 'b' , move_to_first_line_position_command ) ;
- set_c ( 'c' , 'c' , copy_command ) ;
- set_c ( 'd' , 'd' , start_deletion_command ) ;
- set_c ( 'e' , 'e' , move_to_last_line_position_command ) ;
- set_c ( 'f' , 'f' , find_command ) ;
- set_c ( 'h' , 'h' , help_command ) ;
- set_c ( 'i' , 'i' , insert_command ) ;
- set_c ( 'j' , 'j' , jump_command ) ;
- set_c ( 'k' , 'k' , kill_command ) ;
- set_c ( 'l' , 'l' , print_screen_command ) ;
- set_c ( 'm' , 'm' , re_margin_command ) ;
- set_c ( 'p' , 'p' , advance_page_command ) ;
- set_c ( 'q' , 'q' , quit_command ) ;
- set_c ( 'r' , 'r' , replace_command ) ;
- set_c ( 's' , 's' , set_stuff_command ) ;
- set_c ( 'v' , 'v' , verify_screen_command ) ;
- set_c ( 'w' , 'w' , advance_word_command ) ;
- set_c ( 'x' , 'x' , enter_exchange_mode ) ;
- set_c ( 'y' , 'y' , advance_paragraph_command ) ;
- set_c ( 'z' , 'z' , zap_command ) ;
- set_c ( '?' , '?' , help_command ) ;
- set_c ( ' ' , ' ' , advance_character_command ) ;
- set_c ( ',' , ',' , set_backward_direction ) ;
- set_c ( '<' , '<' , set_backward_direction ) ;
- set_c ( '.' , '.' , set_forward_direction ) ;
- set_c ( '>' , '>' , set_forward_direction ) ;
- set_c ( '+' , '+' , shift_screen_right ) ;
- set_c ( ';' , ';' , shift_screen_right ) ;
- set_c ( '-' , '-' , shift_screen_left ) ;
- set_c ( '!' , '!' , show_other_prompt_command ) ;
- set_c ( '/' , '/' , infinity_command ) ;
- set_c ( '=' , '=' , jump_to_marked_position_command);
- for cc in '0' .. '9' loop
- set_c ( cc , cc , digit_command ) ;
- end loop ;
- -- key_macro ( all ) is handled in the lower levels
- end initialize_translate_tables ;
-
- procedure initialize_prompt_lines is
- begin
- Main_Command_Prompt :=
- " Edit: A(djst C(opy D(elete F(ind H(elp I(nsrt Q(uit R(place eX(chg '!'" ;
- Alternate_Command_Prompt :=
- " Edit: H(elp J(ump K(ill L(inePrntr M(argin P(age S(et V(erify Z(ap '!'" ;
- Adjust_Command_Prompt :=
- " Adjust: L(just R(just C(ent <left,right,up,down> [<ACCEPT> to leave]" ;
- Copy_Command_Prompt :=
- " Copy: B(uffer, F(ile, or <Reject> to abort ? " ;
- Delete_Command_Prompt :=
- " Delete: < > <Moving Commands>, <Append Toggle>, <Accept>, <Reject> " ;
- Find_Command_Prompt := " Find: " ;
- Help_Command_Prompt := " Help: Prompt not defined...." ;
- Insert_Command_Prompt :=
- " Insert: Text [<bs> a char,<del> a line][<Accept> or <Reject>] " ;
- Jump_Command_Prompt :=
- " Jump to B(egin, E(nd, M(arker, or <Reject> to abort ? " ;
- Kill_Command_Prompt :=
- "!KILLING! - - Are You Really Sure You Want To Kill All Following Text "
- & "(Y/N) ? " ;
- Line_Printer_Command_Prompt :=
- "!PRINTING! - - Are You Sure You Want To Print This Screen (Y/N) ? " ;
- Margin_Command_Prompt := " " ;
- Quit_Command_Prompt := " Quit Options: " ;
- Replace_Command_Prompt := " Replace: " ;
- Set_Command_Prompt :=
- " Set: E(nvironment, M(arker, T(abs, Z(ap Marker, H(elp or <Reject> ? " ;
- eXchange_Command_Prompt :=
- " eXchange TEXT [<bs> a char] [<reject> escapes, <accept> accepts]" ;
- Zap_Command_Prompt :=
- " WARNING! Are you sure you wish to zap ? (y/n) " ;
- Enter_Input_File_Name_Prompt :=
- " Enter Input File Name ( or <return> for a new file ) => " ;
- Enter_Copied_In_File_Name_Prompt :=
- " Copy: from what file ( or <return> to skip ) => " ;
- end initialize_prompt_lines ;
-
- procedure translate( ch : in character ;
- special : in crt.special_keys ;
- new_ch : out character ;
- edit_special : out crt_editor_command ) is
- -- translate an input character and special meaning pair to
- -- an internal editor character representation and editor
- -- special meaning pair
- temp_new_ch : character ;
- temp_special: crt_editor_command ;
- begin -- translate
- case special is
- when crt.key_function =>
- if character'pos(ch) <= maximum_function_keys then
- temp_new_ch := function_key ( character'pos(ch) ).c ;
- temp_special := function_key ( character'pos(ch) ).command ;
- else
- temp_new_ch := ascii.nul ;
- temp_special := illegal_command ;
- end if ;
- when crt.key_alternate =>
- if character'pos(ch) <= maximum_alternate_keys then
- temp_new_ch := alternate_key ( character'pos(ch) ).c ;
- temp_special := alternate_key ( character'pos(ch) ).command ;
- else
- temp_new_ch := ascii.nul ;
- temp_special := illegal_command ;
- end if ;
- when crt.key_character =>
- temp_new_ch := c_to_command ( character'pos(ch) ).c ;
- temp_special := c_to_command ( character'pos(ch) ).command ;
- when others =>
- temp_new_ch := physical_tran ( special ).c ;
- temp_special := physical_tran ( special ).command ;
- end case ;
- if temp_special = word_processor_command then
- word_processor_command_string_length :=
- word_processor_command_list(character'pos(temp_new_ch)).len ;
- word_processor_command_string :=
- word_processor_command_list(character'pos(temp_new_ch)).str ;
- end if ;
- new_ch := temp_new_ch ;
- edit_special := temp_special ;
- end translate ;
-
- begin -- editor_customization
- -- EDITVT10 by SAIC/Clearwater Editor Customization VT100 07 Jan 85
- initialize_translate_tables ;
- initialize_prompt_lines ; -- can't put into constants at top because
- -- of initialization code limitation on wicat
- end editor_customization ;
-
- begin -- crt_customization
- -- CRTVT100 by SAIC/Clearwater CRT Customization for VT100 07 Jan 85
- null ;
- end crt_customization ;
-
- --$$$- CRTVT100
-
- --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- --crtvt52
- --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- --$$$+ CRTVT52
-
- --
- -- File 003b
- --
- -- Editor Written By Robert S. Cymbalski
- -- Science Applications International Corporation
- -- Energy Systems Group
- -- Ada Software Development Project Team
- -- 2280 U.S. Highway 19 North, Suite 120
- -- Clearwater, Florida 33575
- --
- -- CRT Manager Revised from text Copyright (c) 1984 , R.S.Cymbalski
- --
- -- Program for CRT I/O for the VT52
-
-
- with string_library ;
- use string_library ;
-
- with basic_io_system ;
- use basic_io_system ;
-
- package crt_customization is
-
- package CRT is
-
- type SPECIAL_KEYS is ( KEY_ILLEGAL, KEY_CHARACTER, KEY_END_OF_TEXT,
- KEY_ESCAPE, KEY_TAB_FORWARD, KEY_HOME,
- KEY_LINE_FEED , KEY_CARRIAGE_RETURN ,
- KEY_TAB_BACKWARD, KEY_BACKSPACE, KEY_UP, KEY_DOWN,
- KEY_RIGHT, KEY_LEFT, KEY_DELETE, KEY_FUNCTION,
- KEY_ALTERNATE );
-
- type CRT_COLOR is (BLACK,RED,BLUE,GREEN,PURPLE,YELLOW,LIGHT_BLUE,WHITE);
- type CHAR_ATTRIBUTES is (NORMAL, BLINK, UNDERLINE, OTHER_INTENSITY );
- type CRT_CONTROL is (COLD_INIT, WARM_INIT, ERASE_ALL, ERASE_EOL,
- ERASE_EOS, INSERT_LINE, DELETE_LINE, REVERSE_VIDEO,
- CRT_HOME, CRT_UP, CRT_DOWN, CRT_RIGHT, CRT_LEFT,
- scroll_middle_screen_up , scroll_entire_screen_up ,
- scroll_partial_screen_up ,
- scroll_middle_screen_down , scroll_entire_screen_down ,
- scroll_partial_screen_down ,
- CURSOR_ON, CURSOR_OFF, EXTRA_DISPLAY_ON,
- EXTRA_DISPLAY_OFF, KEYBOARD_INPUT_ON,
- KEYBOARD_INPUT_OFF, PROGRAM_TERMINATION );
-
- CRT_ATTRIBUTE_1 : CHAR_ATTRIBUTES := NORMAL ;
- CRT_ATTRIBUTE_2 : CHAR_ATTRIBUTES := NORMAL ;
- CRT_ATTRIBUTE_3 : CHAR_ATTRIBUTES := NORMAL ;
-
- CURRENT_CRT_COLOR : CRT_COLOR := GREEN ; -- holds current color
- DEFAULT_CRT_COLOR : CRT_COLOR := GREEN ; -- is standard I/O color
- CURRENT_BACKGROUND_COLOR : CRT_COLOR := BLACK ;
- DEFAULT_BACKGROUND_COLOR : CRT_COLOR := BLACK ;--standard background color
-
- NUM_KEY_TYPES : constant integer := 5 ;
- NUM_KEYS_WITHIN_TYPE : constant integer := 16 ;
- type type_of_key_change is record
- KEY : extended_character;
- SPECIAL_MEANING: SPECIAL_KEYS ;
- FINAL_KEY : extended_character;
- end record;
- type ARRAY_TYPE_OF_KEY_CHANGE is
- array ( 1 .. NUM_KEYS_WITHIN_TYPE ) of type_of_key_change ;
- type KEY_SET is record
- LEAD_IN_LENGTH : INTEGER ;
- LEAD_IN : STRING(1 .. 5);
- FOLLOW_REMOVE : INTEGER ;
- EACH_KEY : ARRAY_TYPE_OF_KEY_CHANGE ;
- end record;
- type ALL_KEYS is array ( 1..NUM_KEY_TYPES ) of KEY_SET ;
-
- KEY_MAP : ALL_KEYS;
- REAL_KEY_ON_INPUT : array ( 0..255 ) of extended_character ;
- SPECIAL_MEANING_ON_INPUT : array ( 0..255 ) OF SPECIAL_KEYS ;
-
- -- Now, we need the CRT handler routines
-
- procedure GOTOXY(COL : in A_SCREEN_COLUMN_NUMBER;
- LINE : in A_SCREEN_LINE_NUMBER);
- -- Positions the cursor to COL,LINE on the screen; changing COL
- -- and LINE to maximum allowable column or line if they are
- -- in error.
- -- This could be done with SET_COL/SET_LINE but this is one call
-
- function CRT_HAS( CONTROL : in CRT_CONTROL ) return BOOLEAN;
- -- Returns true if CRT has the ability to perform the given crt
- -- control function, false otherwise.
-
- procedure DO_CRT( CONTROL : in CRT_CONTROL );
- -- Performs the given crt control function; if the crt does not have
- -- the ability to perform the crt control, nothing is done.
-
- procedure CHANGE_CRT( TO : in CHAR_ATTRIBUTES ;
- ALSO : in CHAR_ATTRIBUTES := normal ;
- AND_ALSO : in CHAR_ATTRIBUTES := NORMAL );
- -- Changes the crt attributes to one, two or three new attributes
-
- procedure CHANGE_COLOR( TEXT_COLOR : in CRT_COLOR ;
- BACKGROUND_COLOR : in CRT_COLOR := black);
- -- Changes the crt color to the new text and background colors
-
- procedure scroll_up_middle_screen (
- first_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_up_entire_screen (
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_up_partial_screen (
- first_line_to_scroll : a_screen_line_number ;
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_down_middle_screen (
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_down_entire_screen (
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_down_partial_screen (
- first_line_to_scroll : a_screen_line_number ;
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- end CRT ;
-
- package editor_customization is
-
- type crt_editor_command is ( up_command , down_command ,
- right_command , left_command ,
-
- advance_character_command ,
- advance_word_command ,
- advance_tab_command ,
- advance_line_command ,
- advance_paragraph_command ,
- advance_page_command ,
- advance_infinity_command ,
-
- forward_character_command ,
- backward_character_command ,
- forward_word_command , backward_word_command ,
- forward_tab_command , backward_tab_command ,
- forward_line_command , backward_line_command ,
- forward_paragraph_command ,
- backward_paragraph_command ,
- forward_page_command , backward_page_command ,
-
- home_command ,
- move_to_first_line_position_command ,
- move_to_last_line_position_command ,
- jump_to_first_position_command ,
- jump_to_last_position_command ,
-
- jump_to_marked_position_command ,
-
- set_forward_direction ,
- set_backward_direction ,
-
- shift_screen_right , shift_screen_left ,
-
- adjust_command ,
- copy_command ,
- start_deletion_command,
- find_command ,
- help_command ,
- insert_command ,
- jump_command ,
- kill_command ,
- print_screen_command ,
- re_margin_command ,
- quit_command ,
- replace_command ,
- set_stuff_command ,
- verify_screen_command ,
- enter_exchange_mode ,
- zap_command ,
-
- accept_command ,
- reject_command ,
- word_processor_command,
- digit_command ,
- infinity_command ,
- show_other_prompt_command ,
- illegal_command ) ;
-
- Main_Command_Prompt : string (1..71) ;
- Alternate_Command_Prompt : string (1..71) ;
- Adjust_Command_Prompt : string (1..69) ;
- Copy_Command_Prompt : string (1..46) ;
- Delete_Command_Prompt : string (1..69) ;
- Find_Command_Prompt : string (1.. 7) ;
- Help_Command_Prompt : string (1..29) ;
- Insert_Command_Prompt : string (1..63) ;
- Jump_Command_Prompt : string (1..55) ;
- Kill_Command_Prompt : string (1..78) ;
- Line_Printer_Command_Prompt : string (1..66) ;
- Margin_Command_Prompt : string (1.. 1) ;
- Quit_Command_Prompt : string (1..20) ;
- Replace_Command_Prompt : string (1..10) ;
- Set_Command_Prompt : string (1..69) ;
- eXchange_Command_Prompt : string (1..65) ;
- Zap_Command_Prompt : string (1..47) ;
- Enter_Input_File_Name_Prompt : string (1..57) ;
- Enter_Copied_In_File_Name_Prompt : string (1..49) ;
-
- procedure translate( ch : in character ;
- special : in crt.special_keys ;
- new_ch : out character ;
- edit_special : out crt_editor_command ) ;
- -- translate an input character and special meaning pair to
- -- an internal editor character representation and editor
- -- special meaning pair
-
- max_wp_command_length : constant integer := 20 ;
-
- word_processor_command_string_length : integer ;
- -- The length of the word processor command string for the
- -- key just pressed
-
- word_processor_command_string : string ( 1 .. max_wp_command_length ) ;
- -- The string of characters associated with the function key hit
- -- If the first character is ascii.cr, then start a new line at
- -- column 1. If the length is greater than 1 and then the last
- -- character is ascii.cr, then end by starting a new line and
- -- indenting to the old indentation from before the command key.
- -- If the first character is a space, then, only put the space in
- -- if the last character was not a space
-
- end;
-
- end crt_customization ;
-
- package body crt_customization is
-
- package body CRT is
-
- procedure GOTOXY( COL : in A_SCREEN_COLUMN_NUMBER ;
- LINE : in A_SCREEN_LINE_NUMBER ) is
- -- It will change the col or line if they are in error
- A_COL, A_LINE : NATURAL;
- begin
- A_COL := COL ;
- A_LINE := LINE ;
- if A_COL > TOTAL_CRT_COL then
- A_COL := TOTAL_CRT_COL ;
- end if;
- if A_LINE > TOTAL_CRT_LINE then
- A_LINE := TOTAL_CRT_LINE ;
- end if;
- CRT_COL := A_COL ;
- CRT_LINE := A_LINE ;
- put_transparent(ASCII.ESC);
- put_transparent("Y");
- put_transparent(CHARACTER'VAL(A_LINE+31));
- put_transparent(CHARACTER'VAL(A_COL+31));
- end;
-
- function CRT_HAS( CONTROL : in CRT_CONTROL ) return BOOLEAN is
- ok : BOOLEAN ;
- begin
- case CONTROL is
- when COLD_INIT => ok := TRUE ; -- Required
- when WARM_INIT => ok := TRUE ; -- Required
- when ERASE_ALL => ok := TRUE ; -- Required
- when ERASE_EOL => ok := TRUE ;
- when ERASE_EOS => ok := TRUE ;
- when INSERT_LINE => ok := FALSE ;
- when DELETE_LINE => ok := FALSE ;
- when REVERSE_VIDEO => ok := FALSE ;
- when CRT_HOME => ok := TRUE ; -- Required
- when CRT_UP => ok := TRUE ;
- when CRT_DOWN => ok := TRUE ;
- when CRT_RIGHT => ok := TRUE ;
- when CRT_LEFT => ok := TRUE ;
- when scroll_middle_screen_up => ok := false ;
- when scroll_entire_screen_up => ok := true ; -- required
- when scroll_partial_screen_up => ok := false ;
- when scroll_middle_screen_down => ok := false ;
- when scroll_entire_screen_down => ok := false ;
- when scroll_partial_screen_down => ok := false ;
- when CURSOR_ON => ok := FALSE ;
- when CURSOR_OFF => ok := FALSE ;
- when EXTRA_DISPLAY_ON => ok := FALSE ;
- when EXTRA_DISPLAY_OFF => ok := FALSE ;
- when KEYBOARD_INPUT_ON => ok := FALSE ;
- when KEYBOARD_INPUT_OFF => ok := FALSE ;
- when PROGRAM_TERMINATION=> ok := TRUE ; -- Required
- end case;
- return ok ;
- end;
-
- procedure new_attributes(new_text_color ,
- new_background_color : crt_color;
- new_crt_atr_1 , new_crt_atr_2 , new_crt_atr_3 : char_attributes) is
- screen_color : crt_color ;
-
- BEGIN
- NULL ;
- END ;
-
- procedure CHANGE_CRT( TO : in CHAR_ATTRIBUTES ;
- ALSO : in CHAR_ATTRIBUTES := normal ;
- AND_ALSO : in CHAR_ATTRIBUTES := NORMAL ) is
- begin
- new_attributes( current_crt_color , current_background_color ,
- to , also , and_also );
- end;
-
- procedure CHANGE_COLOR( TEXT_COLOR : in CRT_COLOR ;
- BACKGROUND_COLOR : in CRT_COLOR := black) is
- begin
- new_attributes( text_color , background_color ,
- crt_attribute_1 , crt_attribute_2 , crt_attribute_3 );
- end;
-
- procedure KEYBOARD_INITIALIZE;
-
- procedure DO_CRT( CONTROL : in CRT_CONTROL ) is
- begin
- case CONTROL is
- when COLD_INIT => TOTAL_CRT_COL := 80 ;
- TOTAL_CRT_LINE:= 24 ;
- KEYBOARD_INITIALIZE;
- DO_CRT(WARM_INIT);
- when WARM_INIT => CHANGE_CRT( NORMAL ) ;
- CHANGE_COLOR( GREEN ) ;
- DO_CRT(ERASE_ALL);
- DO_CRT(CURSOR_ON);
- DO_CRT(EXTRA_DISPLAY_ON);
- DO_CRT(KEYBOARD_INPUT_ON);
- when ERASE_ALL => do_crt(crt_home) ;
- do_crt(erase_eos) ;
- DO_CRT(CRT_HOME) ; -- This is not done
- -- automatically, but
- -- ERASE_ALL always
- --provides this service
- when ERASE_EOL => put_transparent(ASCII.ESC);
- put_transparent("K") ;
- when ERASE_EOS => put_transparent(ASCII.ESC);
- put_transparent("J") ;
- when INSERT_LINE => null ;
- when DELETE_LINE => null ;
- when REVERSE_VIDEO=> null ;
- when CRT_HOME => GOTOXY(1,1);
- when CRT_UP => if CRT_LINE > 1 then
- CRT_LINE := CRT_LINE - 1 ;
- put_transparent(ASCII.ESC);
- put_transparent("A");
- -- else do nothing...
- end if ;
- when CRT_DOWN => if CRT_LINE < TOTAL_CRT_LINE then
- CRT_LINE := CRT_LINE + 1 ;
- put_transparent(ASCII.ESC);
- put_transparent("B");
- -- else do nothing...
- end if ;
- when CRT_RIGHT => if CRT_COL < TOTAL_CRT_COL then
- CRT_COL := CRT_COL + 1 ;
- put_transparent(ASCII.ESC);
- put_transparent("C");
- -- else do nothing...
- end if ;
- when CRT_LEFT => if CRT_COL > 1 then
- CRT_COL := CRT_COL - 1 ;
- put_transparent(ASCII.ESC);
- put_transparent("D") ;
- -- Else, we do nothing...
- end if ;
- when scroll_middle_screen_up => null ; -- handled separately
- when scroll_entire_screen_up => scroll_up_entire_screen(1);
- when scroll_partial_screen_up => null ; -- handled separately
- when scroll_middle_screen_down => null ; -- handled separately
- when scroll_entire_screen_down => scroll_down_entire_screen(1);
- when scroll_partial_screen_down => null ; -- handled separately
- when CURSOR_ON => null ;
- when CURSOR_OFF => null ;
- when EXTRA_DISPLAY_ON => null ;
- when EXTRA_DISPLAY_OFF => null ;
- when KEYBOARD_INPUT_ON => null ;
- when KEYBOARD_INPUT_OFF => null ;
- when PROGRAM_TERMINATION=> do_crt(warm_init) ;
- put(" Type A Key ") ;
- terminate_basic_io_system ;
- do_crt(warm_init) ;
- end case;
- end;
-
- procedure scroll_up_middle_screen (
- first_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_up_middle_screen
- null ;
- end scroll_up_middle_screen ;
-
- procedure scroll_up_entire_screen (
- number_of_lines_to_scroll : a_screen_line_number ) is
- lines_so_far : integer := 0 ;
- begin -- scroll_up_entire_screen
- gotoxy(1,total_crt_line);
- loop
- put_transparent( ascii.lf ) ;
- lines_so_far := lines_so_far + 1 ;
- exit when lines_so_far >= number_of_lines_to_scroll ;
- end loop ;
- end scroll_up_entire_screen ;
-
- procedure scroll_up_partial_screen (
- first_line_to_scroll : a_screen_line_number ;
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_up_partial_screen
- null ;
- end scroll_up_partial_screen ;
-
- procedure scroll_down_middle_screen (
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_down_middle_screen
- null ;
- end scroll_down_middle_screen ;
-
- procedure scroll_down_entire_screen (
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_down_entire_screen
- null ;
- end scroll_down_entire_screen ;
-
- procedure scroll_down_partial_screen (
- first_line_to_scroll : a_screen_line_number ;
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_down_partial_screen
- null ;
- end scroll_down_partial_screen ;
-
- -- Finally, we need the Keyboard handler routines
-
- function CTRL( A_CHARACTER : in CHARACTER ) return INTEGER is
- begin
- return CHARACTER'POS(A_CHARACTER) mod 32; -- Strip off high bits
- end;
-
- procedure KEYBOARD_INITIALIZE is
- -- Set up for the input of special keys.
- -- Program the function keys
-
- procedure set_em( place:integer; c_val: integer; new_key: special_keys) is
- begin -- set_em
- real_key_on_input ( place ) := extended_character ( c_val ) ;
- special_meaning_on_input ( place ) := new_key ;
- end set_em ;
-
- procedure SET_KEY_MAPPINGS is
- -- Set up the mappings of keys to new meanings
- begin
- -- First, do the normal mappings
- for C_NUMBER in 0..255 loop
- set_em ( c_number , c_number , key_character ) ;
- end loop;
- -- Then, change the characters which are to be treated specially...
- set_em ( ctrl('A') , 0 , key_home ) ;
- set_em ( ctrl('U') , 0 , key_up ) ;
- set_em ( ctrl('D') , 0 , key_down ) ;
- set_em ( ctrl('R') , 0 , key_right ) ;
- set_em ( ctrl('L') , 0 , key_left ) ;
- set_em ( ctrl('V') , 0 , key_end_of_text ) ;
- set_em ( 27 , 0 , key_escape ) ;
- set_em ( ctrl('I') , 0 , key_tab_forward ) ;
- set_em ( ctrl('H') , 0 , key_backspace ) ;
- set_em ( ctrl('J') , 0 , key_line_feed ) ;
- set_em ( ctrl('M') , 0 , key_carriage_return ) ;
- set_em ( 127 , 0 , key_delete ) ;
- end;
-
- procedure MAP_FUNCTION_KEYS is
-
- function make_key( in_character : in character ;
- out_meaning : in special_keys ;
- out_character: in integer )
- return type_of_key_change is
- t : type_of_key_change ;
- begin
- t.key := extended_character( CHARACTER'POS( in_character ) ) ;
- t.special_meaning := out_meaning ;
- t.final_key := extended_character( out_character ) ;
- return t;
- end;
-
- begin
- -- Initialize to nothing...
- for A_KEY_TYPE in 1..NUM_KEY_TYPES loop
- KEY_MAP(A_KEY_TYPE).LEAD_IN_LENGTH := 0 ;
- KEY_MAP(A_KEY_TYPE).LEAD_IN := " ";
- KEY_MAP(A_KEY_TYPE).FOLLOW_REMOVE := 0 ;
- for A_SINGLE_KEY in 1..NUM_KEYS_WITHIN_TYPE loop
- KEY_MAP(A_KEY_TYPE).EACH_KEY(A_SINGLE_KEY)
- := make_key( CHARACTER'VAL(0) , key_illegal , 0 );
- end loop;
- end loop;
- KEY_MAP(1).LEAD_IN_LENGTH := 1 ;
- KEY_MAP(1).LEAD_IN(1) := ASCII.ESC ;
- KEY_MAP(1).FOLLOW_REMOVE := 0 ;
- KEY_MAP(1).EACH_KEY(01) := make_key('A',KEY_UP, 0);
- KEY_MAP(1).EACH_KEY(02) := make_key('B',KEY_DOWN, 0);
- KEY_MAP(1).EACH_KEY(03) := make_key('C',KEY_RIGHT, 0);
- KEY_MAP(1).EACH_KEY(04) := make_key('D',KEY_LEFT, 0);
- KEY_MAP(1).EACH_KEY(05) := make_key('P',key_function, 1);
- KEY_MAP(1).EACH_KEY(06) := make_key('Q',key_function, 2);
- KEY_MAP(1).EACH_KEY(07) := make_key('R',key_function, 3);
- KEY_MAP(1).EACH_KEY(08) := make_key('S',key_function, 4);
- key_map(1).each_key(12) := make_key(ascii.esc,key_escape,0);
- KEY_MAP(2).LEAD_IN_LENGTH := 1 ;
- KEY_MAP(2).LEAD_IN(1) := ASCII.ESC ;
- KEY_MAP(2).FOLLOW_REMOVE := 0 ;
- key_map(2).each_key(01) := make_key('1',key_alternate, 1);
- key_map(2).each_key(02) := make_key('2',key_alternate, 2);
- key_map(2).each_key(03) := make_key('3',key_alternate, 3);
- key_map(2).each_key(04) := make_key('4',key_alternate, 4);
- key_map(2).each_key(05) := make_key('5',key_alternate, 5);
- key_map(2).each_key(06) := make_key('6',key_alternate, 6);
- key_map(2).each_key(07) := make_key('7',key_alternate, 7);
- key_map(2).each_key(08) := make_key('8',key_alternate, 8);
- key_map(2).each_key(09) := make_key('9',key_alternate, 9);
- key_map(2).each_key(10) := make_key('0',key_alternate,10);
- end;
-
- begin -- Keyboard_initialize
- set_key_mappings ; -- Set up the special 1 to 1 mappings
- map_function_keys ; -- ready the memory map to read keys
- end KEYBOARD_INITIALIZE;
-
- begin -- CRT
- -- CRT by SAIC/Clearwater VT52 ANSI I/O Routines 07 Jan 85
- do_crt(cold_init);
- --
- end CRT;
-
- package body editor_customization is
-
- maximum_function_keys : constant integer := 10 ;
- maximum_alternate_keys: constant integer := 10 ;
-
- type command_pair is
- record
- c : character ;
- command : crt_editor_command ;
- end record ;
-
- function_key : array ( 1 .. maximum_function_keys ) of command_pair ;
- alternate_key: array ( 1 .. maximum_alternate_keys) of command_pair ;
-
- type a_wp_command is
- record
- len : integer ;
- str : string ( 1 .. max_wp_command_length ) ;
- end record ;
-
- word_processor_command_list : array ( 1 .. 10 ) of a_wp_command ;
-
- Physical_Tran : array ( crt.special_keys ) of command_pair ;
-
- c_to_command : array ( 0 .. 255 ) of command_pair ;
-
- procedure set_c ( in_char ,
- out_char : in character ;
- out_meaning : in crt_editor_command ) is
- begin -- set_c
- c_to_command( character'pos( in_char ) ) := ( out_char , out_meaning) ;
- end set_c ;
-
- procedure initialize_translate_tables is
-
- use crt ;
-
- begin -- initialize_translate_tables
- -- First , make everything Illegal
- for indx in 1 .. maximum_function_keys loop
- function_key ( indx ) := ( ascii.nul , illegal_command ) ;
- end loop ;
- for indx in 1 .. maximum_alternate_keys loop
- alternate_key ( indx ) := ( ascii.nul , illegal_command ) ;
- end loop ;
- for indx in crt.special_keys'first .. crt.special_keys'last loop
- Physical_Tran( indx ) := ( ascii.nul , illegal_command ) ;
- end loop ;
- for indx in 0 .. 255 loop
- c_to_command ( indx ) := ( ascii.nul , illegal_command ) ;
- end loop ;
- -- We have 4 function keys on the VT 100 Terminal
- -- This mapping set is called when the input key type is key_function
- -- Note that we could have another set called if we needed to work
- -- with key_alternate
- function_key ( 1 ) := ( ascii.nul , accept_command ) ;
- function_key ( 2 ) := ( ascii.nul , home_command ) ;
- function_key ( 3 ) := ( ascii.nul , advance_paragraph_command ) ;
- function_key ( 4 ) := ( ascii.nul , reject_command ) ;
- -- The following is the physical to editor logical key mapping
- Physical_Tran ( key_end_of_text ) := ( ascii.nul , accept_command) ;
- Physical_Tran ( key_escape ) := ( ascii.nul , reject_command) ;
- Physical_Tran ( key_line_feed ) := ( ascii.nul , down_command ) ;
- Physical_Tran ( key_carriage_return):=(ascii.nul , advance_line_command);
- Physical_Tran ( key_tab_forward ) := ( ascii.nul , advance_tab_command );
- Physical_Tran ( key_home ) := ( ascii.nul , home_command ) ;
- -- Physical_Tran ( key_tab_backward) := ( ascii.nul , ) ;
- Physical_Tran ( key_backspace ) := ( ascii.nul ,
- backward_character_command ) ;
- Physical_Tran ( key_up ) := ( ascii.nul , up_command ) ;
- Physical_Tran ( key_down ) := ( ascii.nul , down_command ) ;
- Physical_Tran ( key_right ) := ( ascii.nul , right_command ) ;
- Physical_Tran ( key_left ) := ( ascii.nul , left_command ) ;
- Physical_Tran ( key_delete ) := ( ascii.nul , backward_line_command);
- -- Max wp command length is 20 , so initialize to that length
- for posn in 1 .. 10 loop
- alternate_key(posn) := ( character'val(posn), word_processor_command ) ;
- end loop ;
- word_processor_command_list( 1) :=
- ( 8 , ascii.cr & ".add 1" & ascii.cr & " " ) ;
- word_processor_command_list( 2) :=
- ( 7 , ascii.cr & ".bold " & " " ) ;
- word_processor_command_list( 3) :=
- ( 9 , ascii.cr & ".shadow " & " " ) ;
- word_processor_command_list( 4) :=
- ( 11 , ascii.cr & ".end_page" & ascii.cr & " " ) ;
- word_processor_command_list( 5) :=
- ( 4 , " on" & ascii.cr & " ") ;
- word_processor_command_list( 6) :=
- ( 5 , " off" & ascii.cr & " " ) ;
- word_processor_command_list( 7) :=
- ( 9 , ascii.cr & ".indent " & " " ) ;
- word_processor_command_list( 8) :=
- ( 12 , ascii.cr & ".underline " & " " ) ;
- word_processor_command_list( 9) :=
- ( 14 , ascii.cr & ".ucontinuous " & " " ) ;
- word_processor_command_list(10) :=
- ( 1 , ascii.cr & " " ) ;
- -- the last is the soft carriage return
- -- key_character is handled next
- set_c ( 'A' , 'A' , adjust_command ) ;
- set_c ( 'B' , 'B' , move_to_first_line_position_command ) ;
- set_c ( 'C' , 'C' , copy_command ) ;
- set_c ( 'D' , 'D' , start_deletion_command ) ;
- set_c ( 'E' , 'E' , move_to_last_line_position_command ) ;
- set_c ( 'F' , 'F' , find_command ) ;
- set_c ( 'H' , 'H' , help_command ) ;
- set_c ( 'I' , 'I' , insert_command ) ;
- set_c ( 'J' , 'J' , jump_command ) ;
- set_c ( 'K' , 'K' , kill_command ) ;
- set_c ( 'L' , 'L' , print_screen_command ) ;
- set_c ( 'M' , 'M' , re_margin_command ) ;
- set_c ( 'P' , 'P' , advance_page_command ) ;
- set_c ( 'Q' , 'Q' , quit_command ) ;
- set_c ( 'R' , 'R' , replace_command ) ;
- set_c ( 'S' , 'S' , set_stuff_command ) ;
- set_c ( 'V' , 'V' , verify_screen_command ) ;
- set_c ( 'W' , 'W' , advance_word_command ) ;
- set_c ( 'X' , 'X' , enter_exchange_mode ) ;
- set_c ( 'Y' , 'Y' , advance_paragraph_command ) ;
- set_c ( 'Z' , 'Z' , zap_command ) ;
- set_c ( 'a' , 'a' , adjust_command ) ;
- set_c ( 'b' , 'b' , move_to_first_line_position_command ) ;
- set_c ( 'c' , 'c' , copy_command ) ;
- set_c ( 'd' , 'd' , start_deletion_command ) ;
- set_c ( 'e' , 'e' , move_to_last_line_position_command ) ;
- set_c ( 'f' , 'f' , find_command ) ;
- set_c ( 'h' , 'h' , help_command ) ;
- set_c ( 'i' , 'i' , insert_command ) ;
- set_c ( 'j' , 'j' , jump_command ) ;
- set_c ( 'k' , 'k' , kill_command ) ;
- set_c ( 'l' , 'l' , print_screen_command ) ;
- set_c ( 'm' , 'm' , re_margin_command ) ;
- set_c ( 'p' , 'p' , advance_page_command ) ;
- set_c ( 'q' , 'q' , quit_command ) ;
- set_c ( 'r' , 'r' , replace_command ) ;
- set_c ( 's' , 's' , set_stuff_command ) ;
- set_c ( 'v' , 'v' , verify_screen_command ) ;
- set_c ( 'w' , 'w' , advance_word_command ) ;
- set_c ( 'x' , 'x' , enter_exchange_mode ) ;
- set_c ( 'y' , 'y' , advance_paragraph_command ) ;
- set_c ( 'z' , 'z' , zap_command ) ;
- set_c ( '?' , '?' , help_command ) ;
- set_c ( ' ' , ' ' , advance_character_command ) ;
- set_c ( ',' , ',' , set_backward_direction ) ;
- set_c ( '<' , '<' , set_backward_direction ) ;
- set_c ( '.' , '.' , set_forward_direction ) ;
- set_c ( '>' , '>' , set_forward_direction ) ;
- set_c ( '+' , '+' , shift_screen_right ) ;
- set_c ( ';' , ';' , shift_screen_right ) ;
- set_c ( '-' , '-' , shift_screen_left ) ;
- set_c ( '!' , '!' , show_other_prompt_command ) ;
- set_c ( '/' , '/' , infinity_command ) ;
- set_c ( '=' , '=' , jump_to_marked_position_command);
- for cc in '0' .. '9' loop
- set_c ( cc , cc , digit_command ) ;
- end loop ;
- -- key_macro ( all ) is handled in the lower levels
- end initialize_translate_tables ;
-
- procedure initialize_prompt_lines is
- begin
- Main_Command_Prompt :=
- " Edit: A(djst C(opy D(elete F(ind H(elp I(nsrt Q(uit R(place eX(chg '!'" ;
- Alternate_Command_Prompt :=
- " Edit: H(elp J(ump K(ill L(inePrntr M(argin P(age S(et V(erify Z(ap '!'" ;
- Adjust_Command_Prompt :=
- " Adjust: L(just R(just C(ent <left,right,up,down> [<ACCEPT> to leave]" ;
- Copy_Command_Prompt :=
- " Copy: B(uffer, F(ile, or <Reject> to abort ? " ;
- Delete_Command_Prompt :=
- " Delete: < > <Moving Commands>, <Append Toggle>, <Accept>, <Reject> " ;
- Find_Command_Prompt := " Find: " ;
- Help_Command_Prompt := " Help: Prompt not defined...." ;
- Insert_Command_Prompt :=
- " Insert: Text [<bs> a char,<del> a line][<Accept> or <Reject>] " ;
- Jump_Command_Prompt :=
- " Jump to B(egin, E(nd, M(arker, or <Reject> to abort ? " ;
- Kill_Command_Prompt :=
- "!KILLING! - - Are You Really Sure You Want To Kill All Following Text "
- & "(Y/N) ? " ;
- Line_Printer_Command_Prompt :=
- "!PRINTING! - - Are You Sure You Want To Print This Screen (Y/N) ? " ;
- Margin_Command_Prompt := " " ;
- Quit_Command_Prompt := " Quit Options: " ;
- Replace_Command_Prompt := " Replace: " ;
- Set_Command_Prompt :=
- " Set: E(nvironment, M(arker, T(abs, Z(ap Marker, H(elp or <Reject> ? " ;
- eXchange_Command_Prompt :=
- " eXchange TEXT [<bs> a char] [<reject> escapes, <accept> accepts]" ;
- Zap_Command_Prompt :=
- " WARNING! Are you sure you wish to zap ? (y/n) " ;
- Enter_Input_File_Name_Prompt :=
- " Enter Input File Name ( or <return> for a new file ) => " ;
- Enter_Copied_In_File_Name_Prompt :=
- " Copy: from what file ( or <return> to skip ) => " ;
- end initialize_prompt_lines ;
-
- procedure translate( ch : in character ;
- special : in crt.special_keys ;
- new_ch : out character ;
- edit_special : out crt_editor_command ) is
- -- translate an input character and special meaning pair to
- -- an internal editor character representation and editor
- -- special meaning pair
- temp_new_ch : character ;
- temp_special: crt_editor_command ;
- begin -- translate
- case special is
- when crt.key_function =>
- if character'pos(ch) <= maximum_function_keys then
- temp_new_ch := function_key ( character'pos(ch) ).c ;
- temp_special := function_key ( character'pos(ch) ).command ;
- else
- temp_new_ch := ascii.nul ;
- temp_special := illegal_command ;
- end if ;
- when crt.key_alternate =>
- if character'pos(ch) <= maximum_alternate_keys then
- temp_new_ch := alternate_key ( character'pos(ch) ).c ;
- temp_special := alternate_key ( character'pos(ch) ).command ;
- else
- temp_new_ch := ascii.nul ;
- temp_special := illegal_command ;
- end if ;
- when crt.key_character =>
- temp_new_ch := c_to_command ( character'pos(ch) ).c ;
- temp_special := c_to_command ( character'pos(ch) ).command ;
- when others =>
- temp_new_ch := physical_tran ( special ).c ;
- temp_special := physical_tran ( special ).command ;
- end case ;
- if temp_special = word_processor_command then
- word_processor_command_string_length :=
- word_processor_command_list(character'pos(temp_new_ch)).len ;
- word_processor_command_string :=
- word_processor_command_list(character'pos(temp_new_ch)).str ;
- end if ;
- new_ch := temp_new_ch ;
- edit_special := temp_special ;
- end translate ;
-
- begin -- editor_customization
- -- EDITVT10 by SAIC/Clearwater Editor Customization VT52 07 Jan 85
- initialize_translate_tables ;
- initialize_prompt_lines ; -- can't put into constants at top because
- -- of initialization code limitation on wicat
- end editor_customization ;
-
- begin -- crt_customization
- -- CRTVT52 by SAIC/Clearwater CRT Customization for VT52 07 Jan 85
- null ;
- end crt_customization ;
-
- --$$$- CRTVT52
-
- --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- --crtdig
- --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- --$$$+ CRTDIG
-
- --
- -- File 004
- --
- -- Editor Written By Robert S. Cymbalski
- -- Science Applications International Corporation
- -- Energy Systems Group
- -- Ada Software Development Project Team
- -- 2280 U.S. Highway 19 North, Suite 120
- -- Clearwater, Florida 33575
- --
- -- CRT Manager Revised from text Copyright (c) 1984 , R.S.Cymbalski
- --
- -- Program for CRT I/O for the Digital Microsystem 5086 (80x24 mode)
- -- Editor Customization Package
-
- with string_library ;
- use string_library ;
-
- with basic_io_system ;
- use basic_io_system ;
-
- package crt_customization is
-
- package CRT is
-
- type SPECIAL_KEYS is ( KEY_ILLEGAL, KEY_CHARACTER, KEY_END_OF_TEXT,
- KEY_ESCAPE, KEY_TAB_FORWARD, KEY_HOME,
- KEY_LINE_FEED , KEY_CARRIAGE_RETURN ,
- KEY_TAB_BACKWARD, KEY_BACKSPACE, KEY_UP, KEY_DOWN,
- KEY_RIGHT, KEY_LEFT, KEY_DELETE, KEY_FUNCTION,
- KEY_ALTERNATE );
-
- type CRT_COLOR is (BLACK,RED,BLUE,GREEN,PURPLE,YELLOW,LIGHT_BLUE,WHITE);
- type CHAR_ATTRIBUTES is (NORMAL, BLINK, UNDERLINE, OTHER_INTENSITY );
- type CRT_CONTROL is (COLD_INIT, WARM_INIT, ERASE_ALL, ERASE_EOL,
- ERASE_EOS, INSERT_LINE, DELETE_LINE,REVERSE_VIDEO,
- CRT_HOME, CRT_UP, CRT_DOWN, CRT_RIGHT, CRT_LEFT,
- scroll_middle_screen_up , scroll_entire_screen_up ,
- scroll_partial_screen_up ,
- scroll_middle_screen_down , scroll_entire_screen_down ,
- scroll_partial_screen_down ,
- CURSOR_ON, CURSOR_OFF, EXTRA_DISPLAY_ON,
- EXTRA_DISPLAY_OFF, KEYBOARD_INPUT_ON,
- KEYBOARD_INPUT_OFF, PROGRAM_TERMINATION );
-
- CRT_ATTRIBUTE_1 : CHAR_ATTRIBUTES := NORMAL ;
- CRT_ATTRIBUTE_2 : CHAR_ATTRIBUTES := NORMAL ;
- CRT_ATTRIBUTE_3 : CHAR_ATTRIBUTES := NORMAL ;
-
- CURRENT_CRT_COLOR : CRT_COLOR := GREEN ; -- holds current color
- DEFAULT_CRT_COLOR : CRT_COLOR := GREEN ; -- is standard I/O color
- CURRENT_BACKGROUND_COLOR : CRT_COLOR := BLACK ;
- DEFAULT_BACKGROUND_COLOR : CRT_COLOR := BLACK ;--standard background color
-
- NUM_KEY_TYPES : constant integer := 5 ;
- NUM_KEYS_WITHIN_TYPE : constant integer := 16 ;
- type type_of_key_change is record
- KEY : extended_character;
- SPECIAL_MEANING: SPECIAL_KEYS ;
- FINAL_KEY : extended_character;
- end record;
- type ARRAY_TYPE_OF_KEY_CHANGE is
- array ( 1 .. NUM_KEYS_WITHIN_TYPE ) of type_of_key_change ;
- type KEY_SET is record
- LEAD_IN_LENGTH : INTEGER ;
- LEAD_IN : STRING(1 .. 5);
- FOLLOW_REMOVE : INTEGER ;
- EACH_KEY : ARRAY_TYPE_OF_KEY_CHANGE ;
- end record;
- type ALL_KEYS is array ( 1..NUM_KEY_TYPES ) of KEY_SET ;
-
- KEY_MAP : ALL_KEYS;
- REAL_KEY_ON_INPUT : array ( 0..255 ) of extended_character ;
- SPECIAL_MEANING_ON_INPUT : array ( 0..255 ) OF SPECIAL_KEYS ;
-
- -- Now, we need the CRT handler routines
-
- procedure GOTOXY(COL : in A_SCREEN_COLUMN_NUMBER;
- LINE : in A_SCREEN_LINE_NUMBER);
- -- Positions the cursor to COL,LINE on the screen; changing COL
- -- and LINE to maximum allowable column or line if they are
- -- in error.
- -- This could be done with SET_COL/SET_LINE but this is one call
-
- function CRT_HAS( CONTROL : in CRT_CONTROL ) return BOOLEAN;
- -- Returns true if CRT has the ability to perform the given crt
- -- control function, false otherwise.
-
- procedure DO_CRT( CONTROL : in CRT_CONTROL );
- -- Performs the given crt control function; if the crt does not have
- -- the ability to perform the crt control, nothing is done.
-
- procedure CHANGE_CRT( TO : in CHAR_ATTRIBUTES ;
- ALSO : in CHAR_ATTRIBUTES := normal ;
- AND_ALSO : in CHAR_ATTRIBUTES := NORMAL );
- -- Changes the crt attributes to one, two or three new attributes
-
- procedure CHANGE_COLOR( TEXT_COLOR : in CRT_COLOR ;
- BACKGROUND_COLOR : in CRT_COLOR := black);
- -- Changes the crt color to the new text and background colors
-
- procedure scroll_up_middle_screen (
- first_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_up_entire_screen (
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_up_partial_screen (
- first_line_to_scroll : a_screen_line_number ;
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_down_middle_screen (
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_down_entire_screen (
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_down_partial_screen (
- first_line_to_scroll : a_screen_line_number ;
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- end CRT ;
-
- package editor_customization is
-
- type crt_editor_command is ( up_command , down_command ,
- right_command , left_command ,
-
- advance_character_command ,
- advance_word_command ,
- advance_tab_command ,
- advance_line_command ,
- advance_paragraph_command ,
- advance_page_command ,
- advance_infinity_command ,
-
- forward_character_command ,
- backward_character_command ,
- forward_word_command , backward_word_command ,
- forward_tab_command , backward_tab_command ,
- forward_line_command , backward_line_command ,
- forward_paragraph_command ,
- backward_paragraph_command ,
- forward_page_command , backward_page_command ,
-
- home_command ,
- move_to_first_line_position_command ,
- move_to_last_line_position_command ,
- jump_to_first_position_command ,
- jump_to_last_position_command ,
-
- jump_to_marked_position_command ,
-
- set_forward_direction ,
- set_backward_direction ,
-
- shift_screen_right , shift_screen_left ,
-
- adjust_command ,
- copy_command ,
- start_deletion_command,
- find_command ,
- help_command ,
- insert_command ,
- jump_command ,
- kill_command ,
- print_screen_command ,
- re_margin_command ,
- quit_command ,
- replace_command ,
- set_stuff_command ,
- verify_screen_command ,
- enter_exchange_mode ,
- zap_command ,
-
- accept_command ,
- reject_command ,
- word_processor_command,
- digit_command ,
- infinity_command ,
- show_other_prompt_command ,
- illegal_command ) ;
-
- Main_Command_Prompt : string (1..71) ;
- Alternate_Command_Prompt : string (1..71) ;
- Adjust_Command_Prompt : string (1..69) ;
- Copy_Command_Prompt : string (1..46) ;
- Delete_Command_Prompt : string (1..69) ;
- Find_Command_Prompt : string (1.. 7) ;
- Help_Command_Prompt : string (1..29) ;
- Insert_Command_Prompt : string (1..63) ;
- Jump_Command_Prompt : string (1..55) ;
- Kill_Command_Prompt : string (1..78) ;
- Line_Printer_Command_Prompt : string (1..66) ;
- Margin_Command_Prompt : string (1.. 1) ;
- Quit_Command_Prompt : string (1..20) ;
- Replace_Command_Prompt : string (1..10) ;
- Set_Command_Prompt : string (1..69) ;
- eXchange_Command_Prompt : string (1..65) ;
- Zap_Command_Prompt : string (1..47) ;
- Enter_Input_File_Name_Prompt : string (1..57) ;
- Enter_Copied_In_File_Name_Prompt : string (1..49) ;
-
- procedure translate( ch : in character ;
- special : in crt.special_keys ;
- new_ch : out character ;
- edit_special : out crt_editor_command ) ;
- -- translate an input character and special meaning pair to
- -- an internal editor character representation and editor
- -- special meaning pair
-
- max_wp_command_length : constant integer := 20 ;
-
- word_processor_command_string_length : integer ;
- -- The length of the word processor command string for the
- -- key just pressed
-
- word_processor_command_string : string ( 1 .. max_wp_command_length ) ;
- -- The string of characters associated with the function key hit
- -- If the first character is ascii.cr, then start a new line at
- -- column 1. If the length is greater than 1 and then the last
- -- character is ascii.cr, then end by starting a new line and
- -- indenting to the old indentation from before the command key.
- -- If the first character is a space, then, only put the space in
- -- if the last character was not a space
-
- end;
-
- end crt_customization ;
-
- package body crt_customization is
-
- package body CRT is
-
- procedure GOTOXY( COL : in A_SCREEN_COLUMN_NUMBER ;
- LINE : in A_SCREEN_LINE_NUMBER ) is
- -- It will change the col or line if they are in error
- A_COL, A_LINE : NATURAL;
- begin
- A_COL := COL ;
- A_LINE := LINE ;
- if A_COL > TOTAL_CRT_COL then
- A_COL := TOTAL_CRT_COL ;
- end if;
- if A_LINE > TOTAL_CRT_LINE then
- A_LINE := TOTAL_CRT_LINE ;
- end if;
- CRT_COL := A_COL ;
- CRT_LINE := A_LINE ;
- put_transparent(ASCII.ESC);
- put_transparent("Y");
- put_transparent(character'val(A_LINE+32));
- put_transparent(character'val(A_COL+32));
- end;
-
- function CRT_HAS( CONTROL : in CRT_CONTROL ) return BOOLEAN is
- ok : BOOLEAN ;
- begin
- case CONTROL is
- when COLD_INIT => ok := TRUE ; -- Required
- when WARM_INIT => ok := TRUE ; -- Required
- when ERASE_ALL => ok := TRUE ; -- Required
- when ERASE_EOL => ok := TRUE ;
- when ERASE_EOS => ok := TRUE ;
- when INSERT_LINE => ok := FALSE ;
- when DELETE_LINE => ok := FALSE ;
- when CRT_HOME => ok := TRUE ; -- Required
- when CRT_UP => ok := TRUE ;
- when CRT_DOWN => ok := TRUE ;
- when CRT_RIGHT => ok := TRUE ;
- when CRT_LEFT => ok := TRUE ;
- when REVERSE_VIDEO => ok := FALSE ;
- when scroll_middle_screen_up => ok := false ;
- when scroll_entire_screen_up => ok := true ; -- required
- when scroll_partial_screen_up => ok := false ;
- when scroll_middle_screen_down => ok := false ;
- when scroll_entire_screen_down => ok := false ;
- when scroll_partial_screen_down => ok := false ;
- when CURSOR_ON => ok := FALSE ;
- when CURSOR_OFF => ok := FALSE ;
- when EXTRA_DISPLAY_ON => ok := FALSE ;
- when EXTRA_DISPLAY_OFF => ok := FALSE ;
- when KEYBOARD_INPUT_ON => ok := FALSE ;
- when KEYBOARD_INPUT_OFF => ok := FALSE ;
- when PROGRAM_TERMINATION=> ok := TRUE ; -- Required
- end case;
- return ok ;
- end;
-
- procedure new_attributes(new_text_color ,
- new_background_color : crt_color;
- new_crt_atr_1 , new_crt_atr_2 , new_crt_atr_3 : char_attributes) is
- screen_color : crt_color ;
-
- begin
- null ;
- end;
-
- procedure CHANGE_CRT( TO : in CHAR_ATTRIBUTES ;
- ALSO : in CHAR_ATTRIBUTES := normal ;
- AND_ALSO : in CHAR_ATTRIBUTES := NORMAL ) is
- begin
- null ;
- end;
-
- procedure CHANGE_COLOR( TEXT_COLOR : in CRT_COLOR ;
- BACKGROUND_COLOR : in CRT_COLOR := black) is
- begin
- null ;
- end;
-
- procedure KEYBOARD_INITIALIZE;
-
- function cntrl(A_CHARACTER : in CHARACTER) return CHARACTER is
- begin
- return CHARACTER'val(CHARACTER'pos(A_CHARACTER) mod 32) ;
- end;
-
- procedure DO_CRT( CONTROL : in CRT_CONTROL ) is
- begin
- case CONTROL is
- when COLD_INIT => TOTAL_CRT_COL := 80 ;
- TOTAL_CRT_LINE:= 24 ;
- KEYBOARD_INITIALIZE;
- DO_CRT(WARM_INIT);
- when WARM_INIT => CHANGE_CRT( NORMAL ) ;
- CHANGE_COLOR( GREEN ) ;
- DO_CRT(ERASE_ALL);
- DO_CRT(CURSOR_ON);
- DO_CRT(EXTRA_DISPLAY_ON);
- DO_CRT(KEYBOARD_INPUT_ON);
- when ERASE_ALL => put_transparent(cntrl('L'));
- when ERASE_EOL => put_transparent(ASCII.ESC);
- put_transparent("K") ;
- when ERASE_EOS => put_transparent(ASCII.ESC);
- put_transparent("k") ;
- when INSERT_LINE => null ;
- when DELETE_LINE => null ;
- when CRT_HOME => GOTOXY(1,1);
- when CRT_UP => if CRT_LINE > 1 then
- CRT_LINE := CRT_LINE - 1 ;
- put_transparent(cntrl('Z'));
- -- else do nothing...
- end if ;
- when CRT_DOWN => if CRT_LINE < TOTAL_CRT_LINE then
- CRT_LINE := CRT_LINE + 1 ;
- put_transparent(cntrl('J'));
- -- else do nothing...
- end if ;
- when CRT_RIGHT => if CRT_COL < TOTAL_CRT_COL then
- CRT_COL := CRT_COL + 1 ;
- put_transparent(cntrl('F'));
- -- else do nothing...
- end if ;
- when CRT_LEFT => if CRT_COL > 1 then
- CRT_COL := CRT_COL - 1 ;
- put_transparent(cntrl('H')) ;
- -- Else, we do nothing...
- end if ;
- when REVERSE_VIDEO=> null ;
- when scroll_middle_screen_up => null ; -- handled separately
- when scroll_entire_screen_up => scroll_up_entire_screen(1);
- when scroll_partial_screen_up => null ; -- handled separately
- when scroll_middle_screen_down => null ; -- handled separately
- when scroll_entire_screen_down => scroll_down_entire_screen(1);
- when scroll_partial_screen_down => null ; -- handled separately
- when CURSOR_ON => null ;
- when CURSOR_OFF => null ;
- when EXTRA_DISPLAY_ON => null ;
- when EXTRA_DISPLAY_OFF => null ;
- when KEYBOARD_INPUT_ON => null ;
- when KEYBOARD_INPUT_OFF => null ;
- when PROGRAM_TERMINATION=> do_crt(warm_init) ;
- put(" Type A Key ") ;
- terminate_basic_io_system ;
- do_crt(warm_init) ;
- end case;
- end;
-
- procedure scroll_up_middle_screen (
- first_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_up_middle_screen
- null ;
- end scroll_up_middle_screen ;
-
- procedure scroll_up_entire_screen (
- number_of_lines_to_scroll : a_screen_line_number ) is
- lines_so_far : integer := 0 ;
- begin -- scroll_up_entire_screen
- gotoxy(1,total_crt_line);
- loop
- put_transparent( ascii.lf ) ;
- lines_so_far := lines_so_far + 1 ;
- exit when lines_so_far >= number_of_lines_to_scroll ;
- end loop ;
- end scroll_up_entire_screen ;
-
- procedure scroll_up_partial_screen (
- first_line_to_scroll : a_screen_line_number ;
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_up_partial_screen
- null ;
- end scroll_up_partial_screen ;
-
- procedure scroll_down_middle_screen (
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_down_middle_screen
- null ;
- end scroll_down_middle_screen ;
-
- procedure scroll_down_entire_screen (
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_down_entire_screen
- null ;
- end scroll_down_entire_screen ;
-
- procedure scroll_down_partial_screen (
- first_line_to_scroll : a_screen_line_number ;
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_down_partial_screen
- null ;
- end scroll_down_partial_screen ;
-
- -- Finally, we need the Keyboard handler routines
-
- function CTRL( A_CHARACTER : in CHARACTER ) return INTEGER is
- begin
- return CHARACTER'POS(A_CHARACTER) mod 32; -- Strip off high bits
- end;
-
- procedure KEYBOARD_INITIALIZE is
- -- Set up for the input of special keys.
- -- Program the function keys
-
- procedure set_em( place:integer; c_val: integer; new_key: special_keys) is
- begin -- set_em
- real_key_on_input ( place ) := extended_character ( c_val ) ;
- special_meaning_on_input ( place ) := new_key ;
- end set_em ;
-
- procedure SET_KEY_MAPPINGS is
- -- Set up the mappings of keys to new meanings
- begin
- -- First, do the normal mappings
- for C_NUMBER in 0..255 loop
- set_em ( c_number , c_number , key_character ) ;
- end loop;
- -- Then, change the characters which are to be treated specially...
- set_em ( ctrl('V') , 0 , key_end_of_text ) ;
- set_em ( 27 , 0 , key_escape ) ;
- set_em ( ctrl('I') , 0 , key_tab_forward ) ;
- set_em ( ctrl('H') , 0 , key_backspace ) ;
- set_em ( ctrl('J') , 0 , key_line_feed ) ;
- set_em ( ctrl('M') , 0 , key_carriage_return ) ;
- set_em ( 127 , 0 , key_delete ) ;
- set_em ( ctrl('A') , 0 , key_home ) ;
- end;
-
- procedure MAP_FUNCTION_KEYS is
-
- function make_key( in_character : in character ;
- out_meaning : in special_keys ;
- out_character: in integer )
- return type_of_key_change is
- t : type_of_key_change ;
- begin
- t.key := extended_character( CHARACTER'POS( in_character ) ) ;
- t.special_meaning := out_meaning ;
- t.final_key := extended_character( out_character ) ;
- return t;
- end;
-
- begin
- -- Initialize to nothing...
- for A_KEY_TYPE in 1..NUM_KEY_TYPES loop
- KEY_MAP(A_KEY_TYPE).LEAD_IN_LENGTH := 0 ;
- KEY_MAP(A_KEY_TYPE).LEAD_IN := " ";
- KEY_MAP(A_KEY_TYPE).FOLLOW_REMOVE := 0 ;
- for A_SINGLE_KEY in 1..NUM_KEYS_WITHIN_TYPE loop
- KEY_MAP(A_KEY_TYPE).EACH_KEY(A_SINGLE_KEY)
- := make_key( CHARACTER'VAL(0) , key_illegal , 0 );
- end loop;
- end loop;
- KEY_MAP(1).LEAD_IN_LENGTH := 2 ;
- KEY_MAP(1).LEAD_IN(1..2) := " O" ;
- KEY_MAP(1).LEAD_IN(1) := ASCII.ESC ;
- KEY_MAP(1).FOLLOW_REMOVE := 0 ;
- KEY_MAP(1).EACH_KEY(01) := make_key('A',KEY_FUNCTION,1);
- KEY_MAP(1).EACH_KEY(02) := make_key('B',KEY_FUNCTION,2);
- KEY_MAP(1).EACH_KEY(03) := make_key('C',KEY_FUNCTION,3);
- KEY_MAP(1).EACH_KEY(04) := make_key('D',KEY_FUNCTION,4);
- KEY_MAP(1).EACH_KEY(05) := make_key('E',KEY_FUNCTION,5);
- KEY_MAP(1).EACH_KEY(06) := make_key('F',KEY_FUNCTION,6);
- KEY_MAP(1).EACH_KEY(07) := make_key('G',KEY_FUNCTION,7);
- KEY_MAP(1).EACH_KEY(08) := make_key('H',KEY_FUNCTION,8);
- KEY_MAP(1).EACH_KEY(09) := make_key('I',KEY_FUNCTION,9);
- KEY_MAP(1).EACH_KEY(10) := make_key('J',KEY_FUNCTION,10);
- KEY_MAP(1).EACH_KEY(11) := make_key('K',KEY_FUNCTION,11);
- KEY_MAP(1).EACH_KEY(12) := make_key('L',KEY_FUNCTION,12);
- KEY_MAP(2).LEAD_IN_LENGTH := 2 ;
- KEY_MAP(2).LEAD_IN(1..2) := " O" ;
- KEY_MAP(2).LEAD_IN(1) := ASCII.ESC ;
- KEY_MAP(2).FOLLOW_REMOVE := 0 ;
- KEY_MAP(2).EACH_KEY(01) := make_key('M',key_function,13);
- KEY_MAP(2).EACH_KEY(02) := make_key('N',key_function,14);
- KEY_MAP(2).EACH_KEY(03) := make_key('O',key_function,15);
- KEY_MAP(2).EACH_KEY(04) := make_key('P',key_function,16);
- KEY_MAP(2).EACH_KEY(05) := make_key('1',KEY_FUNCTION,17);
- KEY_MAP(2).EACH_KEY(06) := make_key('2',KEY_FUNCTION,18);
- KEY_MAP(2).EACH_KEY(07) := make_key('3',KEY_FUNCTION,19);
- KEY_MAP(2).EACH_KEY(08) := make_key('a',KEY_FUNCTION,20);
- KEY_MAP(2).EACH_KEY(09) := make_key('b',KEY_FUNCTION,21);
- KEY_MAP(2).EACH_KEY(10) := make_key('c',KEY_FUNCTION,22);
- KEY_MAP(2).EACH_KEY(11) := make_key('d',KEY_FUNCTION,23);
- KEY_MAP(2).EACH_KEY(12) := make_key('e',KEY_FUNCTION,24);
- key_map(3).lead_in_length := 2 ;
- key_map(3).lead_in(1..2) := " 0";
- key_map(3).lead_in(1) := ascii.esc ;
- key_map(3).follow_remove := 0 ;
- key_map(3).each_key(01) := make_key('f',key_function,25);
- key_map(3).each_key(02) := make_key('g',key_function,26);
- key_map(3).each_key(03) := make_key('h',key_function,27);
- key_map(3).each_key(04) := make_key('i',key_function,28);
- key_map(3).each_key(05) := make_key('j',key_function,29);
- key_map(3).each_key(06) := make_key('k',key_function,30);
- key_map(3).each_key(07) := make_key('l',key_function,31);
- key_map(3).each_key(08) := make_key('m',key_function,32);
- key_map(3).each_key(09) := make_key('n',key_function,33);
- key_map(3).each_key(10) := make_key('o',key_function,34);
- key_map(3).each_key(11) := make_key('p',key_function,35);
- key_map(4).lead_in_length := 1 ;
- key_map(4).lead_in(1) := ascii.esc ;
- key_map(4).follow_remove := 0 ;
- key_map(4).each_key(01) := make_key(ascii.esc,key_escape,0) ;
- end;
-
- begin -- Keyboard_initialize
- set_key_mappings ; -- Set up the special 1 to 1 mappings
- map_function_keys ; -- ready the memory map to read keys
- end KEYBOARD_INITIALIZE;
-
- begin -- CRT
- -- CRT by SAIC/Clearwater VT100 ANSI I/O Routines 07 Jan 85
- do_crt(cold_init);
- --
- end CRT;
-
- package body editor_customization is
-
- maximum_function_keys : constant integer := 10 ;
- maximum_alternate_keys: constant integer := 10 ;
-
- type command_pair is
- record
- c : character ;
- command : crt_editor_command ;
- end record ;
-
- function_key : array ( 1 .. maximum_function_keys ) of command_pair ;
- alternate_key: array ( 1 .. maximum_alternate_keys) of command_pair ;
-
- type a_wp_command is
- record
- len : integer ;
- str : string ( 1 .. max_wp_command_length ) ;
- end record ;
-
- word_processor_command_list : array ( 1 .. 10 ) of a_wp_command ;
-
- Physical_Tran : array ( crt.special_keys ) of command_pair ;
-
- c_to_command : array ( 0 .. 255 ) of command_pair ;
-
- procedure set_c ( in_char ,
- out_char : in character ;
- out_meaning : in crt_editor_command ) is
- begin -- set_c
- c_to_command( character'pos( in_char ) ) := ( out_char , out_meaning) ;
- end set_c ;
-
- procedure initialize_translate_tables is
-
- use crt ;
-
- begin -- initialize_translate_tables
- -- First , make everything Illegal
- for indx in 1 .. maximum_function_keys loop
- function_key ( indx ) := ( ascii.nul , illegal_command ) ;
- end loop ;
- for indx in 1 .. maximum_alternate_keys loop
- alternate_key ( indx ) := ( ascii.nul , illegal_command ) ;
- end loop ;
- for indx in crt.special_keys'first .. crt.special_keys'last loop
- Physical_Tran( indx ) := ( ascii.nul , illegal_command ) ;
- end loop ;
- for indx in 0 .. 255 loop
- c_to_command ( indx ) := ( ascii.nul , illegal_command ) ;
- end loop ;
- -- We have 4 function keys on the VT 100 Terminal
- -- This mapping set is called when the input key type is key_function
- -- Note that we could have another set called if we needed to work
- -- with key_alternate
- function_key ( 1 ) := ( ascii.nul , accept_command ) ;
- function_key ( 2 ) := ( ascii.nul , home_command ) ;
- function_key ( 3 ) := ( ascii.nul , advance_paragraph_command ) ;
- function_key ( 4 ) := ( ascii.nul , reject_command ) ;
- -- The following is the physical to editor logical key mapping
- Physical_Tran ( key_end_of_text ) := ( ascii.nul , accept_command) ;
- Physical_Tran ( key_escape ) := ( ascii.nul , reject_command) ;
- Physical_Tran ( key_line_feed ) := ( ascii.nul , down_command ) ;
- Physical_Tran ( key_carriage_return):=(ascii.nul , advance_line_command);
- Physical_Tran ( key_tab_forward ) := ( ascii.nul , advance_tab_command );
- Physical_Tran ( key_home ) := ( ascii.nul , home_command ) ;
- -- Physical_Tran ( key_tab_backward) := ( ascii.nul , ) ;
- Physical_Tran ( key_backspace ) := ( ascii.nul ,
- backward_character_command ) ;
- Physical_Tran ( key_up ) := ( ascii.nul , up_command ) ;
- Physical_Tran ( key_down ) := ( ascii.nul , down_command ) ;
- Physical_Tran ( key_right ) := ( ascii.nul , right_command ) ;
- Physical_Tran ( key_left ) := ( ascii.nul , left_command ) ;
- Physical_Tran ( key_delete ) := ( ascii.nul , backward_line_command);
- -- Max wp command length is 20 , so initialize to that length
- for posn in 1 .. 10 loop
- alternate_key(posn) := ( character'val(posn), word_processor_command ) ;
- end loop ;
- word_processor_command_list( 1) :=
- ( 8 , ascii.cr & ".add 1" & ascii.cr & " " ) ;
- word_processor_command_list( 2) :=
- ( 7 , ascii.cr & ".bold " & " " ) ;
- word_processor_command_list( 3) :=
- ( 9 , ascii.cr & ".shadow " & " " ) ;
- word_processor_command_list( 4) :=
- ( 11 , ascii.cr & ".end_page" & ascii.cr & " " ) ;
- word_processor_command_list( 5) :=
- ( 4 , " on" & ascii.cr & " ") ;
- word_processor_command_list( 6) :=
- ( 5 , " off" & ascii.cr & " " ) ;
- word_processor_command_list( 7) :=
- ( 9 , ascii.cr & ".indent " & " " ) ;
- word_processor_command_list( 8) :=
- ( 12 , ascii.cr & ".underline " & " " ) ;
- word_processor_command_list( 9) :=
- ( 14 , ascii.cr & ".ucontinuous " & " " ) ;
- word_processor_command_list(10) :=
- ( 1 , ascii.cr & " " ) ;
- -- the last is the soft carriage return
- -- key_character is handled next
- set_c ( 'A' , 'A' , adjust_command ) ;
- set_c ( 'B' , 'B' , move_to_first_line_position_command ) ;
- set_c ( 'C' , 'C' , copy_command ) ;
- set_c ( 'D' , 'D' , start_deletion_command ) ;
- set_c ( 'E' , 'E' , move_to_last_line_position_command ) ;
- set_c ( 'F' , 'F' , find_command ) ;
- set_c ( 'H' , 'H' , help_command ) ;
- set_c ( 'I' , 'I' , insert_command ) ;
- set_c ( 'J' , 'J' , jump_command ) ;
- set_c ( 'K' , 'K' , kill_command ) ;
- set_c ( 'L' , 'L' , print_screen_command ) ;
- set_c ( 'M' , 'M' , re_margin_command ) ;
- set_c ( 'P' , 'P' , advance_page_command ) ;
- set_c ( 'Q' , 'Q' , quit_command ) ;
- set_c ( 'R' , 'R' , replace_command ) ;
- set_c ( 'S' , 'S' , set_stuff_command ) ;
- set_c ( 'V' , 'V' , verify_screen_command ) ;
- set_c ( 'W' , 'W' , advance_word_command ) ;
- set_c ( 'X' , 'X' , enter_exchange_mode ) ;
- set_c ( 'Y' , 'Y' , advance_paragraph_command ) ;
- set_c ( 'Z' , 'Z' , zap_command ) ;
- set_c ( 'a' , 'a' , adjust_command ) ;
- set_c ( 'b' , 'b' , move_to_first_line_position_command ) ;
- set_c ( 'c' , 'c' , copy_command ) ;
- set_c ( 'd' , 'd' , start_deletion_command ) ;
- set_c ( 'e' , 'e' , move_to_last_line_position_command ) ;
- set_c ( 'f' , 'f' , find_command ) ;
- set_c ( 'h' , 'h' , help_command ) ;
- set_c ( 'i' , 'i' , insert_command ) ;
- set_c ( 'j' , 'j' , jump_command ) ;
- set_c ( 'k' , 'k' , kill_command ) ;
- set_c ( 'l' , 'l' , print_screen_command ) ;
- set_c ( 'm' , 'm' , re_margin_command ) ;
- set_c ( 'p' , 'p' , advance_page_command ) ;
- set_c ( 'q' , 'q' , quit_command ) ;
- set_c ( 'r' , 'r' , replace_command ) ;
- set_c ( 's' , 's' , set_stuff_command ) ;
- set_c ( 'v' , 'v' , verify_screen_command ) ;
- set_c ( 'w' , 'w' , advance_word_command ) ;
- set_c ( 'x' , 'x' , enter_exchange_mode ) ;
- set_c ( 'y' , 'y' , advance_paragraph_command ) ;
- set_c ( 'z' , 'z' , zap_command ) ;
- set_c ( '?' , '?' , help_command ) ;
- set_c ( ' ' , ' ' , advance_character_command ) ;
- set_c ( ',' , ',' , set_backward_direction ) ;
- set_c ( '<' , '<' , set_backward_direction ) ;
- set_c ( '.' , '.' , set_forward_direction ) ;
- set_c ( '>' , '>' , set_forward_direction ) ;
- set_c ( '+' , '+' , shift_screen_right ) ;
- set_c ( ';' , ';' , shift_screen_right ) ;
- set_c ( '-' , '-' , shift_screen_left ) ;
- set_c ( '!' , '!' , show_other_prompt_command ) ;
- set_c ( '/' , '/' , infinity_command ) ;
- set_c ( '=' , '=' , jump_to_marked_position_command);
- for cc in '0' .. '9' loop
- set_c ( cc , cc , digit_command ) ;
- end loop ;
- -- key_macro ( all ) is handled in the lower levels
- end initialize_translate_tables ;
-
- procedure initialize_prompt_lines is
- begin
- Main_Command_Prompt :=
- " Edit: A(djst C(opy D(elete F(ind H(elp I(nsrt Q(uit R(place eX(chg '!'" ;
- Alternate_Command_Prompt :=
- " Edit: H(elp J(ump K(ill L(inePrntr M(argin P(age S(et V(erify Z(ap '!'" ;
- Adjust_Command_Prompt :=
- " Adjust: L(just R(just C(ent <left,right,up,down> [<ACCEPT> to leave]" ;
- Copy_Command_Prompt :=
- " Copy: B(uffer, F(ile, or <Reject> to abort ? " ;
- Delete_Command_Prompt :=
- " Delete: < > <Moving Commands>, <Append Toggle>, <Accept>, <Reject> " ;
- Find_Command_Prompt := " Find: " ;
- Help_Command_Prompt := " Help: Prompt not defined...." ;
- Insert_Command_Prompt :=
- " Insert: Text [<bs> a char,<del> a line][<Accept> or <Reject>] " ;
- Jump_Command_Prompt :=
- " Jump to B(egin, E(nd, M(arker, or <Reject> to abort ? " ;
- Kill_Command_Prompt :=
- "!KILLING! - - Are You Really Sure You Want To Kill All Following Text "
- & "(Y/N) ? " ;
- Line_Printer_Command_Prompt :=
- "!PRINTING! - - Are You Sure You Want To Print This Screen (Y/N) ? " ;
- Margin_Command_Prompt := " " ;
- Quit_Command_Prompt := " Quit Options: " ;
- Replace_Command_Prompt := " Replace: " ;
- Set_Command_Prompt :=
- " Set: E(nvironment, M(arker, T(abs, Z(ap Marker, H(elp or <Reject> ? " ;
- eXchange_Command_Prompt :=
- " eXchange TEXT [<bs> a char] [<reject> escapes, <accept> accepts]" ;
- Zap_Command_Prompt :=
- " WARNING! Are you sure you wish to zap ? (y/n) " ;
- Enter_Input_File_Name_Prompt :=
- " Enter Input File Name ( or <return> for a new file ) => " ;
- Enter_Copied_In_File_Name_Prompt :=
- " Copy: from what file ( or <return> to skip ) => " ;
- end initialize_prompt_lines ;
-
- procedure translate( ch : in character ;
- special : in crt.special_keys ;
- new_ch : out character ;
- edit_special : out crt_editor_command ) is
- -- translate an input character and special meaning pair to
- -- an internal editor character representation and editor
- -- special meaning pair
- temp_new_ch : character ;
- temp_special: crt_editor_command ;
- begin -- translate
- case special is
- when crt.key_function =>
- if character'pos(ch) <= maximum_function_keys then
- temp_new_ch := function_key ( character'pos(ch) ).c ;
- temp_special := function_key ( character'pos(ch) ).command ;
- else
- temp_new_ch := ascii.nul ;
- temp_special := illegal_command ;
- end if ;
- when crt.key_alternate =>
- if character'pos(ch) <= maximum_alternate_keys then
- temp_new_ch := alternate_key ( character'pos(ch) ).c ;
- temp_special := alternate_key ( character'pos(ch) ).command ;
- else
- temp_new_ch := ascii.nul ;
- temp_special := illegal_command ;
- end if ;
- when crt.key_character =>
- temp_new_ch := c_to_command ( character'pos(ch) ).c ;
- temp_special := c_to_command ( character'pos(ch) ).command ;
- when others =>
- temp_new_ch := physical_tran ( special ).c ;
- temp_special := physical_tran ( special ).command ;
- end case ;
- if temp_special = word_processor_command then
- word_processor_command_string_length :=
- word_processor_command_list(character'pos(temp_new_ch)).len ;
- word_processor_command_string :=
- word_processor_command_list(character'pos(temp_new_ch)).str ;
- end if ;
- new_ch := temp_new_ch ;
- edit_special := temp_special ;
- end translate ;
-
- begin -- editor_customization
- -- EDITVT10 by SAIC/Clearwater Editor Customization VT100 07 Jan 85
- initialize_translate_tables ;
- initialize_prompt_lines ; -- can't put into constants at top because
- -- of initialization code limitation on wicat
- end editor_customization ;
-
- begin -- crt_customization
- -- CRTDIG by SAIC/Clearwater CRT Customization for DIGITAL MICRO 07 Jan 85
- null ;
- end crt_customization ;
-
- --$$$- CRTDIG
-
- --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- --crtvip77
- --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- --$$$+ CRTVIP77
-
- --
- -- File 003
- --
- -- Editor Written By Robert S. Cymbalski
- -- Science Applications International Corporation
- -- Energy Systems Group
- -- Ada Software Development Project Team
- -- 2280 U.S. Highway 19 North, Suite 120
- -- Clearwater, Florida 33575
- --
- -- CRT Manager Revised from text Copyright (c) 1984 , R.S.Cymbalski
- --
- -- Program for CRT I/O for the VIP 7705
- -- Editor Customization Package
-
- with string_library ;
- use string_library ;
-
- with basic_io_system ;
- use basic_io_system ;
-
- package crt_customization is
-
- package CRT is
-
- type SPECIAL_KEYS is ( KEY_ILLEGAL, KEY_CHARACTER, KEY_END_OF_TEXT,
- KEY_ESCAPE, KEY_TAB_FORWARD, KEY_HOME,
- KEY_LINE_FEED , KEY_CARRIAGE_RETURN ,
- KEY_TAB_BACKWARD, KEY_BACKSPACE, KEY_UP, KEY_DOWN,
- KEY_RIGHT, KEY_LEFT, KEY_DELETE, KEY_FUNCTION,
- KEY_ALTERNATE );
-
- type CRT_COLOR is (BLACK,RED,BLUE,GREEN,PURPLE,YELLOW,LIGHT_BLUE,WHITE);
- type CHAR_ATTRIBUTES is (NORMAL, BLINK, UNDERLINE, OTHER_INTENSITY );
- type CRT_CONTROL is (COLD_INIT, WARM_INIT, ERASE_ALL, ERASE_EOL,
- ERASE_EOS, INSERT_LINE, DELETE_LINE,REVERSE_VIDEO,
- CRT_HOME, CRT_UP, CRT_DOWN, CRT_RIGHT, CRT_LEFT,
- scroll_middle_screen_up , scroll_entire_screen_up ,
- scroll_partial_screen_up ,
- scroll_middle_screen_down , scroll_entire_screen_down ,
- scroll_partial_screen_down ,
- CURSOR_ON, CURSOR_OFF, EXTRA_DISPLAY_ON,
- EXTRA_DISPLAY_OFF, KEYBOARD_INPUT_ON,
- KEYBOARD_INPUT_OFF, PROGRAM_TERMINATION );
-
- CRT_ATTRIBUTE_1 : CHAR_ATTRIBUTES := NORMAL ;
- CRT_ATTRIBUTE_2 : CHAR_ATTRIBUTES := NORMAL ;
- CRT_ATTRIBUTE_3 : CHAR_ATTRIBUTES := NORMAL ;
-
- CURRENT_CRT_COLOR : CRT_COLOR := GREEN ; -- holds current color
- DEFAULT_CRT_COLOR : CRT_COLOR := GREEN ; -- is standard I/O color
- CURRENT_BACKGROUND_COLOR : CRT_COLOR := BLACK ;
- DEFAULT_BACKGROUND_COLOR : CRT_COLOR := BLACK ;--standard background color
-
- NUM_KEY_TYPES : constant integer := 5 ;
- NUM_KEYS_WITHIN_TYPE : constant integer := 16 ;
- type type_of_key_change is record
- KEY : extended_character;
- SPECIAL_MEANING: SPECIAL_KEYS ;
- FINAL_KEY : extended_character;
- end record;
- type ARRAY_TYPE_OF_KEY_CHANGE is
- array ( 1 .. NUM_KEYS_WITHIN_TYPE ) of type_of_key_change ;
- type KEY_SET is record
- LEAD_IN_LENGTH : INTEGER ;
- LEAD_IN : STRING(1 .. 5);
- FOLLOW_REMOVE : INTEGER ;
- EACH_KEY : ARRAY_TYPE_OF_KEY_CHANGE ;
- end record;
- type ALL_KEYS is array ( 1..NUM_KEY_TYPES ) of KEY_SET ;
-
- KEY_MAP : ALL_KEYS;
- REAL_KEY_ON_INPUT : array ( 0..255 ) of extended_character ;
- SPECIAL_MEANING_ON_INPUT : array ( 0..255 ) OF SPECIAL_KEYS ;
-
- -- Now, we need the CRT handler routines
-
- procedure GOTOXY(COL : in A_SCREEN_COLUMN_NUMBER;
- LINE : in A_SCREEN_LINE_NUMBER);
- -- Positions the cursor to COL,LINE on the screen; changing COL
- -- and LINE to maximum allowable column or line if they are
- -- in error.
- -- This could be done with SET_COL/SET_LINE but this is one call
-
- function CRT_HAS( CONTROL : in CRT_CONTROL ) return BOOLEAN;
- -- Returns true if CRT has the ability to perform the given crt
- -- control function, false otherwise.
-
- procedure DO_CRT( CONTROL : in CRT_CONTROL );
- -- Performs the given crt control function; if the crt does not have
- -- the ability to perform the crt control, nothing is done.
-
- procedure CHANGE_CRT( TO : in CHAR_ATTRIBUTES ;
- ALSO : in CHAR_ATTRIBUTES := normal ;
- AND_ALSO : in CHAR_ATTRIBUTES := NORMAL );
- -- Changes the crt attributes to one, two or three new attributes
-
- procedure CHANGE_COLOR( TEXT_COLOR : in CRT_COLOR ;
- BACKGROUND_COLOR : in CRT_COLOR := black);
- -- Changes the crt color to the new text and background colors
-
- procedure scroll_up_middle_screen (
- first_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_up_entire_screen (
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_up_partial_screen (
- first_line_to_scroll : a_screen_line_number ;
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_down_middle_screen (
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_down_entire_screen (
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- procedure scroll_down_partial_screen (
- first_line_to_scroll : a_screen_line_number ;
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) ;
-
- end CRT ;
-
- package editor_customization is
-
- type crt_editor_command is ( up_command , down_command ,
- right_command , left_command ,
-
- advance_character_command ,
- advance_word_command ,
- advance_tab_command ,
- advance_line_command ,
- advance_paragraph_command ,
- advance_page_command ,
- advance_infinity_command ,
-
- forward_character_command ,
- backward_character_command ,
- forward_word_command , backward_word_command ,
- forward_tab_command , backward_tab_command ,
- forward_line_command , backward_line_command ,
- forward_paragraph_command ,
- backward_paragraph_command ,
- forward_page_command , backward_page_command ,
-
- home_command ,
- move_to_first_line_position_command ,
- move_to_last_line_position_command ,
- jump_to_first_position_command ,
- jump_to_last_position_command ,
-
- jump_to_marked_position_command ,
-
- set_forward_direction ,
- set_backward_direction ,
-
- shift_screen_right , shift_screen_left ,
-
- adjust_command ,
- copy_command ,
- start_deletion_command,
- find_command ,
- help_command ,
- insert_command ,
- jump_command ,
- kill_command ,
- print_screen_command ,
- re_margin_command ,
- quit_command ,
- replace_command ,
- set_stuff_command ,
- verify_screen_command ,
- enter_exchange_mode ,
- zap_command ,
-
- accept_command ,
- reject_command ,
- word_processor_command,
- digit_command ,
- infinity_command ,
- show_other_prompt_command ,
- illegal_command ) ;
-
- Main_Command_Prompt : string (1..71) ;
- Alternate_Command_Prompt : string (1..71) ;
- Adjust_Command_Prompt : string (1..69) ;
- Copy_Command_Prompt : string (1..46) ;
- Delete_Command_Prompt : string (1..69) ;
- Find_Command_Prompt : string (1.. 7) ;
- Help_Command_Prompt : string (1..29) ;
- Insert_Command_Prompt : string (1..63) ;
- Jump_Command_Prompt : string (1..55) ;
- Kill_Command_Prompt : string (1..78) ;
- Line_Printer_Command_Prompt : string (1..66) ;
- Margin_Command_Prompt : string (1.. 1) ;
- Quit_Command_Prompt : string (1..20) ;
- Replace_Command_Prompt : string (1..10) ;
- Set_Command_Prompt : string (1..69) ;
- eXchange_Command_Prompt : string (1..65) ;
- Zap_Command_Prompt : string (1..47) ;
- Enter_Input_File_Name_Prompt : string (1..57) ;
- Enter_Copied_In_File_Name_Prompt : string (1..49) ;
-
- procedure translate( ch : in character ;
- special : in crt.special_keys ;
- new_ch : out character ;
- edit_special : out crt_editor_command ) ;
- -- translate an input character and special meaning pair to
- -- an internal editor character representation and editor
- -- special meaning pair
-
- max_wp_command_length : constant integer := 20 ;
-
- word_processor_command_string_length : integer ;
- -- The length of the word processor command string for the
- -- key just pressed
-
- word_processor_command_string : string ( 1 .. max_wp_command_length ) ;
- -- The string of characters associated with the function key hit
- -- If the first character is ascii.cr, then start a new line at
- -- column 1. If the length is greater than 1 and then the last
- -- character is ascii.cr, then end by starting a new line and
- -- indenting to the old indentation from before the command key.
- -- If the first character is a space, then, only put the space in
- -- if the last character was not a space
-
- end;
-
- end crt_customization ;
-
- package body crt_customization is
-
- package body CRT is
-
- procedure GOTOXY( COL : in A_SCREEN_COLUMN_NUMBER ;
- LINE : in A_SCREEN_LINE_NUMBER ) is
- -- It will change the col or line if they are in error
- A_COL, A_LINE : NATURAL;
- begin
- A_COL := COL ;
- A_LINE := LINE ;
- if A_COL > TOTAL_CRT_COL then
- A_COL := TOTAL_CRT_COL ;
- end if;
- if A_LINE > TOTAL_CRT_LINE then
- A_LINE := TOTAL_CRT_LINE ;
- end if;
- CRT_COL := A_COL ;
- CRT_LINE := A_LINE ;
- put_transparent(19);
- put_transparent(character'val(A_LINE+31));
- put_transparent(character'val(A_COL+31));
- end;
-
- function CRT_HAS( CONTROL : in CRT_CONTROL ) return BOOLEAN is
- ok : BOOLEAN ;
- begin
- case CONTROL is
- when COLD_INIT => ok := TRUE ; -- Required
- when WARM_INIT => ok := TRUE ; -- Required
- when ERASE_ALL => ok := TRUE ; -- Required
- when ERASE_EOL => ok := TRUE ;
- when ERASE_EOS => ok := TRUE ;
- when INSERT_LINE => ok := FALSE ;
- when DELETE_LINE => ok := FALSE ;
- when CRT_HOME => ok := TRUE ; -- Required
- when CRT_UP => ok := TRUE ;
- when CRT_DOWN => ok := TRUE ;
- when CRT_RIGHT => ok := TRUE ;
- when CRT_LEFT => ok := TRUE ;
- when REVERSE_VIDEO => ok := false ;
- when scroll_middle_screen_up => ok := false ;
- when scroll_entire_screen_up => ok := true ; -- required
- when scroll_partial_screen_up => ok := false ;
- when scroll_middle_screen_down => ok := false ;
- when scroll_entire_screen_down => ok := false ;
- when scroll_partial_screen_down => ok := false ;
- when CURSOR_ON => ok := FALSE ;
- when CURSOR_OFF => ok := FALSE ;
- when EXTRA_DISPLAY_ON => ok := FALSE ;
- when EXTRA_DISPLAY_OFF => ok := FALSE ;
- when KEYBOARD_INPUT_ON => ok := FALSE ;
- when KEYBOARD_INPUT_OFF => ok := FALSE ;
- when PROGRAM_TERMINATION=> ok := TRUE ; -- Required
- end case;
- return ok ;
- end;
-
- procedure new_attributes(new_text_color ,
- new_background_color : crt_color;
- new_crt_atr_1 , new_crt_atr_2 , new_crt_atr_3 : char_attributes) is
- screen_color : crt_color ;
-
- begin
- null ;
- end;
-
- procedure CHANGE_CRT( TO : in CHAR_ATTRIBUTES ;
- ALSO : in CHAR_ATTRIBUTES := normal ;
- AND_ALSO : in CHAR_ATTRIBUTES := NORMAL ) is
- begin
- null ;
- end;
-
- procedure CHANGE_COLOR( TEXT_COLOR : in CRT_COLOR ;
- BACKGROUND_COLOR : in CRT_COLOR := black) is
- begin
- null ;
- end;
-
- procedure KEYBOARD_INITIALIZE;
-
- procedure DO_CRT( CONTROL : in CRT_CONTROL ) is
- begin
- case CONTROL is
- when COLD_INIT => TOTAL_CRT_COL := 80 ;
- TOTAL_CRT_LINE:= 24 ;
- KEYBOARD_INITIALIZE;
- DO_CRT(WARM_INIT);
- when WARM_INIT => CHANGE_CRT( NORMAL ) ;
- CHANGE_COLOR( GREEN ) ;
- DO_CRT(ERASE_ALL);
- DO_CRT(CURSOR_ON);
- DO_CRT(EXTRA_DISPLAY_ON);
- DO_CRT(KEYBOARD_INPUT_ON);
- when ERASE_ALL => put_transparent(character'val(12));
- when ERASE_EOL => put_transparent(ASCII.ESC); -- ???????
- put_transparent("[" & "0K") ; -- ???????
- when ERASE_EOS => put_transparent(ASCII.ESC); -- ???????
- put_transparent("[" & "0J") ; -- ???????
- when INSERT_LINE => null ;
- when DELETE_LINE => null ;
- when CRT_HOME => put_transparent(character'val(20));
- when CRT_UP => if CRT_LINE > 1 then
- CRT_LINE := CRT_LINE - 1 ;
- put_transparent(character'val(17));
- -- else do nothing...
- end if ;
- when CRT_DOWN => if CRT_LINE < TOTAL_CRT_LINE then
- CRT_LINE := CRT_LINE + 1 ;
- put_transparent(character'val(10));
- -- else do nothing...
- end if ;
- when CRT_RIGHT => if CRT_COL < TOTAL_CRT_COL then
- CRT_COL := CRT_COL + 1 ;
- put_transparent(character'val(18));
- -- else do nothing...
- end if ;
- when CRT_LEFT => if CRT_COL > 1 then
- CRT_COL := CRT_COL - 1 ;
- put_transparent(character'val(8));
- -- Else, we do nothing...
- end if ;
- when REVERSE_VIDEO=> null ;
- when scroll_middle_screen_up => null ; -- handled separately
- when scroll_entire_screen_up => scroll_up_entire_screen(1);
- when scroll_partial_screen_up => null ; -- handled separately
- when scroll_middle_screen_down => null ; -- handled separately
- when scroll_entire_screen_down => scroll_down_entire_screen(1);
- when scroll_partial_screen_down => null ; -- handled separately
- when CURSOR_ON => null ;
- when CURSOR_OFF => null ;
- when EXTRA_DISPLAY_ON => null ;
- when EXTRA_DISPLAY_OFF => null ;
- when KEYBOARD_INPUT_ON => null ;
- when KEYBOARD_INPUT_OFF => null ;
- when PROGRAM_TERMINATION=> do_crt(warm_init) ;
- put(" Type A Key ") ;
- terminate_basic_io_system ;
- do_crt(warm_init) ;
- end case;
- end;
-
- procedure scroll_up_middle_screen (
- first_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_up_middle_screen
- null ;
- end scroll_up_middle_screen ;
-
- procedure scroll_up_entire_screen (
- number_of_lines_to_scroll : a_screen_line_number ) is
- lines_so_far : integer := 0 ;
- begin -- scroll_up_entire_screen
- gotoxy(1,total_crt_line);
- loop
- put_transparent( ascii.lf ) ;
- lines_so_far := lines_so_far + 1 ;
- exit when lines_so_far >= number_of_lines_to_scroll ;
- end loop ;
- end scroll_up_entire_screen ;
-
- procedure scroll_up_partial_screen (
- first_line_to_scroll : a_screen_line_number ;
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_up_partial_screen
- null ;
- end scroll_up_partial_screen ;
-
- procedure scroll_down_middle_screen (
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_down_middle_screen
- null ;
- end scroll_down_middle_screen ;
-
- procedure scroll_down_entire_screen (
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_down_entire_screen
- null ;
- end scroll_down_entire_screen ;
-
- procedure scroll_down_partial_screen (
- first_line_to_scroll : a_screen_line_number ;
- last_line_to_scroll : a_screen_line_number ;
- number_of_lines_to_scroll : a_screen_line_number ) is
- begin -- scroll_down_partial_screen
- null ;
- end scroll_down_partial_screen ;
-
- -- Finally, we need the Keyboard handler routines
-
- function CTRL( A_CHARACTER : in CHARACTER ) return INTEGER is
- begin
- return CHARACTER'POS(A_CHARACTER) mod 32; -- Strip off high bits
- end;
-
- procedure KEYBOARD_INITIALIZE is
- -- Set up for the input of special keys.
- -- Program the function keys
-
- procedure set_em( place:integer; c_val: integer; new_key: special_keys) is
- begin -- set_em
- real_key_on_input ( place ) := extended_character ( c_val ) ;
- special_meaning_on_input ( place ) := new_key ;
- end set_em ;
-
- procedure SET_KEY_MAPPINGS is
- -- Set up the mappings of keys to new meanings
- begin
- -- First, do the normal mappings
- for C_NUMBER in 0..255 loop
- set_em ( c_number , c_number , key_character ) ;
- end loop;
- -- Then, change the characters which are to be treated specially...
- set_em ( ctrl('\') , 0 , key_end_of_text ) ;
- set_em ( 128 , 0 , key_escape ) ;
- set_em ( ctrl('I') , 0 , key_tab_forward ) ;
- set_em ( ctrl('_') , 0 , key_backspace ) ;
- set_em ( ctrl('J') , 0 , key_line_feed ) ;
- set_em ( ctrl('M') , 0 , key_carriage_return ) ;
- set_em ( 127 , 0 , key_delete ) ;
- set_em ( ctrl('A') , 0 , key_home ) ;
- --
- set_em ( ctrl('A') , 0 , key_home ) ;
- set_em ( ctrl('U') , 0 , key_up ) ;
- set_em ( ctrl('D') , 0 , key_down ) ;
- set_em ( ctrl('R') , 0 , key_right ) ;
- set_em ( ctrl('L') , 0 , key_left ) ;
- set_em ( ctrl('V') , 0 , key_end_of_text ) ;
- set_em ( 27 , 0 , key_escape ) ;
- set_em ( ctrl('I') , 0 , key_tab_forward ) ;
- set_em ( ctrl('H') , 0 , key_backspace ) ;
- set_em ( ctrl('J') , 0 , key_line_feed ) ;
- set_em ( ctrl('M') , 0 , key_carriage_return ) ;
- set_em ( 127 , 0 , key_delete ) ;
- end;
-
- procedure MAP_FUNCTION_KEYS is
-
- function make_key( in_character : in character ;
- out_meaning : in special_keys ;
- out_character: in integer )
- return type_of_key_change is
- t : type_of_key_change ;
- begin
- t.key := extended_character( CHARACTER'POS( in_character ) ) ;
- t.special_meaning := out_meaning ;
- t.final_key := extended_character( out_character ) ;
- return t;
- end;
-
- begin
- -- Initialize to nothing...
- for A_KEY_TYPE in 1..NUM_KEY_TYPES loop
- KEY_MAP(A_KEY_TYPE).LEAD_IN_LENGTH := 0 ;
- KEY_MAP(A_KEY_TYPE).LEAD_IN := " ";
- KEY_MAP(A_KEY_TYPE).FOLLOW_REMOVE := 0 ;
- for A_SINGLE_KEY in 1..NUM_KEYS_WITHIN_TYPE loop
- KEY_MAP(A_KEY_TYPE).EACH_KEY(A_SINGLE_KEY)
- := make_key( CHARACTER'VAL(0) , key_illegal , 0 );
- end loop;
- end loop;
- KEY_MAP(1).LEAD_IN_LENGTH := 2 ;
- KEY_MAP(1).LEAD_IN(1..2) := " [" ;
- KEY_MAP(1).LEAD_IN(1) := ASCII.ESC ;
- KEY_MAP(1).FOLLOW_REMOVE := 0 ;
- KEY_MAP(1).EACH_KEY(01) := make_key('A',KEY_UP, 0);
- KEY_MAP(1).EACH_KEY(02) := make_key('B',KEY_DOWN, 0);
- KEY_MAP(1).EACH_KEY(03) := make_key('C',KEY_RIGHT, 0);
- KEY_MAP(1).EACH_KEY(04) := make_key('D',KEY_LEFT, 0);
- KEY_MAP(2).LEAD_IN_LENGTH := 2 ;
- KEY_MAP(2).LEAD_IN(1..2) := " O" ;
- KEY_MAP(2).LEAD_IN(1) := ASCII.ESC ;
- KEY_MAP(2).FOLLOW_REMOVE := 0 ;
- KEY_MAP(2).EACH_KEY(01) := make_key('P',key_function, 1);
- KEY_MAP(2).EACH_KEY(02) := make_key('Q',key_function, 2);
- KEY_MAP(2).EACH_KEY(03) := make_key('R',key_function, 3);
- KEY_MAP(2).EACH_KEY(04) := make_key('S',key_function, 4);
- key_map(3).lead_in_length := 1 ;
- key_map(3).lead_in(1) := ascii.esc ;
- key_map(3).follow_remove := 0 ;
- key_map(3).each_key(01) := make_key(ascii.esc,key_escape,0);
- -- The last maps <esc><esc> to a single escape
- key_map(3).each_key(02) := make_key('1',key_alternate, 1);
- key_map(3).each_key(03) := make_key('2',key_alternate, 2);
- key_map(3).each_key(04) := make_key('3',key_alternate, 3);
- key_map(3).each_key(05) := make_key('4',key_alternate, 4);
- key_map(3).each_key(06) := make_key('5',key_alternate, 5);
- key_map(3).each_key(07) := make_key('6',key_alternate, 6);
- key_map(3).each_key(08) := make_key('7',key_alternate, 7);
- key_map(3).each_key(09) := make_key('8',key_alternate, 8);
- key_map(3).each_key(10) := make_key('9',key_alternate, 9);
- key_map(3).each_key(11) := make_key('0',key_alternate,10);
- end;
-
- begin -- Keyboard_initialize
- set_key_mappings ; -- Set up the special 1 to 1 mappings
- map_function_keys ; -- ready the memory map to read keys
- end KEYBOARD_INITIALIZE;
-
- begin -- CRT
- -- CRT by SAIC/Clearwater VT100 ANSI I/O Routines 07 Jan 85
- do_crt(cold_init);
- --
- end CRT;
-
- package body editor_customization is
-
- maximum_function_keys : constant integer := 10 ;
- maximum_alternate_keys: constant integer := 10 ;
-
- type command_pair is
- record
- c : character ;
- command : crt_editor_command ;
- end record ;
-
- function_key : array ( 1 .. maximum_function_keys ) of command_pair ;
- alternate_key: array ( 1 .. maximum_alternate_keys) of command_pair ;
-
- type a_wp_command is
- record
- len : integer ;
- str : string ( 1 .. max_wp_command_length ) ;
- end record ;
-
- word_processor_command_list : array ( 1 .. 10 ) of a_wp_command ;
-
- Physical_Tran : array ( crt.special_keys ) of command_pair ;
-
- c_to_command : array ( 0 .. 255 ) of command_pair ;
-
- procedure set_c ( in_char ,
- out_char : in character ;
- out_meaning : in crt_editor_command ) is
- begin -- set_c
- c_to_command( character'pos( in_char ) ) := ( out_char , out_meaning) ;
- end set_c ;
-
- procedure initialize_translate_tables is
-
- use crt ;
-
- begin -- initialize_translate_tables
- -- First , make everything Illegal
- for indx in 1 .. maximum_function_keys loop
- function_key ( indx ) := ( ascii.nul , illegal_command ) ;
- end loop ;
- for indx in 1 .. maximum_alternate_keys loop
- alternate_key ( indx ) := ( ascii.nul , illegal_command ) ;
- end loop ;
- for indx in crt.special_keys'first .. crt.special_keys'last loop
- Physical_Tran( indx ) := ( ascii.nul , illegal_command ) ;
- end loop ;
- for indx in 0 .. 255 loop
- c_to_command ( indx ) := ( ascii.nul , illegal_command ) ;
- end loop ;
- -- We have 4 function keys on the VT 100 Terminal
- -- This mapping set is called when the input key type is key_function
- -- Note that we could have another set called if we needed to work
- -- with key_alternate
- function_key ( 1 ) := ( ascii.nul , accept_command ) ;
- function_key ( 2 ) := ( ascii.nul , home_command ) ;
- function_key ( 3 ) := ( ascii.nul , advance_paragraph_command ) ;
- function_key ( 4 ) := ( ascii.nul , reject_command ) ;
- -- The following is the physical to editor logical key mapping
- Physical_Tran ( key_end_of_text ) := ( ascii.nul , accept_command) ;
- Physical_Tran ( key_escape ) := ( ascii.nul , reject_command) ;
- Physical_Tran ( key_line_feed ) := ( ascii.nul , down_command ) ;
- Physical_Tran ( key_carriage_return):=(ascii.nul , advance_line_command);
- Physical_Tran ( key_tab_forward ) := ( ascii.nul , advance_tab_command );
- Physical_Tran ( key_home ) := ( ascii.nul , home_command ) ;
- -- Physical_Tran ( key_tab_backward) := ( ascii.nul , ) ;
- Physical_Tran ( key_backspace ) := ( ascii.nul ,
- backward_character_command ) ;
- Physical_Tran ( key_up ) := ( ascii.nul , up_command ) ;
- Physical_Tran ( key_down ) := ( ascii.nul , down_command ) ;
- Physical_Tran ( key_right ) := ( ascii.nul , right_command ) ;
- Physical_Tran ( key_left ) := ( ascii.nul , left_command ) ;
- Physical_Tran ( key_delete ) := ( ascii.nul , backward_line_command);
- -- Max wp command length is 20 , so initialize to that length
- for posn in 1 .. 10 loop
- alternate_key(posn) := ( character'val(posn), word_processor_command ) ;
- end loop ;
- word_processor_command_list( 1) :=
- ( 8 , ascii.cr & ".add 1" & ascii.cr & " " ) ;
- word_processor_command_list( 2) :=
- ( 7 , ascii.cr & ".bold " & " " ) ;
- word_processor_command_list( 3) :=
- ( 9 , ascii.cr & ".shadow " & " " ) ;
- word_processor_command_list( 4) :=
- ( 11 , ascii.cr & ".end_page" & ascii.cr & " " ) ;
- word_processor_command_list( 5) :=
- ( 4 , " on" & ascii.cr & " ") ;
- word_processor_command_list( 6) :=
- ( 5 , " off" & ascii.cr & " " ) ;
- word_processor_command_list( 7) :=
- ( 9 , ascii.cr & ".indent " & " " ) ;
- word_processor_command_list( 8) :=
- ( 12 , ascii.cr & ".underline " & " " ) ;
- word_processor_command_list( 9) :=
- ( 14 , ascii.cr & ".ucontinuous " & " " ) ;
- word_processor_command_list(10) :=
- ( 1 , ascii.cr & " " ) ;
- -- the last is the soft carriage return
- -- key_character is handled next
- set_c ( 'A' , 'A' , adjust_command ) ;
- set_c ( 'B' , 'B' , move_to_first_line_position_command ) ;
- set_c ( 'C' , 'C' , copy_command ) ;
- set_c ( 'D' , 'D' , start_deletion_command ) ;
- set_c ( 'E' , 'E' , move_to_last_line_position_command ) ;
- set_c ( 'F' , 'F' , find_command ) ;
- set_c ( 'H' , 'H' , help_command ) ;
- set_c ( 'I' , 'I' , insert_command ) ;
- set_c ( 'J' , 'J' , jump_command ) ;
- set_c ( 'K' , 'K' , kill_command ) ;
- set_c ( 'L' , 'L' , print_screen_command ) ;
- set_c ( 'M' , 'M' , re_margin_command ) ;
- set_c ( 'P' , 'P' , advance_page_command ) ;
- set_c ( 'Q' , 'Q' , quit_command ) ;
- set_c ( 'R' , 'R' , replace_command ) ;
- set_c ( 'S' , 'S' , set_stuff_command ) ;
- set_c ( 'V' , 'V' , verify_screen_command ) ;
- set_c ( 'W' , 'W' , advance_word_command ) ;
- set_c ( 'X' , 'X' , enter_exchange_mode ) ;
- set_c ( 'Y' , 'Y' , advance_paragraph_command ) ;
- set_c ( 'Z' , 'Z' , zap_command ) ;
- set_c ( 'a' , 'a' , adjust_command ) ;
- set_c ( 'b' , 'b' , move_to_first_line_position_command ) ;
- set_c ( 'c' , 'c' , copy_command ) ;
- set_c ( 'd' , 'd' , start_deletion_command ) ;
- set_c ( 'e' , 'e' , move_to_last_line_position_command ) ;
- set_c ( 'f' , 'f' , find_command ) ;
- set_c ( 'h' , 'h' , help_command ) ;
- set_c ( 'i' , 'i' , insert_command ) ;
- set_c ( 'j' , 'j' , jump_command ) ;
- set_c ( 'k' , 'k' , kill_command ) ;
- set_c ( 'l' , 'l' , print_screen_command ) ;
- set_c ( 'm' , 'm' , re_margin_command ) ;
- set_c ( 'p' , 'p' , advance_page_command ) ;
- set_c ( 'q' , 'q' , quit_command ) ;
- set_c ( 'r' , 'r' , replace_command ) ;
- set_c ( 's' , 's' , set_stuff_command ) ;
- set_c ( 'v' , 'v' , verify_screen_command ) ;
- set_c ( 'w' , 'w' , advance_word_command ) ;
- set_c ( 'x' , 'x' , enter_exchange_mode ) ;
- set_c ( 'y' , 'y' , advance_paragraph_command ) ;
- set_c ( 'z' , 'z' , zap_command ) ;
- set_c ( '?' , '?' , help_command ) ;
- set_c ( ' ' , ' ' , advance_character_command ) ;
- set_c ( ',' , ',' , set_backward_direction ) ;
- set_c ( '<' , '<' , set_backward_direction ) ;
- set_c ( '.' , '.' , set_forward_direction ) ;
- set_c ( '>' , '>' , set_forward_direction ) ;
- set_c ( '+' , '+' , shift_screen_right ) ;
- set_c ( ';' , ';' , shift_screen_right ) ;
- set_c ( '-' , '-' , shift_screen_left ) ;
- set_c ( '!' , '!' , show_other_prompt_command ) ;
- set_c ( '/' , '/' , infinity_command ) ;
- set_c ( '=' , '=' , jump_to_marked_position_command);
- for cc in '0' .. '9' loop
- set_c ( cc , cc , digit_command ) ;
- end loop ;
- -- key_macro ( all ) is handled in the lower levels
- end initialize_translate_tables ;
-
- procedure initialize_prompt_lines is
- begin
- Main_Command_Prompt :=
- " Edit: A(djst C(opy D(elete F(ind H(elp I(nsrt Q(uit R(place eX(chg '!'" ;
- Alternate_Command_Prompt :=
- " Edit: H(elp J(ump K(ill L(inePrntr M(argin P(age S(et V(erify Z(ap '!'" ;
- Adjust_Command_Prompt :=
- " Adjust: L(just R(just C(ent <left,right,up,down> [<ACCEPT> to leave]" ;
- Copy_Command_Prompt :=
- " Copy: B(uffer, F(ile, or <Reject> to abort ? " ;
- Delete_Command_Prompt :=
- " Delete: < > <Moving Commands>, <Append Toggle>, <Accept>, <Reject> " ;
- Find_Command_Prompt := " Find: " ;
- Help_Command_Prompt := " Help: Prompt not defined...." ;
- Insert_Command_Prompt :=
- " Insert: Text [<bs> a char,<del> a line][<Accept> or <Reject>] " ;
- Jump_Command_Prompt :=
- " Jump to B(egin, E(nd, M(arker, or <Reject> to abort ? " ;
- Kill_Command_Prompt :=
- "!KILLING! - - Are You Really Sure You Want To Kill All Following Text "
- & "(Y/N) ? " ;
- Line_Printer_Command_Prompt :=
- "!PRINTING! - - Are You Sure You Want To Print This Screen (Y/N) ? " ;
- Margin_Command_Prompt := " " ;
- Quit_Command_Prompt := " Quit Options: " ;
- Replace_Command_Prompt := " Replace: " ;
- Set_Command_Prompt :=
- " Set: E(nvironment, M(arker, T(abs, Z(ap Marker, H(elp or <Reject> ? " ;
- eXchange_Command_Prompt :=
- " eXchange TEXT [<bs> a char] [<reject> escapes, <accept> accepts]" ;
- Zap_Command_Prompt :=
- " WARNING! Are you sure you wish to zap ? (y/n) " ;
- Enter_Input_File_Name_Prompt :=
- " Enter Input File Name ( or <return> for a new file ) => " ;
- Enter_Copied_In_File_Name_Prompt :=
- " Copy: from what file ( or <return> to skip ) => " ;
- end initialize_prompt_lines ;
-
- procedure translate( ch : in character ;
- special : in crt.special_keys ;
- new_ch : out character ;
- edit_special : out crt_editor_command ) is
- -- translate an input character and special meaning pair to
- -- an internal editor character representation and editor
- -- special meaning pair
- temp_new_ch : character ;
- temp_special: crt_editor_command ;
- begin -- translate
- case special is
- when crt.key_function =>
- if character'pos(ch) <= maximum_function_keys then
- temp_new_ch := function_key ( character'pos(ch) ).c ;
- temp_special := function_key ( character'pos(ch) ).command ;
- else
- temp_new_ch := ascii.nul ;
- temp_special := illegal_command ;
- end if ;
- when crt.key_alternate =>
- if character'pos(ch) <= maximum_alternate_keys then
- temp_new_ch := alternate_key ( character'pos(ch) ).c ;
- temp_special := alternate_key ( character'pos(ch) ).command ;
- else
- temp_new_ch := ascii.nul ;
- temp_special := illegal_command ;
- end if ;
- when crt.key_character =>
- temp_new_ch := c_to_command ( character'pos(ch) ).c ;
- temp_special := c_to_command ( character'pos(ch) ).command ;
- when others =>
- temp_new_ch := physical_tran ( special ).c ;
- temp_special := physical_tran ( special ).command ;
- end case ;
- if temp_special = word_processor_command then
- word_processor_command_string_length :=
- word_processor_command_list(character'pos(temp_new_ch)).len ;
- word_processor_command_string :=
- word_processor_command_list(character'pos(temp_new_ch)).str ;
- end if ;
- new_ch := temp_new_ch ;
- edit_special := temp_special ;
- end translate ;
-
- begin -- editor_customization
- -- EDITVT10 by SAIC/Clearwater Editor Customization VT100 07 Jan 85
- initialize_translate_tables ;
- initialize_prompt_lines ; -- can't put into constants at top because
- -- of initialization code limitation on wicat
- end editor_customization ;
-
- begin -- crt_customization
- -- CRTVIP7705 by SAIC/Clearwater CRT Customization for VT100 07 Jan 85
- null ;
- end crt_customization ;
-
- --$$$- CRTVIP77
-
-
-