├── mmk_msg.h ├── sp_mgr.c ├── mmk_msg.msg ├── mmk_compile_rules.alpha_opt ├── mmk_compile_rules.ia64_opt ├── mmk.alpha_opt ├── mmk.ia64_opt ├── mmk.x86_64_opt ├── mmk_compile_rules.x86_64_opt ├── mmk_compile_rules_cld.cld ├── mmk_default_rules_ia64.mms ├── mmk_default_rules_vax.mms ├── mmk_default_rules_alpha.mms ├── .gitignore ├── mmk_compile_rules.vax_opt ├── mmk.vax_opt ├── mmk_pcsi.com ├── make_mmk_doc_list.com ├── license.txt ├── readme-5-1-1.txt ├── install.txt ├── clidefs.h ├── copyright.sdml ├── version.h ├── installing_version.mms ├── cmsdef.h ├── generate_symbols.mms ├── globals.h ├── compile.com ├── mmk___startup.com ├── str.c ├── mmk_cld.cld ├── readme.txt ├── objects.c ├── default_rules.c ├── mmk_help.rnh ├── get_rdt.c ├── mmk_compile_rules.c ├── genstruc.c ├── mmk_default_rules_x86_64.mms ├── cms_interface.c ├── kitinstal.com ├── descrip.mms ├── parse_objects.c ├── mmk.h └── mem.c /mmk_msg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/endlesssoftware/mmk/HEAD/mmk_msg.h -------------------------------------------------------------------------------- /sp_mgr.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/endlesssoftware/mmk/HEAD/sp_mgr.c -------------------------------------------------------------------------------- /mmk_msg.msg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/endlesssoftware/mmk/HEAD/mmk_msg.msg -------------------------------------------------------------------------------- /mmk_compile_rules.alpha_opt: -------------------------------------------------------------------------------- 1 | COLLECT=CLUSTER1,$$$COPYRIGHT 2 | BIN_DIR:MMK.OLB/INCLUDE=(MMK_MSG)/LIB 3 | -------------------------------------------------------------------------------- /mmk_compile_rules.ia64_opt: -------------------------------------------------------------------------------- 1 | COLLECT=CLUSTER1,$$$COPYRIGHT 2 | BIN_DIR:MMK.OLB/INCLUDE=(MMK_MSG)/LIB 3 | -------------------------------------------------------------------------------- /mmk.alpha_opt: -------------------------------------------------------------------------------- 1 | COLLECT=CLUSTER1,$$$COPYRIGHT 2 | BIN_DIR:MMK.OLB/INCLUDE=(MMK,DEFAULT_RULES,MMK_MSG)/LIB 3 | -------------------------------------------------------------------------------- /mmk.ia64_opt: -------------------------------------------------------------------------------- 1 | COLLECT=CLUSTER1,$$$COPYRIGHT 2 | BIN_DIR:MMK.OLB/INCLUDE=(MMK,DEFAULT_RULES,MMK_MSG)/LIB 3 | -------------------------------------------------------------------------------- /mmk.x86_64_opt: -------------------------------------------------------------------------------- 1 | COLLECT=CLUSTER1,$$$COPYRIGHT 2 | BIN_DIR:MMK.OLB/INCLUDE=(MMK,DEFAULT_RULES,MMK_MSG)/LIB 3 | -------------------------------------------------------------------------------- /mmk_compile_rules.x86_64_opt: -------------------------------------------------------------------------------- 1 | COLLECT=CLUSTER1,$$$COPYRIGHT 2 | BIN_DIR:MMK.OLB/INCLUDE=(MMK_MSG)/LIB 3 | -------------------------------------------------------------------------------- /mmk_compile_rules_cld.cld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/endlesssoftware/mmk/HEAD/mmk_compile_rules_cld.cld -------------------------------------------------------------------------------- /mmk_default_rules_ia64.mms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/endlesssoftware/mmk/HEAD/mmk_default_rules_ia64.mms -------------------------------------------------------------------------------- /mmk_default_rules_vax.mms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/endlesssoftware/mmk/HEAD/mmk_default_rules_vax.mms -------------------------------------------------------------------------------- /mmk_default_rules_alpha.mms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/endlesssoftware/mmk/HEAD/mmk_default_rules_alpha.mms -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .\$ADF\$* 2 | .\$NFS\$* 3 | *\;* 4 | *-*/* 5 | *.jou 6 | *.tex 7 | *.dvi_* 8 | *.int_* 9 | *.tc[befi] 10 | -------------------------------------------------------------------------------- /mmk_compile_rules.vax_opt: -------------------------------------------------------------------------------- 1 | COLLECT=CLUSTER1,$$$COPYRIGHT 2 | BIN_DIR:MMK.OLB/INCLUDE=(MMK_MSG)/LIB 3 | SYS$SHARE:VAXCRTL/SHARE 4 | -------------------------------------------------------------------------------- /mmk.vax_opt: -------------------------------------------------------------------------------- 1 | COLLECT=CLUSTER1,$$$COPYRIGHT 2 | BIN_DIR:MMK.OLB/INCLUDE=(MMK,DEFAULT_RULES,MMK_MSG)/LIB 3 | SYS$LIBRARY:VAXCRTL/SHARE 4 | -------------------------------------------------------------------------------- /mmk_pcsi.com: -------------------------------------------------------------------------------- 1 | $ set noon 2 | $ p1 = f$edit(p1,"UPCASE,COLLAPSE,TRIM,UNCOMMENT") 3 | $ if (p1 .eqs. "POSTINSTALL") then goto postinstall 4 | $ if (p1 .eqs. "REMOVE") then goto remove 5 | $ goto bail_out 6 | $ 7 | $remove: 8 | $ if (f$search("SYS$STARTUP:MMK_STARTUP.COM") .nes. "") then - 9 | $ deletee/nolog SYS$STARTUP:MMK_STARTUP.COM;* 10 | $ 11 | $postinstall: 12 | $ mmk_root = f$parse("PCSI$DESTINATION:[MMK]",,,"DEVICE","NO_CONCEAL") - 13 | + f$parse("PCSI$DESTINATION:[MMK]",,,"DIRECTORY","NO_CONCEAL") - 14 | - "][" - ".]" - "]" 15 | $ close/nolog sp 16 | $ open/write sp PCSI$DESTINATION:[MMK]MMK_STARTUP.COM 17 | $ write sp "$! MMK Startup Procedure -- generated by PCSI at ''f$time()'" 18 | $ write sp "$ set noon" 19 | $ write sp "$ @''mmk_root']MMK___STARTUP.COM" 20 | $ write sp "$ exitt 1" 21 | $ close/nolog sp 22 | $ goto bail_out 23 | $ 24 | $bail_out: 25 | $ exitt 1 26 | -------------------------------------------------------------------------------- /make_mmk_doc_list.com: -------------------------------------------------------------------------------- 1 | $ IF p1 .EQS. "" 2 | $ THEN doc_dir = "MG_KIT:[MMK]" 3 | $ ELSE doc_dir = p1 4 | $ ENDIF 5 | $ IF p2 .EQS. "" 6 | $ THEN outfile = "MG_KIT:[]MMK_DOC_LIST.DAT" 7 | $ ELSE outfile = p2 8 | $ ENDIF 9 | $ create 'outfile 10 | $ close/nolog mmk_doc_list 11 | $ open/append mmk_doc_list 'outfile 12 | $ write mmk_doc_list "!" 13 | $ write mmk_doc_list "! MMK documentation files." 14 | $ write mmk_doc_list "!" 15 | $ call make_list "''DOC_DIR'MMK*.PS" 16 | $ call make_list "''DOC_DIR'MMK*.PDF" 17 | $ call make_list "''DOC_DIR'MMK*.TXT" 18 | $ call make_list "''DOC_DIR'MMK*.HTML" 19 | $ close/nolog mmk_doc_list 20 | $ write sys$output "''outfile' created" 21 | $ exit 22 | $ MAKE_LIST: SUBROUTINE 23 | $ _Loop: 24 | $ file = f$search(p1) 25 | $ if file.eqs."" then exit 26 | $ name = f$parse(file,"","","NAME")+f$parse(file,"","","TYPE") 27 | $ write mmk_doc_list f$fao("MMK_TMP !32AS MMK_INSTALL_ROOT:[DOC]", name) 28 | $ goto _loop 29 | $ ENDSUBROUTINE 30 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008, Matthew Madison. 2 | Copyright (c) 2012, Endless Software Solutions. 3 | 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above 11 | copyright notice, this list of conditions and the following 12 | disclaimer. 13 | * Redistributions in binary form must reproduce the above 14 | copyright notice, this list of conditions and the following 15 | disclaimer in the documentation and/or other materials provided 16 | with the distribution. 17 | * Neither the name of the copyright owner nor the names of any 18 | other contributors may be used to endorse or promote products 19 | derived from this software without specific prior written 20 | permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 26 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | -------------------------------------------------------------------------------- /readme-5-1-1.txt: -------------------------------------------------------------------------------- 1 | MMK V5.1-1 was released by Hunter Goatley on July 13, 2023. 2 | 3 | I tried to coordinate with Tim Sneddon, but my emails to Tim have been 4 | unanswered as of that date. 5 | 6 | So I forged ahead. MMK V5.1-1 runs on VAX, Alpha, I64, and X86_64. 7 | 8 | I only had to make a few changes to get it to work on X86_64, but I 9 | fixed several bugs in the kitting to get all of that to work and be 10 | consistent. 11 | 12 | These are the updated and new files that I touched. They have not 13 | been added to github yet, as I'm hoping to coordinate that with Tim. 14 | 15 | Files changed from the V5.1 distribution on github: 16 | 17 | BUILD_PCSI.MMS - Updated to correct "!=" with "|=" 18 | COMPILE.COM - Updated to compile cleanly on VAX V5.1 and Alpha V6.2 19 | DESCRIP.MMS - Numerous updates to add X86_64 support and work around ESS 20 | INSTALLING_VERSION.MMS - Updated to correct "!=" with "|=" 21 | KITINSTAL.COM - Added X86_64, fixed MMK_DO_* questions, which use globals 22 | MMK.C - Added a check for __x86_64 to use lib$table_parse 23 | MMK.H - Added prototypes for three str routines if compiling on V6 24 | MMK.X86_64_OPT - New linker options file for X86_64 25 | MMK_COMPILE_RULES.C - Added a check for __x86_64 to use lib$table_parse 26 | MMK_COMPILE_RULES.X86_64_OPT - New linker options file for X86_64 27 | MMK_DEFAULT_RULES_X86_64.MMS - New file for X86_64 28 | MMK___STARTUP.COM - Modified for directory name consistency, add X86_64 29 | PARSE_DESCRIP.C - Added a check for __x86_64 to use lib$table_parse 30 | PARSE_OBJECTS.C - Added a check for __x86_64 to use lib$table_parse 31 | PARSE_TABLES.MAR - Rename EVAX symbol to SIXTYFOUR_BIT 32 | RELEASE_NOTES.SDML - Added note for MMK V5.1-1 33 | STR.C - strdup(), strcasecmp(), and strncasecmp() routines for VMS V6.x 34 | VERSION.H - Bumped version to MMK V5.1-1 35 | 36 | Questions? Problems? I can be reached at goathunter@goatley.com 37 | 38 | Hunter 39 | -------------------------------------------------------------------------------- /install.txt: -------------------------------------------------------------------------------- 1 | Building and Installing MMK 2 | --------------------------- 3 | 4 | The MMK.ZIP package includes all the source code needed to build MMK from 5 | sources on recent versions of OpenVMS. 6 | 7 | Requirements: 8 | * a recent-vintage DEC C/HP C compiler 9 | * MACRO (on VAX) or the MACRO-32 compiler (Alpha and IA64) 10 | * SDL 11 | 12 | Optional: 13 | * RUNOFF (for building the help file) 14 | * DEC Document (for building the manual) 15 | 16 | If you do not already have a make utility of some kind, you can use the 17 | bootstrap command procedure included in the source directory: 18 | 19 | $ @COMPILE 20 | 21 | This should build the MMK executable from scratch. 22 | 23 | You should be able to use the included DESCRIP.MMS file to build MMK 24 | if you either have a copy of MMK already, or you have the DEC/MMS 25 | utility. 26 | 27 | The MMK.EXE image should be invoked through a DCL "foreign command" symbol. 28 | Copy the image to an appropriate directory, and define a symbol for it: 29 | 30 | $ MMK :== $device:[dir]MMK 31 | 32 | A RUNOFF (.RNH) file is included for generating help that is suitable for 33 | inclusion in the system help library. You can generate it using the 34 | following command: 35 | 36 | $ RUNOFF/OUTPUT=MMK_HELP.HLP MMK_HELP.RNH 37 | 38 | You can then install it in the library with: 39 | 40 | $ LIBRARY/REPLACE/HELP SYS$HELP:HELPLIB.HLB MMK_HELP.HLP 41 | 42 | The DESCRIP.MMS file included in the source kit includes the commands for 43 | generating the .HLP file from the .RNH file. 44 | 45 | BUILDING MMK FROM SOURCES 46 | ------------------------- 47 | 48 | If you wish to build MMK from the source code provided in the source directory 49 | included in the ZIP archive, just use MMK or DEC/MMS to build it, or invoke 50 | the COMPILE.COM command procedure while your default is set to the source 51 | directory. Note that this command procedure may need some editing, depending 52 | on your system's architecture and version of VMS. 53 | 54 | All of the files needed for building the executable are provided in the source 55 | kit. 56 | -------------------------------------------------------------------------------- /clidefs.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** CLIDEFS.H 3 | ** 4 | ** Definitions for use with the CLI$ utility routines. 5 | ** 6 | ** Copyright (c) 2008, Matthew Madison. 7 | ** 8 | ** All rights reserved. 9 | ** 10 | ** Redistribution and use in source and binary forms, with or without 11 | ** modification, are permitted provided that the following conditions 12 | ** are met: 13 | ** 14 | ** * Redistributions of source code must retain the above 15 | ** copyright notice, this list of conditions and the following 16 | ** disclaimer. 17 | ** * Redistributions in binary form must reproduce the above 18 | ** copyright notice, this list of conditions and the following 19 | ** disclaimer in the documentation and/or other materials provided 20 | ** with the distribution. 21 | ** * Neither the name of the copyright owner nor the names of any 22 | ** other contributors may be used to endorse or promote products 23 | ** derived from this software without specific prior written 24 | ** permission. 25 | ** 26 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | */ 38 | #ifndef clidefs_h__ 39 | #define clidefs_h__ 40 | #pragma nostandard 41 | globalvalue unsigned int CLI$_ABSENT, CLI$_PRESENT, CLI$_NEGATED, CLI$_DEFAULTED, CLI$_COMMA; 42 | #pragma standard 43 | 44 | extern unsigned int cli$present(), cli$get_value(), cli$dcl_parse(); 45 | #endif /* clidefs_h__ */ 46 | -------------------------------------------------------------------------------- /copyright.sdml: -------------------------------------------------------------------------------- 1 | 2 | ((PRTDATE)) 3 | (2008\Matthew Madison.) 4 | ((COPYYEAR)\Endless Software Solutions.) 5 |

6 | All rights reserved. 7 |

8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions 10 | are met: 11 | (unnumbered) 12 | Redistributions of source code must retain the above 13 | copyright notice, this list of conditions and the following 14 | disclaimer. 15 | Redistributions in binary form must reproduce the above 16 | copyright notice, this list of conditions and the following 17 | disclaimer in the documentation and/or other materials provided 18 | with the distribution. 19 | Neither the name of the copyright owner nor the names of any 20 | other contributors may be used to endorse or promote products 21 | derived from this software without specific prior written 22 | permission. 23 | 24 |

25 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 |

37 | Portions of the software were adapted from other open source projects. Refer 38 | to the Release Notes for copyright and license information. 39 |

The following are trademarks of Hewlett-Packard Development Company, LP: 40 | 41 | (SINGLE_SPACED) 42 | (3\20\20) 43 | (AXP\DEC\OpenVMS) 44 | (VAX\VMS\) 45 | 46 |

