home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / unzip51.zip / vms / vms.h < prev    next >
C/C++ Source or Header  |  1994-01-08  |  8KB  |  317 lines

  1. /*---------------------------------------------------------------------------
  2.  
  3.   vms.h
  4.  
  5.   Generic VMS header file for Info-ZIP's UnZip; now includes VMSmunch.h (at
  6.   end, except fchdef part deleted).
  7.  
  8.   ---------------------------------------------------------------------------*/
  9.  
  10. #include <descrip.h>
  11. #include <syidef.h>
  12. #include <atrdef.h>
  13. #include <fibdef.h>
  14. #include <iodef.h>
  15. #include <fchdef.h>
  16. #include <rms.h>
  17.  
  18. #define ERR(s) !((s) & 1)    /* VMS system error */
  19.  
  20. #ifndef SYI$_VERSION
  21. #define SYI$_VERSION 4096    /* VMS 5.4 definition */
  22. #endif
  23.  
  24. /*
  25.  *  Under Alpha (DEC C?), the FIB unions are declared as variant_unions.
  26.  *  FIBDEF.H includes the definition of __union, which we check
  27.  *  below to make sure we access the structure correctly.
  28.  */
  29. #define variant_union 1
  30. #if defined(__union) && (__union == variant_union)
  31. #  define FIB$W_DID       fib$w_did
  32. #  define FIB$W_FID       fib$w_fid
  33. #  define FIB$L_ACCTL     fib$l_acctl
  34. #  define FIB$W_EXCTL     fib$w_exctl
  35. #else
  36. #  define FIB$W_DID       fib$r_did_overlay.fib$w_did
  37. #  define FIB$W_FID       fib$r_fid_overlay.fib$w_fid
  38. #  define FIB$L_ACCTL     fib$r_acctl_overlay.fib$l_acctl
  39. #  define FIB$W_EXCTL     fib$r_exctl_overlay.fib$w_exctl
  40. #endif
  41. #undef variant_union
  42.  
  43.  
  44. struct EB_header    /* Common header of extra block */
  45. {   ush tag;
  46.     ush size;
  47.     uch data[1];
  48. };
  49.  
  50. /*------ Old style INFO-ZIP extra field definitions -----*/
  51.  
  52. #if (!defined(VAXC) && !defined(_RMS_H))
  53.  
  54. struct XAB {                    /* This definition may be skipped */
  55.     unsigned char xab$b_cod;
  56.     unsigned char xab$b_bln;
  57.     short int xabdef$$_fill_1;
  58.     char *xab$l_nxt;
  59. };
  60.  
  61. #endif /* !VAXC && !_RMS_H */
  62.  
  63. #define BC_MASK    07   /* 3 bits for compression type */
  64. #define BC_STORED  0    /* Stored */
  65. #define BC_00      1    /* 0byte -> 0bit compression */
  66. #define BC_DEFL    2    /* Deflated */
  67.  
  68. /*
  69.  *  Extra record format
  70.  *  ===================
  71.  *  signature       (2 bytes)   = 'I','M'
  72.  *  size            (2 bytes)
  73.  *  block signature (4 bytes)
  74.  *  flags           (2 bytes)
  75.  *  uncomprssed size(2 bytes)
  76.  *  reserved        (4 bytes)
  77.  *  data            ((size-12) bytes)
  78.  *  ....
  79.  */
  80.  
  81. struct IZ_block
  82. {
  83.     ush sig;            /* Extra field block header structure */
  84.     ush size;
  85.     ulg bid;
  86.     ush flags;
  87.     ush length;
  88.     ulg reserved;
  89.     uch body[1];
  90. };
  91.  
  92. /*
  93.  *   Extra field signature and block signatures
  94.  */
  95.  
  96. #define IZ_SIGNATURE "IM"
  97. #define FABL    (cc$rms_fab.fab$b_bln)
  98. #define RABL    (cc$rms_rab.rab$b_bln)
  99. #define XALLL   (cc$rms_xaball.xab$b_bln)
  100. #define XDATL   (cc$rms_xabdat.xab$b_bln)
  101. #define XFHCL   (cc$rms_xabfhc.xab$b_bln)
  102. #define XKEYL   (cc$rms_xabkey.xab$b_bln)
  103. #define XPROL   (cc$rms_xabpro.xab$b_bln)
  104. #define XRDTL   (cc$rms_xabrdt.xab$b_bln)
  105. #define XSUML   (cc$rms_xabsum.xab$b_bln)
  106. #define EXTBSL  4            /* Block signature length */
  107. #define RESL    8            /* Reserved 8 bytes */
  108. #define EXTHL   (4+EXTBSL)
  109. #define FABSIG  "VFAB"
  110. #define XALLSIG "VALL"
  111. #define XFHCSIG "VFHC"
  112. #define XDATSIG "VDAT"
  113. #define XRDTSIG "VRDT"
  114. #define XPROSIG "VPRO"
  115. #define XKEYSIG "VKEY"
  116. #define XNAMSIG "VNAM"
  117. #define VERSIG  "VMSV"
  118.  
  119. typedef unsigned char byte;
  120.  
  121. struct iosb
  122. {   ush status;
  123.     ush count;
  124.     ulg spec;
  125. };
  126.  
  127. /*------------ PKWARE extra block definitions ----------*/
  128.  
  129. /* Structure of PKWARE extra header */
  130.  
  131. #ifdef VMS_ZIP
  132.  
  133. struct PK_info
  134. {
  135.     ush tag_ra; ush len_ra;     byte ra[ATR$S_RECATTR];
  136.     ush tag_uc; ush len_uc;     byte uc[ATR$S_UCHAR];
  137.     ush tag_jr; ush len_jr;     byte jr[ATR$S_JOURNAL];
  138.     ush tag_cd; ush len_cd;     byte cd[ATR$S_CREDATE];
  139.     ush tag_rd; ush len_rd;     byte rd[ATR$S_REVDATE];
  140.     ush tag_ed; ush len_ed;     byte ed[ATR$S_EXPDATE];
  141.     ush tag_bd; ush len_bd;     byte bd[ATR$S_BAKDATE];
  142.     ush tag_rn; ush len_rn;     ush  rn;
  143.     ush tag_ui; ush len_ui;     byte ui[ATR$S_UIC];
  144.     ush tag_fp; ush len_fp;     byte fp[ATR$S_FPRO];
  145.     ush tag_rp; ush len_rp;     byte rp[ATR$S_RPRO];
  146. };
  147.  
  148. #endif /* ?VMS_ZIP */
  149.  
  150. /* PKWARE "VMS" tag */
  151. #define PK_SIGNATURE        0x000C
  152. #define IZ_NEW_SIGNATURE    0x010C  /* New signature, extra record format
  153.                     *  mostly compatible with PKWARE's */
  154.  
  155. /* Total number of attributes to be saved */
  156. #define VMS_ATTR_COUNT    11
  157. #define VMS_MAX_ATRCNT    20
  158.  
  159. struct PK_field
  160. {   ush        tag;
  161.     ush        size;
  162.     byte    value[1];
  163. };
  164.  
  165. #define PK_FLDHDR_SIZE    4
  166.  
  167. struct PK_header
  168. {   ush    tag;
  169.     ush    size;
  170.     ulg    crc32;
  171.     byte data[1];
  172. };
  173.  
  174. #define    PK_HEADER_SIZE    8
  175.  
  176. #ifdef    VMS_ZIP
  177. /* File description structure for Zip low level I/O */
  178. struct ioctx
  179. {   ush            chan;
  180.     int            status;
  181.     struct iosb        iosb;
  182.     long        vbn;
  183.     long        size;
  184.     long        rest;
  185.     struct PK_info    PKi;
  186.     long        acllen;
  187.     uch            aclbuf[ATR$S_READACL];
  188. };
  189. #endif    /* VMS_ZIP */
  190.  
  191.  
  192.  
  193. /*---------------------------------------------------------------------------
  194.  
  195.   VMSmunch.h
  196.  
  197.   A few handy #defines, plus the contents of three header files from Joe
  198.   Meadows' FILE program.  Used by VMSmunch and by various routines which
  199.   call VMSmunch (e.g., in Zip and UnZip).
  200.  
  201.   ---------------------------------------------------------------------------*/
  202.  
  203. #define GET_TIMES       4
  204. #define SET_TIMES       0
  205. #define GET_RTYPE       1
  206. #define CHANGE_RTYPE    2
  207. #define RESTORE_RTYPE   3
  208.  
  209. /*---------------------------------------------------------------------------
  210.     fatdef.h
  211.   ---------------------------------------------------------------------------*/
  212.  
  213. /* This header file was created by Joe Meadows, and is not copyrighted
  214.    in any way. No guarantee is made as to the accuracy of the contents
  215.    of this header file. This header file was last modified on Sep. 22th,
  216.    1987. (Modified to include this statement) */
  217. #define FAT$K_LENGTH 32
  218. #define FAT$C_LENGTH 32
  219. #define FAT$S_FATDEF 32
  220.  
  221. struct fatdef {
  222.   union  {
  223.     unsigned char fat$b_rtype;
  224.     struct  {
  225.       unsigned fat$v_rtype : 4;
  226.       unsigned fat$v_fileorg : 4;
  227.     } fat$r_rtype_bits;
  228.   } fat$r_rtype_overlay;
  229. # define FAT$S_RTYPE 4
  230. # define FAT$V_RTYPE 0
  231. #   define FAT$C_UNDEFINED 0
  232. #   define FAT$C_FIXED 1
  233. #   define FAT$C_VARIABLE 2
  234. #   define FAT$C_VFC 3
  235. #   define FAT$C_STREAM 4
  236. #   define FAT$C_STREAMLF 5
  237. #   define FAT$C_STREAMCR 6
  238. # define FAT$S_FILEORG 4
  239. # define FAT$V_FILEORG 4
  240. #   define FAT$C_SEQUENTIAL 0
  241. #   define FAT$C_RELATIVE 1
  242. #   define FAT$C_INDEXED 2
  243. #   define FAT$C_DIRECT 3
  244.   union  {
  245.     unsigned char fat$b_rattrib;
  246.     struct  {
  247.       unsigned fat$v_fortrancc : 1;
  248.       unsigned fat$v_impliedcc : 1;
  249.       unsigned fat$v_printcc : 1;
  250.       unsigned fat$v_nospan : 1;
  251.     } fat$r_rattrib_bits;
  252.   } fat$r_rattrib_overlay;
  253. #   define FAT$V_FORTRANCC 0
  254. #   define FAT$M_FORTRANCC 1
  255. #   define FAT$V_IMPLIEDCC 1
  256. #   define FAT$M_IMPLIEDCC 2
  257. #   define FAT$V_PRINTCC 2
  258. #   define FAT$M_PRINTCC 4
  259. #   define FAT$V_NOSPAN 3
  260. #   define FAT$M_NOSPAN 8
  261.   unsigned short int fat$w_rsize;
  262.   union
  263.   {
  264.     unsigned long int fat$l_hiblk;
  265.     struct
  266.     {
  267.       unsigned short int fat$w_hiblkh;
  268.       unsigned short int fat$w_hiblkl;
  269.     } fat$r_hiblk_fields;
  270.   } fat$r_hiblk_overlay;
  271.   union
  272.   {
  273.     unsigned long int fat$l_efblk;
  274.     struct
  275.     {
  276.       unsigned short int fat$w_efblkh;
  277.       unsigned short int fat$w_efblkl;
  278.     } fat$r_efblk_fields;
  279.   } fat$r_efblk_overlay;
  280.   unsigned short int fat$w_ffbyte;
  281.   unsigned char fat$b_bktsize;
  282.   unsigned char fat$b_vfcsize;
  283.   unsigned short int fat$w_maxrec;
  284.   unsigned short int fat$w_defext;
  285.   unsigned short int fat$w_gbc;
  286.   char fat$fill[8];
  287.   unsigned short int fat$w_versions;
  288. };
  289.  
  290.  
  291. /*---------------------------------------------------------------------------
  292.     fjndef.h
  293.   ---------------------------------------------------------------------------*/
  294.  
  295. /* This header file was created by Joe Meadows, and is not copyrighted
  296.    in any way. No guarantee is made as to the accuracy of the contents
  297.    of this header file. This header file was last modified on Sep. 22th,
  298.    1987. (Modified to include this statement) */
  299.  
  300. #define FJN$M_ONLY_RU 1
  301. #define FJN$M_RUJNL 2
  302. #define FJN$M_BIJNL 4
  303. #define FJN$M_AIJNL 8
  304. #define FJN$M_ATJNL 16
  305. #define FJN$M_NEVER_RU 32
  306. #define FJN$M_JOURNAL_FILE 64
  307. #define FJN$S_FJNDEF 1
  308. struct fjndef  {
  309.   unsigned fjn$v_only_ru : 1;
  310.   unsigned fjn$v_rujnl : 1;
  311.   unsigned fjn$v_bijnl : 1;
  312.   unsigned fjn$v_aijnl : 1;
  313.   unsigned fjn$v_atjnl : 1;
  314.   unsigned fjn$v_never_ru : 1;
  315.   unsigned fjn$v_journal_file:1;
  316. } ;
  317.