[0001]
[0002]
[0003]
[0004]
[0005]
[0006]
[0007]
[0008]
[0009]
[0010]
[0011]
[0012]
[0013]
[0014]
[0015]
[0016]
[0017]
[0018]
[0019]
[0020]
[0021]
[0022]
[0023]
[0024]
[0025]
[0026]
[0027]
[0028]
[0029]
[0030]
[0031]
[0032]
[0033]
[0034]
[0035]
[0036]
[0037]
[0038]
[0039]
[0040]
[0041]
[0042]
[0043]
[0044]
[0045]
[0046]
[0047]
[0048]
[0049]
[0050]
[0051]
[0052]
[0053]
[0054]
[0055]
[0056]
[0057]
[0058]
[0059]
[0060]
[0061]
[0062]
[0063]
[0064]
[0065]
[0066]
[0067]
[0068]
[0069]
[0070]
[0071]
[0072]
[0073]
[0074]
[0075]
[0076]
[0077]
[0078]
[0079]
[0080]
[0081]
[0082]
[0083]
[0084]
[0085]
[0086]
[0087]
[0088]
[0089]
[0090]
[0091]
[0092]
[0093]
[0094]
[0095]
[0096]
[0097]
[0098]
[0099]
[0100]
[0101]
[0102]
[0103]
[0104]
[0105]
[0106]
[0107]
[0108]
[0109]
[0110]
[0111]
[0112]
[0113]
[0114]
[0115]
[0116]
[0117]
[0118]
[0119]
[0120]
[0121]
[0122]
[0123]
[0124]
[0125]
[0126]
[0127]
[0128]
[0129]
[0130]
[0131]
[0132]
[0133]
[0134]
[0135]
[0136]
[0137]
[0138]
[0139]
[0140]
[0141]
[0142]
[0143]
[0144]
[0145]
[0146]
[0147]
[0148]
[0149]
[0150]
[0151]
[0152]
[0153]
[0154]
[0155]
[0156]
[0157]
[0158]
[0159]
[0160]
[0161]
[0162]
[0163]
[0164]
[0165]
[0166]
[0167]
[0168]
[0169]
[0170]
[0171]
[0172]
[0173]
[0174]
[0175]
[0176]
[0177]
[0178]
[0179]
[0180]
[0181]
[0182]
[0183]
[0184]
[0185]
[0186]
[0187]
[0188]
[0189]
[0190]
[0191]
[0192]
[0193]
[0194]
[0195]
[0196]
[0197]
[0198]
[0199]
[0200]
[0201]
[0202]
[0203]
[0204]
[0205]
[0206]
[0207]
[0208]
[0209]
[0210]
[0211]
[0212]
[0213]
[0214]
[0215]
[0216]
[0217]
[0218]
[0219]
[0220]
[0221]
[0222]
[0223]
[0224]
[0225]
[0226]
[0227]
[0228]
[0229]
[0230]
[0231]
[0232]
[0233]
[0234]
[0235]
[0236]
[0237]
[0238]
[0239]
[0240]
[0241]
[0242]
[0243]
[0244]
[0245]
[0246]
[0247]
[0248]
[0249]
[0250]
[0251]
[0252]
[0253]
[0254]
[0255]
[0256]
[0257]
[0258]
[0259]
[0260]
[0261]
[0262]
[0263]
[0264]
[0265]
[0266]
[0267]
[0268]
[0269]
[0270]
[0271]
[0272]
[0273]
[0274]
[0275]
[0276]
[0277]
[0278]
[0279]
[0280]
[0281]
[0282]
[0283]
[0284]
[0285]
[0286]
[0287]
[0288]
[0289]
[0290]
[0291]
[0292]
[0293]
[0294]
[0295]
[0296]
[0297]
[0298]
[0299]
[0300]
[0301]
[0302]
[0303]
[0304]
[0305]
[0306]
[0307]
[0308]
[0309]
[0310]
[0311]
[0312]
[0313]
[0314]
[0315]
[0316]
[0317]
[0318]
[0319]
[0320]
[0321]
[0322]
[0323]
[0324]
[0325]
[0326]
[0327]
[0328]
[0329]
[0330]
[0331]
[0332]
[0333]
[0334]
[0335]
[0336]
[0337]
[0338]
[0339]
[0340]
[0341]
[0342]
[0343]
[0344]
[0345]
[0346]
[0347]
[0348]
[0349]
[0350]
[0351]
[0352]
[0353]
/*****************************************************************************/
/*
                                 eNAMeL.h

Don't know what the 'e's actually represent, but this header is used to gloss
over :^) the issue of older versions of VMS and DECC not having a long NAM
structure or definitions used to support ODS-5.  For the same reason an
extended FIB structure definition must be provided.  For such environments this
header file provides the necessary infrastructure, allowing extended file
specification compliant code to be compiled and linked on pre-v7.2 systems. 
This should then be able to be executed on both the pre-v7.2 systems and others
having v7.2ff installed (which is a nice trick if it doesn't bring you
unstuck too often).

Of course runtime decision structures based on the VMS version, device ACP
type, etc., must be used if pre-v7.2 systems are to avoid using the NAML
structure with RMS (which would of course result in runtime errors).

No such constraint apparently exists with using the extended FIB structure as
it contains no sanity check item that I can see identifying either it's role as
a FIB or it's size as a FIB!  (These must just get longer over time ;^)

Programs using this approach must use the ENAMEL_RMS_NAML macro to initialize
the NAML structure.  This will also work for VMS versions earlier than those
that support the NAML structure and would not have the cc$rms_naml structure
available.  That is use,

  struct NAML  a_naml;
  ENAMEL_RMS_NAML(a_naml)

instead of,

  struct NAML  a_naml = cc$rms_naml;

Programs using this header file can check whether the native header NAML was
used or the ENAMEL.H header NAML by checking for the existance of an
ENAMEL_NAML macro.  In a similar fashion, whether the 'enamel_fibdef' structure 
needs to be used or the native 'fibdef' structure, by checking for the
existance of the ENAMEL_FIBDEF macro.

The ENAMEL_NAML_SANITY_CHECK and ENAMEL_FIBDEF_SANITY_CHECK macros provide a
crude sanity check against any real stupid problems with the ENAMEL.H NAML
structure (such as compilation member alignment issues, etc.) and should be
incorporated somewhere at the start of runtime for this purpose.


VERSION HISTORY
---------------
21-DEC-2003  MGD  minor conditional mods to support IA64
13-AUG-2002  MGD  change detection of FIB$C_LENGTH (DECC V6.5?)
30-MAR-2002  MGD  force this FIBDEF to be used if FIBDEF not otherwise defined
23-DEC-1999  MGD  initial
*/
/*****************************************************************************/

