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