$! ************************************************* $! * FORCEX010_PACKAGE.COM $! * This command procedure will extract all source modules required $! * to create the FORCEX010 package. After extracting the files, $! * this procedure will optionally execute the BUILD.COM command $! * procedure included with this package to compile the source files and $! * link the executable image. $! * $! * Created 4-JAN-2000 by the PACKAGE utility $! ************************************************* $! $ Write SYS$OUTPUT "" $ Write SYS$OUTPUT "This procedure extracts and optionally builds the FORCEX010 package." $ Write SYS$OUTPUT "All files will be extracted to ",F$Environment("Default") $ Write SYS$OUTPUT "" $ Call Extract_Files $ Write SYS$OUTPUT "" $ Get_Answer: $ Read/Error=Exit/Prompt="Do you wish to build the FORCEX010 package? " - SYS$COMMAND Answer $ Answer = F$Extract(0,1,F$Edit(Answer,"Trim,UpCase")) $ If Answer .EQS. "N" Then Goto Exit $ If Answer .NES. "Y" Then Goto Get_Answer $ @BUILD.COM $ Exit: $ Exit $! $! $ Extract_Files: SubRoutine $ Call Extract_BUILD_COM $ Call Extract_CLI_C $ Call Extract_FORCEX_C $ Call Extract_FORCEX_CLD $ Call Extract_FORCEX_HLP $ Call Extract_FORCEX_CLD_CLD $ EndSubRoutine ! Extract_Files $! $! $! $ Extract_BUILD_COM: SubRoutine $ Write SYS$OUTPUT "Extracting BUILD.COM..." $ WO := Write OutFile $ SQ = "'" $ SQ2 = SQ + SQ $ Close/NoLog OutFile $ Open/Write/Share OutFile BUILD.COM $ WO "$! **********************************************************************" $ WO "$! * BUILD.COM *" $ WO "$! * (Re)build necessary modules and relink program. *" $ WO "$! * *" $ WO "$! * This is a generic ""make"" command procedure. Modify the section *" $ WO "$! * below with the following symbols: *" $ WO "$! * *" $ WO "$! * Image_Name = ""xxx.EXE"" - the name of the output image name *" $ WO "$! * Version = ""Vn.n"" - the version number of the product *" $ WO "$! * Object_List == """" - this symbol must be defined as null *" $ WO "$! * *" $ WO "$! * Then add or modify the ""Call"" lines for each module in the *" $ WO "$! * program: *" $ WO "$! * *" $ WO "$! * Call Compile_C filename.C ''SQ'P1''SQ' - for each C source module *" $ WO "$! * Call Message filename.MSG ''SQ'P1''SQ' - for each message source mod *" $ WO "$! * Call CLD filename.CLD ''SQ'P1''SQ' - for each CLD source module *" $ WO "$! * *" $ WO "$! * BUILD will recompile only those modules which have changed *" $ WO "$! * since last compile and relink the image. *" $ WO "$! * *" $ WO "$! * If you specify ""ALL"" as parameter P1, all source modules are *" $ WO "$! * unconditionally recompiled. *" $ WO "$! * *" $ WO "$! * 18-DEC-1996 RDJ Command Procedure Creation. *" $ WO "$! **********************************************************************" $ WO "$!" $ WO "$ Object_List == """"" $ WO "$ Image_Name = ""FORCEX.EXE""" $ WO "$ Image_Version = ""V10""" $ WO "$!" $ WO "$ Call Compile_C FORCEX.C ''SQ'P1''SQ'" $ WO "$ Call Compile_C CLI.C ''SQ'P1''SQ'" $ WO "$! Call Message MESSAGE.MSG ''SQ'P1''SQ'" $ WO "$ Call CLD FORCEX_CLD.CLD ''SQ'P1''SQ'" $ WO "$!" $ WO "$! **************************************************************************" $ WO "$ Write SYS$OUTPUT ""Linking ",SQ2,"Image_Name''SQ'...""" $ WO "$ PID = F$GetJPI("""",""PID"")" $ WO "$ On Error Then Goto Cleanup" $ WO "$ If F$Search(""SYS$SYSTEM:DECC$COMPILER.EXE"") .EQS. """"" $ WO "$ Then" $ WO "$ Close/NoLog OutFile" $ WO "$ Open/Write OutFile SYS$SCRATCH:BUILD_TMP.''SQ'PID''SQ'" $ WO "$ Write OutFile ""$ Link/Exec=",SQ2,"Image_Name''SQ'/NoTrace SYS$INPUT/Opt""" $ WO "$ Write OutFile """,SQ2,"Object_List''SQ',SYS$SHARE:VAXCRTL/Share""" $ WO "$ Write OutFile ""IDENTIFICATION=",SQ2,"Image_Version''SQ'""" $ WO "$ Close OutFile" $ WO "$ @SYS$SCRATCH:BUILD_TMP.''SQ'PID''SQ'" $ WO "$ Else" $ WO "$ Close/NoLog OutFile" $ WO "$ Open/Write OutFile SYS$SCRATCH:BUILD_TMP.''SQ'PID''SQ'" $ WO "$ Write OutFile ""$ Link/Exec=",SQ2,"Image_Name''SQ'/NoTrace SYS$INPUT/Opt""" $ WO "$ Write OutFile Object_List" $ WO "$ Write OutFile ""IDENTIFICATION=",SQ2,"Image_Version''SQ'""" $ WO "$ Close OutFile" $ WO "$ @SYS$SCRATCH:BUILD_TMP.''SQ'PID''SQ'" $ WO "$ EndIf" $ WO "$ Cleanup:" $ WO "$ Write SYS$OUTPUT ""Cleaning up..""" $ WO "$ If F$Search(""SYS$SCRATCH:BUILD_TMP.",SQ2,"PID''SQ'"") .NES. """" Then -" $ WO " Delete/NoLog/NoConfirm SYS$SCRATCH:BUILD_TMP.''SQ'PID''SQ';*" $ WO "$ Purge/NoLog/NoConfirm *.OBJ" $ WO "$ Purge/NoLog/NoConfirm *.EXE" $ WO "$ Exit" $ WO "$!" $ WO "$! **********************************************************************" $ WO "$! * Compile_C: Compile a ''SQ'C''SQ' source module. *" $ WO "$! **********************************************************************" $ WO "$ Compile_C: SubRoutine" $ WO "$ If Object_List .EQS. """"" $ WO "$ Then" $ WO "$ Object_List == F$Parse(P1,,,""Name"")" $ WO "$ Else" $ WO "$ Object_List == Object_List + "","" + F$Parse(P1,,,""Name"")" $ WO "$ EndIf" $ WO "$ If P2 .EQS. ""ALL"" Then Goto Compile_It" $ WO "$ O_File = F$Parse(P1,,,""Name"") + "".OBJ""" $ WO "$ If F$Search(""",SQ2,"O_File''SQ'"") .EQS. """" Then Goto Compile_It" $ WO "$ Object_Date = F$CvTime(F$File_Attributes(O_File,""RDT""),""Comparison"")" $ WO "$ Source_Date = F$CvTime(F$File_Attributes(P1,""RDT""),""Comparison"")" $ WO "$ If Source_Date .LTS. Object_Date" $ WO "$ Then" $ WO "$ Write SYS$OUTPUT """,SQ2,"P1''SQ' is up to date; skipping...""" $ WO "$ Exit" $ WO "$ EndIf" $ WO "$ Compile_It:" $ WO "$ Write SYS$OUTPUT ""Compiling ",SQ2,"P1''SQ'...""" $ WO "$ If F$Search(""SYS$SYSTEM:DECC$COMPILER.EXE"") .EQS. """"" $ WO "$ Then" $ WO "$ CC/NoDebug ''SQ'P1''SQ'" $ WO "$ Else" $ WO "$ CC/NoDebug/Standard=VAXC ''SQ'P1''SQ'" $ WO "$ EndIf" $ WO "$ Exit" $ WO "$ EndSubRoutine" $ WO "$!" $ WO "$! **********************************************************************" $ WO "$! * Message: Compile a message module. *" $ WO "$! **********************************************************************" $ WO "$ Message: SubRoutine" $ WO "$ If Object_List .EQS. """"" $ WO "$ Then" $ WO "$ Object_List == F$Parse(P1,,,""Name"")" $ WO "$ Else" $ WO "$ Object_List == Object_List + "","" + F$Parse(P1,,,""Name"")" $ WO "$ EndIf" $ WO "$ If P2 .EQS. ""ALL"" Then Goto Compile_It" $ WO "$ O_File = F$Parse(P1,,,""Name"") + "".OBJ""" $ WO "$ If F$Search(""",SQ2,"O_File''SQ'"") .EQS. """" Then Goto Compile_It" $ WO "$ Object_Date = F$CvTime(F$File_Attributes(O_File,""RDT""),""Comparison"")" $ WO "$ Source_Date = F$CvTime(F$File_Attributes(P1,""RDT""),""Comparison"")" $ WO "$ If Source_Date .LTS. Object_Date" $ WO "$ Then" $ WO "$ Write SYS$OUTPUT """,SQ2,"P1''SQ' is up to date; skipping...""" $ WO "$ Exit" $ WO "$ EndIf" $ WO "$ Compile_It:" $ WO "$ Write SYS$OUTPUT ""Compiling ",SQ2,"P1''SQ'...""" $ WO "$ Message/Object ''SQ'P1''SQ'" $ WO "$ Exit" $ WO "$ EndSubRoutine" $ WO "$!" $ WO "$! **********************************************************************" $ WO "$! * CLD: Compile a CLD module. *" $ WO "$! **********************************************************************" $ WO "$ CLD: SubRoutine" $ WO "$ If Object_List .EQS. """"" $ WO "$ Then" $ WO "$ Object_List == F$Parse(P1,,,""Name"")" $ WO "$ Else" $ WO "$ Object_List == Object_List + "","" + F$Parse(P1,,,""Name"")" $ WO "$ EndIf" $ WO "$ If P2 .EQS. ""ALL"" Then Goto Compile_It" $ WO "$ O_File = F$Parse(P1,,,""Name"") + "".OBJ""" $ WO "$ If F$Search(""",SQ2,"O_File''SQ'"") .EQS. """" Then Goto Compile_It" $ WO "$ Object_Date = F$CvTime(F$File_Attributes(O_File,""RDT""),""Comparison"")" $ WO "$ Source_Date = F$CvTime(F$File_Attributes(P1,""RDT""),""Comparison"")" $ WO "$ If Source_Date .LTS. Object_Date" $ WO "$ Then" $ WO "$ Write SYS$OUTPUT """,SQ2,"P1''SQ' is up to date; skipping...""" $ WO "$ Exit" $ WO "$ EndIf" $ WO "$ Compile_It:" $ WO "$ Write SYS$OUTPUT ""Compiling ",SQ2,"P1''SQ'...""" $ WO "$ Set Command/Object ''SQ'P1''SQ'" $ WO "$ Exit" $ WO "$ EndSubRoutine" $ WO " $ Close/NoLog OutFile $ Exit $ EndSubRoutine ! Extract_BUILD_COM $! $ Extract_CLI_C: SubRoutine $ Write SYS$OUTPUT "Extracting CLI.C..." $ WO := Write OutFile $ SQ = "'" $ SQ2 = SQ + SQ $ Close/NoLog OutFile $ Open/Write/Share OutFile CLI.C $ WO "/************************************************************************" $ WO " * *" $ WO " * FORCEX *" $ WO " * version 1.0 *" $ WO " * Copyright © 1998 by Richard D. Johnson *" $ WO " * All Rights Reserved *" $ WO " * *" $ WO " * This software has been released to public domain, and may be freely *" $ WO " * copied, distributed, and modiffied. This software is provided as is, *" $ WO " * free of charge. The author assumes no repsonsibility for the use *" $ WO " * of this software. *" $ WO " * *" $ WO " * Richware: http://richj.home.mindspring.com/richware/ *" $ WO " * *" $ WO " ************************************************************************" $ WO " * CLI.C *" $ WO " * *" $ WO " * This module contains routines to parse the CLI command line. *" $ WO " * *" $ WO " ************************************************************************" $ WO " * Revision History *" $ WO " * *" $ WO " * 17-DEC-1996 RDJ Module completion. *" $ WO " ************************************************************************/" $ WO "#include " $ WO "#include " $ WO "#include " $ WO "#include " $ WO "#include " $ WO "" $ WO "typedef enum {false,true} boolean;" $ WO "" $ WO "/************************************************************************" $ WO " * cli_parse_command_line: parse the CLI command line for correct *" $ WO " * syntax and set up for other command line parsing calls. *" $ WO " ************************************************************************/" $ WO "unsigned long cli_parse_command_line (command_name, command_module)" $ WO "char *command_name;" $ WO "long *command_module;" $ WO "{" $ WO " char command_buffer[256];" $ WO " $DESCRIPTOR (d_line, command_buffer);" $ WO " $DESCRIPTOR (d_cldline, command_buffer);" $ WO " unsigned long status;" $ WO " short int length;" $ WO " int command_length;" $ WO "" $ WO " sprintf (command_buffer, ""%s "", command_name);" $ WO " command_length = strlen(command_buffer);" $ WO " d_line.dsc$w_length = d_line.dsc$w_length - command_length;" $ WO " d_line.dsc$a_pointer = d_line.dsc$a_pointer + command_length;" $ WO " lib$get_foreign(&d_line,0,&length,0);" $ WO " command_buffer[length + command_length] = ''SQ'\0''SQ';" $ WO " d_cldline.dsc$w_length = length + command_length;" $ WO " status = cli$dcl_parse (&d_cldline,command_module,0,0,0);" $ WO " if (status == 196609)" $ WO " return (SS$_NORMAL);" $ WO " if (status == CLI$_ENTNF)" $ WO " return (SS$_NORMAL);" $ WO " exit (SS$_NORMAL);" $ WO "}" $ WO "" $ WO "" $ WO "" $ WO "" $ WO "" $ WO "/************************************************************************" $ WO " * cli_check_qualifier: search the command line for a specific *" $ WO " * qualifier and set a boolean status variable. *" $ WO " ************************************************************************/" $ WO "cli_check_qualifier (qualifier_name, status)" $ WO "char *qualifier_name; /* name of qualifier to check for */" $ WO "boolean *status; /* status variable */" $ WO "{" $ WO " $DESCRIPTOR (entity_desc,qualifier_name);" $ WO "" $ WO " entity_desc.dsc$w_length = strlen(qualifier_name);" $ WO " switch (cli$present (&entity_desc)) {" $ WO " case CLI$_PRESENT:" $ WO " case CLI$_DEFAULTED:" $ WO " *status = true;" $ WO " break;" $ WO " default:" $ WO " *status = false;" $ WO " }" $ WO "}" $ WO "" $ WO "" $ WO "" $ WO "" $ WO "" $ WO "/************************************************************************" $ WO " * cli_get_value: get the value of a command line entity. *" $ WO " ************************************************************************/" $ WO "unsigned long cli_get_value (entity, value)" $ WO "char *entity; /* entity to get value of */" $ WO "char *value; /* returned value */" $ WO "{" $ WO " $DESCRIPTOR (entity_desc,entity); /* descriptor for entity string */" $ WO " $DESCRIPTOR (value_desc,value); /* descriptor for value string */" $ WO " unsigned short value_length; /* length of returned value */" $ WO " unsigned long status; /* return status of cli$ call */" $ WO "" $ WO " entity_desc.dsc$w_length = strlen(entity);" $ WO " value_desc.dsc$w_length = 256;" $ WO " status = cli$get_value (&entity_desc,&value_desc,&value_length);" $ WO " value[value_length] = ''SQ'\0''SQ';" $ WO " return (status);" $ WO "}" $ WO "" $ WO " $ Close/NoLog OutFile $ Exit $ EndSubRoutine ! Extract_CLI_C $! $ Extract_FORCEX_C: SubRoutine $ Write SYS$OUTPUT "Extracting FORCEX.C..." $ WO := Write OutFile $ SQ = "'" $ SQ2 = SQ + SQ $ Close/NoLog OutFile $ Open/Write/Share OutFile FORCEX.C $ WO "#include " $ WO "#include " $ WO "#include " $ WO "#include " $ WO "" $ WO "" $ WO "typedef enum {false,true} boolean;" $ WO "char process_name[256];" $ WO "$DESCRIPTOR (process_desc,process_name);" $ WO "" $ WO "extern forcex_cld_table();" $ WO "" $ WO "main () {" $ WO " boolean id_present;" $ WO " unsigned long process_id;" $ WO " char id_string[256];" $ WO " int length,j;" $ WO " unsigned long completion_code = SS$_NORMAL;" $ WO "" $ WO " cli_parse_command_line(""FORCEX"",forcex_cld_table);" $ WO " cli_check_qualifier (""IDENTIFICATION"",&id_present);" $ WO " if (id_present == false) {" $ WO " cli_get_value(""P1"",process_name);" $ WO " if (process_name[0] == ''SQ'""''SQ') {" $ WO " length = strlen(process_name);" $ WO " for (j=0; j