-- -- Author: Robert C. Shock, Dept of CS & CEG Wright State University -- In cooperation with: WRDC/ELED WPAFB Dayton, OH -- -- -- Purpose -- The procedure vhdl_scroll_set_style preserves the shape style of vhdl source, while scrolling the vhdl code to the screen in a fixed number of rows per screen. No lexical unit except the comment line is separated. -- The scroll style of an vhdl source code consist of these specifications: the_column_width, the_indent_margin, the_tab_set, the_wrap_indent_length, the_comment_ragged_indent, and the_comment_wrap_string ( length exactly 4 characters ), the_rows_per_screen, the_prompt_message; -- The purpose of the procedure vhdl_scroll_set_style is to provide a mechanism that assigns values to the shape specifications without recompiling code. -- Assumptions and process overview -- Input: device = text_io.standard_input; -- data = vhdl_lexicon_shape_style.specifciation + rows_per_screen -- + prompt_message + vhdl (syntax) source code -- Output: device = text_io.standard_output -- data = text format with these specifications below -- -- Process: see purpose; below are the default values of the scroll specifications -- the_column_width = 80, -- the_indent_margin = 48, -- the_tab_set = 3, -- the_wrap_indent_length = 1, -- the_comment_ragged_indent = 14, -- the_comment_wrap_string = "-- ", -- the_rows_per_screen = 23, -- the_prompt_message = string = "" -- CONSTRAINT: the values must satisfy these equations -- the_wrap_indent_length <= the_tab_set and -- the_tab_set <= the_indent_margin and -- the_indent_margin < 3 + the_column_width - the_comment_wrap_string'length -- NOTE: A violation of the above constraint outputs an empty file. -- Design decision and organizations -- Used the construct, passive iterator with parameters, located in the package vhdl_lexicon_shape_style. with vhdl_lexicon; with vhdl_lexicon_shape_style; with vhdl_lexicon_scroll_style; with text_io; procedure vhdl_scroll_set_style is package positive_io is new text_io.integer_io ( positive ); function next_string_value_is return string is the_string: string ( 1 .. 1 ) := ( others => ' ' ); begin if text_io.end_of_line then text_io.skip_line; return ""; else text_io.get ( the_string ( 1 ) ); return the_string & next_string_value_is; end if; end next_string_value_is; function the_rows_per_screen_is return natural is the_rows_per_screen: natural := 23; begin positive_io.get ( the_rows_per_screen ); text_io.skip_line; return the_rows_per_screen; end the_rows_per_screen_is; begin -- the order of input is fixed and must be followed vhdl_lexicon_scroll_style.iterate_to_standard_output ( with_the_shape_specification => vhdl_lexicon_shape_style.is_initializing ( text_io.standard_input ), with_the_rows_per_screen => the_rows_per_screen_is, the_prompt_message => next_string_value_is, the_file_name => next_string_value_is ); exception when others => vhdl_lexicon.put ( "Error does the file exist ? " & ( 1 => vhdl_lexicon.the_end_line_character ) ); end vhdl_scroll_set_style;