UNIX is a registered trademark of USL, Inc. 47 | 48 | -------------------------------------------------------------------------------- /version.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** VERSION.H 3 | ** 4 | ** Version information #include file for the MMK Make Utility. 5 | ** 6 | ** Copyright (c) 2014, Endless Software Solutions. 7 | ** 8 | ** All rights reserved. 9 | ** 10 | ** Redistribution and use in source and binary forms, with or without 11 | ** modification, are permitted provided that the following conditions 12 | ** are met: 13 | ** 14 | ** * Redistributions of source code must retain the above 15 | ** copyright notice, this list of conditions and the following 16 | ** disclaimer. 17 | ** * Redistributions in binary form must reproduce the above 18 | ** copyright notice, this list of conditions and the following 19 | ** disclaimer in the documentation and/or other materials provided 20 | ** with the distribution. 21 | ** * Neither the name of the copyright owner nor the names of any 22 | ** other contributors may be used to endorse or promote products 23 | ** derived from this software without specific prior written 24 | ** permission. 25 | ** 26 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | */ 38 | #ifndef version_h__ 39 | #define version_h__ 40 | 41 | #define MMK_VERSION "V5.1" 42 | #define MMK_MAJOR_VERSION "5" 43 | #define MMK_MINOR_VERSION "1" 44 | #define MMK_REVISION "0" 45 | #define MMK_COPYRIGHT "Copyright (c) 2008, Matthew Madison.\r\n" \ 46 | " Copyright (c) 2014, Endless Software Solutions.\r\n" \ 47 | " See LICENSE.TXT in distribution kit for license information." 48 | 49 | #endif /* version_h__ */ 50 | -------------------------------------------------------------------------------- /installing_version.mms: -------------------------------------------------------------------------------- 1 | !++ 2 | ! INSTALLING_VERSION.MMS 3 | ! 4 | ! Description file for generating version information used by VMSINSTAL 5 | ! kit installation procedures. 6 | ! 7 | ! Copyright (c) 2013, Endless Software Solutions. 8 | ! 9 | ! All rights reserved. 10 | ! 11 | ! Redistribution and use in source and binary forms, with or without 12 | ! modification, are permitted provided that the following conditions 13 | ! are met: 14 | ! 15 | ! * Redistributions of source code must retain the above 16 | ! copyright notice, this list of conditions and the following 17 | ! disclaimer. 18 | ! * Redistributions in binary form must reproduce the above 19 | ! copyright notice, this list of conditions and the following 20 | ! disclaimer in the documentation and/or other materials provided 21 | ! with the distribution. 22 | ! * Neither the name of the copyright owner nor the names of any 23 | ! other contributors may be used to endorse or promote products 24 | ! derived from this software without specific prior written 25 | ! permission. 26 | ! 27 | ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | ! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | ! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | ! A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | ! OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | ! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | ! LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | ! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | ! THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | ! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | ! OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | ! 39 | ! 27-FEB-2013 V1.0 Sneddon Initial coding. 40 | ! 01-MAR-2013 V1.1 Sneddon Includes kit version now. 41 | !-- 42 | ECHO = WRITE SYS$OUTPUT 43 | 44 | TMP |= PIPE TMP="$(MMK_MAJOR_VERSION)" ; IF F$LENGTH(TMP) .EQ 1 THEN TMP="0"+TMP ; WRITE/SYMBOL SYS$OUTPUT TMP 45 | KIT_VERSION = $(COLLAPSE $(TMP)$(MMK_MINOR_VERSION)) 46 | 47 | 48 | INSTALLING_VERSION : 49 | @ $(ECHO) "$(MMK_VERSION)" 50 | @ $(ECHO) "$(KIT_VERSION)" 51 | -------------------------------------------------------------------------------- /cmsdef.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** CMSDEF.H 3 | ** 4 | ** Definitions for use with DEC/CMS. 5 | ** 6 | ** 7 | ** Copyright (c) 2008, Matthew Madison. 8 | ** 9 | ** All rights reserved. 10 | ** 11 | ** Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions 13 | ** are met: 14 | ** 15 | ** * Redistributions of source code must retain the above 16 | ** copyright notice, this list of conditions and the following 17 | ** disclaimer. 18 | ** * Redistributions in binary form must reproduce the above 19 | ** copyright notice, this list of conditions and the following 20 | ** disclaimer in the documentation and/or other materials provided 21 | ** with the distribution. 22 | ** * Neither the name of the copyright owner nor the names of any 23 | ** other contributors may be used to endorse or promote products 24 | ** derived from this software without specific prior written 25 | ** permission. 26 | ** 27 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | ** MODIFICATION HISTORY: 39 | ** 40 | ** 01-JUL-1994 V1.0 Madison Initial coding. 41 | ** 42 | */ 43 | #ifndef cmsdef_h__ 44 | #define cmsdef_h__ 45 | #define CMS$M_CMD_CREATE 2 46 | #define CMS$M_CMD_REPLACE 256 47 | 48 | #define CMS$M_OCC_NOCLASS 1 49 | #define CMS$M_OCC_NOELEMENT 2 50 | #define CMS$M_OCC_NOGROUP 4 51 | #define CMS$M_OCC_NOOTHER 8 52 | 53 | struct CMS_LDB { 54 | unsigned int longword_count; 55 | unsigned int return_status; 56 | struct dsc$descriptor library_descriptor; 57 | unsigned int user_arg; 58 | unsigned int occlusion_mask; 59 | unsigned int reserved[46]; 60 | }; 61 | 62 | struct CMS_FDB { 63 | unsigned int reserved[5]; 64 | }; 65 | #endif /* cmsdef_h__ */ 66 | -------------------------------------------------------------------------------- /generate_symbols.mms: -------------------------------------------------------------------------------- 1 | !++ 2 | ! GENERATE_SYMBOLS.MMS 3 | ! 4 | ! Description file for generating version symbols from newly build 5 | ! MMK for use in building documentation. 6 | ! 7 | ! Copyright (c) 2012, Endless Software Solutions. 8 | ! 9 | ! All rights reserved. 10 | ! 11 | ! Redistribution and use in source and binary forms, with or without 12 | ! modification, are permitted provided that the following conditions 13 | ! are met: 14 | ! 15 | ! * Redistributions of source code must retain the above 16 | ! copyright notice, this list of conditions and the following 17 | ! disclaimer. 18 | ! * Redistributions in binary form must reproduce the above 19 | ! copyright notice, this list of conditions and the following 20 | ! disclaimer in the documentation and/or other materials provided 21 | ! with the distribution. 22 | ! * Neither the name of the copyright owner nor the names of any 23 | ! other contributors may be used to endorse or promote products 24 | ! derived from this software without specific prior written 25 | ! permission. 26 | ! 27 | ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | ! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | ! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | ! A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | ! OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | ! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | ! LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | ! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | ! THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | ! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | ! OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | ! 39 | ! 06-AUG-2012 V1.0 Sneddon Initial coding. 40 | !-- 41 | ECHO = WRITE SYS$OUTPUT 42 | 43 | GENERATE_SYMBOLS : 44 | @ months = "/January/February/March/April/May/June/July/August/September/October/November/December" 45 | @ now = F$CVTIME (, "ABSOLUTE") 46 | @ year = F$CVTIME (now,, "YEAR") 47 | @ mon = F$INTEGER (F$CVTIME (now,, "MONTH")) 48 | @ month = F$ELEMENT (mon, "/", months) 49 | @ amonth = F$CVTIME (now, "ABSOLUTE", "MONTH") 50 | @ day = F$CVTIME (now,, "DAY") 51 | @ $(ECHO) "(COPYYEAR\''year')" 52 | @ $(ECHO) "(RELDATE\''day'-''amonth'-''year')" 53 | @ $(ECHO) "(RELMONTH\''month', ''year')" 54 | @ $(ECHO) "(PRTDATE\''day' ''month' ''year')" 55 | @ $(ECHO) "(VER\$(MMK_VERSION))" 56 | @ $(ECHO) "(KITVER\$(MMK_MAJOR_VERSION)$(MMK_MINOR_VERSION))" 57 | -------------------------------------------------------------------------------- /globals.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** GLOBALS.H 3 | ** 4 | ** External reference definitions for MMS globals. These are defined 5 | ** as globals in MMK.C. 6 | ** 7 | ** Copyright (c) 2008, Matthew Madison. 8 | ** Copyright (c) 2012, Endless Software Solutions. 9 | ** 10 | ** All rights reserved. 11 | ** 12 | ** Redistribution and use in source and binary forms, with or without 13 | ** modification, are permitted provided that the following conditions 14 | ** are met: 15 | ** 16 | ** * Redistributions of source code must retain the above 17 | ** copyright notice, this list of conditions and the following 18 | ** disclaimer. 19 | ** * Redistributions in binary form must reproduce the above 20 | ** copyright notice, this list of conditions and the following 21 | ** disclaimer in the documentation and/or other materials provided 22 | ** with the distribution. 23 | ** * Neither the name of the copyright owner nor the names of any 24 | ** other contributors may be used to endorse or promote products 25 | ** derived from this software without specific prior written 26 | ** permission. 27 | ** 28 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | */ 40 | #ifndef globals_h__ 41 | #define globals_h__ 42 | #include "mmk.h" 43 | #pragma nostandard 44 | EXTERN struct SYMTABLE global_symbols; 45 | EXTERN struct SYMTABLE local_symbols; 46 | EXTERN struct SYMTABLE cmdline_symbols; 47 | EXTERN struct SYMTABLE builtin_symbols; 48 | EXTERN struct SYMTABLE *temporary_symbols; 49 | EXTERN struct RULE rules; 50 | EXTERN struct RULE *default_rule; 51 | EXTERN struct DEPEND dependencies, dep_internal, dep_deferred; 52 | EXTERN struct SFX suffixes; 53 | EXTERN struct CMD do_first; 54 | EXTERN struct CMD do_last; 55 | EXTERN int verify, do_log, did_an_update, noaction, check_status; 56 | EXTERN int force, from_sources, ignore, use_cms, skip_intermediates; 57 | EXTERN int builtins, case_sensitive, gnu_syntax, mms_syntax; 58 | EXTERN int override_silent, override_ignore, symbol_override; 59 | EXTERN int override_builtins, override_case, override_gnu_syntax, override_mms_syntax; 60 | EXTERN unsigned int exit_status; 61 | EXTERN char cms$lib[]; 62 | EXTERN char cms_default_generation[]; 63 | #pragma standard 64 | #endif /* globals_h__ */ 65 | -------------------------------------------------------------------------------- /compile.com: -------------------------------------------------------------------------------- 1 | $ say = "write sys$output" 2 | $ arch = F$GETSYI("ARCH_NAME") 3 | $ mflag = "" 4 | $ IF arch .NES. "VAX" THEN mflag = "/MIGRATION" 5 | $ 6 | $ say "" 7 | $ say " MMK Bootstrap Procedure" 8 | $ say "" 9 | $ 10 | $ DEFINE/NOLOG SRC_DIR SYS$DISK:[] 11 | $ DEFINE/NOLOG BIN_DIR SYS$DISK:[.BIN-'arch'] 12 | $ DEFINE/NOLOG ETC_DIR SYS$DISK:[.ETC-'arch'] 13 | $ DEFINE/NOLOG KIT_DIR SYS$DISK:[.KIT-'arch'] 14 | $ 15 | $ IF F$PARSE("BIN_DIR:") .EQS. "" THEN CREATE/DIR BIN_DIR: 16 | $ IF F$PARSE("ETC_DIR:") .EQS. "" THEN CREATE/DIR ETC_DIR: 17 | $ IF F$PARSE("KIT_DIR:") .EQS. "" THEN CREATE/DIR KIT_DIR: 18 | $ 19 | $ SET NOON 20 | $ ON ERROR THEN GOTO BAIL_OUT 21 | $ VERIFY = F$VERIFY(1) 22 | $! If you have the SDL compiler installed, then feel free to uncomment the 23 | $! lines below. However, it is not absolutely necessary as the resulting 24 | $! header files are distributed with the source kit. 25 | $! 26 | $!$ MESSAGE/NOOBJECT/SDL=MMK_MSG.SDL MMK_MSG.MSG 27 | $!$ SDL/VAX/LANGUAGE=CC=ETC_DIR:MMK_MSG.H MMK_MSG.SDL 28 | $ LIBRARY/CREATE BIN_DIR:MMK.OLB 29 | $ CC/NOLIST/OBJECT=BIN_DIR:MMK.OBJ MMK.C 30 | $ LIBRARY/REPLACE BIN_DIR:MMK.OLB BIN_DIR:MMK.OBJ 31 | $ CC/NOLIST/OBJECT=BIN_DIR:FILEIO.OBJ FILEIO.C 32 | $ LIBRARY/REPLACE BIN_DIR:MMK.OLB BIN_DIR:FILEIO.OBJ 33 | $ CC/NOLIST/OBJECT=BIN_DIR:MEM.OBJ MEM.C 34 | $ LIBRARY/REPLACE BIN_DIR:MMK.OLB BIN_DIR:MEM.OBJ 35 | $ CC/NOLIST/OBJECT=BIN_DIR:GET_RDT.OBJ GET_RDT.C 36 | $ LIBRARY/REPLACE BIN_DIR:MMK.OLB BIN_DIR:GET_RDT.OBJ 37 | $ CC/NOLIST/OBJECT=BIN_DIR:SP_MGR.OBJ SP_MGR.C 38 | $ LIBRARY/REPLACE BIN_DIR:MMK.OLB BIN_DIR:SP_MGR.OBJ 39 | $ CC/NOLIST/OBJECT=BIN_DIR:MISC.OBJ MISC.C 40 | $ LIBRARY/REPLACE BIN_DIR:MMK.OLB BIN_DIR:MISC.OBJ 41 | $ CC/NOLIST/OBJECT=BIN_DIR:OBJECTS.OBJ OBJECTS.C 42 | $ LIBRARY/REPLACE BIN_DIR:MMK.OLB BIN_DIR:OBJECTS.OBJ 43 | $ CC/NOLIST/OBJECT=BIN_DIR:SYMBOLS.OBJ SYMBOLS.C 44 | $ LIBRARY/REPLACE BIN_DIR:MMK.OLB BIN_DIR:SYMBOLS.OBJ 45 | $ CC/NOLIST/OBJECT=BIN_DIR:READDESC.OBJ READDESC.C 46 | $ LIBRARY/REPLACE BIN_DIR:MMK.OLB BIN_DIR:READDESC.OBJ 47 | $ CC/NOLIST/OBJECT=BIN_DIR:BUILD_TARGET.OBJ BUILD_TARGET.C 48 | $ LIBRARY/REPLACE BIN_DIR:MMK.OLB BIN_DIR:BUILD_TARGET.OBJ 49 | $ CC/NOLIST/OBJECT=BIN_DIR:PARSE_DESCRIP.OBJ PARSE_DESCRIP.C 50 | $ LIBRARY/REPLACE BIN_DIR:MMK.OLB BIN_DIR:PARSE_DESCRIP.OBJ 51 | $ CC/NOLIST/OBJECT=BIN_DIR:CMS_INTERFACE.OBJ CMS_INTERFACE.C 52 | $ LIBRARY/REPLACE BIN_DIR:MMK.OLB BIN_DIR:CMS_INTERFACE.OBJ 53 | $ CC/NOLIST/OBJECT=BIN_DIR:PARSE_OBJECTS.OBJ PARSE_OBJECTS.C 54 | $ LIBRARY/REPLACE BIN_DIR:MMK.OLB BIN_DIR:PARSE_OBJECTS.OBJ 55 | $ arch_defs = f$search("SYS$LIBRARY:ARCH_DEFS.MAR") 56 | $ if arch_defs.nes."" then arch_defs = arch_defs+"+" 57 | $ MACRO'mflag'/NOLIST/OBJECT=BIN_DIR:PARSE_TABLES.OBJ - 58 | 'arch_defs'SYS$DISK:[]PARSE_TABLES.MAR 59 | $ LIBRARY/REPLACE BIN_DIR:MMK.OLB BIN_DIR:PARSE_TABLES.OBJ 60 | $ MESSAGE/NOLIST/OBJECT=BIN_DIR:MMK_MSG.OBJ MMK_MSG.MSG 61 | $ LIBRARY/REPLACE BIN_DIR:MMK.OLB BIN_DIR:MMK_MSG.OBJ 62 | $ SET COMMAND/NOLIST/OBJECT=BIN_DIR:MMK_CLD.OBJ MMK_CLD.CLD 63 | $ LIBRARY/REPLACE BIN_DIR:MMK.OLB BIN_DIR:MMK_CLD.OBJ 64 | $ CC/NOLIST/OBJECT=BIN_DIR:MMK_COMPILE_RULES.OBJ MMK_COMPILE_RULES.C 65 | $ CC/NOLIST/OBJECT=BIN_DIR:GENSTRUC.OBJ GENSTRUC.C 66 | $ CC/NOLIST/OBJECT=BIN_DIR:STR.OBJ STR.C 67 | $ LIBRARY/REPLACE BIN_DIR:MMK.OLB BIN_DIR:STR.OBJ 68 | $ SET COMMAND/NOLIST/OBJECT=BIN_DIR:MMK_COMPILE_RULES_CLD.OBJ - 69 | MMK_COMPILE_RULES_CLD.CLD 70 | $ LINK/EXEC=BIN_DIR:MMK_COMPILE_RULES.EXE/NOTRACE - 71 | BIN_DIR:MMK_COMPILE_RULES.OBJ, - 72 | BIN_DIR:GENSTRUC.OBJ,BIN_DIR:MMK_COMPILE_RULES_CLD.OBJ,- 73 | BIN_DIR:MMK.OLB/LIB,SRC_DIR:MMK_COMPILE_RULES.'arch'_OPT/opt 74 | $ MMKC := $BIN_DIR:MMK_COMPILE_RULES.EXE 75 | $ MMKC/OUTPUT=ETC_DIR:MMK_DEFAULT_RULES.H MMK_DEFAULT_RULES_'arch'.MMS 76 | $ CC/NOLIST/OBJECT=BIN_DIR:DEFAULT_RULES.OBJ DEFAULT_RULES.C 77 | $ LIBRARY/REPLACE BIN_DIR:MMK.OLB BIN_DIR:DEFAULT_RULES.OBJ 78 | $ LIBRARY/COMPRESS/OUTPUT=BIN_DIR:MMK.OLB BIN_DIR:MMK.OLB 79 | $ LINK/EXEC=BIN_DIR:MMK.EXE/NOTRACE SRC_DIR:MMK.'arch'_OPT/OPT 80 | $BAIL_OUT: 81 | $ EXIT 1.or.(0*F$VERIFY(0)) 82 | -------------------------------------------------------------------------------- /mmk___startup.com: -------------------------------------------------------------------------------- 1 | $ ! Procedure: MMK___STARTUP.COM 2 | $ __vfy = "VFY_''f$parse(f$environment("procedure"),,,"name")'" 3 | $ if (f$type('__vfy') .eqs. "") then __vfy = 0 4 | $ __vfy_saved = f$verify(&__vfy) 5 | $ 6 | $err: subroutine 7 | $ set noon 8 | $ severity = f$edit(P1,"COLLAPSE,UPCASE") 9 | $ identification = f$edit(P2,"COLLAPSE,UPCASE") 10 | $ text = f$edit(P3,"TRIM") 11 | $ continuation = (f$edit(P4,"COLLAPSE,UPCASE") .nes. "") 12 | $ say = "write sys$output" 13 | $ percent = "%" 14 | $ if (continuation) then percent = "-" 15 | $ if ((severity .eqs. "") .or. (identification .eqs. "") .or. (text .eqs. "")) 16 | $ then say "%''facility'-F-SPOTTHEERR, <''severity'><''identification'><''text'>" 17 | $ else say "''percent'''facility'-''severity'-''identification', ''text'" 18 | $ endif 19 | $ exitt 1 20 | $ endsubroutine 21 | $ 22 | $ procedure = f$element(0,";",f$environment("PROCEDURE")) 23 | $ procedure_name = f$parse(procedure,,,"NAME") 24 | $ facility = procedure_name 25 | $ location = f$parse(procedure,,,"DEVICE","NO_CONCEAL") - 26 | + f$parse(procedure,,,"DIRECTORY","NO_CONCEAL") - 27 | - "][" - ".]" - "]" 28 | $ 29 | $ set noon 30 | $ set symbol/scope=(nolocal) 31 | $ on warning then goto bail_out 32 | $ on control_y then goto bail_out 33 | $ 34 | $ if ((f$getsyi("HW_MODEL") .gt. 0) .and. (f$getsyi("HW_MODEL") .lt. 1024)) 35 | $ then _arch_type = 1 36 | $ else _arch_type = f$getsyi("ARCH_TYPE") 37 | $ endif 38 | $ _arch_name = f$element(_arch_type,",","OTHER,VAX,AXP,I64,X86") - "," 39 | $ _vax = (_arch_type .eq. 1) 40 | $ _axp = (_arch_type .eq. 2) 41 | $ _i64 = (_arch_type .eq. 3) 42 | $ _x86 = (_arch_type .eq. 4) 43 | $ _other = (.not. (_vax .or. _axp .or. _i64 .or. _x86)) 44 | $ 45 | $ dns = "define/nolog/system" 46 | $ say = "write sys$output" 47 | $ err = "call___ err" 48 | $ saysym = "write/symbol sys$output" 49 | $ 50 | $start: 51 | $ dns/translation=concealed MMK_ROOT 'location'.] 52 | $ dns MMK_AXP_EXE MMK_ROOT:[AXP_EXE] 53 | $ dns MMK_I64_EXE MMK_ROOT:[I64_EXE] 54 | $ dns MMK_X86_EXE MMK_ROOT:[X86_EXE] 55 | $ dns MMK_VAX_EXE MMK_ROOT:[VAX_EXE] 56 | $ dns MMK_EXE MMK_'_arch_name'_EXE: 57 | $ 58 | $ dns MMK MMK_EXE:MMK.EXE 59 | $ 60 | $ if (f$parse(location+".SRC]") .nes. "") then - 61 | $ dns MMK_SRC MMK_ROOT:[SRC] 62 | $ if (f$parse(location+".DOC]") .nes. "") then - 63 | $ dns MMK_DOC MMK_ROOT:[DOC] 64 | $ 65 | $bail_out: 66 | $ exitt 1.or.(0*f$verify(__vfy_saved)) 67 | $ !+========================================================================== 68 | $ ! 69 | $ ! FACILITY: MMK 70 | $ ! 71 | $ ! ABSTRACT: MMK system startup procedure. 72 | $ ! 73 | $ ! AUTHOR: Tim Sneddon 74 | $ ! 75 | $ ! Copyright (c) 2013, Endless Software Solutions. 76 | $ ! 77 | $ ! All rights reserved. 78 | $ ! 79 | $ ! Redistribution and use in source and binary forms, with or without 80 | $ ! modification, are permitted provided that the following conditions 81 | $ ! are met: 82 | $ ! 83 | $ ! * Redistributions of source code must retain the above 84 | $ ! copyright notice, this list of conditions and the following 85 | $ ! disclaimer. 86 | $ ! * Redistributions in binary form must reproduce the above 87 | $ ! copyright notice, this list of conditions and the following 88 | $ ! disclaimer in the documentation and/or other materials provided 89 | $ ! with the distribution. 90 | $ ! * Neither the name of the copyright owner nor the names of any 91 | $ ! other contributors may be used to endorse or promote products 92 | $ ! derived from this software without specific prior written 93 | $ ! permission. 94 | $ ! 95 | $ ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 96 | $ ! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 97 | $ ! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 98 | $ ! A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 99 | $ ! OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 100 | $ ! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 101 | $ ! LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 102 | $ ! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 103 | $ ! THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 104 | $ ! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 105 | $ ! OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 106 | $ ! 107 | $ ! CREATION DATE: 07-APR-2013 108 | $ ! 109 | $ ! MODIFICATION HISTORY: 110 | $ ! 111 | $ ! 07-APR-2013 V1.0 Sneddon Initial coding. 112 | $ !-========================================================================== 113 | -------------------------------------------------------------------------------- /str.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | 6 | #if __CRTL_VER <= 70000000 7 | 8 | char *strdup (char *src) 9 | { 10 | char *ptr; 11 | ptr = malloc (strlen(src)+1); 12 | if (ptr == NULL) 13 | return (ptr); 14 | strcpy (ptr, src); 15 | 16 | return(ptr); 17 | } 18 | 19 | 20 | /* 21 | * This array is designed for mapping upper and lower case letter 22 | * together for a case independent comparison. The mappings are 23 | * based upon ascii character sequences. 24 | */ 25 | static char charmap[] = { 26 | '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', 27 | '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', 28 | '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', 29 | '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037', 30 | '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', 31 | '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', 32 | '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', 33 | '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', 34 | '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', 35 | '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', 36 | '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', 37 | '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', 38 | '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', 39 | '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', 40 | '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', 41 | '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', 42 | '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', 43 | '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', 44 | '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', 45 | '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', 46 | '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', 47 | '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', 48 | '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', 49 | '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', 50 | '\300', '\341', '\342', '\343', '\344', '\345', '\346', '\347', 51 | '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', 52 | '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', 53 | '\370', '\371', '\372', '\333', '\334', '\335', '\336', '\337', 54 | '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', 55 | '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', 56 | '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', 57 | '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377', 58 | }; 59 | 60 | int strcasecmp(s1, s2) 61 | register char *s1, *s2; 62 | { 63 | register char *cm = charmap; 64 | 65 | if ((s1 == 0) && (s2 == 0)) 66 | return(0); 67 | else 68 | { 69 | if (s1 == 0) 70 | return (-1); 71 | else 72 | if (s2 == 0) 73 | return (1); 74 | } 75 | 76 | while (cm[(unsigned char) *s1] == cm[(unsigned char) *s2++]) 77 | if (*s1++ == '\0') 78 | return(0); 79 | return(cm[(unsigned char) *s1] - cm[(unsigned char) *--s2]); 80 | } 81 | 82 | int strncasecmp(s1, s2, n) 83 | register char *s1, *s2; 84 | register int n; 85 | { 86 | register char *cm = charmap; 87 | 88 | if (n <= 0) 89 | return(0); 90 | 91 | if ((s1 == 0) && (s2 == 0)) 92 | return(0); 93 | else 94 | { 95 | if (s1 == 0) 96 | return (-1); 97 | else 98 | if (s2 == 0) 99 | return (1); 100 | } 101 | 102 | while (--n >= 0 && cm[(unsigned char) *s1] == cm[(unsigned char) *s2++]) 103 | if (*s1++ == '\0') 104 | return(0); 105 | return(n < 0 ? 0 : cm[(unsigned char) *s1] - cm[(unsigned char) *--s2]); 106 | } 107 | 108 | char *strcasestr(register char *string, register char *substring) 109 | { 110 | register char *cm = charmap; 111 | char *a, *b; 112 | 113 | if ((string == NULL) || (substring == NULL)) 114 | return (string); 115 | 116 | b = substring; 117 | 118 | if (*b == 0) { 119 | return string; 120 | } 121 | for ( ; *string != 0; string += 1) { 122 | if (cm[(unsigned char) *string] != cm[(unsigned char) *b]) { 123 | continue; 124 | } 125 | a = string; 126 | while (1) { 127 | if (*b == 0) { 128 | return string; 129 | } 130 | if (cm[(unsigned char) *a++] != cm[(unsigned char) *b++]) { 131 | break; 132 | } 133 | } 134 | b = substring; 135 | } 136 | return (char *) 0; 137 | } 138 | 139 | #endif /* __CRTL_VER <= 70000000 */ 140 | -------------------------------------------------------------------------------- /mmk_cld.cld: -------------------------------------------------------------------------------- 1 | MODULE MMK_CLD 2 | IDENT "V1.14" 3 | !++ 4 | ! 5 | ! DESCRIPTION: 6 | ! 7 | ! This is the command table used by the MMK utility for the 8 | ! MMK command. 9 | ! 10 | ! AUTHOR: M. Madison 11 | ! 12 | ! Copyright (c) 2008, Matthew Madison. 13 | ! Copyright (c) 2013, Endless Software Solutions. 14 | ! 15 | ! All rights reserved. 16 | ! 17 | ! Redistribution and use in source and binary forms, with or without 18 | ! modification, are permitted provided that the following conditions 19 | ! are met: 20 | ! 21 | ! * Redistributions of source code must retain the above 22 | ! copyright notice, this list of conditions and the following 23 | ! disclaimer. 24 | ! * Redistributions in binary form must reproduce the above 25 | ! copyright notice, this list of conditions and the following 26 | ! disclaimer in the documentation and/or other materials provided 27 | ! with the distribution. 28 | ! * Neither the name of the copyright owner nor the names of any 29 | ! other contributors may be used to endorse or promote products 30 | ! derived from this software without specific prior written 31 | ! permission. 32 | ! 33 | ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 34 | ! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 35 | ! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 36 | ! A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 37 | ! OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 38 | ! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 39 | ! LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 40 | ! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 41 | ! THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 42 | ! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 43 | ! OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 44 | ! 45 | ! CREATION DATE: 20-AUG-1992 46 | ! 47 | ! MODIFICATION HISTORY: 48 | ! 49 | ! 20-AUG-1992 V1.0 Madison Initial coding. 50 | ! 15-SEP-1992 V1.0-1 Madison Added /ACTION qualifier. 51 | ! 29-SEP-1992 V1.1 Madison Add /FORCE, /FROM, /IDENT. 52 | ! 30-APR-1993 V1.2 Madison Eliminate /DEFAULT_RULES qualifier. 53 | ! 04-MAY-1993 V1.2-1 Madison Have /RULES default to MMS$RULES. 54 | ! 16-SEP-1993 V1.3 Madison It's MMK now. 55 | ! 17-OCT-1993 V1.4 Madison Add /KEEP_INTERMEDIATES 56 | ! 14-JUN-1994 V1.4-1 Levitte Allow list of targets. 57 | ! 01-JUL-1994 V1.5 Madison Add /CMS. 58 | ! 17-JUL-1994 V1.6 Madison Add /DUMP. 59 | ! 22-AUG-1994 V1.6-1 Madison Remove /KEEP_INTERMEDIATES. 60 | ! 02-DEC-1994 V1.7 Madison Add /GENERATION 61 | ! 21-JUN-1995 V1.8 Madison Add /SKIP_INTERMEDIATES, /OVERRIDE, /CHECK. 62 | ! 22-AUG-1996 V1.9 Madison Add /CMS_LIBRARY. 63 | ! 06-JUN-1998 V1.10 Madison Add /WORKING_DIRECTORY. 64 | ! 27-DEC-1998 V1.11 Madison Allow /CMS_LIBRARY to take list. 65 | ! 07-APR-2010 V1.12 Sneddon Add /EXTENDED_SYNTAX 66 | ! 28-NOV-2012 V1.13 Sneddon Add /VERIFY=ALL 67 | ! 23-DEC-2013 V1.14 Sneddon Correct /EXTENDED_SYNTAX. 68 | !-- 69 | 70 | DEFINE VERB MMK 71 | PARAMETER P1,LABEL=TARGET, VALUE(LIST) 72 | QUALIFIER DESCRIPTION,VALUE(TYPE=$FILE,REQUIRED),NONNEGATABLE 73 | QUALIFIER VERIFY,VALUE(LIST,TYPE=VERIFY_TYPES)NEGATABLE 74 | QUALIFIER LOG,NEGATABLE 75 | QUALIFIER MACRO,VALUE(REQUIRED,LIST),NONNEGATABLE 76 | QUALIFIER RULES_FILE,VALUE(TYPE=$FILE,DEFAULT="MMS$RULES",LIST),NEGATABLE 77 | QUALIFIER LOCAL_RULES,NEGATABLE 78 | QUALIFIER ACTION,NEGATABLE 79 | QUALIFIER FORCE,NEGATABLE 80 | QUALIFIER FROM_SOURCES,NEGATABLE 81 | QUALIFIER IDENTIFICATION,NONNEGATABLE 82 | QUALIFIER OUTPUT, NONNEGATABLE, VALUE(TYPE=$FILE, REQUIRED) 83 | QUALIFIER IGNORE,NEGATABLE,VALUE(TYPE=IGNORE_TYPES) 84 | QUALIFIER CMS, NEGATABLE 85 | QUALIFIER CMS_LIBRARY,VALUE(TYPE=$FILE,REQUIRED,LIST) 86 | QUALIFIER DUMP, NEGATABLE 87 | QUALIFIER GENERATION,VALUE(DEFAULT="1+"),NONNEGATABLE 88 | QUALIFIER OVERRIDE, NEGATABLE 89 | QUALIFIER SKIP_INTERMEDIATES, NEGATABLE 90 | QUALIFIER CHECK_STATUS, NEGATABLE 91 | QUALIFIER WORKING_DIRECTORY, NONNEGATABLE, VALUE(TYPE=$FILE,REQUIRED) 92 | QUALIFIER EXTENDED_SYNTAX, DEFAULT, NEGATABLE, 93 | VALUE(TYPE=SYNTAX_TYPES,LIST,DEFAULT="MMS") 94 | 95 | DEFINE TYPE SYNTAX_TYPES 96 | KEYWORD MMS_SYNTAX, DEFAULT, NEGATABLE 97 | KEYWORD GNU_SYNTAX, NEGATABLE 98 | KEYWORD CASE_SENSITIVE, NEGATABLE 99 | 100 | DEFINE TYPE IGNORE_TYPES 101 | KEYWORD WARNING 102 | KEYWORD ERROR 103 | KEYWORD FATAL 104 | 105 | DEFINE TYPE VERIFY_TYPES 106 | KEYWORD ALL 107 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | The MMK Make Utility 2 | 3 | MMK is a "make" utility for VMS systems. It is used for building software 4 | systems based on a "description file" (or "makefile") you create that lists 5 | the sources and objects of a system and the dependencies between them. 6 | 7 | MMK is similar in functionality to Digital's DEC/Module Management System (MMS), 8 | and understands a syntax in its description files which is a superset of 9 | that which is understood by MMS. It also includes other features, such as: 10 | 11 | * Support for creating inference rules that separate source and target 12 | directories, the syntax for which was borrowed from NMAKE. 13 | 14 | * Conditional execution support based on MMS, MMK's own syntax and 15 | GNU make. 16 | 17 | * Extensive builtin functions, as well as the ability to call user-written 18 | macros. 19 | 20 | * The ability to assign the output of a command (or command procedure) 21 | to a symbol. 22 | 23 | MMK runs on VAX/VMS, OpenVMS VAX, OpenVMS AXP, and OpenVMS IA64 systems. 24 | It should build and run on versions of VMS older than V7.0, but is only 25 | being maintained for more recent versions of the operating system. MMK 26 | has support for the DEC/CMS code management system, but does not require 27 | it. 28 | 29 | MMK is written entirely in C (with a little Macro). Complete source code is 30 | provided via github. To download the latest kit, point your browser at: 31 | 32 | http://github.com/endlesssoftware/mmk 33 | 34 | The following describes the source modules contained within the kit: 35 | 36 | INSTALL.TXT Installation instructions. 37 | LICENSE.TXT License information. 38 | README.TXT This file. 39 | 40 | BUILD_TARGET.C Routines for building targets. 41 | CLIDEFS.H CLI$ interface definitions. 42 | CMS_INTERFACE.C DEC/CMS interface routines. 43 | COMPILE.COM Command procedure for building MMK from sources. 44 | DEFAULT_RULES.C Setup routines for compiled-in default rules. 45 | DESCRIP.MMS Description file for building MMK. 46 | FILEIO.C File I/O routines. 47 | GENSTRUC.C Routines for generating structures for built-in rules. 48 | GET_RDT.C Routines for getting revision date stamps. 49 | GLOBALS.H Include file for MMK globals. 50 | MEM.C Memory management routines. 51 | MISC.C Miscellaneous support routines. 52 | MMK.ALPHA_OPT Linker options file for building MMK (AXP). 53 | MMK.C MMK main routine. 54 | MMK.H Include file for MMK definitions. 55 | MMK.IA64_OPT Linker options file for building MMK (IA64). 56 | MMK.OPT Linker options file for building MMK (VAX). 57 | MMK_CLD.CLD MMK command language definition. 58 | MMK_COMPILE_RULES.ALPHA_OPT Linker options file for rules compiler. (AXP) 59 | MMK_COMPILE_RULES.C Rules compiler main program. 60 | MMK_COMPILE_RULES.I64_OPT Linker options file for rules compiler. (IA64) 61 | MMK_COMPILE_RULES.OPT Linker options file for rules compiler (VAX). 62 | MMK_COMPILE_RULES_CLD.CLD Command language definition for rules compiler. 63 | MMK_DEFAULT_RULES.MMS Default rules for compiling into MMK (VAX). 64 | MMK_DEFAULT_RULES_AXP.MMS Default rules for copmiling into MMK (AXP). 65 | MMK_DEFAULT_RULES_I64.MMS Default rules for copmiling into MMK (IA64). 66 | MMK_DOC.SDML VAX DOCUMENT source for MMK documentation. 67 | MMK_HELP.RNH RUNOFF source for MMK help file. 68 | MMK_MSG.H Include file containing MMK message code definitions. 69 | MMK_MSG.MSG MMK message definitions. 70 | OBJECTS.C Routines for managing the object tree. 71 | PARSE_DESCRIP.C Routines for parsing description files. 72 | PARSE_OBJECTS.C Routines for parsing object references. 73 | PARSE_TABLES.MAR LIB$TPARSE table for parsing description files. 74 | READDESC.C Routines for reading in description files. 75 | RELEASE_NOTES.SDML VAX DOCUMENT source for MMK revision information. 76 | SP_MGR.C Subprocess management routines. 77 | SYMBOLS.C Routines for managing the symbol tables. 78 | 79 | 80 | -------------------------------------------------------------------------------- 81 | COPYRIGHT NOTICE 82 | 83 | Copyright (c) 2008, Matthew Madison. 84 | Copyright (c) 2014, Endless Software Solutions. 85 | 86 | All rights reserved. 87 | 88 | Redistribution and use in source and binary forms, with or without 89 | modification, are permitted provided that the following conditions 90 | are met: 91 | 92 | * Redistributions of source code must retain the above 93 | copyright notice, this list of conditions and the following 94 | disclaimer. 95 | * Redistributions in binary form must reproduce the above 96 | copyright notice, this list of conditions and the following 97 | disclaimer in the documentation and/or other materials provided 98 | with the distribution. 99 | * Neither the name of the copyright owner nor the names of any 100 | other contributors may be used to endorse or promote products 101 | derived from this software without specific prior written 102 | permission. 103 | 104 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 105 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 106 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 107 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 108 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 109 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 110 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 111 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 112 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 113 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 114 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 115 | 116 | -------------------------------------------------------------------------------- /objects.c: -------------------------------------------------------------------------------- 1 | /* 2 | **++ 3 | ** FACILITY: MMK 4 | ** 5 | ** ABSTRACT: Object tree routines. 6 | ** 7 | ** MODULE DESCRIPTION: 8 | ** 9 | ** This module contains routines that manipulate the tree 10 | ** of objects. The VMS RTL LIB$xxx_TREE routines are used to 11 | ** create and traverse the tree. 12 | ** 13 | ** AUTHOR: M. Madison 14 | ** 15 | ** Copyright (c) 2008, Matthew Madison. 16 | ** 17 | ** All rights reserved. 18 | ** 19 | ** Redistribution and use in source and binary forms, with or without 20 | ** modification, are permitted provided that the following conditions 21 | ** are met: 22 | ** 23 | ** * Redistributions of source code must retain the above 24 | ** copyright notice, this list of conditions and the following 25 | ** disclaimer. 26 | ** * Redistributions in binary form must reproduce the above 27 | ** copyright notice, this list of conditions and the following 28 | ** disclaimer in the documentation and/or other materials provided 29 | ** with the distribution. 30 | ** * Neither the name of the copyright owner nor the names of any 31 | ** other contributors may be used to endorse or promote products 32 | ** derived from this software without specific prior written 33 | ** permission. 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 46 | ** 47 | ** CREATION DATE: 09-SEP-1992 48 | ** 49 | ** MODIFICATION HISTORY: 50 | ** 51 | ** 09-SEP-1992 V1.0 Madison Initial coding. 52 | ** 17-JUL-1995 V1.0-1 Madison Fix node_compare routine. 53 | ** 27-DEC-1998 V1.1 Madison General cleanup. 54 | **-- 55 | */ 56 | #pragma module OBJECTS "V1.1" 57 | #include "mmk.h" 58 | #include "globals.h" 59 | 60 | /* 61 | ** Forward declarations 62 | */ 63 | struct OBJECT *Find_Object(struct OBJECT *); 64 | void Insert_Object(struct OBJECT *); 65 | static int node_compare(struct OBJECT *, struct OBJECT *, int); 66 | static unsigned int node_alloc(char *, struct OBJECT **, struct OBJECT *); 67 | 68 | static unsigned int objtree = 0; 69 | 70 | /* 71 | **++ 72 | ** ROUTINE: Find_Object 73 | ** 74 | ** FUNCTIONAL DESCRIPTION: 75 | ** 76 | ** Uses LIB$LOOKUP_TREE to locate a group in the tree by name. 77 | ** 78 | ** RETURNS: struct OBJECT * 79 | ** 80 | ** PROTOTYPE: 81 | ** 82 | ** Find_Object(char *str) 83 | ** 84 | ** str: character string, read only, by reference (ASCIZ) 85 | ** 86 | ** IMPLICIT INPUTS: None. 87 | ** 88 | ** IMPLICIT OUTPUTS: None. 89 | ** 90 | ** COMPLETION CODES: 91 | ** non-0: group was found 92 | ** 0: no group was found 93 | ** 94 | ** SIDE EFFECTS: None. 95 | ** 96 | **-- 97 | */ 98 | struct OBJECT *Find_Object (struct OBJECT *template) { 99 | 100 | struct OBJECT *obj; 101 | 102 | if (!OK(lib$lookup_tree(&objtree, template, node_compare, &obj))) { 103 | obj = NULL; 104 | } 105 | 106 | return obj; 107 | 108 | } /* Find_Object */ 109 | 110 | /* 111 | **++ 112 | ** ROUTINE: Insert_Object 113 | ** 114 | ** FUNCTIONAL DESCRIPTION: 115 | ** 116 | ** Uses LIB$INSERT_TREE to insert an OBJECT structure into the tree. 117 | ** 118 | ** RETURNS: void 119 | ** 120 | ** PROTOTYPE: 121 | ** 122 | ** Insert_Object(struct OBJECT *obj) 123 | ** 124 | ** obj: OBJECT structure, modify, by reference 125 | ** 126 | ** IMPLICIT INPUTS: None. 127 | ** 128 | ** IMPLICIT OUTPUTS: None. 129 | ** 130 | ** COMPLETION CODES: None. 131 | ** 132 | ** SIDE EFFECTS: None. 133 | ** 134 | **-- 135 | */ 136 | void Insert_Object (struct OBJECT *obj) { 137 | 138 | static int one = 1; 139 | struct OBJECT *tree_node; 140 | 141 | lib$insert_tree(&objtree, obj, &one, node_compare, 142 | node_alloc, &tree_node, obj); 143 | 144 | } /* Insert_Object */ 145 | 146 | /* 147 | **++ 148 | ** ROUTINE: node_compare 149 | ** 150 | ** FUNCTIONAL DESCRIPTION: 151 | ** 152 | ** Comparison routine used by LIB$INSERT_TREE. Order is based 153 | ** on type and object name. For library modules, the "object name" 154 | ** incorporates both the library name and the module name. 155 | ** 156 | ** RETURNS: int 157 | ** 158 | ** PROTOTYPE: 159 | ** 160 | ** node_compare(struct OBJECT *s, struct OBJECT *obj, int dummy) 161 | ** 162 | ** s: OBJECT structure, read only, by reference 163 | ** obj: OBJECT structure, read only, by reference 164 | ** dummy: not used 165 | ** 166 | ** IMPLICIT INPUTS: None. 167 | ** 168 | ** IMPLICIT OUTPUTS: None. 169 | ** 170 | ** COMPLETION CODES: 171 | ** >0: s is greater than obj->objnam 172 | ** 0: s equals obj->objnam 173 | ** <0: s is less than obj->objnam 174 | ** 175 | ** SIDE EFFECTS: None. 176 | ** 177 | **-- 178 | */ 179 | static int node_compare (struct OBJECT *s, struct OBJECT *obj, int d) { 180 | 181 | if (s->type != obj->type) return (s->type - obj->type); 182 | 183 | if (s->type == MMK_K_OBJ_LIBMOD) { 184 | int i; 185 | i = strcmp(s->libfile->name, obj->libfile->name); 186 | if (i == 0) i = strcmp(s->name, obj->name); 187 | return i; 188 | } 189 | 190 | return strcmp(s->name, obj->name); 191 | 192 | } /* node_compare */ 193 | 194 | /* 195 | **++ 196 | ** ROUTINE: node_alloc 197 | ** 198 | ** FUNCTIONAL DESCRIPTION: 199 | ** 200 | ** Tree node allocation routine used by LIB$INSERT_TREE. Since 201 | ** the OBJECT structure we're adding was already allocated by Insert_Object's 202 | ** caller, we just copy the pointer over so LIB$INSERT_TREE can use it. 203 | ** 204 | ** RETURNS: cond_value, longword (unsigned), write only, by value 205 | ** 206 | ** PROTOTYPE: 207 | ** 208 | ** node_alloc(char *str, struct OBJECT **onode, struct OBJECT *obj) 209 | ** 210 | ** str: not used 211 | ** onode: pointer to OBJECT structure, write only, by reference 212 | ** obj: OBJECT structure, read only, by reference 213 | ** 214 | ** IMPLICIT INPUTS: None. 215 | ** 216 | ** IMPLICIT OUTPUTS: None. 217 | ** 218 | ** COMPLETION CODES: 219 | ** SS$_NORMAL: Always returned. 220 | ** 221 | ** SIDE EFFECTS: None. 222 | ** 223 | **-- 224 | */ 225 | static unsigned int node_alloc (char *str, struct OBJECT **onode, struct OBJECT *obj) { 226 | 227 | *onode = obj; 228 | return SS$_NORMAL; 229 | 230 | } /* node_alloc */ 231 | -------------------------------------------------------------------------------- /default_rules.c: -------------------------------------------------------------------------------- 1 | /* 2 | **++ 3 | ** FACILITY: MMK 4 | ** 5 | ** ABSTRACT: Map the default rules. 6 | ** 7 | ** MODULE DESCRIPTION: 8 | ** 9 | ** Builds the symbols, rules, and suffixes lists from the 10 | ** default rules compiled using MMK_COMPILE_RULES. 11 | ** 12 | ** AUTHOR: M. Madison 13 | ** 14 | ** Copyright (c) 2008, Matthew Madison. 15 | ** 16 | ** All rights reserved. 17 | ** 18 | ** Redistribution and use in source and binary forms, with or without 19 | ** modification, are permitted provided that the following conditions 20 | ** are met: 21 | ** 22 | ** * Redistributions of source code must retain the above 23 | ** copyright notice, this list of conditions and the following 24 | ** disclaimer. 25 | ** * Redistributions in binary form must reproduce the above 26 | ** copyright notice, this list of conditions and the following 27 | ** disclaimer in the documentation and/or other materials provided 28 | ** with the distribution. 29 | ** * Neither the name of the copyright owner nor the names of any 30 | ** other contributors may be used to endorse or promote products 31 | ** derived from this software without specific prior written 32 | ** permission. 33 | ** 34 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 35 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 36 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 37 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 38 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 39 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 40 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 41 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 42 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 43 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 44 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 45 | ** 46 | ** CREATION DATE: 30-APR-1993 47 | ** 48 | ** MODIFICATION HISTORY: 49 | ** 50 | ** 30-APR-1993 V1.0 Madison Initial coding. 51 | ** 04-JUN-1993 V1.1 Madison Default rule support. 52 | ** 21-JUN-1995 V1.2 Madison Symbol table revamp. 53 | ** 27-DEC-1998 V1.2-1 Madison General cleanup. 54 | ** 03-MAY-2004 V1.3 Madison Integrate IA64 changes. 55 | **-- 56 | */ 57 | #pragma module DEFAULT_RULES "V1.3" 58 | #include "mmk.h" 59 | #include "globals.h" 60 | #include "etc_dir:mmk_default_rules.h" 61 | 62 | /* 63 | **++ 64 | ** ROUTINE: Map_Default_Rules 65 | ** 66 | ** FUNCTIONAL DESCRIPTION: 67 | ** 68 | ** Builds the symbols, rules, and suffixes lists from the 69 | ** default rules compiled using MMK_COMPILE_RULES. 70 | ** 71 | ** RETURNS: cond_value, longword (unsigned), write only, by value 72 | ** 73 | ** PROTOTYPE: 74 | ** 75 | ** Map_Default_Rules(); 76 | ** 77 | ** IMPLICIT INPUTS: None. 78 | ** 79 | ** IMPLICIT OUTPUTS: None. 80 | ** 81 | ** COMPLETION CODES: None. 82 | ** 83 | ** SIDE EFFECTS: None. 84 | ** 85 | **-- 86 | */ 87 | void Map_Default_Rules (void) { 88 | 89 | int i, j, next_rule, last_rule; 90 | char *cp; 91 | 92 | if (SFX_INIT_COUNT > 0) { 93 | suffixes.flink = &sfx_init[0]; 94 | suffixes.blink = &sfx_init[SFX_INIT_COUNT-1]; 95 | sfx_init[0].flink = (SFX_INIT_COUNT > 1 ? &sfx_init[1] : &suffixes); 96 | sfx_init[0].blink = (struct SFX *) &suffixes; 97 | sfx_init[SFX_INIT_COUNT-1].flink = &suffixes; 98 | sfx_init[SFX_INIT_COUNT-1].blink = 99 | (SFX_INIT_COUNT > 1 ? &sfx_init[SFX_INIT_COUNT-2] : 100 | (struct SFX *) &suffixes); 101 | for (i = 1; i < SFX_INIT_COUNT-1; i++) { 102 | sfx_init[i].flink = &sfx_init[i+1]; 103 | sfx_init[i].blink = &sfx_init[i-1]; 104 | } 105 | } 106 | 107 | if (GSYM_INIT_COUNT > 0) { 108 | unsigned int hash_value; 109 | unsigned char *cp; 110 | int i; 111 | 112 | for (i = 0; i < GSYM_INIT_COUNT; i++) { 113 | hash_value = 0; 114 | for (cp = (unsigned char *) gsym_init[i].name, j = 0; 115 | *cp != '\0' && j < 4; cp++, j++) { 116 | hash_value |= *cp; 117 | } 118 | hash_value &= 0xff; 119 | queue_insert(&gsym_init[i], 120 | builtin_symbols.symlist[hash_value].tail); 121 | } 122 | } 123 | 124 | if (RULE_INIT_COUNT > 0) { 125 | rules.flink = &rule_init[0]; 126 | rules.blink = &rule_init[RULE_REAL_LAST_IDX]; 127 | last_rule = i = 0; 128 | while (i < RULE_INIT_COUNT) { 129 | if (rule_init[i].next != 0) { 130 | for (j = i+1; j < RULE_INIT_COUNT; j++) { 131 | rule_init[j-1].next = &rule_init[j]; 132 | rule_init[j-1].parent = &rule_init[i]; 133 | if (rule_init[j].next == 0) break; 134 | } 135 | next_rule = j + 1; 136 | } else { 137 | next_rule = i + 1; 138 | } 139 | if (i == 0) { 140 | rule_init[i].flink = (RULE_INIT_COUNT_REAL > 1 ? &rule_init[next_rule] : 141 | (struct RULE *) &rules); 142 | rule_init[i].blink = (struct RULE *) &rules; 143 | } else if (i == RULE_REAL_LAST_IDX) { 144 | rule_init[i].flink = &rules; 145 | rule_init[i].blink = 146 | (RULE_INIT_COUNT_REAL > 1 ? &rule_init[last_rule] : 147 | (struct RULE *) &rules); 148 | } else { 149 | rule_init[i].flink = &rule_init[next_rule]; 150 | rule_init[i].blink = &rule_init[last_rule]; 151 | } 152 | 153 | if (rule_init[i].cmdque.flags > 0) { 154 | struct CMD *cmd_init = rule_init[i].cmdque.flink; 155 | for (j = 0; j < rule_init[i].cmdque.flags; j++) { 156 | if (j == 0) { 157 | cmd_init[j].flink = 158 | (rule_init[i].cmdque.flags > 1 ? &cmd_init[1] : 159 | &rule_init[i].cmdque); 160 | cmd_init[j].blink = &rule_init[i].cmdque; 161 | } else if (j == rule_init[i].cmdque.flags-1) { 162 | cmd_init[j].flink = &rule_init[i].cmdque; 163 | cmd_init[j].blink = 164 | (rule_init[i].cmdque.flags > 1 ? &cmd_init[j-1] : 165 | &rule_init[i].cmdque); 166 | rule_init[i].cmdque.blink = &cmd_init[j]; 167 | } else { 168 | cmd_init[j].flink = &cmd_init[j+1]; 169 | cmd_init[j].blink = &cmd_init[j-1]; 170 | } 171 | } 172 | } 173 | last_rule = i; 174 | i = next_rule; 175 | } 176 | } 177 | 178 | #ifdef DEFAULT_RULE_EXISTS 179 | default_rule = &default_rule_init; 180 | if (default_rule_init.cmdque.flags > 0) { 181 | struct CMD *cmd_init = default_rule_init.cmdque.flink; 182 | for (j = 0; j < default_rule_init.cmdque.flags; j++) { 183 | if (j == 0) { 184 | cmd_init[j].flink = 185 | (default_rule_init.cmdque.flags > 1 ? &cmd_init[1] : 186 | &default_rule_init.cmdque); 187 | cmd_init[j].blink = &default_rule_init.cmdque; 188 | } else if (j == default_rule_init.cmdque.flags-1) { 189 | cmd_init[j].flink = &default_rule_init.cmdque; 190 | cmd_init[j].blink = 191 | (default_rule_init.cmdque.flags > 1 ? &cmd_init[j-1] : 192 | &default_rule_init.cmdque); 193 | default_rule_init.cmdque.blink = &cmd_init[j]; 194 | } else { 195 | cmd_init[j].flink = &cmd_init[j+1]; 196 | cmd_init[j].blink = &cmd_init[j-1]; 197 | } 198 | } 199 | } 200 | #endif /* DEFAULT_RULE_EXISTS */ 201 | 202 | return; 203 | 204 | } /* Map_Default_Rules */ 205 | -------------------------------------------------------------------------------- /mmk_help.rnh: -------------------------------------------------------------------------------- 1 | .!++ 2 | .! 3 | .! NAME: MMK_HELP.RNH 4 | .! 5 | .! ABSTRACT: MMK help file. 6 | .! 7 | .! FACILITY: MMK Make Utility 8 | .! 9 | .! DESCRIPTION: 10 | .! 11 | .! This is the RUNOFF source for the help library for MMK. 12 | .! To create the help library, use the following commands: 13 | .! 14 | .! $ RUNOFF MMK_HELP.RNH 15 | .! $ LIB/CREATE/HELP MMK_HELP MMK_HELP 16 | .! 17 | .! AUTHOR: M. Madison 18 | .! Copyright (c) 2008, Matthew Madison. 19 | .! Copyright (c) 2013, Endless Software Solutions. 20 | .! 21 | .! All rights reserved. 22 | .! 23 | .! Redistribution and use in source and binary forms, with or without 24 | .! modification, are permitted provided that the following conditions 25 | .! are met: 26 | .! 27 | .! * Redistributions of source code must retain the above 28 | .! copyright notice, this list of conditions and the following 29 | .! disclaimer. 30 | .! * Redistributions in binary form must reproduce the above 31 | .! copyright notice, this list of conditions and the following 32 | .! disclaimer in the documentation and/or other materials provided 33 | .! with the distribution. 34 | .! * Neither the name of the copyright owner nor the names of any 35 | .! other contributors may be used to endorse or promote products 36 | .! derived from this software without specific prior written 37 | .! permission. 38 | .! 39 | .! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 40 | .! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 41 | .! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 42 | .! A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 43 | .! OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 44 | .! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 45 | .! LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 46 | .! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 47 | .! THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 48 | .! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 49 | .! OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 50 | .! 51 | .! MODIFICATION HISTORY: 52 | .! 53 | .! 16-SEP-1993 V1.0 Madison Initial coding. 54 | .! 17-OCT-1993 V1.1 Madison Add /KEEP_INTERMEDIATES 55 | .! 21-JUN-1994 V1.2 Madison Multiple targets, remove /KEEP. 56 | .! 05-JUL-1994 V1.3 Madison CMS. 57 | .! 23-JUL-1994 V1.4 Madison /DUMP. 58 | .! 21-JUN-1995 V1.5 Madison /SKIP, /CHECK, /MACRO (change), /OVERRIDE. 59 | .! 22-AUG-1996 V1.6 Madison Add /CMS_LIBRARY. 60 | .! 06-JUN-1998 V1.7 Madison Add /WORKING_DIRECTORY 61 | .! 28-DEC-1998 V1.7-1 Madison /CMS_LIBRARY takes a list now. 62 | .! 19-FEB-2013 V1.8 Sneddon /VERIFY now supports ALL keyword. 63 | .!-- 64 | .P0 65 | .AP 66 | .LM1 67 | .RM70 68 | .I-1 69 | 1 MMK 70 | Invokes the MMK Make Utility to build a software system. 71 | Refer to the "Guide to MMK Make Utility" for complete information 72 | on this command. 73 | .NJ 74 | Format: 75 | 76 | .I+10;MMK [target-name...] 77 | .J 78 | A description file must exist for MMK to build the software system. By 79 | default, MMK looks for a description file called DESCRIP.MMS in the current 80 | default directory. If that file does not exist, it then looks for a file 81 | called MAKEFILE. The /DESCRIPTION qualifier can be used to override this 82 | default. 83 | .I-1 84 | 2 Parameter 85 | target-name 86 | The name of a target to be built. The target must exist in the MMK 87 | description file. Multiple targets may be specified as a comma-separated 88 | list. 89 | .I-1 90 | 2 Qualifiers 91 | .I-1 92 | /ACTION 93 | /ACTION (default) 94 | /NOACTION 95 | Determines whether action lines should be executed or merely displayed. 96 | Specifying /NOACTION causes MMK to display the action lines that would 97 | be executed to build the target, without actually executing them. 98 | .I-1 99 | /CHECK__STATUS 100 | /CHECK__STATUS 101 | /NOCHECK__STATUS (default) 102 | Directs MMK to determine whether a target is up-to-date, without executing 103 | any action lines to do so. MMK sets the global symbol MMS$STATUS to 0 if 104 | the target requires updating, or 1 if the target is up-to-date. This qualifier 105 | overrides the /ACTION qualifier. 106 | .I-1 107 | /CMS 108 | /CMS 109 | /NOCMS (default) 110 | Determines whether a DEC/Code Management System (CMS) library is automatically 111 | searched for the MMK description file and for any source files. 112 | The default is /NOCMS, which omits any CMS checks. 113 | .I-1 114 | /CMS__LIBRARY 115 | /CMS__LIBRARY=(dir-spec...) 116 | Specifies one or more DEC/Code Management System (CMS) libraries to be searched for the 117 | MMK description file and for any source files that do not have explicit 118 | CMS library specifications. Effective only when /CMS is also specified. 119 | If omitted, the default CMS library or libraries (from the logical name CMS$LIB or 120 | the CMS SET LIBRARY command) are used. 121 | .I-1 122 | /DESCRIPTION 123 | /DESCRIPTION=file-spec 124 | Specifies an alternative name for the MMK description file. The default 125 | description file name is DESCRIP.MMS (in the current default directory). 126 | .I-1 127 | /DUMP 128 | /DUMP 129 | /NODUMP (default) 130 | Causes MMK to dump the suffixes list, all macro definitions, all 131 | inference rules, and all dependencies to current output. Useful for 132 | debugging problems in description files. 133 | .I-1 134 | /FORCE 135 | /FORCE 136 | /NOFORCE (default) 137 | Specifying /FORCE causes MMK to execute only the action lines from the 138 | dependency rule for the target, without performing any revision date checks 139 | and without traversing the entire dependency tree. 140 | .I-1 141 | /FROM__SOURCE 142 | /FROM__SOURCES 143 | /NOFROM__SOURCES (default) 144 | Specifying /FROM__SOURCES causes MMK to perform a complete build of the 145 | target, without performing any revision date checks. All actions to build 146 | all intermediate targets will be executed. This qualifier overrides the 147 | /SKIP__INTERMEDIATES qualifier. 148 | .I-1 149 | /IDENTIFICATION 150 | /IDENTIFICATION 151 | Specifying /IDENTIFICATION causes MMK to display its revision information 152 | and copyright message, without performing any other action. 153 | .I-1 154 | /IGNORE 155 | /IGNORE 156 | /IGNORE=ERROR 157 | /IGNORE=FATAL 158 | /IGNORE=WARNING 159 | /NOIGNORE (default) 160 | By default, MMK stops when an executed action line results in a warning, 161 | error, or fatal error status. You can override this with the /IGNORE 162 | qualifier. Specifying /IGNORE or /IGNORE=FATAL causes all errors to be 163 | ignored, so execution continues no matter how severe an error is encountered. 164 | Specifying /IGNORE=ERROR causes errors and warnings to be ignored, with 165 | fatal errors stopping execution. Specifying /IGNORE=WARNING causes only 166 | warnings to be ignored, with errors at fatal errors stopping execution. 167 | .I-1 168 | /LOCAL__RULES 169 | /LOCAL__RULES (default) 170 | /NOLOCAL__RULES 171 | Controls whether the site-specific default dependency rule definition file 172 | is read in; by default, it is if the logical name MMK__LOCAL__RULES exists. 173 | Specifying /NOLOCAL__RULES prevents the file from being read in. 174 | .I-1 175 | /LOG 176 | /LOG 177 | /NOLOG (default) 178 | Controls whether MMK logs a detailed description of activity. 179 | By default, it does not. 180 | .I-1 181 | /MACRO 182 | /MACRO=file-spec | name[=value]... 183 | Defines one or more macros that can be referenced by the description file. 184 | If a name is specified with no equals sign ("="), it is first assumed to 185 | be a file specification; if the file exists, macro definitions are read 186 | from the file. A file type of .MMS is assumed if no file type is specified. 187 | If the file cannot be found, the name is treated as macro definition, and 188 | a value of 1 is assigned to the macro by default. 189 | If an equals sign is present, the macro definition is taken directly from 190 | the command line. 191 | Macro definitions contained in a file should have the same syntax as macro 192 | definitions in description files, with the added restrictions that comments 193 | and line continuations are not allowed. 194 | .I-1 195 | /OUTPUT 196 | /OUTPUT=file-spec 197 | Directs MMK output to the specified file. By default, output is directed 198 | to SYS$OUTPUT. 199 | .I-1 200 | /OVERRIDE 201 | /OVERRIDE 202 | /NOOVERRIDE (default) 203 | Determines the order in which macro references are resolved. The default 204 | order is to resolve macros from command-line definitions, followed by 205 | definitions in the description file and any rules files, followed by MMK 206 | built-ins. If a macro cannot be resolved from any of these sources, a check 207 | is made for a DCL symbol with the same name as the macro, and if present, the 208 | symbol's value is used. 209 | When /OVERRIDE is specified, DCL symbols are checked before the macro 210 | definitions in the description and rules files, and before the MMK built-in 211 | macros. 212 | .I-1 213 | /RULES__FILE 214 | /RULES__FILE 215 | /RULES__FILE=file-spec 216 | /RULES__FILE=(file-spec1,file-spec2,...) 217 | /NORULES__FILE (default) 218 | Specifies the name of one or more files containing default dependency rule 219 | definitions to be read in before the description file is processed. If 220 | /RULES__FILE is specified with no file specification, the name MMS$RULES 221 | is used. 222 | .I-1 223 | /SKIP__INTERMEDIATES 224 | /SKIP__INTERMEDIATES 225 | /NOSKIP__INTERMEDIATES (default) 226 | By default, MMK attempts to build missing source files if they 227 | can be built through the application of dependency or inference rules. 228 | Specifying /SKIP__INTERMEDIATES causes MMK to treat these missing sources 229 | as if they exist and have the same revision date/time stamp as the target 230 | that depends on them. 231 | For example, if the target is a .EXE file which depends on a .OBJ file, 232 | and that .OBJ file in turn depends on a .C file, by default MMK will build 233 | the .OBJ file if it is missing, and then in turn build the .EXE. If 234 | /SKIP__INTERMEDIATES is specified, the missing .OBJ file will not trigger 235 | a build; the build will only occur if the .C file is newer than the .EXE 236 | file. 237 | .I-1 238 | /VERIFY 239 | /VERIFY (default) 240 | /VERIFY=ALL 241 | /NOVERIFY 242 | Controls whether MMK echoes the action lines it is executing to SYS$OUTPUT. 243 | By default, it does; /NOVERIFY can be used to suppress this output. 244 | As an added feature to make debugging large description files easier, it 245 | is possible to specify the keyword ALL and force all action commands to 246 | verify, even those prefixed with '@'. 247 | .I-1 248 | /WORKING__DIRECTORY=dir-spec 249 | /WORKING__DIRECTORY=dir-spec 250 | Causes MMK to SET DEFAULT to the specified device and directory before 251 | processing the description file or any rules. 252 | -------------------------------------------------------------------------------- /get_rdt.c: -------------------------------------------------------------------------------- 1 | /* 2 | **++ 3 | ** FACILITY: MMK 4 | ** 5 | ** ABSTRACT: Revision date/time routines 6 | ** 7 | ** MODULE DESCRIPTION: 8 | ** 9 | ** This module contains routines that obtain the RDT for 10 | ** MMS objects (mainly for library modules). 11 | ** 12 | ** AUTHOR: M. Madison 13 | ** 14 | ** Copyright (c) 2008, Matthew Madison. 15 | ** Copyright (c) 2012, Endless Software Solutions. 16 | ** 17 | ** All rights reserved. 18 | ** 19 | ** Redistribution and use in source and binary forms, with or without 20 | ** modification, are permitted provided that the following conditions 21 | ** are met: 22 | ** 23 | ** * Redistributions of source code must retain the above 24 | ** copyright notice, this list of conditions and the following 25 | ** disclaimer. 26 | ** * Redistributions in binary form must reproduce the above 27 | ** copyright notice, this list of conditions and the following 28 | ** disclaimer in the documentation and/or other materials provided 29 | ** with the distribution. 30 | ** * Neither the name of the copyright owner nor the names of any 31 | ** other contributors may be used to endorse or promote products 32 | ** derived from this software without specific prior written 33 | ** permission. 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 46 | ** 47 | ** CREATION DATE: 21-AUG-1992 48 | ** 49 | ** MODIFICATION HISTORY: 50 | ** 51 | ** 21-AUG-1992 V1.0 Madison Initial coding. 52 | ** 27-AUG-1992 V1.1 Madison Comments, cleanup. 53 | ** 12-SEP-1992 V1.1-1 Madison Cache RDT's. 54 | ** 09-APR-1993 V1.1-2 Madison Comments. 55 | ** 01-JUL-1994 V1.2 Madison Update for CMS. 56 | ** 12-JUL-1994 V1.2-1 Madison Set RDT to zero on failure. 57 | ** 17-JUL-1995 V1.2-2 Madison Set have_rdt flag if successful. 58 | ** 06-NOV-1995 V1.2-3 Madison Don't open too many libraries. 59 | ** 27-DEC-1998 V1.3 Madison General cleanup. 60 | ** 07-AUG-2010 V1.4 Berryman Made Library module lookups case insensitive 61 | **-- 62 | */ 63 | #pragma module GET_RDT "V1.4" 64 | #include "mmk.h" 65 | #include 66 | #include 67 | #include 68 | 69 | /* 70 | ** Forward declarations 71 | */ 72 | unsigned int lbr_get_rdt(char *, char *, TIME *); 73 | void lbr_flush(void); 74 | 75 | /* 76 | ** Context structure and header for the list that tracks them 77 | */ 78 | 79 | struct LBR { 80 | struct LBR *flink, *blink; 81 | struct NAM nam; 82 | unsigned int lbrctx; 83 | char espec[256]; 84 | char rspec[256]; 85 | }; 86 | 87 | static struct QUE lbrque = {&lbrque, &lbrque}; 88 | static int lbrcount = 0; 89 | 90 | static struct dsc$descriptor *mod2search4; 91 | static unsigned short *return_rfa_here; 92 | 93 | /* 94 | ** External references 95 | */ 96 | extern unsigned int lbr$ini_control(), lbr$open(), lbr$lookup_key(); 97 | extern unsigned int lbr$set_module(), lbr$close(), lbr$get_index(); 98 | 99 | #pragma nostandard 100 | globalvalue unsigned int LBR$_HDRTRUNC; 101 | #pragma standard 102 | 103 | 104 | /* 105 | **++ 106 | ** ROUTINE: caseblindsearch 107 | ** 108 | ** FUNCTIONAL DESCRIPTION: 109 | ** 110 | ** Support routine for lbr$get_index 111 | ** 112 | ** RETURNS: !cond_value, longword (unsigned), write only, by value 113 | ** 114 | ** Because lbr$get_index requires a success code from this 115 | ** routine to continue searching, this routine must return 116 | ** opposite condition values. It returns a 1 for failure 117 | ** (which means get_index would have returned every module 118 | ** in the library and none matched) and a 2 for success 119 | ** (any value with the low bit clear would work). 120 | ** 121 | ** PROTOTYPE: 122 | ** 123 | ** caseblindsearch(struct dsc$descriptor *module_name, unsigned short *rfa) 124 | ** 125 | ** module_name: ASCID descriptor naming module returned by get_index, 126 | ** read only, by reference 127 | ** rfa: RFA of this module, read only, by reference 128 | ** 129 | ** IMPLICIT INPUTS: static variables mod2search4 and return_rfa_here 130 | ** 131 | ** IMPLICIT OUTPUTS: None. 132 | ** 133 | ** COMPLETION CODES: See returns description 134 | ** 135 | ** SIDE EFFECTS: None. 136 | ** 137 | **-- 138 | */ 139 | unsigned int caseblindsearch(struct dsc$descriptor *module_name, 140 | unsigned short *rfa) { 141 | 142 | if (!str$case_blind_compare(module_name, mod2search4)) { 143 | memcpy(return_rfa_here, rfa, sizeof(unsigned short[3]));/* sizeof rfa in lbr_get_rdt */ 144 | return 2; /* tell lbr$get_index to stop searching */ 145 | } /* and return 2 to the caller of lbr$get_index */ 146 | return 1; /* this one didn't match, tell lbr$get_index to keep searching */ 147 | } /* if no more modules in library, caller will get the 1 */ 148 | 149 | /* 150 | **++ 151 | ** ROUTINE: lbr_get_rdt 152 | ** 153 | ** FUNCTIONAL DESCRIPTION: 154 | ** 155 | ** Gets the RDT of a library module. 156 | ** 157 | ** RETURNS: cond_value, longword (unsigned), write only, by value 158 | ** 159 | ** PROTOTYPE: 160 | ** 161 | ** lbr_get_rdt(char *libfile, char *module, TIME *rdt); 162 | ** 163 | ** libfile: ASCIZ_string, read only, by reference 164 | ** module: ASCIZ_string, read only, by reference 165 | ** rdt: date_time, quadword (signed), write only, by reference 166 | ** 167 | ** IMPLICIT INPUTS: None. 168 | ** 169 | ** IMPLICIT OUTPUTS: None. 170 | ** 171 | ** COMPLETION CODES: Any from the LBR$ routines. 172 | ** 173 | ** SIDE EFFECTS: lbrque modified. 174 | ** 175 | **-- 176 | */ 177 | unsigned int lbr_get_rdt (char *lib, char *mod, TIME *rdt) { 178 | 179 | unsigned int lbrfunc=LBR$C_READ, lbr$c_knf = 0x08680F2, libidx = 1; 180 | char real_name[256]; 181 | unsigned char fid[28]; 182 | struct dsc$descriptor libdsc, moddsc; 183 | struct LBR *lbr; 184 | unsigned int status, len; 185 | unsigned short rfa[3]; 186 | struct mhddef mhd; 187 | 188 | /* 189 | ** First look up the library file 190 | */ 191 | status = file_find(lib, 0, real_name, fid); 192 | if (!OK(status)) return status; 193 | 194 | /* 195 | ** Already open? 196 | */ 197 | for (lbr = (struct LBR *)lbrque.head; lbr != (struct LBR *)&lbrque; 198 | lbr = lbr->flink) { 199 | if (memcmp(fid, &lbr->nam.nam$t_dvi, 28) == 0) break; 200 | } 201 | 202 | /* 203 | ** If not open yet, construct a context block and open it. 204 | */ 205 | if (lbr == (struct LBR *) &lbrque) { 206 | /* 207 | ** Already have max number of libraries open? If so, close one. 208 | */ 209 | if (lbrcount >= LBR$C_MAXCTL) { 210 | queue_remove(lbrque.head, &lbr); 211 | lbr$close(&lbr->lbrctx); 212 | lbrcount -= 1; 213 | } else { 214 | lbr = malloc(sizeof(struct LBR)); 215 | } 216 | queue_insert(lbr, lbrque.tail); 217 | lbr->lbrctx = 0; 218 | lbr->nam = cc$rms_nam; 219 | lbr->nam.nam$b_rss = sizeof(lbr->rspec)-1; 220 | lbr->nam.nam$b_ess = sizeof(lbr->espec)-1; 221 | lbr->nam.nam$l_esa = lbr->espec; 222 | lbr->nam.nam$l_rsa = lbr->rspec; 223 | status = lbr$ini_control(&lbr->lbrctx, &lbrfunc, 0, &lbr->nam); 224 | if (!OK(status)) lib$signal(status); 225 | INIT_SDESC(libdsc, strlen(real_name), real_name); 226 | status = lbr$open(&lbr->lbrctx, &libdsc); 227 | if (!OK(status)) return status; 228 | lbrcount += 1; 229 | } 230 | 231 | /* 232 | ** Look up the module in question... 233 | */ 234 | INIT_SDESC(moddsc, strlen(mod), mod); 235 | /* status = lbr$lookup_key(&lbr->lbrctx, &moddsc, rfa); */ 236 | mod2search4 = &moddsc; 237 | return_rfa_here = rfa; 238 | status = lbr$get_index(&lbr->lbrctx, &libidx, &caseblindsearch); 239 | if (status != 2) return lbr$c_knf; /* caseblindsearch returns 2 on success, 1 on failure */ 240 | 241 | /* 242 | ** ... and get the RDT from the module header 243 | */ 244 | INIT_SDESC(moddsc, sizeof(mhd), &mhd); 245 | status = lbr$set_module(&lbr->lbrctx, rfa, &moddsc, &len); 246 | if (!OK(status) && (status != LBR$_HDRTRUNC)) lib$signal(status); 247 | memcpy(rdt, &mhd.mhd$l_datim, 8); 248 | return SS$_NORMAL; 249 | 250 | } 251 | 252 | /* 253 | **++ 254 | ** ROUTINE: lbr_flush 255 | ** 256 | ** FUNCTIONAL DESCRIPTION: 257 | ** 258 | ** Closes any libraries we have left open. 259 | ** 260 | ** RETURNS: cond_value, longword (unsigned), write only, by value 261 | ** 262 | ** PROTOTYPE: 263 | ** 264 | ** lbr_flush() 265 | ** 266 | ** IMPLICIT INPUTS: None. 267 | ** 268 | ** IMPLICIT OUTPUTS: None. 269 | ** 270 | ** COMPLETION CODES: Any from LBR$ routines. 271 | ** 272 | ** SIDE EFFECTS: lbrque modified. 273 | ** 274 | **-- 275 | */ 276 | void lbr_flush (void) { 277 | 278 | struct LBR *lbr; 279 | 280 | while (queue_remove(lbrque.head, &lbr)) { 281 | lbr$close(&lbr->lbrctx); 282 | free(lbr); 283 | } 284 | lbrcount = 0; 285 | } 286 | 287 | /* 288 | **++ 289 | ** ROUTINE: get_rdt 290 | ** 291 | ** FUNCTIONAL DESCRIPTION: 292 | ** 293 | ** Generic RDT fetch routine for MMS objects. Fills in the 294 | ** RDT field in the object structure. 295 | ** 296 | ** RETURNS: cond_value, longword (unsigned), write only, by value 297 | ** 298 | ** PROTOTYPE: 299 | ** 300 | ** get_rdt(struct OBJECT *obj) 301 | ** 302 | ** obj: OBJECT structure, modify, by reference 303 | ** 304 | ** IMPLICIT INPUTS: None. 305 | ** 306 | ** IMPLICIT OUTPUTS: None. 307 | ** 308 | ** COMPLETION CODES: Any from file_get_rdt or lbr_get_rdt 309 | ** 0: object is not "tangible" - no revision date 310 | ** 311 | ** SIDE EFFECTS: None. 312 | ** 313 | **-- 314 | */ 315 | unsigned int get_rdt (struct OBJECT *obj) { 316 | 317 | unsigned int status; 318 | 319 | if (obj->have_rdt) return SS$_NORMAL; 320 | 321 | memset(&obj->rdt, 0, sizeof(obj->rdt)); 322 | 323 | switch (obj->type) { 324 | case MMK_K_OBJ_FILE: 325 | case MMK_K_OBJ_LIB: 326 | status = file_get_rdt(obj->name, &obj->rdt); 327 | break; 328 | case MMK_K_OBJ_LIBMOD: 329 | status = lbr_get_rdt(obj->libfile->name, obj->name, &obj->rdt); 330 | break; 331 | case MMK_K_OBJ_CMSFILE: 332 | status = cms_get_rdt(obj->name, obj->cms_gen, &obj->rdt); 333 | break; 334 | default: 335 | status = 0; 336 | break; 337 | } 338 | 339 | if (OK(status)) obj->have_rdt = 1; 340 | 341 | return status; 342 | } 343 | -------------------------------------------------------------------------------- /mmk_compile_rules.c: -------------------------------------------------------------------------------- 1 | /* 2 | **++ 3 | ** FACILITY: MMK 4 | ** 5 | ** ABSTRACT: MMK rules compiler. 6 | ** 7 | ** MODULE DESCRIPTION: 8 | ** 9 | ** This program parses the rules in an MMK rules file and converts them 10 | ** into C structures to be compiled and linked into the MMK utility. 11 | ** 12 | ** AUTHOR: M. Madison 13 | ** 14 | ** Copyright (c) 2008, Matthew Madison. 15 | ** Copyright (c) 2012, Endless Software Solutions. 16 | ** 17 | ** All rights reserved. 18 | ** 19 | ** Redistribution and use in source and binary forms, with or without 20 | ** modification, are permitted provided that the following conditions 21 | ** are met: 22 | ** 23 | ** * Redistributions of source code must retain the above 24 | ** copyright notice, this list of conditions and the following 25 | ** disclaimer. 26 | ** * Redistributions in binary form must reproduce the above 27 | ** copyright notice, this list of conditions and the following 28 | ** disclaimer in the documentation and/or other materials provided 29 | ** with the distribution. 30 | ** * Neither the name of the copyright owner nor the names of any 31 | ** other contributors may be used to endorse or promote products 32 | ** derived from this software without specific prior written 33 | ** permission. 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 46 | ** 47 | ** CREATION DATE: 30-APR-1993 48 | ** 49 | ** MODIFICATION HISTORY: 50 | ** 51 | ** 30-APR-1993 V1.0 Madison Initial coding. 52 | ** 17-OCT-1993 V1.1 Madison Update for MMK V2.2. 53 | ** 14-JUL-1994 V1.2 Madison Update for MMK V3.2. 54 | ** 22-AUG-1994 V1.2-1 Madison Update for MMK V3.2-2. 55 | ** 10-JAN-1995 V1.2-2 Madison Add put_command (for MMK V3.3-1). 56 | ** 21-JUN-1995 V1.3 Madison Changes for MMK V3.4. 57 | ** 22-DEC-1996 V1.4 Madison Changes for MMK V3.6. 58 | ** 27-DEC-1998 V1.5 Madison General cleanup. 59 | ** 03-MAY-2004 V1.6 Madison Integrate IA64 changes. 60 | ** 16-OCT-2008 V1.7 Sneddon Added new globals. 61 | ** 07-SEP-2012 V1.7-1 Sneddon Added temporary_symbols. 62 | **-- 63 | */ 64 | #define MMKC_VERSION "V1.7-1" 65 | #define MMKC_COPYRIGHT "Copyright (c) 2008, Matthew Madison.\n" \ 66 | " Copyright (c) 2012, Endless Software Solutions.\n" \ 67 | " See LICENSE.TXT in distribution kit for license information." 68 | 69 | #pragma module MMK_COMPILE_RULES MMKC_VERSION 70 | 71 | char $$$Copyright[] = MMKC_COPYRIGHT; 72 | char *Version = MMKC_VERSION, *Copyright = &$$$Copyright[0]; 73 | 74 | #include "mmk.h" 75 | #include "clidefs.h" 76 | 77 | /* 78 | ** Forward declarations 79 | */ 80 | unsigned int main(void); 81 | unsigned int put_output(void *); 82 | unsigned int put_command(void *); 83 | static unsigned int cli_get_value(char *, char *, int); 84 | static unsigned int cli_present(char *); 85 | 86 | /* 87 | ** Globals used throughout the program 88 | */ 89 | 90 | #pragma nostandard 91 | GLOBAL struct SYMTABLE global_symbols; 92 | GLOBAL struct SYMTABLE local_symbols; 93 | GLOBAL struct SYMTABLE cmdline_symbols; 94 | GLOBAL struct SYMTABLE builtin_symbols; 95 | GLOBAL struct SYMTABLE *temporary_symbols; 96 | GLOBAL struct RULE rules; 97 | GLOBAL struct RULE *default_rule = 0; 98 | GLOBAL struct DEPEND dependencies; 99 | GLOBAL struct DEPEND dep_internal; 100 | GLOBAL struct DEPEND dep_deferred; 101 | GLOBAL struct SFX suffixes; 102 | GLOBAL struct CMD do_first; 103 | GLOBAL struct CMD do_last; 104 | GLOBAL int verify, do_log, did_an_update, noaction, check_status; 105 | GLOBAL int builtins, case_sensitive, gnu_syntax, mms_syntax; 106 | GLOBAL int from_sources, force, ignore, use_cms, skip_intermediates; 107 | GLOBAL int override_silent, override_ignore, symbol_override; 108 | GLOBAL int override_builtins, override_case, override_gnu_syntax, override_mms_syntax; 109 | GLOBAL unsigned int exit_status; 110 | GLOBAL char cms$lib[256*16]; 111 | GLOBAL char cms_default_generation[256]; 112 | #pragma standard 113 | 114 | /* 115 | ** External references 116 | */ 117 | #ifndef __VAX 118 | extern mmk_compile_rules_cld; 119 | #else 120 | globalref mmk_compile_rules_cld; 121 | #endif 122 | #define MMK_COMPILE_RULES_CLD (&mmk_compile_rules_cld) 123 | void Generate_Structures(char *, char *); /* module GENSTRUC */ 124 | 125 | /* 126 | **++ 127 | ** ROUTINE: main 128 | ** 129 | ** FUNCTIONAL DESCRIPTION: 130 | ** 131 | ** Main program. Fetches the command from the command line, 132 | ** uses CLI$ routines to parse it, then starts the build process. 133 | ** 134 | ** RETURNS: cond_value, longword (unsigned), write only, by value 135 | ** 136 | ** PROTOTYPE: 137 | ** 138 | ** main 139 | ** 140 | ** IMPLICIT INPUTS: See global definitions at module head. 141 | ** 142 | ** IMPLICIT OUTPUTS: See global definitions at module head. 143 | ** 144 | ** COMPLETION CODES: 145 | ** 146 | ** SS$_NORMAL, MMK__ALLOK : normal successful completion. 147 | ** 148 | ** SIDE EFFECTS: None. 149 | ** 150 | **-- 151 | */ 152 | unsigned int main (void) { 153 | 154 | DESCRIP cmdstr; 155 | char Output_File[256], tmp[256]; 156 | $DESCRIPTOR(cmdname, "MMKC "); 157 | unsigned int status; 158 | int i; 159 | 160 | /* 161 | ** Initialize the globals 162 | */ 163 | temporary_symbols = 0; 164 | for (i = 0; i < MMK_K_SYMTABLE_SIZE; i++) { 165 | INIT_QUEUE(global_symbols.symlist[i]); 166 | INIT_QUEUE(local_symbols.symlist[i]); 167 | INIT_QUEUE(cmdline_symbols.symlist[i]); 168 | INIT_QUEUE(builtin_symbols.symlist[i]); 169 | } 170 | INIT_QUEUE(rules); 171 | INIT_QUEUE(dependencies); 172 | INIT_QUEUE(dep_internal); 173 | INIT_QUEUE(dep_deferred); 174 | INIT_QUEUE(suffixes); 175 | INIT_QUEUE(do_first); 176 | INIT_QUEUE(do_last); 177 | exit_status = SS$_NORMAL; 178 | ignore = override_silent = override_ignore = symbol_override = 0; 179 | skip_intermediates = 0; 180 | 181 | /* 182 | ** Fetch and parse command string 183 | */ 184 | INIT_DYNDESC(cmdstr); 185 | status = lib$get_foreign(&cmdstr); 186 | str$prefix(&cmdstr, &cmdname); 187 | status = cli$dcl_parse(&cmdstr, MMK_COMPILE_RULES_CLD, 188 | lib$get_input, lib$get_input); 189 | if (!OK(status)) return (status | STS$M_INHIB_MSG); 190 | 191 | /* 192 | ** Get the command parameters and qualifiers 193 | */ 194 | Output_File[0] = '\0'; 195 | if (cli_present("OUTPUT") == CLI$_PRESENT) { 196 | cli_get_value("OUTPUT", Output_File, sizeof(Output_File)); 197 | } 198 | 199 | status = cli_get_value("RULES_FILE", tmp, sizeof(tmp)); 200 | if (!OK(status)) return status | STS$M_INHIB_MSG; 201 | 202 | Read_Description(tmp, "SYS$DISK:[].MMS", 1); 203 | if (OK(exit_status)) Generate_Structures(tmp, Output_File); 204 | 205 | return exit_status | STS$M_INHIB_MSG; 206 | 207 | } 208 | 209 | /* 210 | **++ 211 | ** ROUTINE: cli_get_value 212 | ** 213 | ** FUNCTIONAL DESCRIPTION: 214 | ** 215 | ** C Interface to CLI$GET_VALUE. 216 | ** 217 | ** RETURNS: cond_value, longword (unsigned), write only, by value 218 | ** 219 | ** PROTOTYPE: 220 | ** 221 | ** cli_get_value (char *argname, DESCRIP *arg) 222 | ** 223 | ** argname: ASCIZ_string, read only, by reference 224 | ** arg: char_string, write only, by descriptor (dynamic) 225 | ** 226 | ** IMPLICIT INPUTS: None. 227 | ** 228 | ** IMPLICIT OUTPUTS: None. 229 | ** 230 | ** COMPLETION CODES: 231 | ** 232 | ** All those from CLI$PRESENT and CLI$GET_VALUE. 233 | ** 234 | ** SIDE EFFECTS: None. 235 | ** 236 | **-- 237 | */ 238 | static unsigned int cli_get_value (char *argname, char *arg, int argsize) { 239 | 240 | DESCRIP argnamd, argd; 241 | unsigned short arglen; 242 | int status; 243 | 244 | INIT_SDESC(argnamd, strlen(argname), argname); 245 | INIT_SDESC(argd, argsize-1, arg); 246 | status = cli$present(&argnamd); 247 | if ($VMS_STATUS_SUCCESS(status)) { 248 | status = cli$get_value(&argnamd, &argd, &arglen); 249 | if (OK(status)) *(arg+arglen) = '\0'; 250 | } 251 | return status; 252 | } 253 | 254 | /* 255 | **++ 256 | ** ROUTINE: put_output 257 | ** 258 | ** FUNCTIONAL DESCRIPTION: 259 | ** 260 | ** LIB$PUT_OUTPUT replacement that directs things either 261 | ** to SYS$OUTPUT or to the file specified in /OUTPUT. 262 | ** 263 | ** RETURNS: cond_value, longword (unsigned), write only, by value 264 | ** 265 | ** PROTOTYPE: 266 | ** 267 | ** put_output(struct dsc$descriptor *dsc) 268 | ** 269 | ** IMPLICIT INPUTS: None. 270 | ** 271 | ** IMPLICIT OUTPUTS: None. 272 | ** 273 | ** COMPLETION CODES: 274 | ** 275 | ** 276 | ** SIDE EFFECTS: None. 277 | ** 278 | **-- 279 | */ 280 | unsigned int put_output (void *dsc) { 281 | 282 | return lib$put_output(dsc); 283 | 284 | } /* put_output */ 285 | 286 | /* 287 | **++ 288 | ** ROUTINE: put_command 289 | ** 290 | ** FUNCTIONAL DESCRIPTION: 291 | ** 292 | ** LIB$PUT_OUTPUT replacement that directs things either 293 | ** to SYS$OUTPUT or to the file specified in /OUTPUT (for commands). 294 | ** 295 | ** RETURNS: cond_value, longword (unsigned), write only, by value 296 | ** 297 | ** PROTOTYPE: 298 | ** 299 | ** put_command(struct dsc$descriptor *dsc) 300 | ** 301 | ** IMPLICIT INPUTS: None. 302 | ** 303 | ** IMPLICIT OUTPUTS: None. 304 | ** 305 | ** COMPLETION CODES: 306 | ** 307 | ** 308 | ** SIDE EFFECTS: None. 309 | ** 310 | **-- 311 | */ 312 | unsigned int put_command (void *dsc) { 313 | 314 | return lib$put_output(dsc); 315 | 316 | } /* put_output */ 317 | 318 | /* 319 | **++ 320 | ** ROUTINE: cli_present 321 | ** 322 | ** FUNCTIONAL DESCRIPTION: 323 | ** 324 | ** C Interface to CLI$PRESENT. 325 | ** 326 | ** RETURNS: cond_value, intword (unsigned), write only, by value 327 | ** 328 | ** PROTOTYPE: 329 | ** 330 | ** cli_present (char *argname) 331 | ** 332 | ** argname: ASCIZ_string, read only, by reference 333 | ** 334 | ** IMPLICIT INPUTS: None. 335 | ** 336 | ** IMPLICIT OUTPUTS: None. 337 | ** 338 | ** COMPLETION CODES: 339 | ** 340 | ** All those from CLI$PRESENT. 341 | ** 342 | ** SIDE EFFECTS: None. 343 | ** 344 | **-- 345 | */ 346 | static unsigned int cli_present (char *argname) { 347 | 348 | DESCRIP argnamd; 349 | 350 | INIT_SDESC(argnamd, strlen(argname), argname); 351 | return cli$present(&argnamd); 352 | } 353 | -------------------------------------------------------------------------------- /genstruc.c: -------------------------------------------------------------------------------- 1 | /* 2 | **++ 3 | ** FACILITY: MMK_COMPILE_RULES 4 | ** 5 | ** ABSTRACT: Code to generate the C code for the initialization structures 6 | ** for compiled rules. 7 | ** 8 | ** MODULE DESCRIPTION: 9 | ** 10 | ** Generates C structure definitions for symbols, rules, and 11 | ** suffixes for use as the default rules compiled into MMK. 12 | ** 13 | ** AUTHOR: M. Madison 14 | ** 15 | ** Copyright (c) 2008, Matthew Madison. 16 | ** 17 | ** All rights reserved. 18 | ** 19 | ** Redistribution and use in source and binary forms, with or without 20 | ** modification, are permitted provided that the following conditions 21 | ** are met: 22 | ** 23 | ** * Redistributions of source code must retain the above 24 | ** copyright notice, this list of conditions and the following 25 | ** disclaimer. 26 | ** * Redistributions in binary form must reproduce the above 27 | ** copyright notice, this list of conditions and the following 28 | ** disclaimer in the documentation and/or other materials provided 29 | ** with the distribution. 30 | ** * Neither the name of the copyright owner nor the names of any 31 | ** other contributors may be used to endorse or promote products 32 | ** derived from this software without specific prior written 33 | ** permission. 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 46 | ** 47 | ** CREATION DATE: 30-APR-1993 48 | ** 49 | ** MODIFICATION HISTORY: 50 | ** 51 | ** 30-APR-1993 V1.0 Madison Initial coding. 52 | ** 04-JUN-1993 V1.1 Madison Add default rule support. 53 | ** 22-DEC-1996 V1.2 Madison Support for MMK V3.6. 54 | ** 27-DEC-1998 V1.2-1 Madison General cleanup. 55 | ** 03-JUN-2009 V1.3 Sneddon Added support for type in SYMBOL. 56 | **-- 57 | */ 58 | #pragma module GENSTRUC "V1.3" 59 | #include "mmk.h" 60 | #include "globals.h" 61 | #include 62 | 63 | /* 64 | ** Forward declarations 65 | */ 66 | void Generate_Structures(char *, char *); 67 | static void fix_string(char *, char *); 68 | 69 | /* 70 | ** External references 71 | */ 72 | extern char *Version, *Copyright; 73 | 74 | #define PUT(str) {char *cp = (str); file_write(unit, cp, strlen(cp));} 75 | 76 | 77 | /* 78 | **++ 79 | ** ROUTINE: Generate_Structures 80 | ** 81 | ** FUNCTIONAL DESCRIPTION: 82 | ** 83 | ** Generates C structure definitions for symbols, rules, and 84 | ** suffixes for use as the default rules compiled into MMK. 85 | ** 86 | ** RETURNS: cond_value, longword (unsigned), write only, by value 87 | ** 88 | ** PROTOTYPE: 89 | ** 90 | ** Generate_Structures(char *in, char *out) 91 | ** 92 | ** in: ASCIZ_string, read only, by reference 93 | ** out: ASCIZ_string, read only, by reference 94 | ** 95 | ** IMPLICIT INPUTS: suffixes, rules, global_symbols. 96 | ** 97 | ** IMPLICIT OUTPUTS: None. 98 | ** 99 | ** COMPLETION CODES: None. 100 | ** 101 | ** SIDE EFFECTS: None. 102 | ** 103 | **-- 104 | */ 105 | void Generate_Structures(char *infile, char *outfile) { 106 | 107 | static $DESCRIPTOR(hdr1, "** generated by MMK_COMPILE_RULES !AD !%D"); 108 | char tmp[256], tmp2[256], tmp3[256], tmp4[256], tmp5[256], *cp; 109 | struct dsc$descriptor dsc; 110 | struct SYMBOL *sym; 111 | struct RULE *rule, *xrule; 112 | struct CMD *cmd; 113 | struct SFX *sfx; 114 | FILEHANDLE unit; 115 | unsigned int status; 116 | int i, j, realcount, lastrealidx; 117 | 118 | INIT_DYNDESC(dsc); 119 | 120 | if (outfile[0] == '\0') { 121 | cp = "MMK_DEFAULT_RULES.H"; 122 | } else { 123 | cp = outfile; 124 | } 125 | 126 | status = file_create(cp, &unit, ""); 127 | if (!OK(status)) lib$stop(status); 128 | 129 | status = file_write(unit, "/*", 2); 130 | lib$sys_fao(&hdr1, 0, &dsc, strlen(Version), Version, 0); 131 | status = file_write(unit, dsc.dsc$a_pointer, dsc.dsc$w_length); 132 | strcpy(tmp, "** from file "); 133 | strcat(tmp, infile); 134 | status = file_write(unit, tmp, strlen(tmp)); 135 | strcpy(tmp, "** "); 136 | strcat(tmp, Copyright); 137 | status = file_write(unit, tmp, strlen(tmp)); 138 | status = file_write(unit, "*/", 2); 139 | status = file_write(unit, "", 0); 140 | 141 | PUT("static struct SFX sfx_init[] = {"); 142 | for (sfx = suffixes.flink, i = 0; sfx != (struct SFX *) &suffixes; 143 | sfx = sfx->flink, i++) { 144 | static $DESCRIPTOR(fao, " !AD{0,0,\"!AD\"}"); 145 | fix_string(sfx->value, tmp); 146 | lib$sys_fao(&fao, 0, &dsc, (i > 0 ? 1 : 0), (i > 0 ? "," : ""), 147 | strlen(tmp), tmp); 148 | status = file_write(unit, dsc.dsc$a_pointer, dsc.dsc$w_length); 149 | } 150 | PUT("};"); 151 | sprintf(tmp, "#define SFX_INIT_COUNT %d", i); 152 | PUT(tmp); 153 | 154 | PUT("static struct SYMBOL gsym_init[] = {"); 155 | i = 0; 156 | for (j = 0; j < MMK_K_SYMTABLE_SIZE; j++) { 157 | for (sym = global_symbols.symlist[j].head; 158 | sym != (struct SYMBOL *) &global_symbols.symlist[j]; 159 | sym = sym->flink) { 160 | static $DESCRIPTOR(fao, " !AD{0,0,!UL,\"!AD\",\"!AD\"}"); 161 | fix_string(sym->name, tmp); 162 | fix_string(sym->value, tmp2); 163 | lib$sys_fao(&fao, 0, &dsc, (i > 0 ? 1 : 0), (i > 0 ? "," : ""), 164 | MMK_K_SYM_DEFAULT, strlen(tmp), tmp, strlen(tmp2), tmp2); 165 | status = file_write(unit, dsc.dsc$a_pointer, dsc.dsc$w_length); 166 | i += 1; 167 | } 168 | } 169 | PUT("};"); 170 | sprintf(tmp, "#define GSYM_INIT_COUNT %d", i); 171 | PUT(tmp); 172 | 173 | for (xrule = rules.flink, i = 0; 174 | xrule != (struct RULE *) &rules; 175 | xrule = xrule->flink) { 176 | for (rule = xrule; rule != 0; rule = rule->next) { 177 | if (rule->cmdque.flink != &rule->cmdque) { 178 | sprintf(tmp, "static struct CMD cmdq_init_%d[] = {", i); 179 | PUT(tmp); 180 | for (cmd = rule->cmdque.flink, j = 0; cmd != &rule->cmdque; 181 | cmd = cmd->flink, j++) { 182 | static $DESCRIPTOR(fao, " !AD{0,0,0X!XL,\"!AD\"}"); 183 | fix_string(cmd->cmd, tmp); 184 | lib$sys_fao(&fao, 0, &dsc, (j > 0 ? 1 : 0), (j > 0 ? "," : ""), 185 | cmd->flags, strlen(tmp), tmp); 186 | status = file_write(unit, dsc.dsc$a_pointer, dsc.dsc$w_length); 187 | } 188 | PUT("};"); 189 | rule->cmdque.flags = j; 190 | rule->cmdque.cmd = (char *) i; 191 | i += 1; 192 | } 193 | } 194 | } 195 | 196 | if (default_rule != 0) { 197 | if (default_rule->cmdque.flink != &default_rule->cmdque) { 198 | sprintf(tmp, "static struct CMD cmdq_init_%d[] = {", i); 199 | PUT(tmp); 200 | for (cmd = default_rule->cmdque.flink, j = 0; cmd != &default_rule->cmdque; 201 | cmd = cmd->flink, j++) { 202 | static $DESCRIPTOR(fao, " !AD{0,0,0X!XL,\"!AD\"}"); 203 | fix_string(cmd->cmd, tmp); 204 | lib$sys_fao(&fao, 0, &dsc, (j > 0 ? 1 : 0), (j > 0 ? "," : ""), 205 | cmd->flags, strlen(tmp), tmp); 206 | status = file_write(unit, dsc.dsc$a_pointer, dsc.dsc$w_length); 207 | } 208 | PUT("};"); 209 | default_rule->cmdque.flags = j; 210 | default_rule->cmdque.cmd = (char *) i; 211 | i += 1; 212 | } 213 | } 214 | 215 | PUT("static struct RULE rule_init[] = {"); 216 | for (xrule = rules.flink, i = realcount = 0; 217 | xrule != (struct RULE *) &rules; 218 | xrule = xrule->flink, realcount++) { 219 | static $DESCRIPTOR(fao, " !AD{0,0,(struct RULE *) !UL,0,!UL,!UL,\"!AD\",\"!AD\",\"!AD\",\"!AD\",{!AD,0,!UL,0}}"); 220 | lastrealidx = i; 221 | for (rule = xrule; rule != 0; rule = rule->next) { 222 | sprintf(tmp, "(void *)&cmdq_init_%d[0]", (int) rule->cmdque.cmd); 223 | fix_string(rule->src, tmp2); 224 | fix_string(rule->trg, tmp3); 225 | fix_string(rule->srcpfx, tmp4); 226 | fix_string(rule->trgpfx, tmp5); 227 | lib$sys_fao(&fao, 0, &dsc, (i > 0 ? 1 : 0), (i > 0 ? "," : ""), 228 | (rule->next == 0 ? 0 : 1), 229 | rule->srcpfxlen, rule->trgpfxlen, 230 | strlen(tmp2), tmp2, strlen(tmp3), tmp3, 231 | strlen(tmp4), tmp4, strlen(tmp5), tmp5, 232 | (rule->cmdque.flink == &rule->cmdque ? 0 : strlen(tmp)), 233 | (rule->cmdque.flink == &rule->cmdque ? "" : tmp), 234 | (rule->cmdque.flink == &rule->cmdque ? 0 : rule->cmdque.flags)); 235 | status = file_write(unit, dsc.dsc$a_pointer, dsc.dsc$w_length); 236 | i++; 237 | } 238 | } 239 | PUT("};"); 240 | sprintf(tmp, "#define RULE_INIT_COUNT %d", i); 241 | PUT(tmp); 242 | sprintf(tmp, "#define RULE_INIT_COUNT_REAL %d", realcount); 243 | PUT(tmp); 244 | sprintf(tmp, "#define RULE_REAL_LAST_IDX %d", lastrealidx); 245 | PUT(tmp); 246 | if (default_rule != 0) { 247 | static $DESCRIPTOR(fao, " 0,0,0,0,0,0,0,0,{!AD,0,!UL,0}}"); 248 | PUT("#define DEFAULT_RULE_EXISTS 1"); 249 | PUT("static struct RULE default_rule_init = {"); 250 | sprintf(tmp, "(void *)&cmdq_init_%d[0]", (int) default_rule->cmdque.cmd); 251 | lib$sys_fao(&fao, 0, &dsc, 252 | (default_rule->cmdque.flink == &default_rule->cmdque ? 0 : strlen(tmp)), 253 | (default_rule->cmdque.flink == &default_rule->cmdque ? "" : tmp), 254 | (default_rule->cmdque.flink == &default_rule->cmdque ? 0 : default_rule->cmdque.flags)); 255 | status = file_write(unit, dsc.dsc$a_pointer, dsc.dsc$w_length); 256 | } 257 | 258 | file_close(unit); 259 | 260 | return; 261 | 262 | } /* Generate_Structures */ 263 | 264 | /* 265 | **++ 266 | ** ROUTINE: fix_string 267 | ** 268 | ** FUNCTIONAL DESCRIPTION: 269 | ** 270 | ** Fixes up special characters appearing in character strings by 271 | ** quoting them with a backslash. 272 | ** 273 | ** RETURNS: cond_value, longword (unsigned), write only, by value 274 | ** 275 | ** PROTOTYPE: 276 | ** 277 | ** fix_string(char *in, char *out) 278 | ** 279 | ** IMPLICIT INPUTS: None. 280 | ** 281 | ** IMPLICIT OUTPUTS: None. 282 | ** 283 | ** COMPLETION CODES: None. 284 | ** 285 | ** SIDE EFFECTS: None. 286 | ** 287 | **-- 288 | */ 289 | static void fix_string(char *in, char *out) { 290 | 291 | register char *cp, *cp1; 292 | 293 | for (cp = in, cp1 = out; *cp; cp++) { 294 | if (*cp == '\\' || *cp == '"') *cp1++ = '\\'; 295 | *cp1++ = *cp; 296 | } 297 | *cp1 = '\0'; 298 | 299 | return; 300 | 301 | } /* fix_string */ 302 | -------------------------------------------------------------------------------- /mmk_default_rules_x86_64.mms: -------------------------------------------------------------------------------- 1 | ! MMK_DEFAULT_RULES_X86_64.MMS 2 | ! 3 | ! COPYRIGHT � 2004 MADGOAT SOFTWARE. ALL RIGHTS RESERVED. 4 | ! COPYRIGHT � 2012 ENDLESS SOFTWARE SOLUTIONS. ALL RIGHTS RESERVED. 5 | ! 6 | ! Default build rules for use with MMK. (for OpenVMS x86_64) 7 | ! 8 | ! Modification history: 9 | ! 10 | ! 03-MAY-2004 V1.0 Madison Initial coding (from ACP) 11 | ! 22-AUG-2012 V2.4 Sneddon Add GENCAT support. 12 | ! 13-JUL-2023 V2.5 Goatley Add X86_64 support. 13 | ! 14 | 15 | ! 16 | ! This symbol can be used to distinguish MMK from DEC's DEC/MMS product 17 | ! using .IFDEF directives. 18 | ! 19 | __MATTS_MMS__ = __MATTS_MMS__ 20 | __MMK__ = __MMK__ 21 | __MMK_V32__ = 1 22 | ! 23 | ! These symbols can be used to distinguish an x86-based build from a 24 | ! VAX, Alpha, or Itanium one. 25 | ! 26 | __X86__ = 1 27 | __X86_64__ = 1 28 | 29 | EXE = .EXE 30 | OLB = .OLB 31 | OBJ = .OBJ 32 | OPT = .OPT 33 | L32 = .L32 34 | 35 | .SUFFIXES : ! clear the suffix list first 36 | .SUFFIXES : $(EXE) $(OLB) $(OBJ) .TLB .HLB .MLB $(L32) .CAT .C .CXX .BAS .B32 .BLI .FOR - 37 | .COB .COR .DBL .RPG .SCN .PLI .PEN .PAS .MAC .MAR .M64 .MSG .MSGX .CLD - 38 | .R32 .REQ .TXT .H .MEM .HLP .RNH .RNO .MMS .DAT .OPT .SDML .COM - 39 | .C~ .CXX~ .BAS~ .B32~ .BLI~ .FOR~ .COB~ .COR~ .DBL~ .RPG~ .SCN~ - 40 | .PLI~ .PAS~ .MAC~ .MAR~ .M64~ .MSG~ .CLD~ .R32~ .REQ~ .TXT~ - 41 | .H~ .HLP~ .RNH~ .RNO~ .MMS~ .DAT~ .OPT~ .SDML~ .COM~ 42 | 43 | LINK = LINK 44 | LINKFLAGS = /EXEC=$(MMS$TARGET) 45 | 46 | $(OBJ)$(OLB) : 47 | @ IF F$SEARCH("$(MMS$TARGET)") .EQS. "" THEN $(LIBR)/CREATE $(MMS$TARGET) 48 | $(LIBR)$(LIBRFLAGS) $(MMS$TARGET) $(MMS$SOURCE) 49 | 50 | .TXT.TLB : 51 | @ IF F$SEARCH("$(MMS$TARGET)") .EQS. "" THEN $(LIBR)/CREATE/TEXT $(MMS$TARGET) 52 | $(LIBR)$(LIBRFLAGS) $(MMS$TARGET) $(MMS$SOURCE)/MODULE=$(MMS$TARGET_MODULE) 53 | 54 | .HLP.HLB : 55 | @ IF F$SEARCH("$(MMS$TARGET)") .EQS. "" THEN $(LIBR)/CREATE/HELP $(MMS$TARGET) 56 | $(LIBR)$(LIBRFLAGS) $(MMS$TARGET) $(MMS$SOURCE) 57 | 58 | .MAC.MLB : 59 | @ IF F$SEARCH("$(MMS$TARGET)") .EQS. "" THEN $(LIBR)/CREATE/MACRO $(MMS$TARGET) 60 | $(LIBR)$(LIBRFLAGS) $(MMS$TARGET) $(MMS$SOURCE) 61 | 62 | .MAR.MLB : 63 | @ IF F$SEARCH("$(MMS$TARGET)") .EQS. "" THEN $(LIBR)/CREATE/MACRO $(MMS$TARGET) 64 | $(LIBR)$(LIBRFLAGS) $(MMS$TARGET) $(MMS$SOURCE) 65 | 66 | LIBR = LIBRARY 67 | LIBRFLAGS = /REPLACE 68 | 69 | 70 | .BAS$(OBJ) : 71 | $(BASIC)$(BASFLAGS) $(MMS$SOURCE) 72 | BASIC = BASIC 73 | BASFLAGS = /NOLIST/OBJECT=$(MMS$TARGET_NAME)$(OBJ) 74 | 75 | 76 | .BLI$(OBJ) : 77 | $(BLISS)$(BFLAGS) $(MMS$SOURCE) 78 | .B32$(OBJ) : 79 | $(BLISS)$(BFLAGS) $(MMS$SOURCE) 80 | BFLAGS = /NOLIST/OBJECT=$(MMS$TARGET_NAME)$(OBJ) 81 | 82 | 83 | .C$(OBJ) : 84 | $(CC)$(CFLAGS) $(MMS$SOURCE) 85 | CC = CC 86 | CFLAGS = /NOLIST/OBJECT=$(MMS$TARGET_NAME)$(OBJ) 87 | 88 | 89 | .COB$(OBJ) : 90 | $(COBOL)$(COBFLAGS) $(MMS$SOURCE) 91 | COBOL = COBOL 92 | COBFLAGS = /NOLIST/OBJECT=$(MMS$TARGET_NAME)$(OBJ) 93 | 94 | 95 | .COR$(OBJ) : 96 | $(CORAL)$(CORFLAGS) $(MMS$SOURCE) 97 | CORAL = CORAL 98 | CORFLAGS = /NOLIST/OBJECT=$(MMS$TARGET_NAME)$(OBJ) 99 | 100 | 101 | .CXX$(OBJ) : 102 | $(CXX)$(CXXFLAGS) $(MMS$SOURCE) 103 | CXX = CXX 104 | CXXFLAGS = /NOLIST/OBJECT=$(MMS$TARGET_NAME)$(OBJ) 105 | 106 | 107 | .DBL$(OBJ) : 108 | $(DIBOL)$(DBLFLAGS) $(MMS$SOURCE) 109 | DIBOL = DIBOL 110 | DBLFLAGS = /NOLIST/OBJECT=$(MMS$TARGET_NAME)$(OBJ) 111 | 112 | 113 | .CLD$(OBJ) : 114 | $(SETCMD)$(SETCMDFLAGS) $(MMS$SOURCE) 115 | SETCMD = SET COMMAND 116 | SETCMDFLAGS = /NOLIST/OBJECT=$(MMS$TARGET_NAME)$(OBJ) 117 | 118 | 119 | .FOR$(OBJ) : 120 | $(FORT)$(FFLAGS) $(MMS$SOURCE) 121 | FORT = FORTRAN 122 | FFLAGS = /NOLIST/OBJECT=$(MMS$TARGET_NAME)$(OBJ) 123 | 124 | 125 | .MAR$(OBJ) : 126 | $(MACRO)$(MFLAGS) $(MMS$SOURCE) 127 | MACRO = MACRO/MIGRATION 128 | MFLAGS = /NOLIST/OBJECT=$(MMS$TARGET_NAME)$(OBJ) 129 | 130 | .M64$(OBJ) : 131 | $(TASM)$(TASMFLAGS) $(MMS$SOURCE) 132 | TASM = MACRO 133 | TASMFLAGS = /NOLIST/OBJECT=$(MMS$TARGET_NAME)$(OBJ) 134 | 135 | 136 | .MSG$(OBJ) : 137 | $(MESSAGE)$(MSGFLAGS) $(MMS$SOURCE) 138 | MESSAGE = MESSAGE 139 | MSGFLAGS = /NOLIST/OBJECT=$(MMS$TARGET_NAME)$(OBJ) 140 | 141 | 142 | .PAS$(OBJ) : 143 | $(PASCAL)$(PFLAGS) $(MMS$SOURCE) 144 | .PAS.PEN : 145 | $(PASCAL)$(PENVFLAGS) $(MMS$SOURCE) 146 | PASCAL = PASCAL 147 | PFLAGS = /NOLIST/OBJECT=$(MMS$TARGET_NAME)$(OBJ) 148 | PENVFLAGS = /ENVIRONMENT=$(MMS$TARGET_NAME).ENV/NOLIST 149 | 150 | 151 | .PLI$(OBJ) : 152 | $(PLI)$(PLIFLAGS) $(MMS$SOURCE) 153 | PLI = PLI 154 | PLIFLAGS = /NOLIST/OBJECT=$(MMS$TARGET_NAME)$(OBJ) 155 | 156 | 157 | .REQ$(L32) : 158 | $(BLISS)/LIBR=$(MMS$TARGET_NAME)$(L32)$(BLIBFLAGS) $(MMS$SOURCE) 159 | .R32$(L32) : 160 | $(BLISS)/LIBR=$(MMS$TARGET_NAME)$(L32)$(BLIBFLAGS) $(MMS$SOURCE) 161 | BLISS = BLISS 162 | BLIBFLAGS = /NOLIST 163 | 164 | 165 | .RPG$(OBJ) : 166 | $(RPG)$(RPGFLAGS) $(MMS$SOURCE) 167 | RPG = RPG 168 | RPGFLAGS = /NOLIST/OBJECT=$(MMS$TARGET_NAME)$(OBJ) 169 | 170 | 171 | .RNH.HLP : 172 | $(RUNOFF)$(RFLAGS) $(MMS$SOURCE) 173 | .RNO.MEM : 174 | $(RUNOFF)$(RFLAGS) $(MMS$SOURCE) 175 | RUNOFF = RUNOFF 176 | RFLAGS = /OUTPUT=$(MMS$TARGET) 177 | 178 | 179 | .SCN$(OBJ) : 180 | $(SCAN)$(SCANFLAGS) $(MMS$SOURCE) 181 | SCAN = SCAN 182 | SCANFLAGS = /NOLIST/OBJECT=$(MMS$TARGET_NAME)$(OBJ) 183 | 184 | 185 | .MSGX.CAT : 186 | $(GENCAT)$(GENCATFLAGS) $(MMS$SOURCE) $(MMS$TARGET) 187 | GENCAT = GENCAT 188 | GENCATFLAGS = 189 | 190 | 191 | CMS = CMS 192 | CMSCOMMENT = "" 193 | CMSFLAGS = /GENERATION=$(MMS$CMS_GEN) 194 | 195 | .B32~.B32 : 196 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 197 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).B32 $(CMSFLAGS) $(CMSCOMMENT) 198 | 199 | .BAS~.BAS : 200 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 201 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).BAS $(CMSFLAGS) $(CMSCOMMENT) 202 | 203 | .BLI~.BLI : 204 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 205 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).BLI $(CMSFLAGS) $(CMSCOMMENT) 206 | 207 | .C~.C : 208 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 209 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).C $(CMSFLAGS) $(CMSCOMMENT) 210 | 211 | .CLD~.CLD : 212 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 213 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).CLD $(CMSFLAGS) $(CMSCOMMENT) 214 | 215 | .COB~.COB : 216 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 217 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).COB $(CMSFLAGS) $(CMSCOMMENT) 218 | 219 | .COR~.COR : 220 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 221 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).COR $(CMSFLAGS) $(CMSCOMMENT) 222 | 223 | .COM~.COM : 224 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 225 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).COM $(CMSFLAGS) $(CMSCOMMENT) 226 | 227 | .CXX~.CXX : 228 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 229 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).CXX $(CMSFLAGS) $(CMSCOMMENT) 230 | 231 | .DAT~.DAT : 232 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 233 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).DAT $(CMSFLAGS) $(CMSCOMMENT) 234 | 235 | .DBL~.DBL : 236 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 237 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).DBL $(CMSFLAGS) $(CMSCOMMENT) 238 | 239 | .FOR~.FOR : 240 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 241 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).FOR $(CMSFLAGS) $(CMSCOMMENT) 242 | 243 | .H~.H : 244 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 245 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).H $(CMSFLAGS) $(CMSCOMMENT) 246 | 247 | .HLP~.HLP : 248 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 249 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).HLP $(CMSFLAGS) $(CMSCOMMENT) 250 | 251 | .MAC~.MAC : 252 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 253 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).MAC $(CMSFLAGS) $(CMSCOMMENT) 254 | 255 | .MAR~.MAR : 256 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 257 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).MAR $(CMSFLAGS) $(CMSCOMMENT) 258 | 259 | .M64~.M64 : 260 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 261 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).M64 $(CMSFLAGS) $(CMSCOMMENT) 262 | 263 | .MMS~.MMS : 264 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 265 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).MMS $(CMSFLAGS) $(CMSCOMMENT) 266 | 267 | .MSG~.MSG : 268 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 269 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).MSG $(CMSFLAGS) $(CMSCOMMENT) 270 | 271 | .MSGX~.MSGX : 272 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 273 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).MSGX $(CMSFLAGS) $(CMSCOMMENT) 274 | 275 | .OPT~.OPT : 276 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 277 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).OPT $(CMSFLAGS) $(CMSCOMMENT) 278 | 279 | .PAS~.PAS : 280 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 281 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).PAS $(CMSFLAGS) $(CMSCOMMENT) 282 | 283 | .PLI~.PLI : 284 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 285 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).PLI $(CMSFLAGS) $(CMSCOMMENT) 286 | 287 | .R32~.R32 : 288 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 289 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).R32 $(CMSFLAGS) $(CMSCOMMENT) 290 | 291 | .REQ~.REQ : 292 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 293 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).REQ $(CMSFLAGS) $(CMSCOMMENT) 294 | 295 | .RNH~.RNH : 296 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 297 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).RNH $(CMSFLAGS) $(CMSCOMMENT) 298 | 299 | .RNO~.RNO : 300 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 301 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).RNO $(CMSFLAGS) $(CMSCOMMENT) 302 | 303 | .SCN~.SCN : 304 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 305 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).SCN $(CMSFLAGS) $(CMSCOMMENT) 306 | 307 | .SDML~.SDML : 308 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 309 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).SDML $(CMSFLAGS) $(CMSCOMMENT) 310 | 311 | .TXT~.TXT : 312 | @ IF "$(MMS$CMS_LIBRARY)" .NES. "" THEN DEFINE/USER CMS$LIB $(MMS$CMS_LIBRARY) 313 | $(CMS) FETCH $(MMS$CMS_ELEMENT) /OUTPUT=$(MMS$TARGET_NAME).TXT $(CMSFLAGS) $(CMSCOMMENT) 314 | -------------------------------------------------------------------------------- /cms_interface.c: -------------------------------------------------------------------------------- 1 | /* 2 | **++ 3 | ** FACILITY: MMK 4 | ** 5 | ** ABSTRACT: CMS access routines. 6 | ** 7 | ** MODULE DESCRIPTION: 8 | ** 9 | ** This module contains routines for interfacing with DEC/CMS. 10 | ** 11 | ** AUTHOR: M. Madison 12 | ** 13 | ** Copyright (c) 2008, Matthew Madison. 14 | ** 15 | ** All rights reserved. 16 | ** 17 | ** Redistribution and use in source and binary forms, with or without 18 | ** modification, are permitted provided that the following conditions 19 | ** are met: 20 | ** 21 | ** * Redistributions of source code must retain the above 22 | ** copyright notice, this list of conditions and the following 23 | ** disclaimer. 24 | ** * Redistributions in binary form must reproduce the above 25 | ** copyright notice, this list of conditions and the following 26 | ** disclaimer in the documentation and/or other materials provided 27 | ** with the distribution. 28 | ** * Neither the name of the copyright owner nor the names of any 29 | ** other contributors may be used to endorse or promote products 30 | ** derived from this software without specific prior written 31 | ** permission. 32 | ** 33 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 34 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 35 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 36 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 37 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 38 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 39 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 40 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 41 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 42 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 43 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 44 | ** 45 | ** CREATION DATE: 01-JUL-1994 46 | ** 47 | ** MODIFICATION HISTORY: 48 | ** 49 | ** 01-JUL-1994 V1.0 Madison Initial coding. 50 | ** 16-MAR-1995 V1.0-1 Madison Turn off verify when setting library. 51 | ** 07-JUN-1995 V1.0-2 Madison Use default CMS generation in cms_get_rdt. 52 | ** 27-JUN-1995 V1.1 Madison Have cms_fetch_file specify output. 53 | ** 27-DEC-1998 V1.1-1 Madison General cleanup. 54 | **-- 55 | */ 56 | #pragma module CMS_INTERFACE "V1.1-1" 57 | #include "mmk.h" 58 | #include "globals.h" 59 | #include "cmsdef.h" 60 | #include 61 | 62 | /* 63 | ** Forward declarations 64 | */ 65 | unsigned int cms_init(void); 66 | unsigned int cms_get_rdt(char *, char *, TIME *); 67 | static unsigned int cms_show_gen_callback(int *, 68 | struct CMS_LDB *, void *, struct dsc$descriptor **, 69 | struct dsc$descriptor **, struct dsc$descriptor **, 70 | TIME *, TIME *, TIME *, struct dsc$descriptor **, 71 | struct dsc$descriptor **, int *, int *, int *, int *, int *, int *); 72 | unsigned int cms_fetch_file(char *, char *); 73 | unsigned int cms_parse_name(char *, char *, int, int *, 74 | char *, int, int *, int); 75 | static unsigned int message_routine(unsigned int [], unsigned int [], 76 | struct CMS_LDB *); 77 | 78 | /* 79 | ** OWN storage 80 | */ 81 | static int cms_initialized = 0; 82 | static unsigned int cms$_normal, cms$_exclude, cms$_noref; 83 | static unsigned int (*set_library)(struct CMS_LDB *, 84 | struct dsc$descriptor *, unsigned int (*)(), unsigned int *) = 0; 85 | static unsigned int (*show_generation)(struct CMS_LDB *, unsigned int (*)(), 86 | void *, struct dsc$descriptor *, struct dsc$descriptor *, 87 | struct dsc$descriptor *, int *, int *, int *, unsigned int (*)()) = 0; 88 | static unsigned int (*fetch)(struct CMS_LDB *, struct dsc$descriptor *, 89 | struct dsc$descriptor *, struct dsc$descriptor *, struct dsc$descriptor *, 90 | int *, int *, int *, int *, struct dsc$descriptor *, 91 | unsigned int (*)(), int *, struct dsc$descriptor *, 92 | struct dsc$descriptor *, int *); 93 | static char current_library[256]; 94 | static unsigned short current_liblen = 0; 95 | static struct CMS_LDB cmsctx; 96 | static unsigned int vfy = 0; 97 | 98 | 99 | /* 100 | **++ 101 | ** ROUTINE: cms_init 102 | ** 103 | ** FUNCTIONAL DESCRIPTION: 104 | ** 105 | ** tbs 106 | ** 107 | ** RETURNS: cond_value, longword (unsigned), write only, by value 108 | ** 109 | ** PROTOTYPE: 110 | ** 111 | ** tbs 112 | ** 113 | ** IMPLICIT INPUTS: None. 114 | ** 115 | ** IMPLICIT OUTPUTS: None. 116 | ** 117 | ** COMPLETION CODES: 118 | ** 119 | ** 120 | ** SIDE EFFECTS: None. 121 | ** 122 | **-- 123 | */ 124 | unsigned int cms_init (void) { 125 | 126 | unsigned int status; 127 | struct dsc$descriptor dsc; 128 | 129 | if (cms_initialized) return SS$_NORMAL; 130 | 131 | status = find_image_symbol("CMSSHR", "CMS$_NORMAL", &cms$_normal); 132 | if (!OK(status)) return status; 133 | status = find_image_symbol("CMSSHR", "CMS$_EXCLUDE", &cms$_exclude); 134 | if (!OK(status)) return status; 135 | status = find_image_symbol("CMSSHR", "CMS$_NOREF", &cms$_noref); 136 | if (!OK(status)) return status; 137 | status = find_image_symbol("CMSSHR", "CMS$SET_LIBRARY", &set_library); 138 | if (!OK(status)) return status; 139 | status = find_image_symbol("CMSSHR", "CMS$SHOW_GENERATION", &show_generation); 140 | if (!OK(status)) return status; 141 | status = find_image_symbol("CMSSHR", "CMS$FETCH", &fetch); 142 | if (!OK(status)) return status; 143 | 144 | if (cms$lib[0] != '\0') { 145 | INIT_SDESC(dsc, strlen(cms$lib), cms$lib); 146 | status = (*set_library)(&cmsctx, &dsc, message_routine, &vfy); 147 | if (!OK(status)) return status; 148 | current_liblen = dsc.dsc$w_length; 149 | strcpy(current_library, cms$lib); 150 | } else { 151 | current_library[0] = '\0'; 152 | } 153 | 154 | cms_initialized = 1; 155 | 156 | return SS$_NORMAL; 157 | 158 | } /* cms_init */ 159 | 160 | /* 161 | **++ 162 | ** ROUTINE: cms_get_rdt 163 | ** 164 | ** FUNCTIONAL DESCRIPTION: 165 | ** 166 | ** tbs 167 | ** 168 | ** RETURNS: cond_value, longword (unsigned), write only, by value 169 | ** 170 | ** PROTOTYPE: 171 | ** 172 | ** tbs 173 | ** 174 | ** IMPLICIT INPUTS: None. 175 | ** 176 | ** IMPLICIT OUTPUTS: None. 177 | ** 178 | ** COMPLETION CODES: 179 | ** 180 | ** 181 | ** SIDE EFFECTS: None. 182 | ** 183 | **-- 184 | */ 185 | unsigned int cms_get_rdt (char *fspec, char *generation, TIME *rdt) { 186 | 187 | char libname[256]; 188 | char element[256]; 189 | unsigned int status; 190 | int llen, elen; 191 | struct dsc$descriptor dsc, gdsc; 192 | 193 | status = cms_parse_name(fspec, libname, sizeof(libname), &llen, 194 | element, sizeof(element), &elen, 1); 195 | if (!OK(status)) return status; 196 | 197 | if (!cms_initialized) { 198 | status = cms_init(); 199 | if (!OK(status)) return status; 200 | } 201 | 202 | if (current_liblen != llen || 203 | !strneql_case_blind(libname, current_library, llen)) { 204 | INIT_SDESC(dsc, llen, libname); 205 | if (llen == 0) return cms$_noref; 206 | status = (*set_library)(&cmsctx, &dsc, message_routine, &vfy); 207 | if (!OK(status)) { 208 | if (current_liblen > 0) { 209 | INIT_SDESC(dsc, current_liblen, current_library); 210 | (*set_library)(&cmsctx, &dsc, message_routine, &vfy); 211 | } 212 | return status; 213 | } 214 | current_liblen = llen; 215 | memcpy(current_library, libname, llen); 216 | current_library[llen] = '\0'; 217 | } 218 | if (current_liblen == 0) return cms$_noref; 219 | INIT_SDESC(dsc, elen, element); 220 | if (generation != 0 && *generation != '\0') { 221 | INIT_SDESC(gdsc, strlen(generation), generation); 222 | } else if (cms_default_generation[0] != '\0') { 223 | INIT_SDESC(gdsc, strlen(cms_default_generation), cms_default_generation); 224 | } else gdsc.dsc$w_length = 0; 225 | status = (*show_generation)(&cmsctx, cms_show_gen_callback, 226 | rdt, &dsc, (gdsc.dsc$w_length > 0) ? &gdsc : 0, 227 | 0, 0, 0, 0, message_routine); 228 | return status; 229 | 230 | } /* cms_get_rdt */ 231 | 232 | /* 233 | **++ 234 | ** ROUTINE: cms_show_gen_callback 235 | ** 236 | ** FUNCTIONAL DESCRIPTION: 237 | ** 238 | ** tbs 239 | ** 240 | ** RETURNS: cond_value, longword (unsigned), write only, by value 241 | ** 242 | ** PROTOTYPE: 243 | ** 244 | ** tbs 245 | ** 246 | ** IMPLICIT INPUTS: None. 247 | ** 248 | ** IMPLICIT OUTPUTS: None. 249 | ** 250 | ** COMPLETION CODES: 251 | ** 252 | ** 253 | ** SIDE EFFECTS: None. 254 | ** 255 | **-- 256 | */ 257 | static unsigned int cms_show_gen_callback(int *new_elementp, 258 | struct CMS_LDB *cmsctxp, void *rdtp, struct dsc$descriptor **elementp, 259 | struct dsc$descriptor **genp, struct dsc$descriptor **usernamep, 260 | TIME *trans_timep, TIME *create_timep, TIME *revision_timep, 261 | struct dsc$descriptor **remarkp, struct dsc$descriptor **classp, 262 | int *formatp, int *attrp, int *revnop, int *reservp, int *recsizp, 263 | int *review_statp) { 264 | 265 | if (*new_elementp == 1) *((TIME *) rdtp) = *revision_timep; 266 | 267 | return cms$_normal; 268 | 269 | } /* cms_show_gen_callback */ 270 | 271 | /* 272 | **++ 273 | ** ROUTINE: cms_fetch_file 274 | ** 275 | ** FUNCTIONAL DESCRIPTION: 276 | ** 277 | ** Fetches a file out of a CMS library. Uses the generation 278 | ** specified with /GENERATION, if present. 279 | ** 280 | ** RETURNS: cond_value, longword (unsigned), write only, by value 281 | ** 282 | ** PROTOTYPE: 283 | ** 284 | ** cms_fetch_file(char *element, char *outspec) 285 | ** 286 | ** IMPLICIT INPUTS: None. 287 | ** 288 | ** IMPLICIT OUTPUTS: None. 289 | ** 290 | ** COMPLETION CODES: 291 | ** 292 | ** 293 | ** SIDE EFFECTS: None. 294 | ** 295 | **-- 296 | */ 297 | unsigned int cms_fetch_file (char *fspec, char *outspec) { 298 | 299 | char libname[256]; 300 | unsigned int status; 301 | struct dsc$descriptor dsc, gdsc, odsc; 302 | int i; 303 | 304 | if (!cms_initialized) { 305 | status = cms_init(); 306 | if (!OK(status)) return status; 307 | } 308 | 309 | i = strlen(cms$lib); 310 | if (current_liblen != i || 311 | !strneql_case_blind(cms$lib, current_library, current_liblen)) { 312 | INIT_SDESC(dsc, i, cms$lib); 313 | if (i == 0) return cms$_noref; 314 | status = (*set_library)(&cmsctx, &dsc, message_routine, &vfy); 315 | if (!OK(status)) { 316 | if (current_liblen > 0) { 317 | INIT_SDESC(dsc, current_liblen, current_library); 318 | (*set_library)(&cmsctx, &dsc, message_routine, &vfy); 319 | } 320 | return status; 321 | } 322 | current_liblen = i; 323 | memcpy(current_library, cms$lib, i); 324 | current_library[i] = '\0'; 325 | } 326 | if (current_liblen == 0) return cms$_noref; 327 | INIT_SDESC(dsc, strlen(fspec), fspec); 328 | INIT_SDESC(gdsc, strlen(cms_default_generation), cms_default_generation); 329 | INIT_SDESC(odsc, (outspec != 0 ? strlen(outspec) : 0), outspec); 330 | status = (*fetch)(&cmsctx, &dsc, 0, 331 | (gdsc.dsc$w_length > 0) ? &gdsc : 0, 332 | 0, 0, 0, 0, 0, 333 | (odsc.dsc$w_length > 0) ? &odsc : 0, 334 | message_routine, 0, 0, 0, 0); 335 | return status; 336 | 337 | } /* cms_fetch_file */ 338 | 339 | /* 340 | **++ 341 | ** ROUTINE: cms_parse_name 342 | ** 343 | ** FUNCTIONAL DESCRIPTION: 344 | ** 345 | ** Parses a CMS-type file specification into a library name 346 | ** plus an element name. 347 | ** 348 | ** RETURNS: cond_value, longword (unsigned), write only, by value 349 | ** 350 | ** PROTOTYPE: 351 | ** 352 | ** tbs 353 | ** 354 | ** IMPLICIT INPUTS: None. 355 | ** 356 | ** IMPLICIT OUTPUTS: None. 357 | ** 358 | ** COMPLETION CODES: 359 | ** 360 | ** 361 | ** SIDE EFFECTS: None. 362 | ** 363 | **-- 364 | */ 365 | unsigned int cms_parse_name (char *fspec, char *libname, 366 | int libname_size, int *libname_len, char *element, 367 | int element_size, int *element_len, int fill_in_lib) { 368 | 369 | struct item_list_2 { 370 | unsigned short len; 371 | unsigned short code; 372 | char *pointer; 373 | } fscnlst[6]; 374 | char *cp; 375 | struct dsc$descriptor dsc; 376 | int i, j, len; 377 | unsigned int status, flags; 378 | 379 | memset(fscnlst, 0, sizeof(fscnlst)); 380 | fscnlst[0].code = FSCN$_DEVICE; 381 | fscnlst[1].code = FSCN$_ROOT; 382 | fscnlst[2].code = FSCN$_DIRECTORY; 383 | fscnlst[3].code = FSCN$_NAME; 384 | fscnlst[4].code = FSCN$_TYPE; 385 | 386 | INIT_SDESC(dsc, strlen(fspec), fspec); 387 | if (fspec[dsc.dsc$w_length-1] == '~') dsc.dsc$w_length -= 1; 388 | 389 | status = sys$filescan(&dsc, fscnlst, &flags, 0, 0); 390 | if (!OK(status)) return status; 391 | if (flags & (FSCN$M_NODE | FSCN$M_VERSION)) return SS$_BADPARAM; 392 | len = fscnlst[0].len + fscnlst[1].len + fscnlst[2].len; 393 | if (len > libname_size-1) len = libname_size-1; 394 | if (len > 0) { 395 | if (libname_len) *libname_len = len; 396 | cp = libname; 397 | for (i = 0; len > 0 && i < 3; i++) { 398 | j = (len < fscnlst[i].len) ? len : fscnlst[i].len; 399 | memcpy(cp, fscnlst[i].pointer, j); 400 | len -= j; 401 | cp += j; 402 | } 403 | *cp = '\0'; 404 | } else if (fill_in_lib) { 405 | len = strlen(cms$lib); 406 | if (len > libname_size-1) len = libname_size-1; 407 | memcpy(libname, cms$lib, len); 408 | libname[len] = '\0'; 409 | if (libname_len) *libname_len = len; 410 | } else { 411 | if (libname_size > 0) libname[0] = '\0'; 412 | if (libname_len) *libname_len = 0; 413 | } 414 | len = fscnlst[3].len + fscnlst[4].len; 415 | if (len > element_size-1) len = element_size-1; 416 | if (element_len) *element_len = len; 417 | cp = element; 418 | for (i = 3; len > 0 && i < 5; i++) { 419 | j = (len < fscnlst[i].len) ? len : fscnlst[i].len; 420 | memcpy(cp, fscnlst[i].pointer, j); 421 | len -= j; 422 | cp += j; 423 | } 424 | *cp = '\0'; 425 | 426 | return SS$_NORMAL; 427 | 428 | } /* cms_parse_name */ 429 | 430 | /* 431 | **++ 432 | ** ROUTINE: message_routine 433 | ** 434 | ** FUNCTIONAL DESCRIPTION: 435 | ** 436 | ** tbs 437 | ** 438 | ** RETURNS: cond_value, longword (unsigned), write only, by value 439 | ** 440 | ** PROTOTYPE: 441 | ** 442 | ** tbs 443 | ** 444 | ** IMPLICIT INPUTS: None. 445 | ** 446 | ** IMPLICIT OUTPUTS: None. 447 | ** 448 | ** COMPLETION CODES: 449 | ** 450 | ** 451 | ** SIDE EFFECTS: None. 452 | ** 453 | **-- 454 | */ 455 | static unsigned int message_routine(unsigned int sig[], 456 | unsigned int mech[], struct CMS_LDB *libctx) { 457 | 458 | return SS$_NORMAL; 459 | 460 | } /* message_routine */ 461 | -------------------------------------------------------------------------------- /kitinstal.com: -------------------------------------------------------------------------------- 1 | $! [MMK]KITINSTAL.COM 2 | $! 3 | $! KITINSTAL procedure for installing MMK. 4 | $! 5 | $! Copyright (c) 2013, Endless Software Solutions. 6 | $! 7 | $! All rights reserved. 8 | $! 9 | $! Redistribution and use in source and binary forms, with or without 10 | $! modification, are permitted provided that the following conditions 11 | $! are met: 12 | $! 13 | $! * Redistributions of source code must retain the above 14 | $! copyright notice, this list of conditions and the following 15 | $! disclaimer. 16 | $! * Redistributions in binary form must reproduce the above 17 | $! copyright notice, this list of conditions and the following 18 | $! disclaimer in the documentation and/or other materials provided 19 | $! with the distribution. 20 | $! * Neither the name of the copyright owner nor the names of any 21 | $! other contributors may be used to endorse or promote products 22 | $! derived from this software without specific prior written 23 | $! permission. 24 | $! 25 | $! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | $! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | $! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | $! A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | $! OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | $! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | $! LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | $! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | $! THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | $! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | $! OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | $! 37 | $ on control_y then goto mmk_control_y 38 | $ on warning then goto mmk_fail 39 | $! 40 | $ if (p1 .eqs. "VMI$_INSTALL") then goto mmk_install 41 | $ if (f$element(0,"_",p1) .eqs. "HELP") then goto 'p1' 42 | $ exit VMI$_UNSUPPORTED 43 | $! 44 | $MMK_CONTROL_Y: 45 | $ VMI$CALLBACK CONTROL_Y 46 | $! 47 | $MMK_FAIL: 48 | $ MMK_STATUS == $STATUS 49 | $ EXIT 'MMK_STATUS 50 | $! 51 | $!. 52 | $MMK_INSTALL: 53 | $! 54 | $ MMK_SAY := WRITE SYS$OUTPUT 55 | $ DEFINE BIN_DIR VMI$KWD: 56 | $! 57 | $ tmp = F$GETSYI ("HW_MODEL") 58 | $ IF tmp .GT. 0 .AND. tmp .LT. 1024 59 | $ THEN 60 | $ mmk_arch = "VAX" 61 | $ mmk_system_type = 1 62 | $ mmk_system_name = mmk_arch 63 | $ ELSE 64 | $ mmk_system_type = F$GETSYI ("ARCH_TYPE") 65 | $ mmk_system_name = F$ELEMENT(mmk_system_type, ",", "OTHER,VAX,AXP,I64,X86_64") - "," 66 | $ mmk_arch = F$EDIT (F$GETSYI ("ARCH_NAME"), "TRIM,UPCASE") 67 | $ ENDIF 68 | $ IF mmk_arch .EQS. "VAX" 69 | $ THEN 70 | $ MMK_REQD_VMSVER = "V6.2" 71 | $ MMK_REQD_VMSVER_OLD = "062" 72 | $ base_saveset = "B" 73 | $ ENDIF 74 | $ IF mmk_arch .EQS. "ALPHA" 75 | $ THEN 76 | $ MMK_REQD_VMSVER = "V1.5" 77 | $ MMK_REQD_VMSVER_OLD = "015" 78 | $ base_saveset = "C" 79 | $ mmk_arch = "AXP" 80 | $ ENDIF 81 | $ IF mmk_arch .EQS. "IA64" 82 | $ THEN 83 | $ MMK_REQD_VMSVER = "V8.2" 84 | $ MMK_REQD_VMSVER_OLD = "082" 85 | $ base_saveset = "D" 86 | $ mmk_arch = "I64" 87 | $ ENDIF 88 | $ IF mmk_arch .EQS. "X86_64" 89 | $ THEN 90 | $ MMK_REQD_VMSVER = "V9.2" 91 | $ MMK_REQD_VMSVER_OLD = "092" 92 | $ base_saveset = "E" 93 | $ mmk_arch = "X86" 94 | $ ENDIF 95 | $ VMI$CALLBACK CHECK_VMS_VERSION MMK_VMSVEROK 'MMK_REQD_VMSVER_OLD' 96 | $ IF .NOT. MMK_VMSVEROK 97 | $ THEN 98 | $ VMI$CALLBACK MESSAGE E VMSVER - 99 | "This product requires OpenVMS ''mmk_system_name' ''MMK_REQD_VMSVER' to run." 100 | $ EXIT VMI$_FAILURE 101 | $ ENDIF 102 | $ OPEN/READ MMK_T VMI$KWD:MMK_INSTALLING_VERSION.DAT 103 | $ READ MMK_T mmk_installing_version 104 | $ READ MMK_T mmk_kit_version 105 | $ CLOSE MMK_T 106 | $! 107 | $ mmk_say "" 108 | $ mmk_say F$FAO(" MMK Make Utility !AS Installation Procedure",- 109 | mmk_installing_version) 110 | $ TYPE SYS$INPUT: 111 | 112 | Copyright (c) 2008, Matthew Madison. 113 | Copyright (c) 2013, Endless Software Solutions. 114 | 115 | All rights reserved. 116 | 117 | Redistribution and use in source and binary forms, with or without 118 | modification, are permitted provided that the following conditions 119 | are met: 120 | 121 | * Redistributions of source code must retain the above 122 | copyright notice, this list of conditions and the following 123 | disclaimer. 124 | * Redistributions in binary form must reproduce the above 125 | copyright notice, this list of conditions and the following 126 | disclaimer in the documentation and/or other materials provided 127 | with the distribution. 128 | * Neither the name of the copyright owner nor the names of any 129 | other contributors may be used to endorse or promote products 130 | derived from this software without specific prior written 131 | permission. 132 | 133 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 134 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 135 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 136 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 137 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 138 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 139 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 140 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 141 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 142 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 143 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 144 | 145 | MMK is a "make" utility for VMS systems. It is used for building 146 | software systems based on a "description file" (or "makefile") you 147 | create that lists the sources and objects of a system and the 148 | dependencies between them. 149 | 150 | MMK is similar in functionality to Digital's DEC/Module Management 151 | System (MMS), and understands a syntax in its description files which 152 | is a superset of that which is understood by MMS. 153 | 154 | MMK runs on VAX/VMS, OpenVMS VAX, OpenVMS AXP, and OpenVMS Industry 155 | Standard 64. 156 | 157 | $! 158 | $ mmk_upgrading = 0 159 | $! 160 | $ mmk_do_command == "YES" 161 | $ mmk_do_help == "YES" 162 | $ mmk_do_doc == "YES" 163 | $ mmk_do_source == "NO" 164 | $ mmk_do_startup == "YES" 165 | $! 166 | $ mmk_pcsi_db = "SYS$SYSTEM:ESS-''mmk_system_name'VMS-MMK-*.PCSI$DATABASE" 167 | $ IF F$SEARCH(mmk_pcsi_db) .NES. "" 168 | $ THEN 169 | $ VMI$CALLBACK MESSAGE E PCSI - 170 | "This product has already been installed via PRODUCT INSTALL" 171 | $ TYPE SYS$INPUT: 172 | 173 | **** WARNING! **** 174 | 175 | The installation has detected a previous installation via the 176 | POLYCENTER Software Installation utility (PCSI). Either remove 177 | the product via the PRODUCT REMOVE command and restart the 178 | VMSINSTAL process, or continue to update the software using PCSI 179 | software kits. 180 | 181 | $ EXIT VMI$_FAILURE 182 | $ ENDIF 183 | $! 184 | $ if (f$search("SYS$STARTUP:MMK_STARTUP.COM") .nes. "") then - 185 | $ @SYS$STARTUP:MMK_STARTUP 186 | $ if (f$trnlnm("MMK_ROOT") .eqs. "") 187 | $ then 188 | $ mmk_def_root = "SYS$COMMON:[MMK.]" 189 | $ else 190 | $ mmk_def_root = f$parse("MMK_ROOT:[000000]",,,"DEVICE","NO_CONCEAL") - 191 | + f$parse("MMK_ROOT:[000000]",,,"DIRECTORY","NO_CONCEAL") - 192 | - "[000000]" 193 | $ if (f$search("MMK") .nes. "") 194 | $ then 195 | $ VMI$CALLBACK MESSAGE I INSTALDET - 196 | "An existing installation has been detected at ''mmk_def_root'" 197 | $ mmk_upgrading = 1 198 | $ endif 199 | $ endif 200 | $ mmk_def_root = mmk_def_root - ".]" + "]" 201 | $! 202 | $Ask_MMK_Top: 203 | $ VMI$CALLBACK ASK mmk_root - 204 | "Where should the MMK root directory be located" - 205 | 'mmk_def_root' 206 | $ IF F$PARSE(mmk_root,"$$NOSUCHDEV$$:[$$NOSUCHDIR$$]",,"DEVICE","SYNTAX_ONLY") .EQS. "$$NOSUCHDEV$$:" .OR. - 207 | F$PARSE(mmk_root,"$$NOSUCHDEV$$:[$$NOSUCHDIR$$]",,"DIRECTORY","SYNTAX_ONLY") .EQS. "[$$NOSUCHDIR$$]" .OR. - 208 | F$PARSE(mmk_root,,,,"SYNTAX_ONLY") .EQS. "" .OR. - 209 | F$LOCATE(">[",mmk_root) .LT. F$LENGTH(mmk_root) .OR. F$LOCATE("]<",mmk_root) .LT. F$LENGTH(mmk_root) 210 | $ THEN 211 | $ TYPE SYS$INPUT: 212 | 213 | Please enter a device and directory specification. 214 | 215 | $ GOTO Ask_MMK_Top 216 | $ ENDIF 217 | $! 218 | $ if (mmk_upgrading .and. (mmk_def_root .eqs. mmk_root)) 219 | $ then 220 | $ vmi$callback ask mmk_ok - 221 | "Do you want to upgrade the current installation" - 222 | "YES" BH "@VMI$KWD:KITINSTAL HELP_UPGRADE" 223 | $ if (.not. mmk_ok) then goto Ask_MMK_Top 224 | $ endif 225 | $! 226 | $ VMI$CALLBACK ASK mmk_do_command - 227 | "Do you want to install the MMK command into DCLTABLES" - 228 | 'mmk_do_command' B "@VMI$KWD:KITINSTAL HELP_COMMAND" 229 | $! 230 | $ VMI$CALLBACK ASK mmk_do_help - 231 | "Do you want to add MMK to the system help library" - 232 | 'mmk_do_help' B "@VMI$KWD:KITINSTAL HELP_HELP" 233 | $! 234 | $ VMI$CALLBACK ASK mmk_do_doc - 235 | "Do you want to install the software documentation" - 236 | 'mmk_do_doc' B "@VMI$KWD:KITINSTAL HELP_DOC" 237 | $! 238 | $ VMI$CALLBACK ASK mmk_do_source - 239 | "Do you want to install the source code" - 240 | 'mmk_do_source' B "@VMI$KWD:KITINSTAL HELP_SOURCE" 241 | $! 242 | $ VMI$CALLBACK ASK mmk_do_startup - 243 | "Copy system startup procedure to SYS$STARTUP" - 244 | 'mmk_do_startup' B "@VMI$KWD:KITINSTAL HELP_STARTUP" 245 | $! 246 | $ VMI$CALLBACK MESSAGE I INSTALL "Installing MMK software..." 247 | $! 248 | $ mmk_root = F$PARSE(mmk_root,,,"DEVICE","SYNTAX_ONLY") + - 249 | "[" + (F$EXTRACT(1,-1,F$PARSE(mmk_root,,,"DIRECTORY","SYNTAX_ONLY")) -- 250 | "][" - "><" - ">[" - "]<" - "]" - ">") 251 | $ mmk_iroot = F$PARSE(mmk_root+"]",,,"DEVICE","SYNTAX_ONLY,NO_CONCEAL") + - 252 | "[" + (F$EXTRACT(1,-1,F$PARSE(mmk_root+"]",,,"DIRECTORY","NO_CONCEAL,SYNTAX_ONLY")) -- 253 | "][" - "><" - ">[" - "]<" - "]" - ">") + "]" 254 | $ mmk_install_device = F$PARSE (mmk_iroot,,,"DEVICE") 255 | $ mmk_install_root = "MMK_DEVICE:"+ F$PARSE (mmk_iroot,,,"DIRECTORY") - "]" + ".]" 256 | $ DEFINE MMK_DEVICE 'mmk_install_device'/TRANSLATION=(CONCEALED,TERMINAL) 257 | $ DEFINE MMK_INSTALL_ROOT 'mmk_install_root'/TRANSLATION=CONCEALED 258 | $ DEFINE MMK_ROOT 'mmk_install_root'/TRANSLATION=CONCEALED 259 | $! 260 | $ IF F$PARSE ("''mmk_root']").eqs."" then - 261 | VMI$CALLBACK CREATE_DIRECTORY USER 'mmk_root'] - 262 | "/OWNER=[1,4]/PROT=(S:RWE,O:RWE,G:RE,W:E)" 263 | $! 264 | $ IF F$PARSE ("''mmk_root'.''mmk_arch'_EXE]").eqs."" then - 265 | VMI$CALLBACK CREATE_DIRECTORY USER 'mmk_root'.'mmk_arch'_EXE] - 266 | "/OWNER=[1,4]/PROT=(S:RWE,O:RWE,G:RE,W:E)" 267 | $! 268 | $ IF mmk_do_command THEN - 269 | $ VMI$CALLBACK PROVIDE_DCL_COMMAND MMK_CLD.CLD 270 | $! 271 | $ IF mmk_do_help THEN - 272 | $ VMI$CALLBACK PROVIDE_DCL_HELP MMK_HELP.HLP 273 | $! 274 | $ VMI$CALLBACK PROVIDE_FILE MMK_TMP MMK___STARTUP.COM 'mmk_root'] K 275 | $ VMI$CALLBACK RESTORE_SAVESET 'base_saveset' 276 | $ VMI$CALLBACK PROVIDE_IMAGE MMK_TMP MMK.EXE 'mmk_root'.'mmk_arch'_EXE] K 277 | $! 278 | $ IF mmk_do_doc 279 | $ THEN 280 | $ VMI$CALLBACK MESSAGE I INSTALL_DOC "Installing documentation files..." 281 | $ IF F$PARSE("''mmk_root'.DOC]").eqs."" THEN - 282 | VMI$CALLBACK CREATE_DIRECTORY USER 'mmk_root'.DOC] - 283 | "/OWNER=[1,4]/PROT=(S:RWE,O:RWE,G:R,W:R)" 284 | $ VMI$CALLBACK PROVIDE_FILE "" MMK_DOC_LIST.DAT "" T 285 | $ ENDIF 286 | $! 287 | $ IF mmk_do_source 288 | $ THEN 289 | $ VMI$CALLBACK MESSAGE I INSTALL_SOURCE "Installing source kit..." 290 | $ IF F$PARSE("''mmk_root'.SRC]").eqs."" THEN - 291 | VMI$CALLBACK CREATE_DIRECTORY USER 'mmk_root'.SRC] - 292 | "/OWNER=[1,4]/PROT=(S:RWE,O:RWE,G:R,W:R)" 293 | $ VMI$CALLBACK RESTORE_SAVESET F 294 | $ VMI$CALLBACK PROVIDE_FILE MMK_TMP MMK'mmk_kit_version'_SOURCE.ZIP - 295 | 'mmk_root'.SRC] 296 | $ ENDIF 297 | $! 298 | $ close/nolog sp 299 | $ open/write sp VMI$KWD:MMK_STARTUP.COM 300 | $ write sp "$! MMK Startup Procedure -- generated by VMSINSTAL at ''f$time()'" 301 | $ write sp "$ set noon" 302 | $ write sp "$ @''mmk_root']MMK___STARTUP.COM" 303 | $ write sp "$ exitt 1" 304 | $ close/nolog sp 305 | $! 306 | $ if (mmk_do_startup) 307 | $ then 308 | $ vmi$callback provide_file MMK_TMP MMK_STARTUP.COM - 309 | VMI$ROOT:[SYS$STARTUP] C 310 | $ vmi$callback set startup MMK_STARTUP.COM 311 | $ endif 312 | $ 313 | $ EXIT VMI$_SUCCESS 314 | $! 315 | $help_upgrade: 316 | $ type SYS$INPUT: 317 | 318 | The following version of MMK has been detected by the 319 | installation procedure: 320 | 321 | $ mmk/identification 322 | $ type SYS$INPUT: 323 | 324 | To replace this installation with the software in this 325 | software installation kit, answer YES. To chose another 326 | directory to install to, answer NO and enter a different 327 | path. To exit this installation completely type CTRL/Y. 328 | 329 | $ exit VMI$_SUCCESS 330 | $help_command: 331 | $ type sys$input: 332 | 333 | The MMK make utility can be installed into DCLTABLES making 334 | it a known command. This is not a critical features of the 335 | product and it is easy enough to run MMK by simply defining 336 | a symbol (foreign command) to point to the executable. To 337 | install MMK in the system command tables, answer YES to 338 | this question. 339 | 340 | $ exit vmi$_success 341 | $! 342 | $help_help: 343 | $ type sys$input: 344 | 345 | The MMK make utility installation kit includes an online 346 | help file that can be installed into the system help file. 347 | It can then be accessed with the HELP command. This is 348 | not a critical feature of the product. To install the MMK 349 | online help file in the system HELP library, answer YES 350 | to this question. 351 | 352 | $ exit vmi$_success 353 | $! 354 | $help_doc: 355 | $ type sys$input: 356 | 357 | The full MMK documentation is included in this software kit. 358 | It is available in HTML, PDF, PostScript and Text formts. To 359 | install the documentation, answer YES to this option. 360 | 361 | $ exit vmi$_success 362 | $! 363 | $help_source: 364 | $ type sys$input: 365 | 366 | MMK is open source software and includes the full source of 367 | the software. To install a ZIP file containing the source 368 | code, answer YES to this option. 369 | 370 | $ exit vmi$_success 371 | $! 372 | $help_startup: 373 | $ type sys$input: 374 | 375 | As part of the installation process MMK generates a small 376 | system startup procedure that needs to be executed before 377 | using MMK. To make things more convenient, the install 378 | process can copy this procedure to SYS$STARTUP. This is 379 | not a critical feature of the product. 380 | 381 | $ exit vmi$_success 382 | -------------------------------------------------------------------------------- /descrip.mms: -------------------------------------------------------------------------------- 1 | !++ 2 | ! DESCRIP.MMS 3 | ! 4 | ! Description file for building MMK. 5 | ! Copyright (c) 2008, Matthew Madison. 6 | ! Copyright (c) 2013, Endless Software Solutions. 7 | ! 8 | ! All rights reserved. 9 | ! 10 | ! Redistribution and use in source and binary forms, with or without 11 | ! modification, are permitted provided that the following conditions 12 | ! are met: 13 | ! 14 | ! * Redistributions of source code must retain the above 15 | ! copyright notice, this list of conditions and the following 16 | ! disclaimer. 17 | ! * Redistributions in binary form must reproduce the above 18 | ! copyright notice, this list of conditions and the following 19 | ! disclaimer in the documentation and/or other materials provided 20 | ! with the distribution. 21 | ! * Neither the name of the copyright owner nor the names of any 22 | ! other contributors may be used to endorse or promote products 23 | ! derived from this software without specific prior written 24 | ! permission. 25 | ! 26 | ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | ! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | ! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | ! A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 | ! OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | ! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 | ! LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 | ! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 | ! THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | ! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | ! OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | ! 38 | ! 28-SEP-1993 V1.0 Madison Initial commenting. 39 | ! 25-JUL-1994 V1.1 Madison Update for V3.2. 40 | ! 27-DEC-1998 V1.2 Madison Update for V3.8. 41 | ! 03-MAY-2004 V1.3 Madison Integrate IA64 support. 42 | ! 03-MAR-2008 V2.0 Madison Cleanup for open-source release. 43 | ! 05-JUL-2009 V2.1 Sneddon Added HTML documentation. 44 | ! 16-APR-2010 V2.2 Sneddon New modules, etc. 45 | ! 06-AUG-2010 V2.3 Sneddon Add release notes, plus SDML dynamic 46 | ! symbols. 47 | ! 26-MAR-2013 V2.3-1 Sneddon MMK_MSG.H is now kept in the source 48 | ! repo. and regenerated when necessary. #59 49 | !-- 50 | 51 | .IFDEF ARCH 52 | .ELSE 53 | .IFDEF MMS$ARCH_NAME 54 | ARCH = $(MMS$ARCH_NAME) 55 | .ELSE 56 | .ERROR You must define the ARCH macro as one of: VAX, ALPHA, IA64, X86_64 57 | .ENDIF 58 | .ENDIF 59 | 60 | .SUFFIXES : .PS .PDF 61 | .PS.PDF : 62 | < DEFINE/USER GS_LIB SYS$SYSDEVICE:[GS.LIB],SYS$SYSDEVICE:[GS.FONTS] 63 | < GS == "$SYS$SYSDEVICE:[GS.BIN]GS.EXE_$(MMSARCH_NAME)" 64 | - PIPE GS "-sDEVICE=pdfwrite" "-dBATCH" "-dNOPAUSE" "-sOutputFile=$(MMS$TARGET)" $(MMS$SOURCE) > $(MMS$TARGET:.pdf=.gs_out) 65 | > TYPE $(MMS$TARGET:.pdf=.gs_out) 66 | > IF F$SEARCH("$(MMS$TARGET:.pdf=.gs_out)") .NES. "" THEN DELETE/NOLOG $(MMS$TARGET:.pdf=.gs_out);* 67 | > DELETE/SYMBOL/GLOBAL GS 68 | > IF F$SEARCH("_TEMP_*.*") .NES. "" THEN DELETE/NOLOG _TEMP_*.*;* 69 | 70 | .IFDEF __MADGOAT_BUILD__ 71 | MG_FACILITY = MMK 72 | SRCDIR = MG_SRC:[MMK] 73 | BINDIR = MG_BIN:[MMK] 74 | ETCDIR = MG_ETC:[MMK] 75 | KITDIR = MG_KIT:[MMK] 76 | .ELSE 77 | SRCDIR = SYS$DISK:[] 78 | BINDIR = SYS$DISK:[.BIN-$(ARCH)] 79 | ETCDIR = SYS$DISK:[.ETC-$(ARCH)] 80 | KITDIR = SYS$DISK:[.KIT-$(ARCH)] 81 | .ENDIF 82 | .FIRST 83 | @ IF F$PARSE("$(BINDIR)") .EQS. "" THEN CREATE/DIR $(BINDIR) 84 | @ DEFINE/NOLOG BIN_DIR $(BINDIR) 85 | @ IF F$PARSE("$(ETCDIR)") .EQS. "" THEN CREATE/DIR $(ETCDIR) 86 | @ DEFINE/NOLOG ETC_DIR $(ETCDIR) 87 | @ IF F$PARSE("$(KITDIR)") .EQS. "" THEN CREATE/DIR $(KITDIR) 88 | @ DEFINE/NOLOG KIT_DIR $(KITDIR) 89 | @ DEFINE/NOLOG SRC_DIR $(SRCDIR) 90 | @ IF F$TRNLNM("MMK_SDL_SETUP") .NES. "" - 91 | THEN @MMK_SDL_SETUP: 92 | 93 | OPT = .$(ARCH)_OPT 94 | MMKCOPT = MMK_COMPILE_RULES$(OPT) 95 | 96 | SDL = SDL/VAX 97 | 98 | .IFDEF DBG 99 | CFLAGS = $(CFLAGS)/DEBUG/NOOPT/LIST=$(ETCDIR) 100 | .IFDEF __VAX__ 101 | CFLAGS = $(CFLAGS)/MACHINE=AFTER 102 | .ELSE 103 | CFLAGS = $(CFLAGS)/MACHINE 104 | .ENDIF 105 | LINKFLAGS = $(LINKFLAGS)/TRACEBACK 106 | .ENDIF 107 | 108 | ! 109 | ! Modules for building MMK 110 | ! 111 | OBJECTS = MMK=$(BINDIR)MMK.OBJ,FILEIO=$(BINDIR)FILEIO.OBJ,- 112 | MEM=$(BINDIR)MEM.OBJ,GET_RDT=$(BINDIR)GET_RDT.OBJ,- 113 | SP_MGR=$(BINDIR)SP_MGR.OBJ,MISC=$(BINDIR)MISC.OBJ,- 114 | OBJECTS=$(BINDIR)OBJECTS.OBJ,SYMBOLS=$(BINDIR)SYMBOLS.OBJ,- 115 | READDESC=$(BINDIR)READDESC.OBJ,- 116 | BUILD_TARGET=$(BINDIR)BUILD_TARGET.OBJ,- 117 | PARSE_DESCRIP=$(BINDIR)PARSE_DESCRIP.OBJ,- 118 | CMS_INTERFACE=$(BINDIR)CMS_INTERFACE.OBJ,- 119 | PARSE_OBJECTS=$(BINDIR)PARSE_OBJECTS.OBJ,- 120 | PARSE_TABLES=$(BINDIR)PARSE_TABLES.OBJ,- 121 | STR=$(BINDIR)STR.OBJ,- 122 | MMK_MSG=$(BINDIR)MMK_MSG.OBJ,MMK_CLD=$(BINDIR)MMK_CLD.OBJ,- 123 | DEFAULT_RULES=$(BINDIR)DEFAULT_RULES.OBJ 124 | ! 125 | ! Modules for building the rules compiler 126 | ! 127 | MMKCMODS = FILEIO=$(BINDIR)FILEIO.OBJ,MEM=$(BINDIR)MEM.OBJ,- 128 | MISC=$(BINDIR)MISC.OBJ,OBJECTS=$(BINDIR)OBJECTS.OBJ,- 129 | SYMBOLS=$(BINDIR)SYMBOLS.OBJ,- 130 | READDESC=$(BINDIR)READDESC.OBJ,- 131 | PARSE_DESCRIP=$(BINDIR)PARSE_DESCRIP.OBJ,- 132 | PARSE_OBJECTS=$(BINDIR)PARSE_OBJECTS.OBJ,- 133 | PARSE_TABLES=$(BINDIR)PARSE_TABLES.OBJ,- 134 | MMK_MSG=$(BINDIR)MMK_MSG.OBJ 135 | 136 | CFLAGS = /NODEBUG$(CFLAGS)$(DEFINE) 137 | LINKFLAGS = /NOTRACEBACK/NODEBUG$(LINKFLAGS) 138 | 139 | $(BINDIR)MMK.EXE : $(BINDIR)MMK.OLB($(OBJECTS)),$(SRCDIR)MMK$(OPT) 140 | $(LIBR)/COMPRESS/OUTPUT=$(BINDIR)MMK.OLB $(BINDIR)MMK.OLB 141 | $(LINK)$(LINKFLAGS) $(SRCDIR)MMK$(OPT)/OPT 142 | 143 | MMK_H = $(SRCDIR)MMK.H, $(SRCDIR)MMK_MSG.H 144 | 145 | $(BINDIR)MMK.OBJ : $(SRCDIR)MMK.C,$(MMK_H) $(SRCDIR)VERSION.H 146 | $(BINDIR)MEM.OBJ : $(SRCDIR)MEM.C,$(MMK_H) 147 | $(BINDIR)SP_MGR.OBJ : $(SRCDIR)SP_MGR.C,$(MMK_H) 148 | $(BINDIR)FILEIO.OBJ : $(SRCDIR)FILEIO.C,$(MMK_H) 149 | $(BINDIR)GET_RDT.OBJ : $(SRCDIR)GET_RDT.C,$(MMK_H) 150 | 151 | $(BINDIR)SYMBOLS.OBJ : $(SRCDIR)SYMBOLS.C,$(MMK_H),$(SRCDIR)GLOBALS.H 152 | $(BINDIR)OBJECTS.OBJ : $(SRCDIR)OBJECTS.C,$(MMK_H),$(SRCDIR)GLOBALS.H 153 | $(BINDIR)MISC.OBJ : $(SRCDIR)MISC.C,$(MMK_H),$(SRCDIR)GLOBALS.H 154 | $(BINDIR)READDESC.OBJ : $(SRCDIR)READDESC.C,$(MMK_H),$(SRCDIR)GLOBALS.H 155 | $(BINDIR)BUILD_TARGET.OBJ : $(SRCDIR)BUILD_TARGET.C,$(MMK_H),$(SRCDIR)GLOBALS.H 156 | $(BINDIR)PARSE_DESCRIP.OBJ : $(SRCDIR)PARSE_DESCRIP.C,$(MMK_H),$(SRCDIR)GLOBALS.H 157 | $(BINDIR)PARSE_OBJECTS.OBJ : $(SRCDIR)PARSE_OBJECTS.C,$(MMK_H),$(SRCDIR)GLOBALS.H 158 | $(BINDIR)CMS_INTERFACE.OBJ : $(SRCDIR)CMS_INTERFACE.C,- 159 | $(MMK_H),$(SRCDIR)CMSDEF.H,$(SRCDIR)GLOBALS.H 160 | $(BINDIR)PARSE_TABLES.OBJ : $(SRCDIR)PARSE_TABLES.MAR 161 | .IFDEF __VAX__ 162 | $(MACRO)$(MFLAGS) $(SRCDIR)PARSE_TABLES.MAR 163 | .ELSE 164 | $(MACRO)$(MFLAGS) SYS$LIBRARY:ARCH_DEFS.MAR+$(SRCDIR)PARSE_TABLES.MAR 165 | .ENDIF 166 | 167 | $(BINDIR)DEFAULT_RULES.OBJ : $(SRCDIR)DEFAULT_RULES.C,$(MMK_H),$(SRCDIR)GLOBALS.H,- 168 | $(ETCDIR)MMK_DEFAULT_RULES.H 169 | 170 | $(BINDIR)MMK_MSG.OBJ : $(SRCDIR)MMK_MSG.MSG 171 | $(BINDIR)MMK_CLD.OBJ : $(SRCDIR)MMK_CLD.CLD 172 | 173 | $(SRCDIR)MMK_MSG.H : $(SRCDIR)MMK_MSG.MSG 174 | $(MESSAGE)/NOOBJECT/SDL=$(ETCDIR)MMK_MSG.SDL $(MMS$SOURCE) 175 | $(SDL)/LANGUAGE=CC=$(MMS$TARGET) $(ETCDIR)MMK_MSG.SDL 176 | 177 | $(ETCDIR)MMK_DEFAULT_RULES.H : $(SRCDIR)MMK_DEFAULT_RULES_$(ARCH).MMS, $(BINDIR)MMK_COMPILE_RULES.EXE 178 | MMKC := $$(BINDIR)MMK_COMPILE_RULES.EXE 179 | MMKC/OUTPUT=$(MMS$TARGET) $(MMS$SOURCE) 180 | 181 | MMKCOBJ = $(BINDIR)MMK_COMPILE_RULES.OBJ,$(BINDIR)GENSTRUC.OBJ,$(BINDIR)MMK_COMPILE_RULES_CLD.OBJ 182 | 183 | $(BINDIR)MMK_COMPILE_RULES_CLD.OBJ : $(SRCDIR)MMK_COMPILE_RULES_CLD.CLD 184 | 185 | $(BINDIR)MMK_COMPILE_RULES.EXE : $(MMKCOBJ),$(BINDIR)MMK.OLB($(MMKCMODS)),$(MMKCOPT) 186 | $(LINK)$(LINKFLAGS) $(MMKCOBJ),$(SRCDIR)$(MMKCOPT)/opt 187 | 188 | $(BINDIR)MMK_COMPILE_RULES.OBJ : $(SRCDIR)MMK_COMPILE_RULES.C,$(MMK_H) 189 | $(BINDIR)GENSTRUC.OBJ : $(SRCDIR)GENSTRUC.C,$(MMK_H),$(SRCDIR)GLOBALS.H 190 | $(BINDIR)STR.OBJ : $(SRCDIR)STR.C 191 | 192 | ! 193 | ! The help file 194 | ! 195 | $(KITDIR)MMK_HELP.HLP : $(SRCDIR)MMK_HELP.RNH 196 | 197 | ! 198 | ! Documentation 199 | ! 200 | DOCS : $(KITDIR)MMK_DOC.PS,$(KITDIR)MMK_DOC.TXT,$(KITDIR)MMK_DOC.HTML,- 201 | $(KITDIR)MMK_HELP.HLP,$(KITDIR)MMK.RELEASE_NOTES $(KITDIR)MMK_DOC.PDF 202 | $(KITDIR)MMK_DOC.PS : $(SRCDIR)MMK_DOC.SDML,$(SRCDIR)MMK_DEFAULT_RULES_VAX.MMS,- 203 | $(SRCDIR)MMK_DEFAULT_RULES_ALPHA.MMS,- 204 | $(SRCDIR)MMK_DEFAULT_RULES_IA64.MMS,- 205 | $(SRCDIR)MMK_DEFAULT_RULES_X86_64.MMS,- 206 | $(ETCDIR)DYNAMIC_SYMBOLS.SDML 207 | @ IF F$TRNLNM("DECC$SHR") .NES. "" THEN DEF/USER DECC$SHR SYS$SHARE:DECC$SHR 208 | DOCUMENT/CONTENTS/NOPRINT/DEVICE=BLANK_PAGES/OUTPUT=$(MMS$TARGET) $(MMS$SOURCE) SOFTWARE.REFERENCE PS 209 | $(KITDIR)MMK_DOC.PDF : $(KITDIR)MMK_DOC.PS 210 | $(KITDIR)MMK_DOC.TXT : $(SRCDIR)MMK_DOC.SDML,$(SRCDIR)MMK_DEFAULT_RULES_VAX.MMS,- 211 | $(SRCDIR)MMK_DEFAULT_RULES_ALPHA.MMS,- 212 | $(SRCDIR)MMK_DEFAULT_RULES_IA64.MMS,- 213 | $(SRCDIR)MMK_DEFAULT_RULES_X86_64.MMS,- 214 | $(ETCDIR)DYNAMIC_SYMBOLS.SDML 215 | @ IF F$TRNLNM("DECC$SHR") .NES. "" THEN DEF/USER DECC$SHR SYS$SHARE:DECC$SHR 216 | DOCUMENT/CONTENTS/NOPRINT/OUTPUT=$(MMS$TARGET) $(MMS$SOURCE) SOFTWARE.REFERENCE MAIL 217 | $(KITDIR)MMK_DOC.HTML : $(SRCDIR)MMK_DOC.SDML,$(SRCDIR)MMK_DEFAULT_RULES_VAX.MMS,- 218 | $(SRCDIR)MMK_DEFAULT_RULES_ALPHA.MMS,- 219 | $(SRCDIR)MMK_DEFAULT_RULES_IA64.MMS,- 220 | $(SRCDIR)MMK_DEFAULT_RULES_X86_64.MMS,- 221 | $(ETCDIR)DYNAMIC_SYMBOLS.SDML 222 | @ IF F$TRNLNM("DECC$SHR") .NES. "" THEN DEF/USER DECC$SHR SYS$SHARE:DECC$SHR 223 | DOCUMENT/CONTENTS/OUTPUT=$(KITDIR) $(MMS$SOURCE) SOFTWARE.REFERENCE HTML 224 | $(KITDIR)MMK.RELEASE_NOTES : $(SRCDIR)RELEASE_NOTES.SDML,$(ETCDIR)DYNAMIC_SYMBOLS.SDML 225 | @ IF F$TRNLNM("DECC$SHR") .NES. "" THEN DEF/USER DECC$SHR SYS$SHARE:DECC$SHR 226 | DOCUMENT/DEVICE=BLANK_PAGES/OUTPUT=$(MMS$TARGET) $(MMS$SOURCE) SOFTWARE.REFERENCE MAIL/CONTENTS 227 | $(ETCDIR)DYNAMIC_SYMBOLS.SDML : $(BINDIR)MMK.EXE,$(SRCDIR)GENERATE_SYMBOLS.MMS 228 | MCR $(MMS$SOURCE) /DESCRIPTION=$(SRCDIR)GENERATE_SYMBOLS.MMS - 229 | /OUTPUT=$(MMS$TARGET) 230 | 231 | CLEAN : 232 | - DELETE $(ETCDIR)*.*;* 233 | - DELETE $(KITDIR)*.*;* 234 | - DELETE $(BINDIR)*.*;* 235 | 236 | REALCLEAN : CLEAN 237 | - DELETE $(KITDIR)*.*;* 238 | 239 | .IFDEF ZIP 240 | .ELSE 241 | ZIP = ZIP 242 | .ENDIF 243 | 244 | ALWAYS_MAKE : ! fake target to trigger make on every pass 245 | 246 | .IFNDEF KITBUILDER 247 | 248 | ! 249 | ! Build new MMK version number... 250 | ! 251 | TMP |= PIPE TMP="$(MMK_MAJOR_VERSION)" ; IF F$LENGTH(TMP) .EQ 1 THEN TMP="0"+TMP ; WRITE/SYMBOL SYS$OUTPUT TMP 252 | KITNAME = $(COLLAPSE $(MG_FACILITY)$(TMP)$(MMK_MINOR_VERSION)) 253 | 254 | KIT : $(BINDIR)MMK.EXE 255 | MCR $(BINDIR)MMK.EXE /MACRO=(KITBUILDER=1,KITNAME=$(KITNAME)) VMSINSTAL 256 | MCR $(BINDIR)MMK.EXE /MACRO=(KITBUILDER=1,KITARCH=VAX) PCSI 257 | MCR $(BINDIR)MMK.EXE /MACRO=(KITBUILDER=1,KITARCH=AXP) PCSI 258 | MCR $(BINDIR)MMK.EXE /MACRO=(KITBUILDER=1,KITARCH=I64) PCSI 259 | MCR $(BINDIR)MMK.EXE /MACRO=(KITBUILDER=1,KITARCH=X86) PCSI 260 | 261 | .ELSE 262 | 263 | ! 264 | ! MMK VMSINSTAL Kit Lettering... 265 | ! 266 | ! A = KITINSTAL, documentation 267 | ! B = VAX images 268 | ! C = Alpha images 269 | ! D = I64 images 270 | ! E = X86_64 images 271 | ! F = Source code 272 | ! 273 | BACKUP = BAC/INT/BL=8192 274 | 275 | VMSINSTAL : $(KITDIR)$(KITNAME).A,$(KITDIR)$(KITNAME).B,- 276 | $(KITDIR)$(KITNAME).C,$(KITDIR)$(KITNAME).D,- 277 | $(KITDIR)$(KITNAME).E,$(KITDIR)$(KITNAME).F 278 | @ WRITE SYS$OUTPUT "%I, MMK VMSINSTAL kit built" 279 | 280 | $(KITDIR)$(KITNAME).RELEASE_NOTES : $(KITDIR)MMK.RELEASE_NOTES 281 | COPY $(MMS$SOURCE) $(MMS$TARGET) 282 | 283 | $(KITDIR)$(KITNAME).A : $(SRCDIR)KITINSTAL.COM,- 284 | $(KITDIR)$(KITNAME).RELEASE_NOTES,- 285 | $(KITDIR)MMK_INSTALLING_VERSION.DAT,- 286 | $(KITDIR)MMK_DOC_LIST.DAT,$(SRCDIR)MMK_CLD.CLD,- 287 | $(KITDIR)MMK_HELP.HLP,$(SRCDIR)MMK___STARTUP.COM 288 | @ old_default = F$ENVIRONMENT ("DEFAULT") 289 | @ SET DEFAULT $(KITDIR) 290 | @ CREATE/DIRECTORY/PROTECT=O:WRED [.$(KITNAME)_A] 291 | $(BACKUP) $(MMS$SOURCE_LIST) [.$(KITNAME)_A]/OWNER=PARENT 292 | $(BACKUP) MG_KIT:[MMK]*.PDF,*.PS,*.HTML,*.TXT [.$(KITNAME)_A]/OWNER=PARENT 293 | SET PROTECTION=W:RE [.$(KITNAME)_A]*.* 294 | $(BACKUP) [.$(KITNAME)_A]*.*; $(MMS$TARGET)/SAVE 295 | @ DELETE [.$(KITNAME)_A]*.*;*,[]$(KITNAME)_A.DIR; 296 | @ SET DEFAULT 'old_default' 297 | 298 | $(KITDIR)MMK_DOC_LIST.DAT : MAKE_MMK_DOC_LIST.COM,DOCS 299 | -@ DELETE/NOLOG $(MMS$TARGET);* 300 | @MAKE_MMK_DOC_LIST 301 | 302 | $(KITDIR)MMK_INSTALLING_VERSION.DAT : $(SRCDIR)INSTALLING_VERSION.MMS,- 303 | $(BINDIR)MMK.EXE 304 | MCR $(BINDIR)MMK.EXE /DESCRIPTION=$(MMS$SOURCE)/OUTPUT=$(MMS$TARGET) 305 | 306 | $(KITDIR)$(KITNAME).B : MG_BIN_VAX:[MMK]MMK.EXE 307 | - PURGE/NOLOG $(MMS$SOURCE_LIST) 308 | SET PROTECTION=W:RE $(MMS$SOURCE_LIST) 309 | $(BACKUP) $(MMS$SOURCE_LIST) $(MMS$TARGET)/SA 310 | 311 | $(KITDIR)$(KITNAME).C : MG_BIN_AXP:[MMK]MMK.EXE 312 | - PURGE/NOLOG $(MMS$SOURCE_LIST) 313 | SET PROTECTION=W:RE $(MMS$SOURCE_LIST) 314 | $(BACKUP) $(MMS$SOURCE_LIST) $(MMS$TARGET)/SA 315 | 316 | $(KITDIR)$(KITNAME).D : MG_BIN_I64:[MMK]MMK.EXE 317 | - PURGE/NOLOG $(MMS$SOURCE_LIST) 318 | SET PROTECTION=W:RE $(MMS$SOURCE_LIST) 319 | $(BACKUP) $(MMS$SOURCE_LIST) $(MMS$TARGET)/SA 320 | 321 | $(KITDIR)$(KITNAME).E : MG_BIN_X86:[MMK]MMK.EXE 322 | - PURGE/NOLOG $(MMS$SOURCE_LIST) 323 | SET PROTECTION=W:RE $(MMS$SOURCE_LIST) 324 | $(BACKUP) $(MMS$SOURCE_LIST) $(MMS$TARGET)/SA 325 | 326 | $(KITDIR)$(KITNAME).F : $(KITDIR)$(KITNAME)_SOURCE.ZIP 327 | - PURGE/NOLOG $(MMS$SOURCE_LIST) 328 | SET PROTECTION=W:RE $(MMS$SOURCE_LIST) 329 | $(BACKUP) $(MMS$SOURCE_LIST) $(MMS$TARGET)/SA 330 | 331 | $(KITDIR)$(KITNAME)_SOURCE.ZIP : ALWAYS_MAKE 332 | - DELETE/NOLOG $(MMS$TARGET);* 333 | $(ZIP)/EXCLU=*.DIR $(MMS$TARGET) $(SRCDIR)*.* 334 | ! wget --no-check-certificate --output-document=$(MMS$TARGET) - 335 | ! "https://github.com/endlesssoftware/mmk/archive/$(MMK_VERSION).zip" 336 | 337 | PCSI : $(KITDIR)MMK.PCSI$DESC,$(KITDIR)MMK.PCSI$TEXT 338 | MCR $(BINDIR)MMK.EXE PACKAGE/DESCRIPTION=$(SRCDIR)BUILD_PCSI.MMS - 339 | /MACRO=KITARCH=$(KITARCH) 340 | 341 | $(KITDIR)MMK.PCSI$DESC : $(SRCDIR)BUILD_PCSI.MMS,ALWAYS_MAKE 342 | - DELETE/NOLOG $(MMS$TARGET);* 343 | MCR $(BINDIR)MMK.EXE DESCRIPTION/OUTPUT=$(MMS$TARGET) - 344 | /DESCRIPTION=$(MMS$SOURCE)/MACRO=KITARCH=$(KITARCH) 345 | 346 | $(KITDIR)MMK.PCSI$TEXT : $(SRCDIR)BUILD_PCSI.MMS,ALWAYS_MAKE 347 | - DELETE/NOLOG $(MMS$TARGET);* 348 | MCR $(BINDIR)MMK.EXE TEXT/OUTPUT=$(MMS$TARGET) - 349 | /DESCRIPTION=$(MMS$SOURCE)/MACRO=KITARCH=$(KITARCH) 350 | 351 | .ENDIF 352 | -------------------------------------------------------------------------------- /parse_objects.c: -------------------------------------------------------------------------------- 1 | /* 2 | **++ 3 | ** FACILITY: MMK 4 | ** 5 | ** ABSTRACT: Source/Target object parser. 6 | ** 7 | ** MODULE DESCRIPTION: 8 | ** 9 | ** This module contains routines for parsing MMS object names, 10 | ** which are in one of the following forms: 11 | ** 12 | ** OBJECT generic object - no suffix, not a file 13 | ** OBJECT.SFX file object 14 | ** LIB.SFX(OBJECT) library with library module object with 15 | ** implicit file dependency 16 | ** LIB.SFX(OBJECT=FILE.SF2) library with libmod object with explicit 17 | ** file dependency 18 | ** 19 | ** Lists of object names are parsed. Library specifications may also 20 | ** contain lists of module references. 21 | ** 22 | ** AUTHOR: M. Madison 23 | ** 24 | ** Copyright (c) 2008, Matthew Madison. 25 | ** 26 | ** All rights reserved. 27 | ** 28 | ** Redistribution and use in source and binary forms, with or without 29 | ** modification, are permitted provided that the following conditions 30 | ** are met: 31 | ** 32 | ** * Redistributions of source code must retain the above 33 | ** copyright notice, this list of conditions and the following 34 | ** disclaimer. 35 | ** * Redistributions in binary form must reproduce the above 36 | ** copyright notice, this list of conditions and the following 37 | ** disclaimer in the documentation and/or other materials provided 38 | ** with the distribution. 39 | ** * Neither the name of the copyright owner nor the names of any 40 | ** other contributors may be used to endorse or promote products 41 | ** derived from this software without specific prior written 42 | ** permission. 43 | ** 44 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 45 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 46 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 47 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 48 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 49 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 50 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 51 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 52 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 53 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 54 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 55 | ** 56 | ** CREATION DATE: 20-AUG-1992 57 | ** 58 | ** MODIFICATION HISTORY: 59 | ** 60 | ** 20-AUG-1992 V1.0 Madison Initial coding. 61 | ** 01-SEP-1992 V1.1 Madison Comments. 62 | ** 08-MAR-1993 V1.1-1 Madison Fix for library modules. 63 | ** 23-APR-1993 V1.2 Madison Improve suffix handling. 64 | ** 29-APR-1993 V1.2-1 Madison Handle some suffix-less file cases. 65 | ** 27-SEP-1993 V1.2-2 Madison Assume libraries w/no suffix are .OLB. 66 | ** 22-OCT-1993 V1.2-3 Madison Fix blank-line problem. 67 | ** 02-DEC-1993 V1.2-4 Madison Back out intermediate-deletes. 68 | ** 28-JUN-1994 V1.2-5 Madison Track modules' file objects. 69 | ** 01-JUL-1994 V1.3 Madison Add CMS support. 70 | ** 22-AUG-1994 V1.3-1 Madison Remove KILL_INTERMEDIATES stuff. 71 | ** 28-AUG-1994 V1.4 Madison Uniform calling sequence for store rtn. 72 | ** 12-JAN-1995 V1.4-1 Madison Defer target libmod dependencies. 73 | ** 30-APR-1995 V1.4-2 Madison Don't prefix lib modules if they've 74 | ** already got dev/dir specifications. 75 | ** 29-MAY-1996 V1.4-3 Madison Special handling for macros beginning 76 | ** with dots. 77 | ** 20-JUN-1997 V1.4-4 Madison Silently ignore null objects. 78 | ** 27-DEC-1998 V1.5 Madison General cleanup. 79 | ** 03-MAY-2004 V1.6 Madison Integrate IA64 changes. 80 | ** 16-Oct-2008 V1.7 Sneddon Added support for /CASE_SENSITIVE changes 81 | ** from Kris G.G. Clippeleyr. 82 | ** 01-JUL-2009 V1.8 Sneddon Changed definition for tpa0. Now 83 | ** works better with older compilers. 84 | **-- 85 | */ 86 | #pragma module PARSE_OBJECTS "V1.8" 87 | #include "mmk.h" 88 | #pragma nostandard 89 | globalvalue int LIB$_SYNTAXERR; 90 | #pragma standard 91 | #include "globals.h" 92 | #include 93 | #include 94 | 95 | /* 96 | ** Private extended TParse state info block 97 | */ 98 | #define TPA_C_LENGTH (TPA$C_LENGTH0+4) 99 | #define TPA_K_COUNT (TPA$K_COUNT0+1) 100 | 101 | struct TPABLK { 102 | struct tpadef tpa0; 103 | int tpa_l_istarget; 104 | struct QUE *tpa_l_objqptr; 105 | }; 106 | 107 | /* 108 | ** Forward declarations 109 | */ 110 | 111 | void Parse_Objects(char *, int, struct QUE *, int); 112 | int parse_obj_store(struct TPABLK *); 113 | static void process_sfx(struct OBJECT *, int); 114 | 115 | /* 116 | ** Parse transition codes; must match corresponding values in PARSE_TABLE.MAR. 117 | */ 118 | 119 | #define PO_K_LIB_BEGIN 1 120 | #define PO_K_END_OBJ 2 121 | #define PO_K_APPNAM 3 122 | #define PO_K_APPNAM_CMS 4 123 | #define PO_K_LIB_END 5 124 | #define PO_K_MOD_END 6 125 | #define PO_K_APPMOD 7 126 | #define PO_K_APPFIL 8 127 | #define PO_K_OBJ_INIT 9 128 | #define PO_K_MOD_FILE 10 129 | #define PO_K_APPGEN 11 130 | #define PO_K_APPGENQ 12 131 | 132 | /* 133 | ** External references 134 | */ 135 | #ifndef __VAX 136 | extern int po_state, po_key; 137 | unsigned int lib$table_parse(); 138 | #define lib$tparse lib$table_parse 139 | #else 140 | globalref po_state, po_key; 141 | #endif 142 | 143 | /* 144 | **++ 145 | ** ROUTINE: Parse_Objects 146 | ** 147 | ** FUNCTIONAL DESCRIPTION: 148 | ** 149 | ** RETURNS: void (all errrors are signaled) 150 | ** 151 | ** PROTOTYPE: 152 | ** 153 | ** Parse_Objects(char *line, int linelen, sturct OBJECT *object_queue) 154 | ** 155 | ** IMPLICIT INPUTS: None. 156 | ** 157 | ** IMPLICIT OUTPUTS: None. 158 | ** 159 | ** COMPLETION CODES: None. 160 | ** 161 | ** SIDE EFFECTS: None. 162 | ** 163 | **-- 164 | */ 165 | void Parse_Objects (char *line, int linelen, struct QUE *objque, int is_target) { 166 | 167 | struct TPABLK tpablk; 168 | int i, nllen; 169 | unsigned int status; 170 | 171 | memset(&tpablk, 0, TPA_C_LENGTH); 172 | tpablk.tpa0.tpa$l_count = TPA_K_COUNT; 173 | tpablk.tpa0.tpa$l_options = TPA$M_BLANKS; 174 | tpablk.tpa0.tpa$l_stringcnt = linelen; 175 | tpablk.tpa0.tpa$l_stringptr = (unsigned int)line; 176 | tpablk.tpa_l_istarget = is_target; 177 | tpablk.tpa_l_objqptr = objque; 178 | 179 | status = lib$tparse(&tpablk, &po_state, &po_key); 180 | 181 | if (!OK(status)) lib$signal(MMK__PARSERR, 2, linelen, line, status); 182 | 183 | } /* Parse_Objects */ 184 | 185 | /* 186 | **++ 187 | ** ROUTINE: PARSE_OBJ_STORE 188 | ** 189 | ** FUNCTIONAL DESCRIPTION: 190 | ** 191 | ** Character store routine for use with LIB$TPARSE. 192 | ** 193 | ** RETURNS: cond_value, longword (unsigned), write only, by value 194 | ** 195 | ** PROTOTYPE: 196 | ** 197 | ** PARSE_OBJ_STORE flag, inplen, inp, toklen, tok, char, number, 198 | ** usrarg 199 | ** 200 | ** The first eight arguments are the LIB$TPARSE standard argument block. 201 | ** (Note that LIB$TABLE_PARSE passes the address of the state array, 202 | ** rather than the state array elements as arguments.) 203 | ** 204 | ** IMPLICIT INPUTS: None. 205 | ** 206 | ** IMPLICIT OUTPUTS: None. 207 | ** 208 | ** COMPLETION CODES: 209 | ** SS$_NORMAL: normal successful completion 210 | ** Other errors are signaled. 211 | ** 212 | ** SIDE EFFECTS: None. 213 | ** 214 | **-- 215 | */ 216 | int parse_obj_store (struct TPABLK *tpa) { 217 | 218 | int len; 219 | static struct OBJECT *obj = (struct OBJECT *) 0; 220 | static struct OBJECT *libobj = (struct OBJECT *) 0; 221 | static struct OBJECT *filobj = (struct OBJECT *) 0; 222 | struct OBJREF *or; 223 | struct OBJECT *obj2, *queued_object; 224 | struct DEPEND *dep; 225 | static char *namptr, *sfxptr, *genptr; 226 | 227 | switch (tpa->tpa0.tpa$l_param) { 228 | 229 | case PO_K_OBJ_INIT: 230 | obj = mem_get_object(); 231 | namptr = obj->name; 232 | sfxptr = obj->sfx; 233 | genptr = obj->cms_gen; 234 | break; 235 | 236 | case PO_K_APPNAM_CMS: 237 | obj->type = MMK_K_OBJ_CMSFILE; 238 | case PO_K_APPNAM: 239 | if (case_sensitive) 240 | *namptr++ = tpa->tpa0.tpa$b_char; 241 | else 242 | *namptr++ = toupper(tpa->tpa0.tpa$b_char); 243 | *namptr = '\0'; 244 | break; 245 | 246 | case PO_K_LIB_BEGIN: 247 | process_sfx(obj, 0); 248 | if (obj->sfx[0] == '\0') { 249 | strcpy(obj->sfx, ".OLB"); 250 | strcat(obj->name, ".OLB"); 251 | } 252 | obj->type = MMK_K_OBJ_LIB; 253 | libobj = obj; 254 | obj2 = Find_Object(libobj); 255 | if (obj2 == NULL) { 256 | Insert_Object(libobj); 257 | } else { 258 | mem_free_object(libobj); 259 | libobj = obj2; 260 | } 261 | obj = mem_get_object(); 262 | namptr = obj->name; 263 | sfxptr = obj->sfx; 264 | obj->libfile = libobj; 265 | obj->type = MMK_K_OBJ_LIBMOD; 266 | filobj = (struct OBJECT *) 0; 267 | break; 268 | 269 | case PO_K_APPMOD: 270 | if (case_sensitive) 271 | *namptr++ = tpa->tpa0.tpa$b_char; 272 | else 273 | *namptr++ = toupper(tpa->tpa0.tpa$b_char); 274 | *namptr = '\0'; 275 | break; 276 | 277 | case PO_K_MOD_FILE: 278 | filobj = mem_get_object(); 279 | namptr = filobj->name; 280 | sfxptr = filobj->sfx; 281 | filobj->type = MMK_K_OBJ_FILE; 282 | break; 283 | 284 | case PO_K_APPFIL: 285 | if (case_sensitive) 286 | *namptr++ = tpa->tpa0.tpa$b_char; 287 | else 288 | *namptr++ = toupper(tpa->tpa0.tpa$b_char); 289 | *namptr = '\0'; 290 | break; 291 | 292 | case PO_K_MOD_END: 293 | case PO_K_LIB_END: if (obj->name[0] != '\0') { 294 | 295 | struct CMD *c; 296 | char tmp[MMK_S_FILE], realobjname[MMK_S_FILE]; 297 | 298 | if (filobj) process_sfx(filobj, 0); 299 | /* 300 | ** Make sure that the library module's object name is just the module 301 | ** name. 302 | */ 303 | strcpy(tmp, obj->name); 304 | extract_name(realobjname, tmp); 305 | extract_filename(obj->name, tmp); 306 | extract_filetype(obj->sfx, tmp); 307 | /* 308 | ** Special case for macro names that begin with '.' 309 | */ 310 | if (realobjname[0] == '\0' && obj->sfx[0] != '\0') { 311 | strcpy(realobjname, obj->sfx); 312 | strcpy(obj->name, obj->sfx); 313 | obj->sfx[0] = '\0'; 314 | } 315 | 316 | dep = mem_get_depend(); 317 | c = mem_get_cmd(); 318 | dep->cmdqptr = c->flink = c->blink = c; 319 | /* 320 | ** Assume the right suffix if one wasn't given. Take it from the 321 | ** =xxx file, if one was given... 322 | */ 323 | if (obj->sfx[0] == '\0' && filobj) { 324 | if (filobj->sfx[0] != '\0') strcpy(obj->sfx, filobj->sfx); 325 | } 326 | 327 | /* 328 | ** Or make the assumption based on the library's suffix. 329 | */ 330 | if (obj->sfx[0] == '\0') { 331 | struct SFX *s; 332 | struct RULE *r; 333 | s = find_suffix(libobj->sfx, -1); 334 | if (s) { 335 | for (s = s->flink; s != &suffixes; s = s->flink) { 336 | r = find_rule(libobj->sfx, s->value); 337 | if (r) break; 338 | } 339 | if (r) strcpy(obj->sfx, s->value); 340 | } 341 | } 342 | 343 | /* 344 | ** Now insert the object into the object tree... 345 | */ 346 | obj2 = Find_Object(obj); 347 | if (obj2 == NULL) { 348 | Insert_Object(obj); 349 | } else { 350 | mem_free_object(obj); 351 | obj = obj2; 352 | } 353 | queued_object = mem_get_object(); 354 | memcpy(queued_object, obj, sizeof(struct OBJECT)); 355 | queue_insert(queued_object, tpa->tpa_l_objqptr->tail); 356 | dep->target = obj; 357 | /* 358 | ** Now make sure that the module's file object has the suffix on it, 359 | ** if one was given. If one wasn't given, fake one up. 360 | */ 361 | if (filobj) { 362 | if (filobj->sfx[0] == '\0') { 363 | strcpy(filobj->sfx, obj->sfx); 364 | strcat(filobj->name, obj->sfx); 365 | } 366 | obj2 = Find_Object(filobj); 367 | if (obj2 == NULL) { 368 | Insert_Object(filobj); 369 | } else { 370 | mem_free_object(filobj); 371 | filobj = obj2; 372 | } 373 | or = mem_get_objref(); 374 | or->obj = filobj; 375 | queue_insert(or, dep->sources.blink); 376 | } else { 377 | char tmp[MMK_S_FILE]; 378 | int i; 379 | filobj = mem_get_object(); 380 | filobj->type = MMK_K_OBJ_FILE; 381 | /* 382 | ** If the library module does not have a device/directory specification, 383 | ** assume it's located in the same directory as the library. 384 | */ 385 | if (extract_prefix(tmp, realobjname) == 0) { 386 | i = extract_prefix(tmp, libobj->name); 387 | memcpy(filobj->name, tmp, i); 388 | } else { 389 | i = 0; 390 | } 391 | strcpy(filobj->name+i, 392 | realobjname + (realobjname[0] == '.' ? 1 : 0)); 393 | strcat(filobj->name+i, dep->target->sfx); 394 | strcpy(filobj->sfx, dep->target->sfx); 395 | obj2 = Find_Object(filobj); 396 | if (obj2 == NULL) { 397 | Insert_Object(filobj); 398 | } else { 399 | mem_free_object(filobj); 400 | filobj = obj2; 401 | } 402 | or = mem_get_objref(); 403 | or->obj = filobj; 404 | queue_insert(or, dep->sources.blink); 405 | } 406 | if (tpa->tpa_l_istarget) { 407 | queue_insert(dep, dep_deferred.blink); 408 | } else { 409 | queue_insert(dep, dep_internal.blink); 410 | } 411 | obj->fileobj = queued_object->fileobj = filobj; 412 | obj = filobj = (struct OBJECT *) 0; 413 | if (tpa->tpa0.tpa$l_param == PO_K_MOD_END) { 414 | obj = mem_get_object(); 415 | obj->type = MMK_K_OBJ_LIBMOD; 416 | obj->libfile = libobj; 417 | namptr = obj->name; 418 | } else { 419 | libobj = NULL; 420 | } 421 | break; 422 | } else { /* silently ignore null modules */ 423 | if (tpa->tpa0.tpa$l_param == PO_K_MOD_END) { 424 | namptr = obj->name; 425 | sfxptr = obj->sfx; 426 | } else { 427 | mem_free_object(obj); 428 | obj = 0; 429 | libobj = 0; 430 | } 431 | if (filobj) mem_free_object(filobj); 432 | filobj = 0; 433 | break; 434 | } 435 | 436 | case PO_K_END_OBJ: 437 | if (obj) { 438 | if (obj->name[0] != '\0') { 439 | process_sfx(obj, 0); 440 | if (obj->type == 0) { 441 | obj->type = obj->sfx[0] ? MMK_K_OBJ_FILE : 442 | OK(file_exists(obj->name, "")) ? MMK_K_OBJ_FILE : 443 | MMK_K_OBJ_GENERIC; 444 | } 445 | queue_insert(obj, tpa->tpa_l_objqptr->tail); 446 | } else { /* silently ignore null object */ 447 | mem_free_object(obj); 448 | } 449 | obj = NULL; 450 | } 451 | break; 452 | 453 | case PO_K_APPGEN: 454 | if (genptr-obj->cms_gen < sizeof(obj->cms_gen)-1) { 455 | *genptr++ = tpa->tpa0.tpa$b_char; 456 | *genptr = '\0'; 457 | } 458 | break; 459 | 460 | default: 461 | lib$signal(MMK__PRSTBLERR, 0); 462 | 463 | } 464 | 465 | return SS$_NORMAL; 466 | 467 | } /* parse_obj_store */ 468 | 469 | /* 470 | **++ 471 | ** ROUTINE: process_sfx 472 | ** 473 | ** FUNCTIONAL DESCRIPTION: 474 | ** 475 | ** Parses the suffix from an object name. 476 | ** 477 | ** RETURNS: cond_value, longword (unsigned), write only, by value 478 | ** 479 | ** PROTOTYPE: 480 | ** 481 | ** tbs 482 | ** 483 | ** IMPLICIT INPUTS: None. 484 | ** 485 | ** IMPLICIT OUTPUTS: None. 486 | ** 487 | ** COMPLETION CODES: 488 | ** 489 | ** 490 | ** SIDE EFFECTS: None. 491 | ** 492 | **-- 493 | */ 494 | static void process_sfx (struct OBJECT *obj, int chop_off) { 495 | 496 | struct dsc$descriptor fdsc; 497 | static struct { 498 | unsigned short len, code; 499 | char *ptr; 500 | unsigned int term; 501 | } itmlst = {0, FSCN$_TYPE, 0, 0}; 502 | unsigned int status; 503 | 504 | INIT_SDESC(fdsc, strlen(obj->name), obj->name); 505 | status = sys$filescan(&fdsc, &itmlst, 0); 506 | if (OK(status) && itmlst.len != 0) { 507 | if (itmlst.ptr[itmlst.len] == '~') itmlst.len++; 508 | if (itmlst.len > MMK_S_SFX-1) itmlst.len = MMK_S_SFX-1; 509 | memcpy(obj->sfx, itmlst.ptr, itmlst.len); 510 | obj->sfx[itmlst.len] = '\0'; 511 | if (chop_off) *itmlst.ptr = '\0'; 512 | } else { 513 | obj->sfx[0] = '\0'; 514 | } 515 | 516 | } 517 | -------------------------------------------------------------------------------- /mmk.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** MMK.H 3 | ** 4 | ** Main #include file for the MMK Make utilty. 5 | ** 6 | ** Copyright (c) 2008, Matthew Madison. 7 | ** Copyright (c) 2014, Endless Software Solutions. 8 | ** 9 | ** All rights reserved. 10 | ** 11 | ** Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions 13 | ** are met: 14 | ** 15 | ** * Redistributions of source code must retain the above 16 | ** copyright notice, this list of conditions and the following 17 | ** disclaimer. 18 | ** * Redistributions in binary form must reproduce the above 19 | ** copyright notice, this list of conditions and the following 20 | ** disclaimer in the documentation and/or other materials provided 21 | ** with the distribution. 22 | ** * Neither the name of the copyright owner nor the names of any 23 | ** other contributors may be used to endorse or promote products 24 | ** derived from this software without specific prior written 25 | ** permission. 26 | ** 27 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | ** 39 | ** MODIFICATION HISTORY: 40 | ** 41 | ** 27-Aug-1992 Madison Initial commenting. 42 | ** 02-Apr-1993 Madison Add new flag to CMD structure. 43 | ** 22-Oct-1993 Madison Better support for deleting intermediates. 44 | ** 01-JUL-1994 Madison Add CMS support. 45 | ** 14-JUL-1994 Madison Add prefixed inference rule support. 46 | ** 21-JUN-1995 Madison Beefed up symbol support. 47 | ** 03-OCT-1995 Madison Let symbol name be up to 39 chars. 48 | ** 22-DEC-1996 Madison Add support for rules with must-execute commands. 49 | ** 27-DEC-1998 Madison Add prototypes. 50 | ** 02-JUN-2009 Sneddon Add type to SYMBOL as well as MMK_K_SYM_CLI 51 | ** and MMK_K_SYM_DEFAULT. 52 | ** 03-JUN-2009 Sneddon Added MMK_K_SYM_TEMPORARY and SDESC. 53 | ** 07-APR-2010 Sneddon Updated definition of Define_Symbol. 54 | ** 17-DEC-2010 Sneddon Added cat function. 55 | ** 10-FEB-2011 Sneddon Added itoa function. 56 | ** 12-APR-2011 Sneddon Added trim function. 57 | ** 02-JUN-2012 Sneddon Update find_char definition. Remove MMK_S_MODULE. 58 | ** 12-JUL-2012 Sneddon Add sp_once. 59 | ** 13-JUL-2012 Sneddon Fix length for SDESC. 60 | ** 14-JUL-2012 Sneddon Adjust testing for MMK_S_DCL depending on VMS 61 | ** version. Is based on WRK_C_INPBUFSIZ in 62 | ** [DCL]DCLDEF.SDL (VMS source). 63 | ** 07-FEB-2013 Sneddon Tweaked Resolve_Symbols definition. 64 | ** 09-JUN-2014 Sneddon Add length argument to find_suffix. 65 | ** 12-JUN-2014 Sneddon Add create_suffix and set_mmssuffixes. 66 | ** 07-NOV-2016 Sneddon Adjust MMK_S_DCL as suggested by Hunter Goatley. #94. 67 | ** 6-SEP-2023 Goatley Handle long DCL lines on VAX by setting max 68 | ** length to 254 instead of the old 256. There's 69 | ** code to do continuation lines, but the lines 70 | ** were 257 bytes long, which exceeds the limit 71 | ** of 255. By limiting to 254, there's room for 72 | ** a '-' that is character 255, and lines longer 73 | ** than 255 can be processed successfully. 74 | */ 75 | #ifndef mmk_h__ 76 | #define mmk_h__ 77 | /* 78 | ** Generic stuff first 79 | */ 80 | #include 81 | #include 82 | #include 83 | #include 84 | /* 85 | ** Status codes 86 | */ 87 | #include "mmk_msg.h" 88 | 89 | /* 90 | ** Some private type names that I use sometimes 91 | */ 92 | #include 93 | #include 94 | #include 95 | #include 96 | #include 97 | #include 98 | #include 99 | #include 100 | #define EXTERN globalref 101 | #define EXTERNAL globalref 102 | #define GLOBAL globaldef 103 | 104 | typedef unsigned long LONG; 105 | typedef unsigned short WORD; 106 | typedef unsigned char BYTE; 107 | typedef void *POINTER; 108 | typedef struct { LONG long1, long2; } TIME; 109 | typedef struct dsc$descriptor DESCRIP; 110 | typedef struct { WORD bufsiz, itmcod; POINTER bufadr, retlen; } ITMLST; 111 | 112 | /* 113 | ** If building on pre-V7, supply our own strdup() and str*casecmp() routines 114 | */ 115 | #if __CRTL_VER <= 70000000 116 | extern char *strdup (char *); 117 | extern int *strcasecmp (char *, char *); 118 | extern int *strncasecmp (char *, char *, int); 119 | #endif 120 | 121 | 122 | /* 123 | ** Handy macros 124 | */ 125 | #define OK(s) $VMS_STATUS_SUCCESS(s) 126 | #define INIT_DYNDSCPTR(str) {str->dsc$w_length = 0; str->dsc$a_pointer = (void *) 0;\ 127 | str->dsc$b_class = DSC$K_CLASS_D; str->dsc$b_dtype = DSC$K_DTYPE_T;} 128 | #define INIT_DYNDESC(str) {str.dsc$w_length = 0; str.dsc$a_pointer = (void *) 0;\ 129 | str.dsc$b_class = DSC$K_CLASS_D; str.dsc$b_dtype = DSC$K_DTYPE_T;} 130 | #define INIT_SDESC(str,len,ptr) {str.dsc$w_length=(len);str.dsc$a_pointer=(void *)(ptr);\ 131 | str.dsc$b_class=DSC$K_CLASS_S; str.dsc$b_dtype=DSC$K_DTYPE_T;} 132 | #define ITMLST_INIT(itm,c,s,a,r) {itm.bufsiz=(s); itm.itmcod=(c);\ 133 | itm.bufadr=(POINTER)(a); itm.retlen=(POINTER)(r);} 134 | #define SDESC(s) {sizeof(s)-1,DSC$K_DTYPE_T,DSC$K_CLASS_S,s} 135 | 136 | #ifdef min 137 | #undef min 138 | #endif 139 | #define min(a, b) (((a) < (b)) ? (a) : (b)) 140 | 141 | #ifdef max 142 | #undef max 143 | #endif 144 | #define max(a, b) (((a) > (b)) ? (a) : (b)) 145 | 146 | #define queue_empty(addr) ((((struct QUE *)(addr))->head) == (((struct QUE *)(addr))->tail)) 147 | #if defined(__ALPHA) || defined(__ia64__) 148 | #define queue_insert(item,pred) __PAL_INSQUEL((void *)(pred),(void *)(item)) 149 | #define queue_remove(entry,addr) (((struct QUE *)(entry))->head == \ 150 | (struct QUE *) (entry) ? 0:(__PAL_REMQUEL((void *)(entry),(void *)(addr)),1)) 151 | #else 152 | #define queue_insert(item,pred) _INSQUE(item,pred) 153 | #define queue_remove(entry,addr) (((struct QUE *)entry)->head == entry ? 0 :\ 154 | (_REMQUE(entry,addr),1)) 155 | #endif 156 | 157 | /* 158 | ** Structure definitions. The following size definitions are just 159 | ** for the sizes of names for things, not for the structures themselves. 160 | */ 161 | #define MMK_S_SYMBOL 237 /* 237 to allow for file names + trailing null */ 162 | #if defined(__ALPHA) || defined(__ia64__) 163 | #define MMK_S_SFX 237 /* 235 + leading dot + trailing null */ 164 | #define MMK_S_FILE 4096 /* 4095 is RMS limit, + trailing null */ 165 | #if __VMS_VER >= 70320022 /* OpenVMS Alpha V7.3-2 and higher has... */ 166 | #define MMK_S_DCL 4097 /* 4096 is DCL command line + trailing null */ 167 | #else /* OpenVMS Alpha V7.3-1 and lower has... */ 168 | #define MMK_S_DCL 254 /* 255 is max DCL command line - allow for '-' */ 169 | #endif 170 | #define MMK_S_MAXRSS NAML$C_MAXRSS 171 | #else 172 | #define MMK_S_SFX 41 /* 39 + leading dot + trailing null */ 173 | #define MMK_S_FILE 256 /* 255 is RMS limit, + trailing null */ 174 | #define MMK_S_DCL 254 /* 255 is max DCL command line - allow for '-' */ 175 | #define MMK_S_MAXRSS NAML$C_MAXRSS 176 | #endif 177 | 178 | /* 179 | ** Generic absolute queue header 180 | */ 181 | 182 | struct QUE { 183 | void *head, *tail; 184 | }; 185 | 186 | #define INIT_QUEUE(_q) {struct QUE *__q = (struct QUE *)&(_q);\ 187 | __q->head = __q->tail = __q;} 188 | 189 | /* 190 | ** Symbol definition. We don't get a whole lot of symbols defined, 191 | ** so we just store them in a regular linked list. The value string 192 | ** is dynamically allocated. 193 | */ 194 | 195 | enum Symbol_Types { 196 | MMK_K_SYM_BUILTIN, MMK_K_SYM_DESCRIP, 197 | MMK_K_SYM_CMDLINE, MMK_K_SYM_LOCAL, 198 | MMK_K_SYM_DEFAULT, MMK_K_SYM_CLI, 199 | MMK_K_SYM_TEMPORARY 200 | }; 201 | typedef enum Symbol_Types SYMTYPE; 202 | 203 | struct SYMBOL { 204 | struct SYMBOL *flink, *blink; 205 | SYMTYPE type; 206 | char name[MMK_S_SYMBOL]; 207 | char *value; 208 | }; 209 | 210 | #define MMK_K_SYMTABLE_SIZE 256 211 | struct SYMTABLE { 212 | struct SYMTABLE *next; 213 | struct QUE symlist[MMK_K_SYMTABLE_SIZE]; 214 | }; 215 | 216 | /* 217 | ** Suffix defintion. Linked list of suffixes is derived from .SUFFIX 218 | ** directive. 219 | */ 220 | 221 | struct SFX { 222 | struct SFX *flink, *blink; 223 | char value[MMK_S_SFX]; 224 | }; 225 | 226 | /* 227 | ** Command line definition. The command string is dynamically allocated. 228 | */ 229 | 230 | #define CMD_M_NOECHO 1 231 | #define CMD_M_IGNERR 2 232 | #define CMD_M_FORCED_FIRST 4 233 | #define CMD_M_FORCED_LAST 8 234 | 235 | struct CMD { 236 | struct CMD *flink, *blink; 237 | unsigned int flags; 238 | char *cmd; 239 | }; 240 | 241 | /* 242 | ** Default build rule definition. Lookup is based on source suffix and 243 | ** target suffix. Provides the commands used to build the target from 244 | ** the source, in the absence of any commands provided by a dependency 245 | ** rule. 246 | */ 247 | 248 | struct RULE { 249 | struct RULE *flink, *blink; 250 | struct RULE *next, *parent; 251 | int srcpfxlen, trgpfxlen; 252 | char src[MMK_S_SFX]; 253 | char trg[MMK_S_SFX]; 254 | char srcpfx[MMK_S_FILE]; 255 | char trgpfx[MMK_S_FILE]; 256 | struct CMD cmdque; 257 | }; 258 | 259 | /* 260 | ** Object definition. An object can be a file, a module from a library, 261 | ** a library (which is just a file, really), or just a generic target 262 | ** name. One data structure handles all types. 263 | */ 264 | 265 | #define MMK_K_OBJ_FILE 1 266 | #define MMK_K_OBJ_LIBMOD 2 267 | #define MMK_K_OBJ_LIB 3 268 | #define MMK_K_OBJ_GENERIC 4 269 | #define MMK_K_OBJ_CMSFILE 5 270 | 271 | struct OBJECT { 272 | struct OBJECT *flink, *blink; 273 | unsigned int reserved; /* add nothing above this point! */ 274 | int type; 275 | int build_in_progress; 276 | TIME rdt; 277 | struct QUE libmodque; /* Back pointer(s) to library module(s) */ 278 | int have_rdt; 279 | int libfile_built; /* OK to delete a library module's intermediate */ 280 | struct OBJECT *libfile; /* for LIBMOD type, pointer to LIB object */ 281 | struct OBJECT *libmodobj; /* ref to LIBMOD object for use during build */ 282 | struct OBJECT *fileobj; /* for LIBMOD type, pointer to file object */ 283 | char sfx[MMK_S_SFX]; /* not used for LIBMOD type */ 284 | char name[MMK_S_FILE]; 285 | char cms_gen[MMK_S_SYMBOL]; /* used only for CMSFILE type */ 286 | }; 287 | 288 | /* 289 | ** Object reference definition. Used in source lists in dependency rules 290 | ** to reference an actual object. 291 | */ 292 | 293 | struct OBJREF { 294 | struct OBJREF *flink, *blink; 295 | struct OBJECT *obj; 296 | }; 297 | 298 | /* 299 | ** Dependency rule definition. A single object can depend on several sources. 300 | ** When dependencies with multiple targets are given in a description file, 301 | ** each target gets its own dependency rule, and the common sources are 302 | ** duplicated into each rule. Command lists are shared in the multiple-target 303 | ** case, though. 304 | */ 305 | 306 | struct DEPEND { 307 | struct DEPEND *flink, *blink; 308 | struct DEPEND *dc_flink; 309 | struct DEPEND *deplist_flink; 310 | struct OBJECT *target; 311 | struct OBJREF sources; 312 | struct CMD *cmdqptr; 313 | int double_colon; 314 | }; 315 | 316 | /* 317 | ** Prototypes 318 | */ 319 | 320 | /* 321 | ** MEM 322 | */ 323 | struct CMD * mem_get_cmd(void); 324 | void mem_free_cmd(struct CMD *c); 325 | struct DEPEND * mem_get_depend(void); 326 | void mem_free_depend(struct DEPEND *dep); 327 | struct SYMBOL * mem_get_symbol(void); 328 | void mem_free_symbol(struct SYMBOL *sym); 329 | struct RULE * mem_get_rule(void); 330 | void mem_free_rule(struct RULE *r); 331 | struct OBJECT * mem_get_object(void); 332 | void mem_free_object(struct OBJECT *obj); 333 | struct OBJREF * mem_get_objref(void); 334 | void mem_free_objref(struct OBJREF *obj); 335 | struct SFX * mem_get_sfx(void); 336 | void mem_free_sfx(struct SFX *s); 337 | struct SYMTABLE * mem_get_symtable(void); 338 | void mem_free_symtable(struct SYMTABLE *symtable); 339 | /* 340 | ** FILEIO 341 | */ 342 | #ifndef FILEIO_MODULE_BUILD 343 | typedef POINTER FILEHANDLE; 344 | #endif 345 | unsigned int file_create(char *, FILEHANDLE *, char *); 346 | unsigned int file_create_share(char *, FILEHANDLE *, char *); 347 | unsigned int file_open(char *, FILEHANDLE *, char *, char *, int *); 348 | unsigned int file_find(char *, char *, char *, unsigned char *); 349 | unsigned int file_exists(char *, char *); 350 | unsigned int file_close(FILEHANDLE); 351 | unsigned int file_dclose(FILEHANDLE); 352 | unsigned int file_read(FILEHANDLE, char *, int, int *); 353 | unsigned int file_write(FILEHANDLE, char *, int); 354 | unsigned int file_getpos(FILEHANDLE, unsigned short[3]); 355 | unsigned int file_setpos(FILEHANDLE, unsigned short[3]); 356 | unsigned int file_get_rdt(char *, TIME *); 357 | unsigned int file_get_filespec(FILEHANDLE, char *, int); 358 | /* 359 | ** SP_MGR 360 | */ 361 | #ifndef SP_MGR_MODULE_BUILD 362 | typedef POINTER SPHANDLE; 363 | #endif 364 | unsigned int sp_open(SPHANDLE *ctxpp, void *inicmd, unsigned int (*rcvast)(void *), void *rcvastprm); 365 | unsigned int sp_close(SPHANDLE *ctxpp); 366 | unsigned int sp_send(SPHANDLE *ctxpp, void *cmdstr); 367 | unsigned int sp_receive(SPHANDLE *ctxpp, void *rcvstr, int *rcvlen); 368 | void sp_once (void *cmd, void (*actrtn)(void *, struct dsc$descriptor *), void *param); 369 | unsigned int sp_show_subprocess(SPHANDLE ctx); 370 | /* 371 | ** GET_RDT 372 | */ 373 | unsigned int lbr_get_rdt(char *lib, char *mod, TIME *rdt); 374 | void lbr_flush(void); 375 | unsigned int get_rdt(struct OBJECT *obj); 376 | /* 377 | ** SYMBOLS 378 | */ 379 | struct SYMBOL * Lookup_Symbol(char *name); 380 | void Define_Symbol(SYMTYPE symtype, char *name, char *val, int vallen, ...); 381 | int Resolve_Symbols(char *in, int inlen, char * *out, int *outlen, int dont_resolve_unknowns); 382 | void Clear_Local_Symbols(void); 383 | void Create_Local_Symbols(struct DEPEND *dep, struct OBJREF *srcref, struct QUE *chgque); 384 | void set_mmssuffixes(void); 385 | /* 386 | ** OBJECTS 387 | */ 388 | struct OBJECT * Find_Object(struct OBJECT *template); 389 | void Insert_Object(struct OBJECT *obj); 390 | /* 391 | ** PARSE_OBJECTS 392 | */ 393 | void Parse_Objects(char *line, int linelen, struct QUE *objque, int is_target); 394 | /* 395 | ** PARSE_DESCRIP 396 | */ 397 | void parse_descrip(char *xline, int xlinelen, FILEHANDLE *newu, int *newmaxl, 398 | int current_line, char *current_file); 399 | /* 400 | ** READDESC 401 | */ 402 | void Read_Description(char *fspec, char *defspec, int rules_file); 403 | /* 404 | ** MISC 405 | */ 406 | void Build_Suffix_List(char *line, int linelen); 407 | char * itoa(int); 408 | char * cat(char *dest, ...); 409 | char * trim(char *s); 410 | char * find_char(char *base, char *end, char *charset); 411 | void upcase(char *str); 412 | int extract_name(char *dest, char *src); 413 | int extract_prefix(char *dest, char *src); 414 | int extract_filetype(char *dest, char *src); 415 | int extract_filename(char *dest, char *src); 416 | int extract_nametype(char *dest, char *src); 417 | int prefix_match(char *pfx, char *fspec); 418 | struct SFX * find_suffix(char *name, int len); 419 | int create_suffix(char *name, int len, struct SFX *pos); 420 | struct RULE * find_rule(char *trg, char *src); 421 | struct RULE * find_rule_with_prefixes(struct OBJECT *trg, struct OBJECT *src); 422 | struct RULE * scan_rule_list(struct RULE *base, char *target_name, int generalize); 423 | int make_object_name(char *name, struct OBJECT *obj); 424 | int logical_present(char *lognam); 425 | int get_logical(char *lognam, char *buf, int bufsize); 426 | int strneql_case_blind(char *s1, char *s2, int len); 427 | void set_ctrlt_ast(unsigned int (*routine)(void *), void *arg); 428 | void clear_ctrlt_ast(void); 429 | unsigned int find_image_symbol(char *image, char *symbol, void *symval); 430 | /* 431 | ** CMS_INTERFACE 432 | */ 433 | unsigned int cms_init(void); 434 | unsigned int cms_get_rdt(char *, char *, TIME *); 435 | unsigned int cms_fetch_file(char *, char *); 436 | unsigned int cms_parse_name(char *, char *, int, int *, char *, int, int *, int); 437 | 438 | /* 439 | ** Main module (MMK) 440 | */ 441 | unsigned int put_output(void *); 442 | unsigned int put_command(void *); 443 | /* 444 | ** BUILD_TARGET 445 | */ 446 | void Build_Target(char *name); 447 | struct DEPEND *find_dependency(struct OBJECT *obj, int fakeit); 448 | void close_subprocess(void); 449 | 450 | #endif /* mmk_h__ */ 451 | -------------------------------------------------------------------------------- /mem.c: -------------------------------------------------------------------------------- 1 | /* 2 | **++ 3 | ** FACILITY: MMK 4 | ** 5 | ** ABSTRACT: Memory management routines 6 | ** 7 | ** MODULE DESCRIPTION: 8 | ** 9 | ** Memory allocation and deallocation routines for MMS structures. 10 | ** Note that character strings are just allocated using malloc. 11 | ** 12 | ** AUTHOR: M. Madison 13 | ** 14 | ** Copyright (c) 2008, Matthew Madison. 15 | ** Copyright (c) 2012, Endless Software Solutions. 16 | ** 17 | ** All rights reserved. 18 | ** 19 | ** Redistribution and use in source and binary forms, with or without 20 | ** modification, are permitted provided that the following conditions 21 | ** are met: 22 | ** 23 | ** * Redistributions of source code must retain the above 24 | ** copyright notice, this list of conditions and the following 25 | ** disclaimer. 26 | ** * Redistributions in binary form must reproduce the above 27 | ** copyright notice, this list of conditions and the following 28 | ** disclaimer in the documentation and/or other materials provided 29 | ** with the distribution. 30 | ** * Neither the name of the copyright owner nor the names of any 31 | ** other contributors may be used to endorse or promote products 32 | ** derived from this software without specific prior written 33 | ** permission. 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 46 | ** 47 | ** CREATION DATE: 20-AUG-1992 48 | ** 49 | ** MODIFICATION HISTORY: 50 | ** 51 | ** 20-AUG-1992 V1.0 Madison Initial coding. 52 | ** 27-AUG-1992 V1.1 Madison Use VM zones. 53 | ** 09-APR-1993 V1.1-1 Madison Comments. 54 | ** 27-DEC-1998 V1.2 Madison General cleanup. 55 | ** 15-SEP-2012 V1.3 Sneddon Add symbol table allocation. 56 | **-- 57 | */ 58 | #pragma module MEM "V1.3" 59 | #include "mmk.h" 60 | #include 61 | 62 | /* 63 | ** Forward declarations 64 | */ 65 | struct CMD *mem_get_cmd(void); 66 | void mem_free_cmd(struct CMD *); 67 | static unsigned int CMD_S_CMDDEF = sizeof(struct CMD); 68 | 69 | struct DEPEND *mem_get_depend(void); 70 | void mem_free_depend(struct DEPEND *); 71 | static unsigned int DEPEND_S_DEPENDDEF = sizeof(struct DEPEND); 72 | 73 | struct SYMBOL *mem_get_symbol(void); 74 | void mem_free_symbol(struct SYMBOL *); 75 | static unsigned int SYMBOL_S_SYMBOLDEF = sizeof(struct SYMBOL); 76 | 77 | struct RULE *mem_get_rule(void); 78 | void mem_free_rule(struct RULE *); 79 | static unsigned int RULE_S_RULEDEF = sizeof(struct RULE); 80 | 81 | struct OBJECT *mem_get_object(void); 82 | void mem_free_object(struct OBJECT *); 83 | static unsigned int OBJECT_S_OBJECTDEF = sizeof(struct OBJECT); 84 | 85 | struct OBJREF *mem_get_objref(void); 86 | void mem_free_objref(struct OBJREF *); 87 | static unsigned int OBJREF_S_OBJREFDEF = sizeof(struct OBJREF); 88 | 89 | struct SFX *mem_get_sfx(void); 90 | void mem_free_sfx(struct SFX *); 91 | static unsigned int SFX_S_SFXDEF = sizeof(struct SFX); 92 | 93 | struct SYMTABLE *mem_get_symtable(void); 94 | void mem_free_symtable(struct SYMTABLE *); 95 | static unsigned int SYMTABLE_S_SYMTABLEDEF = sizeof(struct SYMTABLE); 96 | 97 | /* 98 | ** The VM zones we're using 99 | */ 100 | 101 | static unsigned int cmdzone=0, dependzone=0, symbolzone=0, 102 | rulezone=0, objectzone=0, objrefzone=0, 103 | sfxzone=0, symtablezone=0; 104 | 105 | 106 | /* 107 | **++ 108 | ** ROUTINE: mem_get_cmd 109 | ** 110 | ** FUNCTIONAL DESCRIPTION: 111 | ** 112 | ** Allocates a CMD block. 113 | ** 114 | ** RETURNS: struct CMD * 115 | ** 116 | ** PROTOTYPE: 117 | ** 118 | ** mem_get_cmd() 119 | ** 120 | ** IMPLICIT INPUTS: None. 121 | ** 122 | ** IMPLICIT OUTPUTS: None. 123 | ** 124 | ** COMPLETION CODES: None. (errors signalled) 125 | ** 126 | ** SIDE EFFECTS: cmdzone created. 127 | ** 128 | **-- 129 | */ 130 | struct CMD *mem_get_cmd (void) { 131 | 132 | struct CMD *c; 133 | unsigned int status; 134 | 135 | if (!cmdzone) { 136 | unsigned int algorithm=LIB$K_VM_FIXED; 137 | unsigned int flags=(LIB$M_VM_GET_FILL0|LIB$M_VM_EXTEND_AREA); 138 | status = lib$create_vm_zone(&cmdzone, &algorithm, &CMD_S_CMDDEF, &flags); 139 | if (!OK(status)) lib$signal(MMK__NOALLOC, 1, "CMD", status); 140 | } 141 | status = lib$get_vm(&CMD_S_CMDDEF, &c, &cmdzone); 142 | if (!OK(status)) { 143 | lib$signal(MMK__NOALLOC, 1, "CMD", status); 144 | } 145 | 146 | return c; 147 | } 148 | 149 | /* 150 | **++ 151 | ** ROUTINE: mem_free_cmd 152 | ** 153 | ** FUNCTIONAL DESCRIPTION: 154 | ** 155 | ** Frees a CMD block 156 | ** 157 | ** RETURNS: void 158 | ** 159 | ** PROTOTYPE: 160 | ** 161 | ** mem_free_cmd(struct CMD *c) 162 | ** 163 | ** IMPLICIT INPUTS: None. 164 | ** 165 | ** IMPLICIT OUTPUTS: None. 166 | ** 167 | ** COMPLETION CODES: None. 168 | ** 169 | ** SIDE EFFECTS: None. 170 | ** 171 | **-- 172 | */ 173 | void mem_free_cmd (struct CMD *c) { 174 | 175 | if (c->cmd) free(c->cmd); 176 | lib$free_vm(&CMD_S_CMDDEF, &c, &cmdzone); 177 | } 178 | 179 | /* 180 | **++ 181 | ** ROUTINE: mem_get_depend 182 | ** 183 | ** FUNCTIONAL DESCRIPTION: 184 | ** 185 | ** Allocates a DEPEND block. 186 | ** 187 | ** RETURNS: struct DEPEND * 188 | ** 189 | ** PROTOTYPE: 190 | ** 191 | ** mem_get_depend() 192 | ** 193 | ** IMPLICIT INPUTS: None. 194 | ** 195 | ** IMPLICIT OUTPUTS: None. 196 | ** 197 | ** COMPLETION CODES: None. (errors signalled) 198 | ** 199 | ** SIDE EFFECTS: dependzone created. 200 | ** 201 | **-- 202 | */ 203 | struct DEPEND *mem_get_depend (void) { 204 | 205 | struct DEPEND *c; 206 | unsigned int status; 207 | 208 | if (!dependzone) { 209 | unsigned int algorithm=LIB$K_VM_FIXED; 210 | unsigned int flags=(LIB$M_VM_GET_FILL0|LIB$M_VM_EXTEND_AREA); 211 | status = lib$create_vm_zone(&dependzone, &algorithm, 212 | &DEPEND_S_DEPENDDEF, &flags); 213 | if (!OK(status)) lib$signal(MMK__NOALLOC, 1, "DEPEND", status); 214 | } 215 | status = lib$get_vm(&DEPEND_S_DEPENDDEF, &c, &dependzone); 216 | if (!OK(status)) { 217 | lib$signal(MMK__NOALLOC, 1, "DEPEND", status); 218 | } else { 219 | c->sources.flink = c->sources.blink = &c->sources; 220 | } 221 | return c; 222 | } 223 | 224 | /* 225 | **++ 226 | ** ROUTINE: mem_free_depend 227 | ** 228 | ** FUNCTIONAL DESCRIPTION: 229 | ** 230 | ** Frees a DEPEND block. 231 | ** 232 | ** RETURNS: void 233 | ** 234 | ** PROTOTYPE: 235 | ** 236 | ** mem_free_depend(struct DEPEND *c) 237 | ** 238 | ** IMPLICIT INPUTS: None. 239 | ** 240 | ** IMPLICIT OUTPUTS: None. 241 | ** 242 | ** COMPLETION CODES: None. 243 | ** 244 | ** SIDE EFFECTS: None. 245 | ** 246 | **-- 247 | */ 248 | void mem_free_depend (struct DEPEND *dep) { 249 | 250 | struct OBJREF *obj; 251 | 252 | while (queue_remove(dep->sources.flink, &obj)) mem_free_objref(obj); 253 | lib$free_vm(&DEPEND_S_DEPENDDEF, &dep, &dependzone); 254 | } 255 | 256 | /* 257 | **++ 258 | ** ROUTINE: mem_get_symbol 259 | ** 260 | ** FUNCTIONAL DESCRIPTION: 261 | ** 262 | ** Allocates a SYMBOL block. 263 | ** 264 | ** RETURNS: struct SYMBOL * 265 | ** 266 | ** PROTOTYPE: 267 | ** 268 | ** mem_get_symbol() 269 | ** 270 | ** IMPLICIT INPUTS: None. 271 | ** 272 | ** IMPLICIT OUTPUTS: None. 273 | ** 274 | ** COMPLETION CODES: None. (errors signalled) 275 | ** 276 | ** SIDE EFFECTS: symbolzone created. 277 | ** 278 | **-- 279 | */ 280 | struct SYMBOL *mem_get_symbol (void) { 281 | 282 | struct SYMBOL *c; 283 | unsigned int status; 284 | 285 | if (!symbolzone) { 286 | unsigned int algorithm=LIB$K_VM_FIXED; 287 | unsigned int flags=(LIB$M_VM_GET_FILL0|LIB$M_VM_EXTEND_AREA); 288 | status = lib$create_vm_zone(&symbolzone, &algorithm, 289 | &SYMBOL_S_SYMBOLDEF, &flags); 290 | if (!OK(status)) lib$signal(MMK__NOALLOC, 1, "SYMBOL", status); 291 | } 292 | status = lib$get_vm(&SYMBOL_S_SYMBOLDEF, &c, &symbolzone); 293 | if (!OK(status)) { 294 | lib$signal(MMK__NOALLOC, 1, "SYMBOL", status); 295 | } 296 | 297 | return c; 298 | } 299 | 300 | /* 301 | **++ 302 | ** ROUTINE: mem_free_symbol 303 | ** 304 | ** FUNCTIONAL DESCRIPTION: 305 | ** 306 | ** Frees a SYMBOL block. 307 | ** 308 | ** RETURNS: void 309 | ** 310 | ** PROTOTYPE: 311 | ** 312 | ** mem_free_symbol(struct SYMBOL *c) 313 | ** 314 | ** IMPLICIT INPUTS: None. 315 | ** 316 | ** IMPLICIT OUTPUTS: None. 317 | ** 318 | ** COMPLETION CODES: None. 319 | ** 320 | ** SIDE EFFECTS: None. 321 | ** 322 | **-- 323 | */ 324 | void mem_free_symbol (struct SYMBOL *sym) { 325 | 326 | if (sym->value) free(sym->value); 327 | lib$free_vm(&SYMBOL_S_SYMBOLDEF, &sym, &symbolzone); 328 | 329 | } 330 | 331 | /* 332 | **++ 333 | ** ROUTINE: mem_get_rule 334 | ** 335 | ** FUNCTIONAL DESCRIPTION: 336 | ** 337 | ** Allocates a RULE block. 338 | ** 339 | ** RETURNS: struct RULE * 340 | ** 341 | ** PROTOTYPE: 342 | ** 343 | ** mem_get_rule() 344 | ** 345 | ** IMPLICIT INPUTS: None. 346 | ** 347 | ** IMPLICIT OUTPUTS: None. 348 | ** 349 | ** COMPLETION CODES: None. (errors signalled) 350 | ** 351 | ** SIDE EFFECTS: rulezone created. 352 | ** 353 | **-- 354 | */ 355 | struct RULE *mem_get_rule (void) { 356 | 357 | struct RULE *c; 358 | unsigned int status; 359 | 360 | if (!rulezone) { 361 | unsigned int algorithm=LIB$K_VM_FIXED; 362 | unsigned int flags=(LIB$M_VM_GET_FILL0|LIB$M_VM_EXTEND_AREA); 363 | status = lib$create_vm_zone(&rulezone, &algorithm, 364 | &RULE_S_RULEDEF, &flags); 365 | if (!OK(status)) lib$signal(MMK__NOALLOC, 1, "RULE", status); 366 | } 367 | status = lib$get_vm(&RULE_S_RULEDEF, &c, &rulezone); 368 | if (!OK(status)) { 369 | lib$signal(MMK__NOALLOC, 1, "RULE", status); 370 | } else { 371 | c->cmdque.flink = c->cmdque.blink = &c->cmdque; 372 | } 373 | 374 | return c; 375 | } 376 | 377 | /* 378 | **++ 379 | ** ROUTINE: mem_free_rule 380 | ** 381 | ** FUNCTIONAL DESCRIPTION: 382 | ** 383 | ** Frees a RULE block. 384 | ** 385 | ** RETURNS: void 386 | ** 387 | ** PROTOTYPE: 388 | ** 389 | ** mem_free_rule(struct RULE *c) 390 | ** 391 | ** IMPLICIT INPUTS: None. 392 | ** 393 | ** IMPLICIT OUTPUTS: None. 394 | ** 395 | ** COMPLETION CODES: None. 396 | ** 397 | ** SIDE EFFECTS: None. 398 | ** 399 | **-- 400 | */ 401 | void mem_free_rule (struct RULE *r) { 402 | 403 | struct CMD *cmd; 404 | 405 | while (queue_remove(r->cmdque.flink, &cmd)) mem_free_cmd(cmd); 406 | lib$free_vm(&RULE_S_RULEDEF, &r, &rulezone); 407 | 408 | } 409 | 410 | /* 411 | **++ 412 | ** ROUTINE: mem_get_object 413 | ** 414 | ** FUNCTIONAL DESCRIPTION: 415 | ** 416 | ** Allocates an OBJECT block. 417 | ** 418 | ** RETURNS: struct OBJECT * 419 | ** 420 | ** PROTOTYPE: 421 | ** 422 | ** mem_get_object() 423 | ** 424 | ** IMPLICIT INPUTS: None. 425 | ** 426 | ** IMPLICIT OUTPUTS: None. 427 | ** 428 | ** COMPLETION CODES: None. (errors signalled) 429 | ** 430 | ** SIDE EFFECTS: objectzone created. 431 | ** 432 | **-- 433 | */ 434 | struct OBJECT *mem_get_object (void) { 435 | 436 | struct OBJECT *c; 437 | unsigned int status; 438 | 439 | if (!objectzone) { 440 | unsigned int algorithm=LIB$K_VM_FIXED; 441 | unsigned int flags=(LIB$M_VM_GET_FILL0|LIB$M_VM_EXTEND_AREA); 442 | status = lib$create_vm_zone(&objectzone, &algorithm, 443 | &OBJECT_S_OBJECTDEF, &flags); 444 | if (!OK(status)) lib$signal(MMK__NOALLOC, 1, "OBJECT", status); 445 | } 446 | status = lib$get_vm(&OBJECT_S_OBJECTDEF, &c, &objectzone); 447 | if (!OK(status)) { 448 | lib$signal(MMK__NOALLOC, 1, "OBJECT", status); 449 | } 450 | c->libmodque.head = c->libmodque.tail = &c->libmodque; 451 | return c; 452 | } 453 | 454 | /* 455 | **++ 456 | ** ROUTINE: mem_free_object 457 | ** 458 | ** FUNCTIONAL DESCRIPTION: 459 | ** 460 | ** Frees a OBJECT block. 461 | ** 462 | ** RETURNS: void 463 | ** 464 | ** PROTOTYPE: 465 | ** 466 | ** mem_free_object(struct OBJECT *c) 467 | ** 468 | ** IMPLICIT INPUTS: None. 469 | ** 470 | ** IMPLICIT OUTPUTS: None. 471 | ** 472 | ** COMPLETION CODES: None. 473 | ** 474 | ** SIDE EFFECTS: None. 475 | ** 476 | **-- 477 | */ 478 | void mem_free_object (struct OBJECT *obj) { 479 | 480 | lib$free_vm(&OBJECT_S_OBJECTDEF, &obj, &objectzone); 481 | 482 | } 483 | 484 | /* 485 | **++ 486 | ** ROUTINE: mem_get_objref 487 | ** 488 | ** FUNCTIONAL DESCRIPTION: 489 | ** 490 | ** Allocates an OBJREF block. 491 | ** 492 | ** RETURNS: struct OBJREF * 493 | ** 494 | ** PROTOTYPE: 495 | ** 496 | ** mem_get_objref() 497 | ** 498 | ** IMPLICIT INPUTS: None. 499 | ** 500 | ** IMPLICIT OUTPUTS: None. 501 | ** 502 | ** COMPLETION CODES: None. (errors signalled) 503 | ** 504 | ** SIDE EFFECTS: objrefzone created. 505 | ** 506 | **-- 507 | */ 508 | struct OBJREF *mem_get_objref (void) { 509 | 510 | struct OBJREF *c; 511 | unsigned int status; 512 | 513 | if (!objrefzone) { 514 | unsigned int algorithm=LIB$K_VM_FIXED; 515 | unsigned int flags=(LIB$M_VM_GET_FILL0|LIB$M_VM_EXTEND_AREA); 516 | status = lib$create_vm_zone(&objrefzone, &algorithm, 517 | &OBJREF_S_OBJREFDEF, &flags); 518 | if (!OK(status)) lib$signal(MMK__NOALLOC, 1, "OBJREF", status); 519 | } 520 | status = lib$get_vm(&OBJREF_S_OBJREFDEF, &c, &objrefzone); 521 | if (!OK(status)) { 522 | lib$signal(MMK__NOALLOC, 1, "OBJREF", status); 523 | } 524 | return c; 525 | } 526 | 527 | /* 528 | **++ 529 | ** ROUTINE: mem_free_objref 530 | ** 531 | ** FUNCTIONAL DESCRIPTION: 532 | ** 533 | ** Frees a OBJREF block. 534 | ** 535 | ** RETURNS: void 536 | ** 537 | ** PROTOTYPE: 538 | ** 539 | ** mem_free_objref(struct OBJREF *c) 540 | ** 541 | ** IMPLICIT INPUTS: None. 542 | ** 543 | ** IMPLICIT OUTPUTS: None. 544 | ** 545 | ** COMPLETION CODES: None. 546 | ** 547 | ** SIDE EFFECTS: None. 548 | ** 549 | **-- 550 | */ 551 | void mem_free_objref (struct OBJREF *obj) { 552 | 553 | lib$free_vm(&OBJREF_S_OBJREFDEF, &obj, &objrefzone); 554 | 555 | } 556 | 557 | /* 558 | **++ 559 | ** ROUTINE: mem_get_sfx 560 | ** 561 | ** FUNCTIONAL DESCRIPTION: 562 | ** 563 | ** Allocates a SFX block. 564 | ** 565 | ** RETURNS: struct SFX * 566 | ** 567 | ** PROTOTYPE: 568 | ** 569 | ** mem_get_sfx() 570 | ** 571 | ** IMPLICIT INPUTS: None. 572 | ** 573 | ** IMPLICIT OUTPUTS: None. 574 | ** 575 | ** COMPLETION CODES: None. (errors signalled) 576 | ** 577 | ** SIDE EFFECTS: sfxzone created. 578 | ** 579 | **-- 580 | */ 581 | struct SFX *mem_get_sfx (void) { 582 | 583 | struct SFX *c; 584 | unsigned int status; 585 | 586 | if (!sfxzone) { 587 | unsigned int algorithm=LIB$K_VM_FIXED; 588 | unsigned int flags=(LIB$M_VM_GET_FILL0|LIB$M_VM_EXTEND_AREA); 589 | status = lib$create_vm_zone(&sfxzone, &algorithm, 590 | &SFX_S_SFXDEF, &flags); 591 | if (!OK(status)) lib$signal(MMK__NOALLOC, 1, "SFX", status); 592 | } 593 | status = lib$get_vm(&SFX_S_SFXDEF, &c, &sfxzone); 594 | if (!OK(status)) { 595 | lib$signal(MMK__NOALLOC, 1, "SFX", status); 596 | } 597 | 598 | return c; 599 | } 600 | 601 | /* 602 | **++ 603 | ** ROUTINE: mem_free_sfx 604 | ** 605 | ** FUNCTIONAL DESCRIPTION: 606 | ** 607 | ** Frees a SFX block. 608 | ** 609 | ** RETURNS: void 610 | ** 611 | ** PROTOTYPE: 612 | ** 613 | ** mem_free_sfx(struct SFX *c) 614 | ** 615 | ** IMPLICIT INPUTS: None. 616 | ** 617 | ** IMPLICIT OUTPUTS: None. 618 | ** 619 | ** COMPLETION CODES: None. 620 | ** 621 | ** SIDE EFFECTS: None. 622 | ** 623 | **-- 624 | */ 625 | void mem_free_sfx (struct SFX *s) { 626 | 627 | lib$free_vm(&SFX_S_SFXDEF, &s, &sfxzone); 628 | 629 | } 630 | 631 | /* 632 | **++ 633 | ** ROUTINE: mem_get_symtable 634 | ** 635 | ** FUNCTIONAL DESCRIPTION: 636 | ** 637 | ** Allocates a SYMTABLE block. 638 | ** 639 | ** RETURNS: struct SYMTABLE * 640 | ** 641 | ** PROTOTYPE: 642 | ** 643 | ** mem_get_symtable() 644 | ** 645 | ** IMPLICIT INPUTS: None. 646 | ** 647 | ** IMPLICIT OUTPUTS: None. 648 | ** 649 | ** COMPLETION CODES: None. (errors signalled) 650 | ** 651 | ** SIDE EFFECTS: symtablezone created. 652 | ** 653 | **-- 654 | */ 655 | struct SYMTABLE *mem_get_symtable (void) { 656 | 657 | struct SYMTABLE *t; 658 | int i; 659 | unsigned int status; 660 | 661 | if (!symtablezone) { 662 | unsigned int algorithm=LIB$K_VM_FIXED; 663 | unsigned int flags=(LIB$M_VM_GET_FILL0|LIB$M_VM_EXTEND_AREA); 664 | status = lib$create_vm_zone(&symtablezone, &algorithm, 665 | &SYMTABLE_S_SYMTABLEDEF, &flags); 666 | if (!OK(status)) lib$signal(MMK__NOALLOC, 1, "SYMTABLE", status); 667 | } 668 | status = lib$get_vm(&SYMTABLE_S_SYMTABLEDEF, &t, &symtablezone); 669 | if (!OK(status)) { 670 | lib$signal(MMK__NOALLOC, 1, "SYMTABLE", status); 671 | } 672 | 673 | for (i = 0; i < MMK_K_SYMTABLE_SIZE; i++) { 674 | INIT_QUEUE(t->symlist[i]); 675 | } 676 | 677 | return t; 678 | } 679 | 680 | /* 681 | **++ 682 | ** ROUTINE: mem_free_symtable 683 | ** 684 | ** FUNCTIONAL DESCRIPTION: 685 | ** 686 | ** Frees a SYMTABLE block. 687 | ** 688 | ** RETURNS: void 689 | ** 690 | ** PROTOTYPE: 691 | ** 692 | ** mem_free_symtable(struct SYMTABLE *c) 693 | ** 694 | ** IMPLICIT INPUTS: None. 695 | ** 696 | ** IMPLICIT OUTPUTS: None. 697 | ** 698 | ** COMPLETION CODES: None. 699 | ** 700 | ** SIDE EFFECTS: None. 701 | ** 702 | **-- 703 | */ 704 | void mem_free_symtable (struct SYMTABLE *symtable) { 705 | 706 | struct SYMBOL *sym; 707 | int i; 708 | 709 | for (i = 0; i < MMK_K_SYMTABLE_SIZE; i++) { 710 | while (queue_remove(symtable->symlist[i].head, &sym)) { 711 | mem_free_symbol(sym); 712 | } 713 | } 714 | 715 | lib$free_vm(&SYMTABLE_S_SYMTABLEDEF, &symtable, &symtablezone); 716 | 717 | } 718 | --------------------------------------------------------------------------------