$! File: Build_CONFIG_INCLUDE_FILES.COM $! $! This procedure reads in the PYTHON_VMS_MODULES.MMS file and $! creates two include files for use in building the config.c module $! of python. $! $! For each module module.obj, there needs to be a declaration in the $! first include file of the form "extern init(void);" $! $! In the second include file there needs to be lines of the form $! "{"foo","foomodule"}," $! $! 03-Jun-2002 J. Malmberg Original $! $!============================================================================ $! $ss_normal = 1 $ss_abort = 44 $ss_control_y = 1556 $status = ss_normal $on control_y then goto control_y $on warning then goto general_error $! $outfile = "PRJ_SRC:PYTHON_VMS_MODULES.MMS" $include1 = "lcl_modules:vms_config_extern.h" $include2 = "lcl_modules:vms_config_static_init.h" $! $! $! Some information for writing timestamps to created files $!---------------------------------------------------------- $my_proc = f$environment("PROCEDURE") $my_proc_file = f$parse(my_proc,,,"NAME") + f$parse(my_proc,,,"TYPE") $tab[0,8] = 9 $datetime = f$element(0,".",f$cvtime(,"ABSOLUTE","DATETIME")) $username = f$edit(f$getjpi("","USERNAME"),"TRIM") $! $open/read srcfile 'outfile' $! $! Open the first output include file and write a header $!------------------------------------------------------- $create 'include1' $open/append incfile1 'include1' $! $write incfile1 "/* File ''include1'" $write incfile1 "**" $write incfile1 - "** This file was created from ''outfile' by the" $write incfile1 "** build procedure and should not be manually edited." $write incfile1 "**" $write incfile1 - "** ", datetime, tab, username $write incfile1 - "** ", tab, tab, tab, tab, "Generated by ''my_proc_file'" $write incfile1 "**" $write incfile1 - "****************************************************************************/" $write incfile1 "" $! $! and now the second $!-------------------- $create 'include2' $open/append incfile2 'include2' $! $write incfile2 "/* File ''include2'" $write incfile2 "**" $write incfile2 - "** This file was created from ''outfile' by the" $write incfile2 "** build procedure and should not be manually edited." $write incfile2 "**" $write incfile2 - "** ", datetime, tab, username $write incfile2 - "** ", tab, tab, tab, tab, "Generated by ''my_proc_file'" $write incfile2 "**" $write incfile2 - "****************************************************************************/" $write incfile2 "" $! $! $! $! $src_loop: $ read srcfile/end=src_loop_end line_in $ line_in = line_in - "\" $ line_in = f$edit(line_in, "COMPRESS, TRIM, LOWERCASE") $ len = f$length(line_in) $! $! Skip blank lines $!------------------- $ if len .eq. 0 then goto src_loop $! $! Skip comments $!--------------- $ if f$extract(0,1,line_in) .eqs. "#" then goto src_loop $! $! Skip lines with out an object file in them $!--------------------------------------------- $ if f$locate(".obj", line_in) .ge. len then goto src_loop $! $! Stop looking when an MMS rule is found $!---------------------------------------- $ if f$locate(" :", line_in) .lt. len then goto src_loop_end $! $! $ name = f$edit(f$parse(line_in,,,"NAME","SYNTAX_ONLY"),"LOWERCASE") $ if f$locate("module", name) .ge. f$length(name) then goto src_loop $! $ name = name - "module" $! $! Write out the first include file line $!---------------------------------------- $write incfile1 "extern void init''name'(void);" $! $! $! Write out the second include file line $!------------------------------------------ $write incfile2 " {""''name'"", init''name'}," $! $goto src_loop $! $src_loop_end: $close srcfile $close incfile1 $close incfile2 $! $! $! Exit and clean up $!-------------------- $general_error: $status = '$status' $all_exit: $set noon $if f$trnlnm("srcfile","lnm$process",,"SUPERVISOR") .nes. "" $then $ close srcfile $endif $if f$trnlnm("incfile1","lnm$process",,"SUPERVISOR") .nes. "" $then $ close incfile1 $endif $if f$trnlnm("incfile2","lnm$process",,"SUPERVISOR") .nes. "" $then $ close incfile2 $endif $exit 'status' $! $control_y: $ status = ss_control_y $ goto all_exit