#ifndef ENAMEL_H_LOADED
#define ENAMEL_H_LOADED 1

#ifndef __VAX

#include <atrdef.h>
#include <fibdef.h>
#include <namdef.h>

/*********************/
/* ATRDEF DEFINITION */
/*********************/

#ifndef __NEW_STARLET

/* apparently not all compiler environments have ATRDEF defined */
#ifndef ATRDEF

#undef _atrdef

#ifndef __VAX
#   pragma member_alignment __save
#   pragma member_alignment
#endif

typedef struct _atrdef
{
   unsigned short int atr$w_size;
   unsigned short int atr$w_type;
   void *atr$l_addr;
} ATRDEF;
#endif /* ATRDEF */

#ifndef __VAX
#   pragma member_alignment __restore
#endif

#endif /* __NEW_STARLET */

/*******************/
/* NAML DEFINITION */
/*******************/

/* if NAML has not been defined (i.e. Alpha pre-V7.2) conjure one up! */
#ifndef NAML

/* length of NAML block */
#define NAML$C_BLN 248
/* RMS code for NAML block */
#define NAML$C_BID   4

#pragma member_alignment __save

/* this works for DECC 6.2 at least */
struct namldef
{
#pragma __nomember_alignment
   unsigned char  naml$b_bid;
   unsigned char  naml$b_bln;
   unsigned char  naml$b_rss;
   unsigned char  naml$b_rsl;
   char  *naml$l_rsa;
   unsigned char  naml$b_nop;
   unsigned char  naml$b_rfs;
   unsigned char  naml$b_ess;
   unsigned char  naml$b_esl;
   char  *naml$l_esa;
   struct namldef  *naml$l_rlf_naml;
   char  naml$t_dvi [16];
   unsigned short int  naml$w_fid [3];
   unsigned short int  naml$w_did [3];
   unsigned int  naml$l_wcc;
   unsigned int  naml$l_fnb;
   unsigned char  naml$b_node;
   unsigned char  naml$b_dev;
   unsigned char  naml$b_dir;
   unsigned char  naml$b_name;
   unsigned char  naml$b_type;
   unsigned char  naml$b_ver;
   unsigned char  naml$b_nmc;
   char  namldef$$_fill_6 [1];
   char  *naml$l_node;
   char  *naml$l_dev;
   char  *naml$l_dir;
   char  *naml$l_name;
   char  *naml$l_type;
   char  *naml$l_ver;
   unsigned short int  naml$w_first_wild_dir;
   unsigned short int  naml$w_long_dir_levels;
   unsigned int  namldef$$_fill_7 [1];
   unsigned int  naml$l_long_defname_size;
   char  *naml$l_long_defname;
   unsigned int  naml$l_long_filename_size;
   char  *naml$l_long_filename;
   unsigned int  naml$l_long_node_size;
   char  *naml$l_long_node;
   unsigned int  naml$l_long_dev_size;
   char  *naml$l_long_dev;
   unsigned int  naml$l_long_dir_size;
   char  *naml$l_long_dir;
   unsigned int  naml$l_long_name_size;
   char  *naml$l_long_name;
   unsigned int  naml$l_long_type_size;
   char  *naml$l_long_type;
   unsigned int  naml$l_long_ver_size;
   char  *naml$l_long_ver;
#pragma __nomember_alignment __quadword
   unsigned int  naml$l_long_expand_size;
#pragma __nomember_alignment
   char  *naml$l_long_expand;
   unsigned  int naml$l_long_expand_alloc;
   int  naml$l_reserved_mbz_9;
#pragma __nomember_alignment __quadword
   unsigned int  naml$l_long_result_size;
#pragma __nomember_alignment
   char  *naml$l_long_result;
   unsigned int  naml$l_long_result_alloc;
   int  naml$l_reserved_mbz_8;
#pragma __nomember_alignment __quadword
   unsigned int  naml$l_filesys_name_size;
#pragma __nomember_alignment
   char  *naml$l_filesys_name;
   unsigned int  naml$l_filesys_name_alloc;
   unsigned int  naml$l_output_flags;
   unsigned int  naml$l_input_flags;
   int  naml$l_reserved_mbz_7;
   unsigned int  naml$q_user_context[2];
   int  naml$l_reserved_mbz_6;
   int  naml$l_reserved_mbz_5;
   int  naml$l_reserved_mbz_4;
   int  naml$l_reserved_mbz_3;
   int  naml$l_reserved_mbz_2;
   int  naml$l_reserved_mbz_1;
};
 
