/***************************************************************************** * * * COPYRIGHT (c) 1993 BY * * DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. * * ALL RIGHTS RESERVED. * * * * THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED * * ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE * * INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER * * COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY * * OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * * TRANSFERRED. * * * * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE * * AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT * * CORPORATION. * * * * DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS * * SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL. * * * *****************************************************************************/ /* *++ * FACILITY: * * VMS Executive (LIB) * * ABSTRACT: * * This header file will setup a loadable image structure. Although you might * think this sort of thing should just be a macro, well, guess again. You * can't use #pragma to manipulate the extern_models and PSECT names from * inside a macro. So it's done this way. Bascially, you #define a few symbols * and include this header file. It will do the rest. * * 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{}. The "temporary" symbols you * define for this header file will be undefined for you. * * This header file will build a table in the EXEC$NONPAGED_DATA_STATBLKS * PSECT. Your link options file must be sure to specify the attributes of * this PSECT as: PIC,USR,CON,REL,GBL,NOSHR,NOEXE,RD,WRT,NOVEC * * There are 3 "parameters" to this header file, the latter 2 of which can * be defaulted (to zero). The following example shows how to setup the * symbols and invoke this header file: * * #define LDI_IMAGE_NAME "SYSTEM_DEBUG.EXE" * #define LDI_FLAGS 1 * #define LDI_LDR_FLAGS 1 * #include * * main() * { } * * AUTHOR: * * Steve DiPirro * * CREATION DATE: 18-Feb-1993 * * MODIFICATION HISTORY: * * X-2 SDD Steve DiPirro 20-May-1994 * Fix usage of #error directive * *-- */ /* We want to allow multiple inclusions of this header file. So no need to do the setup more than once. */ #ifndef __LOADABLE_IMAGE_SETUP #define __LOADABLE_IMAGE_SETUP 1 typedef struct { int image_name_size; char *image_name; int flags; int ldr_flags; } LOADABLE_IMAGE_VEC; #define lixconcat(a,b) a ## b #define liconcat(a,b) lixconcat(a,b) #define LIDATA_PREFIX ldi_vec_ #define LIDATA_SUFFIX 0 #endif /* If we've been in here one too many times, let's get out. */ #if LIDATA_SUFFIX == 30 #error "Header file currently supports a max of 30 loadable images" #endif /* Setup any defaulted symbols. */ #ifndef LDI_IMAGE_NAME #error "Loadable image name must be supplied" #endif #ifndef LDI_FLAGS #define LDI_FLAGS 0 #endif #ifndef LDI_LDR_FLAGS #define LDI_LDR_FLAGS 0 #endif /* Now initialize the structure */ #pragma extern_model save #pragma extern_model strict_refdef "EXEC$NONPAGED_DATA_STATBLKS" LOADABLE_IMAGE_VEC liconcat(LIDATA_PREFIX,LIDATA_SUFFIX)={ sizeof(LDI_IMAGE_NAME)-1,LDI_IMAGE_NAME, LDI_FLAGS,LDI_LDR_FLAGS}; #pragma extern_model restore /* Now undefine or redefine all the temporary symbols */ #undef LDI_IMAGE_NAME #undef LDI_FLAGS #undef LDI_LDR_FLAGS /* Unfortunately, I could think of no other way to produce unique data names for each inclusion of this header file other than the nauseating hack below. This header file doesn't get used much...Not that it's any excuse, mind you. */ #if LIDATA_SUFFIX == 29 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 30 #endif #if LIDATA_SUFFIX == 28 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 29 #endif #if LIDATA_SUFFIX == 27 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 28 #endif #if LIDATA_SUFFIX == 26 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 27 #endif #if LIDATA_SUFFIX == 25 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 26 #endif #if LIDATA_SUFFIX == 24 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 25 #endif #if LIDATA_SUFFIX == 23 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 24 #endif #if LIDATA_SUFFIX == 22 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 23 #endif #if LIDATA_SUFFIX == 21 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 22 #endif #if LIDATA_SUFFIX == 20 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 21 #endif #if LIDATA_SUFFIX == 19 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 20 #endif #if LIDATA_SUFFIX == 18 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 19 #endif #if LIDATA_SUFFIX == 17 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 18 #endif #if LIDATA_SUFFIX == 16 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 17 #endif #if LIDATA_SUFFIX == 15 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 16 #endif #if LIDATA_SUFFIX == 14 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 15 #endif #if LIDATA_SUFFIX == 13 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 14 #endif #if LIDATA_SUFFIX == 12 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 13 #endif #if LIDATA_SUFFIX == 11 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 12 #endif #if LIDATA_SUFFIX == 10 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 11 #endif #if LIDATA_SUFFIX == 9 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 10 #endif #if LIDATA_SUFFIX == 8 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 9 #endif #if LIDATA_SUFFIX == 7 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 8 #endif #if LIDATA_SUFFIX == 6 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 7 #endif #if LIDATA_SUFFIX == 5 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 6 #endif #if LIDATA_SUFFIX == 4 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 5 #endif #if LIDATA_SUFFIX == 3 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 4 #endif #if LIDATA_SUFFIX == 2 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 3 #endif #if LIDATA_SUFFIX == 1 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 2 #endif #if LIDATA_SUFFIX == 0 #undef LIDATA_SUFFIX #define LIDATA_SUFFIX 1 #endif