!+ ! Tools Group ! Space Telescope Science Institute ! 3700 San Martin Drive ! Baltimore, MD 21218 ! ! NAME ! FIND_SCAN_DEPENDENCIES ! ! DESCRIPTION ! This module scans a SCAN (!) source file searching for VAX SCAN ! include statements of all possible forms as descibed in the VAX ! SCAN manual including: ! ! INCLUDE 'any_file.scn'; ! INCLUDE 'dirddl:another_include.scn'; ! ! Include statements in comments are ignored. ! ! RETURN VALUE ! ! HISTORY ! 11/88 Bauer First cut. ! !- MODULE FIND_SCAN_DEPDENDENCIES; ! ! --- Set definitions --- ! SET blank ( ' ' ); SET horizontal_tab ( s'ht' ); SET form_feed ( s'ff' ); SET end_of_line ( s'eol' ); SET end_of_stream ( s'eos' ); SET open_paren ( '(' ); SET close_paren ( ')' ); SET open_bracket ( '[' ); SET close_bracket ( ']' ); SET ampersand ( '&' ); SET asterisk ( '*' ); SET colon ( ':' ); SET semi_colon ( ';' ); SET equal ( '=' ); SET comma ( ',' ); SET period ( '.' ); SET single_quote ( '''' ); SET double_quote ( '"' ); SET underscore ( '_' ); SET hyphen ( '-' ); SET dollar_sign ( '$' ); SET numeric_char ( '0'..'9' ); SET lower_alpha_char ( 'a'..'z' ); SET upper_alpha_char ( 'A'..'Z' ); SET alpha_char ( lower_alpha_char OR upper_alpha_char ); SET white_space ( blank OR horizontal_tab OR form_feed ); SET non_white_space ( NOT ( blank OR horizontal_tab OR form_feed OR end_of_line OR end_of_stream ) ); SET any ( NOT ( end_of_line or end_of_stream ) ); ! ! --- Token definitions --- ! TOKEN ignore_spaces IGNORE { { white_space }... }; TOKEN include_T CASELESS { 'INCLUDE' }; TOKEN comment_T ALIAS '!' { '!' }; TOKEN single_quote_T { '''' }; TOKEN eol_T { end_of_line }; ! ! VMS file specification tokens. ! TOKEN disk { { alpha_char | numeric_char | underscore | dollar_sign } [ { alpha_char | numeric_char | underscore | dollar_sign | hyphen }... ] colon }; TOKEN directory { open_bracket { { alpha_char | numeric_char | underscore | dollar_sign } [ { alpha_char | numeric_char | underscore | dollar_sign | hyphen }... ] [ period ] }... close_bracket }; TOKEN file_spec { { alpha_char | numeric_char | underscore | dollar_sign } [ { alpha_char | numeric_char | underscore | dollar_sign | hyphen }... ] [ period { alpha_char | numeric_char | underscore | dollar_sign } [ { alpha_char | numeric_char | underscore | dollar_sign | hyphen }... ] ] }; ! ! --- MACRO definitions --- ! ! ! MACROs to recognize and ignore SCAN comment lines ! - Note this will treat an ! in a tring as a comment ! MACRO ignore_comments_M TRIGGER { comment_T FIND(s'eol') }; END MACRO; ! ! MACRO to recognize the SCAN include lines ! MACRO include_statement_M TRIGGER { include_T is_file: file_spec single_quote_T include_file_name: { [disk] [directory] file_spec } single_quote_T FIND(s'eol') eol_T }; EXTERNAL PROCEDURE add_to_dependency_tree (STRING); is_file = UPPER(TRIM(is_file)); IF is_file = 'FILE' THEN CALL add_to_dependency_tree (include_file_name); END IF; END MACRO; ! ! --- PROCEDURE definitions --- ! PROCEDURE find_scan_dependencies (what_file : STRING); DECLARE dump_output : FIXED STRING(1); START SCAN INPUT FILE what_file OUTPUT STRING dump_output; END PROCEDURE; END MODULE;