#define NAML namldef
#define ENAMEL_NAML namldef

#pragma member_alignment __restore

#define ENAMEL_NAML_USED "WASD NAML"

#else /* ifndef NAML */

#define ENAMEL_NAML_USED "VMS NAML"

#endif /* ifndef NAML */

/* block initialize macro */
#define ENAMEL_RMS_NAML(naml) \
{ \
   memset (&naml, 0, NAML$C_BLN); \
   naml.naml$b_bln = NAML$C_BLN; \
   naml.naml$b_bid = NAML$C_BID; \
}

/******************/
/* FIB DEFINITION */
/******************/

#pragma member_alignment __save
#pragma __nomember_alignment

#define ENAMEL_FIB$C_LENGTH 96
#define ENAMEL_PRE72_FIB$C_LENGTH 92

#ifndef __NEW_STARLET

/* apparently not all compiler environments have FIBDEF defined */
#ifndef FIB$C_LENGTH
#  define FIB$C_LENGTH 0
#endif /* FIB$C_LENGTH */

#endif /* __NEW_STARLET */

/* if the FIB looks pre-7.2 then use this local definition */
#if FIB$C_LENGTH <= ENAMEL_PRE72_FIB$C_LENGTH

#undef fibdef
#undef fib$l_acctl
#undef fib$w_fid
#undef fib$w_did
#undef fib$l_wcc
#undef fib$w_nmctl
#undef fib$w_exctl
#undef fib$l_exsz
#undef fib$l_exvbn
#undef fib$b_alopts
#undef fib$b_alalign
#undef fib$w_alloc
#undef fib$w_verlimit
#undef fib$b_agent_mode
#undef fib$b_ru_facility
#undef fib$l_aclctx
#undef fib$l_acl_status
#undef fib$l_status
#undef fib$l_alt_access
#undef fib$r_funcdepend
#undef fib$w_file_hdrseq_incr
#undef fib$w_dir_hdrseq_incr
#undef fib$w_file_dataseq_incr
#undef fib$w_dir_dataseq_incr
#undef fib$l_caching_options
#undef fib$w_sd_fid
 
