home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / unzip52.zip / os2 / os2.h < prev    next >
C/C++ Source or Header  |  1996-03-12  |  3KB  |  143 lines

  1. /******************************************************************************
  2.  OS/2 specific structures and data to be included in the global data structure
  3.  ******************************************************************************/
  4.  
  5.  
  6. #define MAXNAMLEN  256
  7. #define MAXPATHLEN 256
  8. #define  MAXLEN          256       /* temporary buffer length        */
  9. #define  IBUF_LEN       4096       /* Input buffer length            */
  10.  
  11. #define INCL_NOPM
  12. #define INCL_DOSNLS
  13. #define INCL_DOSPROCESS
  14. #define INCL_DOSDEVICES
  15. #define INCL_DOSDEVIOCTL
  16. #define INCL_DOSERRORS
  17. #define INCL_DOSMISC
  18.  
  19. #if defined(OS2API) && !defined(DLL)
  20. # undef OS2API
  21. #endif
  22.  
  23. #ifdef OS2API
  24. # define  INCL_REXXSAA
  25. # include <rexxsaa.h>
  26. #endif
  27. #include <os2.h>
  28.  
  29.  
  30. struct direct
  31. {
  32.   ino_t    d_ino;                   /* a bit of a farce */
  33.   int      d_reclen;                /* more farce */
  34.   int      d_namlen;                /* length of d_name */
  35.   char     d_name[MAXNAMLEN + 1];   /* null terminated */
  36.   /* nonstandard fields */
  37.   long     d_size;                  /* size in bytes */
  38.   unsigned d_mode;                  /* MS-DOS or OS/2 file attributes */
  39.   unsigned d_time;
  40.   unsigned d_date;
  41. };
  42.  
  43.  
  44. /* The fields d_size and d_mode are extensions by me (Kai Uwe Rommel).  The
  45.  * find_first and find_next calls deliver these data without any extra cost.
  46.  * If these data are needed, the fields save a lot of extra calls to stat()
  47.  * (each stat() again performs a find_first call !).
  48.  */
  49.  
  50. struct _dircontents
  51. {
  52.   char *_d_entry;
  53.   long _d_size;
  54.   unsigned _d_mode, _d_time, _d_date;
  55.   struct _dircontents *_d_next;
  56. };
  57.  
  58. typedef struct _dirdesc
  59. {
  60.   int  dd_id;                   /* uniquely identify each open directory */
  61.   long dd_loc;                  /* where we are in directory entry is this */
  62.   struct _dircontents *dd_contents;   /* pointer to contents of dir */
  63.   struct _dircontents *dd_cp;         /* pointer to current position */
  64. }
  65. DIR;
  66.  
  67.  
  68.  
  69.  
  70.  
  71. struct os2Global {
  72.  
  73. #ifndef SFX
  74.   HDIR hdir;
  75. #  ifdef __32BIT__
  76.   ULONG count;
  77.   FILEFINDBUF3 find;
  78. #  else
  79.   USHORT count;
  80.   FILEFINDBUF find;
  81. #  endif
  82. #endif
  83.   
  84.   int created_dir;        /* used by mapname(), checkdir() */
  85.   int renamed_fullpath;   /* ditto */
  86.   int fnlen;              /* ditto */
  87. #ifdef __32BIT__
  88.   ULONG nLabelDrive;   /* ditto */
  89. #else
  90.   USHORT nLabelDrive;
  91. #endif
  92.   int longnameEA;         /* checkdir(), close_outfile() */
  93.   char *lastpathcomp;     /* ditto */
  94.   
  95.   struct direct dp;
  96.   int lower;
  97.   USHORT nLastDrive, nResult;
  98.   
  99.   DIR *dir;
  100.   char *dirname, *wildname, matchname[FILNAMSIZ];
  101.   int firstcall, have_dirname, dirnamelen;
  102.   
  103.   int rootlen;          /* length of rootpath */
  104.   char *rootpath;       /* user's "extract-to" directory */
  105.   char *buildpathHPFS;  /* full path (so far) to extracted file, */
  106.   char *buildpathFAT;   /*  both HPFS/EA (main) and FAT versions */
  107.   char *endHPFS;        /* corresponding pointers to end of */
  108.   char *endFAT;         /*  buildpath ('\0') */
  109.  
  110. #ifdef OS2API
  111.   char buffer[IBUF_LEN];
  112.   char output_var[MAXLEN];
  113.   char getvar_buf[MAXLEN];
  114.   int getvar_len;
  115.   
  116.   int output_idx;
  117.   int stem_len;
  118.   int putchar_idx;
  119.   int rexx_error;
  120.   char *rexx_mes;
  121.  
  122.   SHVBLOCK request;
  123. #endif
  124.   
  125. };
  126.  
  127. #define SYSTEM_SPECIFIC_GLOBALS struct os2Global os2;
  128. #define SYSTEM_SPECIFIC_CTOR    os2GlobalsCtor
  129.  
  130.  
  131. #ifdef OS2API
  132.  
  133. # ifdef API_DOC
  134.  
  135. #   define SYSTEM_API_BRIEF    REXXBrief
  136. #   define SYSTEM_API_DETAILS  REXXDetails
  137.  
  138.     extern char *REXXBrief;
  139.     extern APIDocStruct REXXDetails[];
  140.  
  141. # endif
  142. #endif
  143.