Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.   Copyright (c) 1990-2000 Info-ZIP.  All rights reserved.
  3.  
  4.   See the accompanying file LICENSE, version 2000-Apr-09 or later
  5.   (the contents of which are also included in unzip.h) for terms of use.
  6.   If, for some reason, all these files are missing, the Info-ZIP license
  7.   also may be found at:  ftp://ftp.info-zip.org/pub/infozip/license.html
  8. */
  9. /*---------------------------------------------------------------------------
  10.     MACOS specific configuration and declarations:
  11.   ---------------------------------------------------------------------------*/
  12.  
  13. #ifndef __maccfg_h
  14. #define __maccfg_h
  15.  
  16.  
  17. /*****************************************************************************/
  18. /*  Macros, missing RTL declarations, compatibility typedefs                 */
  19. /*****************************************************************************/
  20.  
  21.  
  22. #if defined(__MWERKS__) && defined(macintosh)
  23. #  include <OSUtils.h>
  24.  
  25.    typedef unsigned long mode_t;
  26. #  define _STAT
  27.  
  28. #  if (defined(MacStaticLib) || defined(USE_SIOUX))
  29. #    define MAIN   UZ_EXP UzpMain   /* was UzpUnzip */
  30. #  else
  31. #    define MAIN   _dummy_main
  32. #  endif
  33. #endif
  34.  
  35. #ifdef THINK_C
  36. #  ifndef __STDC__              /* if Think C hasn't defined __STDC__ ... */
  37. #    define __STDC__ 1          /*   make sure it's defined: it needs it */
  38. #  else
  39. #    if !__STDC__               /* sometimes __STDC__ is defined as 0; */
  40. #      undef __STDC__           /*   it needs to be 1 or required header */
  41. #      define __STDC__ 1        /*   files are not properly included. */
  42. #    endif /* !__STDC__ */
  43. #  endif
  44. #  define IOCompletionUPP   ProcPtr
  45. #  define CREATOR  'KAHL'
  46. #  define MAIN     _dummy_main
  47. #endif /* THINK_C */
  48.  
  49. #ifdef MPW
  50. #  include <Errors.h>
  51. #  include <Files.h>
  52. #  include <Memory.h>
  53. #  include <Quickdraw.h>
  54. #  include <ToolUtils.h>
  55. #  ifndef QUERY_TRNEWLN
  56. #    define QUERY_TRNEWLN
  57. #  endif
  58. #  ifdef fileno
  59. #    undef fileno
  60. #  endif
  61. #  ifdef MCH_MACINTOSH
  62. #    define CREATOR     'Manx'
  63. #  else
  64. #    define CREATOR     'MPS '
  65. #  endif
  66. #endif /* MPW */
  67.  
  68. #include <fcntl.h>              /* O_BINARY for open() w/o CR/LF translation */
  69. #define fileno(x)       ((x) == stdout ? 1 : ((x) == stderr ? 2 : (short)(x)))
  70. #define open            macopen
  71. #define close           macclose
  72. #define fclose(x)       macclose(fileno((x)))
  73. #define read            macread
  74. #define write           macwrite
  75. #define lseek           maclseek
  76. #define creat(x,y)      maccreat((x))
  77. #define stat            UZmacstat
  78. #define lstat           UZmacstat
  79. #define dup
  80. #ifndef MCH_MACINTOSH
  81. #  define NO_STRNICMP
  82. #endif
  83.  
  84. #define DIR_END ':'
  85. #ifndef DATE_FORMAT
  86. #  define DATE_FORMAT DF_MDY
  87. #endif
  88. #define lenEOL        1
  89. #define PutNativeEOL  *q++ = native(CR);
  90. #define NOANSIFILT  /* MWRKS C creates broken code for the ANSI-ESC filter */
  91. #define MALLOC_WORK
  92. #define INT_SPRINTF
  93.  
  94. #if (!defined(NO_EF_UT_TIME) && !defined(USE_EF_UT_TIME))
  95. #  define USE_EF_UT_TIME
  96. #endif
  97.  
  98. #undef IZ_CHECK_TZ
  99. #undef MORE
  100. #undef DYNAMIC_CRC_TABLE
  101.  
  102.  
  103. #ifndef MPW
  104. #  ifndef MacStaticLib
  105. #    ifndef USE_SIOUX
  106. #      define fgets       macfgets
  107. #      define fflush(f)
  108. #      define fprintf     macfprintf
  109. #      define fputs(s,f)  macfprintf((f), "%s", (s))
  110. #      define printf      macprintf
  111. #      ifdef putc
  112. #        undef putc
  113. #      endif
  114. #      define putc(c,f)   macfprintf((f), "%c", (c))
  115. #    endif /* !USE_SIOUX */
  116. #  else
  117. #    ifdef putc
  118. #      undef putc
  119. #    endif
  120. #    define putc(c,f)   fprintf((f), "%c", (c))
  121. #  endif
  122.  
  123. #  define isatty(f)     (((f) >= 0) || ((f) <= 2))
  124. #endif
  125.  
  126. #ifndef isascii
  127. #  define isascii(c)    ((unsigned char)(c) <= 0x3F)
  128. #endif
  129.  
  130. #include "macstat.h"
  131. #include "macdir.h"
  132.  
  133. #ifdef CR
  134. #  undef  CR
  135. #endif
  136.  
  137.  
  138. #ifdef foreign
  139. #  undef foreign
  140. #endif
  141. #define foreign(c) ((c) & 0x80 ? MacRoman_to_WinCP1252[(c) & 0x7f] : (c))
  142.  
  143. #ifdef native
  144. #  undef native
  145. #endif
  146. #define native(c)  ((c) & 0x80 ? WinCP1252_to_MacRoman[(c) & 0x7f] : (c))
  147. #define NATIVE "MacRoman charset"
  148.  
  149. #ifdef _ISO_INTERN
  150. #  undef _ISO_INTERN
  151. #endif
  152. #define _ISO_INTERN(str1) {register uch *p;\
  153.    for (p=(uch *)(str1); *p; p++)\
  154.      *p = (*p & 0x80) ? WinCP1252_to_MacRoman[*p & 0x7f] : *p;}
  155.  
  156. #ifdef _OEM_INTERN
  157. #  undef _OEM_INTERN
  158. #endif
  159. #ifndef IZ_OEM2ISO_ARRAY
  160. #  define IZ_OEM2ISO_ARRAY
  161. #endif
  162. #define _OEM_INTERN(str1) {register uch *p;\
  163.    for (p=(uch *)(str1); *p; p++)\
  164.      *p = (*p & 0x80) ? WinCP1252_to_MacRoman[oem2iso[*p & 0x7f]] : *p;}
  165.  
  166. #ifdef __FILEIO_C       /* get the ISO8859-1 <--> MacROMAN conversion tables */
  167. #  include "charmap.h"
  168. #else
  169.    extern ZCONST uch WinCP1252_to_MacRoman[128];
  170.    extern ZCONST uch MacRoman_to_WinCP1252[128];
  171. #endif
  172.  
  173.  
  174. #define EB_M3_FL_NOCHANGE   0x02    /* filename will be not changed */
  175. /* other EB_M3 flags are defined in unzpriv.h */
  176. #define EB_MAC3_SIZE        (EB_HEADSIZE + EB_MAC3_HLEN)
  177.  
  178. /*****************************************************************************/
  179. /*  Structure typedefs                                                       */
  180. /*****************************************************************************/
  181.  
  182. typedef struct _ZipExtraHdr {
  183.         ush header;               /*    2 bytes */
  184.         ush data;                 /*    2 bytes */
  185. } ZIP_EXTRA_HEADER;
  186.  
  187.  
  188. /* the following structure is a combination of the old and the new
  189.    extra-field definition; so it's *not* the definition of the extra-field  */
  190.  
  191. typedef struct _MacInfo {
  192.     unsigned char *filename;  /* for ZipIt ef */
  193.     ush         header;     /* tag for this extra block type  */
  194.     ush         data;       /* total data size for this block */
  195.     ulg         size;       /* uncompressed finder attribute data size */
  196.  
  197.     ush         flags;      /* info bits:
  198.                                  bit 0   if set, file is a data fork
  199.                                  bit 1   if set, filename will be not changed
  200.                                  bit 2   if set, Attribs is uncompressed
  201.                                  bit 3   if set, date and times are in 64 bit;
  202.                                          if zero, date and times are in 32 bit
  203.                                  bit 4   if set, "local time - UTC" offsets are
  204.                                          omitted
  205.                                  bits 5-15       reserved; not tested;   */
  206.  
  207.     ush         CompType;
  208.     ulg         CRCvalue;
  209.  
  210.     CInfoPBRec  fpb;        /* Macintosh FInfo / FXInfo structure */
  211.     long        Cr_UTCoffs; /* difference "local time - UTC" for Creat-time */
  212.     long        Md_UTCoffs; /* difference "local time - UTC" for Modif-time */
  213.     long        Bk_UTCoffs; /* difference "local time - UTC" for Bckup-time */
  214.  
  215.     short       TextEncodingBase;   /* TextEncodingBase (Charset) */
  216.     char       *FullPath;           /* Path of the current file */
  217.     char       *FinderComment;      /* Finder Comment of current file */
  218. } MACINFO;
  219.  
  220.  
  221. /*****************************************************************************/
  222. /*  Global Vars                                                              */
  223. /*****************************************************************************/
  224.  
  225. #define SYSTEM_SPECIFIC_GLOBALS \
  226.     short    giCursor;\
  227.     CursHandle rghCursor[4];       /* status cursors */
  228.  
  229. #define SYSTEM_SPECIFIC_CTOR    MacGlobalsInit
  230.  
  231.  
  232. /*****************************************************************************/
  233. /*  Prototypes                                                               */
  234. /*****************************************************************************/
  235.  
  236. void    screenOpen      OF((char *));                         /* macscreen.c */
  237. void    screenControl   OF((char *, int));                    /* macscreen.c */
  238. void    screenDump      OF((char *, long));                   /* macscreen.c */
  239. void    screenUpdate    OF((WindowPtr));                      /* macscreen.c */
  240. void    screenClose     OF((void));                           /* macscreen.c */
  241. int     macgetch        OF((void));                           /* macscreen.c */
  242.  
  243. int     macmkdir        OF((char *));                             /* macos.c */
  244. short   macopen         OF((char *, short));                      /* macos.c */
  245. short   maccreat        OF((char *));                             /* macos.c */
  246. short   macread         OF((short, char *, unsigned));            /* macos.c */
  247. long    macwrite        OF((short, char *, unsigned));            /* macos.c */
  248. short   macclose        OF((short));                              /* macos.c */
  249. long    maclseek        OF((short, long, short));                 /* macos.c */
  250. char   *macfgets        OF((char *, int, FILE *));                /* macos.c */
  251. int     macfprintf      OF((FILE *, char *, ...));                /* macos.c */
  252. int     macprintf       OF((char *, ...));                        /* macos.c */
  253.  
  254. ulg    makePPClong(ZCONST uch *sig);
  255. ush    makePPCword(ZCONST uch *b);
  256. void   UserStop(void);
  257.  
  258. #endif /* !__maccfg_h */
  259.