struct enamel_fibdef
{
   unsigned int  fib$l_acctl;
   unsigned short int  fib$w_fid [3];
   unsigned short int  fib$w_did [3];
   unsigned int  fib$l_wcc;
   unsigned short int  fib$w_nmctl;
   unsigned short int  fib$w_exctl;
   unsigned int  fib$l_exsz;
   unsigned int  fib$l_exvbn;
   unsigned char  fib$b_alopts;
   unsigned char  fib$b_alalign;
   unsigned short int  fib$w_alloc [5];
   unsigned short int  fib$w_verlimit;
   unsigned char  fib$b_agent_mode;
   unsigned char  fib$b_ru_facility;
   unsigned int  fib$l_aclctx;
   unsigned int  fib$l_acl_status;
   unsigned int  fib$l_status;
   unsigned int  fib$l_alt_access;
   unsigned int  fib$r_funcdepend [2];
   unsigned short int  fib$w_file_hdrseq_incr;
   unsigned short int  fib$w_dir_hdrseq_incr;
   unsigned short int  fib$w_file_dataseq_incr;
   unsigned short int  fib$w_dir_dataseq_incr;
   unsigned int  fib$l_caching_options;
   unsigned short int  fib$w_sd_fid [3];
   short int  fibdef$$_reserved_1;
   /* the following is from VMS v7.2ff */
   unsigned char  fib$b_name_format_in;
   unsigned char  fib$b_name_format_out;
   unsigned char  fib$b_ascname_format;
   unsigned char  fib$b_reserved_2;
};
 
#define fibdef enamel_fibdef
#define FIBDEF enamel_fibdef
#define ENAMEL_FIBDEF enamel_fibdef

/* will need these too */
#define FIB$C_ISO_LATIN 1
#define FIB$M_NAMES_8BIT 0x1

#define ENAMEL_FIB_USED "WASD FIB"

#else /* FIB$C_LENGTH <= ENAMEL_PRE72_FIB$C_LENGTH */

#define ENAMEL_FIB_USED "VMS FIB"

#endif /* FIB$C_LENGTH <= ENAMEL_PRE72_FIB$C_LENGTH */

#pragma member_alignment __restore

/*****************/
/* SANITY CHECKS */
/*****************/

/* just a crude sanity check when using ENAMEL.H structures */
#ifdef ENAMEL_NAML
#   define ENAMEL_NAML_SANITY_CHECK \
      { if (sizeof(struct NAML) != NAML$C_BLN) \
           exit (SS$_BUGCHECK); }
#else
#   define ENAMEL_NAML_SANITY_CHECK
#endif
#ifdef ENAMEL_FIBDEF
#   define ENAMEL_FIBDEF_SANITY_CHECK \
      { if (sizeof(struct ENAMEL_FIBDEF) != ENAMEL_FIB$C_LENGTH) \
           exit (SS$_BUGCHECK); } 
#else
#   define ENAMEL_FIBDEF_SANITY_CHECK
#endif

#else /* ifndef __VAX */

#define ENAMEL_FIB_USED "VMS FIB"
#define ENAMEL_NAML_USED "no NAML"

#endif /* ifndef __VAX */

#ifndef __NEW_STARLET
#ifndef ATRDEF
#  define ATRDEF struct atrdef
#endif
#ifndef FIBDEF
#  define FIBDEF struct fibdef
#endif
#endif

#endif /* ENAMEL_H_LOADED */

/****************************************************************************/