/* ************************************************************************* */ /* * * */ /* * HPE CONFIDENTIAL. This software is confidential proprietary software * */ /* * licensed by Hewlett Packard Enterprise Development, LP, and is not * */ /* * authorized to be used, duplicated or disclosed to anyone without the * */ /* * prior written permission of HPE. * */ /* * Copyright 2021 Hewlett Packard Enterprise Development, LP * */ /* * * */ /* * VMS SOFTWARE, INC. CONFIDENTIAL. This software is confidential * */ /* * proprietary software licensed by VMS Software, Inc., and is not * */ /* * authorized to be used, duplicated or disclosed to anyone without * */ /* * the prior written permission of VMS Software, Inc. * */ /* * Copyright 2021 VMS Software, Inc. * */ /* * * */ /* ************************************************************************* */ /* *++ * FACILITY: * * VMS Executive (LIB) * * ABSTRACT: * * This header file will setup initialization/unload routines for execlets. * Before including this header file, the programmer needs to #define symbols * for those routines to be defined. The good news is that you can setup all * your initialization and unload routines in one swell foop. You can define * multiple symbols and then just #include this file to do the setup. This is * different from how the setup works from MACRO or BLISS, where a nice macro * takes care of ALL of the ugly stuff. In C, you need to get ugly yourself * (yes, this is supposed to be an improvement - Guess again!). Fortunately, * that's easy for most of us. * * This include file has been setup so that multiple inclusions won't cause * problems. It will still work properly. However, the way you use this include * file DOES matter. It can ONLY be invoked from the outer most scope of your * C module, and that includes outside of main{}. You must also have already * declared the initialization/unload routines. * * This include file specifies the following psect option attributes that must * not be overridden in your link option file (DECC always sets MOD for * psects with initial data): * * For EXEC$INIT_000 and EXEC$INIT_001: * * LONG,PIC,CON,REL,GBL,NOSHR,EXE,NOWRT,NOVEC,MOD * * For EXEC$UNL_000 and EXEC$UNL_001: * * OCTA,PIC,CON,REL,GBL,NOSHR,NOEXE,WRT,NOVEC,MOD * * The following examples show what to do in your C execlet to emulate what * you used to do in MACRO and BLISS: * * To setup a single, priority 0 (the MACRO/BLISS default) initialization * routine: * * execlet_init_rtn() * { } * * #define INIT000_ROUTINE execlet_init_rtn * #include * * main() * { } * * To setup a priority 1 initialization routine and priority 0 (the MACRO/BLISS * default) unload routine: * * execlet_init_rtn() * { } * execlet_unload_rtn() * { } * * #define INIT001_ROUTINE execlet_init_rtn * #define UNL000_ROUTINE execlet_unload_rtn * #include * * main() * { } * * AUTHOR: * * Steve DiPirro * * CREATION DATE: 07-Jan-1993 * * MODIFICATION HISTORY: * * X-8 CEG0982 Clair Grant 19-Apr-2021 * Make exec$init_000, _001 NOEXE * * X-7 CEG0972 Clair Grant 28-Mar-2021 * Make exec$init_000, _001 RD,WRT,NOEXE * * X-6 CEG0960 Clair Grant 28-Mar-2021 * More psect fixing. * * X-5 CEG0957 Clair Grant 26-Mar-2021 * Fix WRT,EXE psect definitions. VSI copyright. * VDE version sync. * * X-3 Andy Kuehnel 22-Jul-1998 * - Allow multiple modules to specify init routines. * - Specify the psect options; we are finally using a * compiler that allows us to do that. * * X-2 SDD Steve DiPirro 06-May-1996 * Make sure required pointer size explicitly declared. * *-- */ /* We want to allow multiple inclusions of this header file. So no need to do the setup more than once. */ #ifndef __INIT_RTN_SETUP #define __INIT_RTN_SETUP 1 #ifdef __INITIAL_POINTER_SIZE #pragma __required_pointer_size __save #pragma __required_pointer_size __short #endif /* Some compilers warn if an array is allocated on too small an alignment. We must allocate on an exact alignment for the init processing to work, so we must do it this way. Disable the warning. */ #pragma message save #pragma message disable UNKMSGID /* This allows the next one to work even on compilers where it is not supported*/ #pragma message disable ALIGNNOTSTD typedef struct { int (*init_rtn)(); long second_long; } INIT_RTN_VEC; #endif #define ssxconcat(a,b) a##b #define ssconcat(a,b) ssxconcat(a,b) /* The setup is complete. For each routine symbol which has been defined, setup the vector in the appropriate PSECT for that routine. */ #ifdef INIT001_ROUTINE #pragma extern_model save #pragma extern_model strict_refdef "EXEC$INIT_001" long,pic,con,rel,gbl,noshr,noexe,wrt,novec INIT_RTN_VEC ssconcat(INIVEC$,INIT001_ROUTINE)={INIT001_ROUTINE,0}; #pragma extern_model restore #undef INIT001_ROUTINE #endif #ifdef INIT000_ROUTINE #pragma extern_model save #pragma extern_model strict_refdef "EXEC$INIT_000" long,pic,con,rel,gbl,noshr,noexe,wrt,novec INIT_RTN_VEC ssconcat(INIVEC$,INIT000_ROUTINE)={INIT000_ROUTINE,0}; #pragma extern_model restore #undef INIT000_ROUTINE #endif #ifdef UNL001_ROUTINE #pragma extern_model save #pragma extern_model strict_refdef "EXEC$UNL_001" octa,pic,con,rel,gbl,noshr,noexe,wrt,novec INIT_RTN_VEC ssconcat(INIVEC$,UNL001_ROUTINE)={UNL001_ROUTINE,0}; #pragma extern_model restore #undef UNL001_ROUTINE #endif #ifdef UNL000_ROUTINE #pragma extern_model save #pragma extern_model strict_refdef "EXEC$UNL_000" octa,pic,con,rel,gbl,noshr,noexe,wrt,novec INIT_RTN_VEC ssconcat(INIVEC$,UNL000_ROUTINE)={UNL000_ROUTINE,0}; #pragma extern_model restore #undef UNL000_ROUTINE #endif #pragma message restore #ifdef __INITIAL_POINTER_SIZE #pragma __required_pointer_size __restore #endif