From: CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 1-JUN-1991 11:55:31.93 To: ARISIA::EVERHART CC: Subj: Re: Vax-C/Message Utility From: RELAY-INFO-VAX@CRVAX.SRI.COM@SMTP@CRDGW2 To: Everhart@Arisia@MRGATE Received: by crdgw1.ge.com (5.57/GE 1.99) id AA17710; Sat, 1 Jun 91 02:18:07 EDT Received: From UCBVAX.BERKELEY.EDU by CRVAX.SRI.COM with TCP; Fri, 31 MAY 91 23:06:26 PDT Received: by ucbvax.Berkeley.EDU (5.63/1.42) id AA07054; Fri, 31 May 91 22:49:44 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for info-vax@kl.sri.com (info-vax@kl.sri.com) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 31 May 91 15:56:02 GMT From: dog.ee.lbl.gov!hellgate.utah.edu!caen!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!jarthur!mti!adrian@ucbvax.Berkeley.EDU (Adrian McCarthy) Organization: Micro Technology, Anaheim, CA Subject: Re: Vax-C/Message Utility Message-Id: <3284@mti.mti.com> References: <2476.2844dd34@spacm1.spac.spc.com> Sender: info-vax-request@kl.sri.com To: info-vax@kl.sri.com In article <2476.2844dd34@spacm1.spac.spc.com> ibasacc06@spacm1.spac.spc.com (Robert Fisch) writes: >Most VMS header files (.h files for use with vax-c) are a series of define >statements, i.e. > >#define SS$_NORMAL 1 >/* blah blah blah */ >................... > >Now I assume somehere there are message source files compiled with the message >utility. But where do these header files come from? How are they generated? The MESSAGE compiler has an undocumented qualifier /SDL. It causes MESSAGE to generate a language-independent description of all of the identifiers defined. Inside DEC (I don't think it's a product they offer), they have an SDL processor which reads these SDL files and converts them to include files in the language of your choice. That's how they generated many of the .h files in SYS$LIBRARY. >Using DCL I have found several ways to generate 'define header files' for my >own message files. You might be able to write a quick program that reads the SDL file and generates the C header files. The format is pretty simple (at least the ones I've seen generated by MESSAGE). I imagine that the difficult part of the SDL processor is supporting multiple languages. The other thing you might consider is predicting the values that MESSAGE will assign to the symbols. This isn't too hard if you don't use any .BASE directives. This approach is admittedly a bit clumsy from a configuration management point of view, but there is sometimes a time and place for an approach like this. Consider the following macros: /* * Bit masks for message codes (see Introduction to System Routines, * Section 2.5). */ #define MSG_MSEV 0x00000007L /* severity bits */ #define MSG_MID 0x00007FF8L /* ident bits */ #define MSG_MNONSYS 0x00008000L /* facility specific (1) */ #define MSG_MFAC 0x07FF0000L /* facility bits */ #define MSG_MUSER 0x08000000L /* non-DEC facility (1) */ #define MSG_MCONTROL 0x10000000L /* inhibit message bit */ /* Shift amounts to each field. */ #define MSG_SSEV 0 #define MSG_SID 3 #define MSG_SNONSYS 15 #define MSG_SFAC 16 #define MSG_SUSER 27 #define MSG_SCONTROL 28 #define SEV_WARNING 0 #define SEV_SUCCESS 1 #define SEV_ERROR 2 #define SEV_INFO 3 #define SEV_INFORMATION SEV_INFO #define SEV_FATAL 4 /* 5, 6, and 7 are reserved to DIGITAL. */ #define MKMSGNUM(f,i,s) (((f) << MSG_SFAC) | \ ((i) << MSG_SID) | \ ((s) << MSG_SSEV) | \ MSG_MNONSYS | MSG_MUSER) MKMSGNUM(f,i,s) evaluates to the code for a *user* message in facility f (the number you provide in the .FACILITY directive), identification i (the serial number of the message in the .MSG file, starting with 1), and severity s (from the SEV_* macros above). Use these macros at you're own risk. I recommend the SDL approach over the predictive approach. Aid. (adrian@gonzo.mti.com) I'm not speaking for MTI.