Subversion Repositories Kolibri OS

Rev

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

  1. /*
  2.   Copyright (c) 1990-2005 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. /* amiga.h
  10.  *
  11.  * Globular definitions that affect all of AmigaDom.
  12.  *
  13.  * Originally included in unzip.h, extracted for simplicity and eeze of
  14.  * maintenance by John Bush.
  15.  *
  16.  * THIS FILE IS #INCLUDE'd by unzpriv.h
  17.  *
  18.  */
  19.  
  20. #ifndef __amiga_amiga_h
  21. #define __amiga_amiga_h
  22.  
  23. #include "amiga/z-stat.h"     /* substitute for <stat.h> and <direct.h> */
  24. #include <limits.h>
  25. #ifndef NO_FCNTL_H
  26. #  include <fcntl.h>
  27. #else
  28.    int mkdir(const char *_name);
  29. #endif
  30.  
  31. /* we only have dinky old-sk00l 32 bit filesystems */
  32. #ifdef LARGE_FILE_SUPPORT
  33. #  undef LARGE_FILE_SUPPORT
  34. #endif
  35.  
  36. typedef long        zoff_t;
  37. #define ZOFF_T_DEFINED
  38. typedef struct stat z_stat;
  39. #define Z_STAT_DEFINED
  40.  
  41. #ifdef AZTEC_C                       /* Manx Aztec C, 5.0 or newer only */
  42. #  include <clib/dos_protos.h>
  43. #  include <pragmas/dos_lib.h>           /* do inline dos.library calls */
  44. #  define O_BINARY 0
  45. #  define direct dirent
  46.  
  47. #  ifndef IZTZ_DEFINESTDGLOBALS
  48. #    define IZTZ_DEFINESTDGLOBALS
  49. #  endif
  50.  
  51. #  define DECLARE_TIMEZONE
  52. #  define ASM_INFLATECODES
  53. #  define ASM_CRC
  54.  
  55.    /* This compiler environment supplies a flat 32-bit address space    */
  56.    /* where C rtl functions are capable of handling large (32-bit-wide) */
  57.    /* allocations and I/O.  But, for speed on old 68000 CPUs, standard  */
  58.    /* ints are 16-bits wide per default.  ("size_t" is defined as       */
  59.    /* "unsigned long" in this case.)  The Deflate64 support requires    */
  60.    /* the variables for handling the decompression buffer to hold       */
  61.    /* 32-bit wide integers.  The INT_16BIT symbol defined below forces  */
  62.    /* the declarations of these variables to use "unsigned long" type.  */
  63. #  ifndef _INT32
  64. #    define INT_16BIT                   /* or deflate64 stuff will fail */
  65. #  endif
  66.  
  67. /* Note that defining REENTRANT will not eliminate all global/static */
  68. /* variables.  The functions we use from c.lib, including stdio, are */
  69. /* not reentrant.  Neither are the stuff in amiga/stat.c or the time */
  70. /* functions in amiga/filedate.c, because they just augment c.lib.   */
  71. /* If you want a fully reentrant and reexecutable "pure" UnZip with  */
  72. /* Aztec C, assemble and link in the startup module purify.a by Paul */
  73. /* Kienitz.  REENTRANT should be used just to reduce memory waste.   */
  74. #endif /* AZTEC_C */
  75.  
  76.  
  77. #ifdef __SASC
  78. /* NOTE: SAS/C COMPILATION HAS BEEN UNSUPPORTED THROUGH MANY UNZIP VERSIONS. */
  79. /* (Which is too bad, because it would probably perform better than Aztec.)  */
  80.  
  81. /* includes */
  82. #  include <sys/types.h>
  83. #  include <sys/dir.h>
  84. #  include <dos.h>
  85. #  include <exec/memory.h>
  86. #  include <exec/execbase.h>
  87. #  if (defined(_M68020) && (!defined(__USE_SYSBASE)))
  88.                             /* on 68020 or higher processors it is faster   */
  89. #    define __USE_SYSBASE   /* to use the pragma libcall instead of syscall */
  90. #  endif                    /* to access functions of the exec.library      */
  91. #  include <proto/exec.h>   /* see SAS/C manual:part 2,chapter 2,pages 6-7  */
  92. #  include <proto/dos.h>
  93. #  include <proto/locale.h>
  94.  
  95. #  ifdef DEBUG
  96. #    include <sprof.h>      /* profiler header file */
  97. #  endif
  98. #  if ( (!defined(O_BINARY)) && defined(O_RAW))
  99. #    define O_BINARY O_RAW
  100. #  endif
  101. #  if (defined(_SHORTINT) && !defined(USE_FWRITE))
  102. #    define USE_FWRITE      /* define if write() returns 16-bit int */
  103. #  endif
  104. #  if (!defined(REENTRANT) && !defined(FUNZIP))
  105. #    define REENTRANT      /* define if unzip is going to be pure */
  106. #  endif
  107. #  if defined(REENTRANT) && defined(DYNALLOC_CRCTAB)
  108. #    undef DYNALLOC_CRCTAB
  109. #  endif
  110. #  ifdef MWDEBUG
  111. #    include <stdio.h>      /* both stdio.h and stdlib.h must be included */
  112. #    include <stdlib.h>     /* before memwatch.h                          */
  113. #    include "memwatch.h"
  114. #    undef getenv
  115. #  endif /* MWDEBUG */
  116. #  ifndef IZTZ_SETLOCALTZINFO
  117.      /*  XXX !!  We have really got to find a way to operate without these. */
  118. #    define IZTZ_SETLOCALTZINFO
  119. #  endif
  120. #endif /* SASC */
  121.  
  122.  
  123. #define MALLOC_WORK
  124. #define USE_EF_UT_TIME
  125. #if (!defined(NOTIMESTAMP) && !defined(TIMESTAMP))
  126. #  define TIMESTAMP
  127. #endif
  128.  
  129. #ifndef IZTZ_GETLOCALETZINFO
  130. #  define IZTZ_GETLOCALETZINFO GetPlatformLocalTimezone
  131. #endif
  132. /* the amiga port uses Info-ZIP's own timezone library, which includes
  133.  * a "working" mktime() implementation
  134.  */
  135. #ifndef HAVE_MKTIME
  136. #  define HAVE_MKTIME
  137. #endif
  138.  
  139. /* check that TZ environment variable is defined before using UTC times */
  140. #if (!defined(NO_IZ_CHECK_TZ) && !defined(IZ_CHECK_TZ))
  141. #  define IZ_CHECK_TZ
  142. #endif
  143.  
  144. #define AMIGA_FILENOTELEN 80
  145. #ifndef DATE_FORMAT
  146. #  define DATE_FORMAT     DF_MDY
  147. #endif
  148. #define lenEOL            1
  149. #define PutNativeEOL      *q++ = native(LF);
  150. #define PIPE_ERROR        0
  151.  
  152. #ifdef GLOBAL         /* crypt.c usage conflicts with AmigaDOS headers */
  153. #  undef GLOBAL
  154. #endif
  155.  
  156. /* Funkshine Prough Toe Taipes */
  157.  
  158. extern int real_timezone_is_set;
  159. void tzset(void);
  160. #define VALID_TIMEZONE(tempvar) (tzset(), real_timezone_is_set)
  161.  
  162. int Agetch(void);               /* getch() like function, in amiga/filedate.c */
  163. LONG FileDate(char *, time_t[]);
  164. int screensize(int *ttrows, int *ttcols);
  165. void _abort(void);              /* ctrl-C trap */
  166.  
  167. #define SCREENSIZE(ttrows, ttcols) screensize(ttrows, ttcols)
  168. #define SCREENWIDTH 80
  169. #define SCREENLWRAP 1
  170. #define TABSIZE     8
  171.  
  172. /* Static variables that we have to add to Uz_Globs: */
  173. #define SYSTEM_SPECIFIC_GLOBALS \
  174.     int filenote_slot;\
  175.     char *(filenotes[DIR_BLKSIZ]);\
  176.     int created_dir, renamed_fullpath, rootlen;\
  177.     char *rootpath, *buildpath, *build_end;\
  178.     DIR *wild_dir;\
  179.     ZCONST char *wildname;\
  180.     char *dirname, matchname[FILNAMSIZ];\
  181.     int dirnamelen, notfirstcall;
  182.  
  183. /* filenotes[] and filenote_slot are for the -N option that restores      */
  184. /*    comments of Zip archive entries as AmigaDOS filenotes.  The others  */
  185. /*    are used by functions in amiga/amiga.c only.                        */
  186. /* created_dir and renamed_fullpath are used by mapname() and checkdir(). */
  187. /* rootlen, rootpath, buildpath, and build_end are used by checkdir().    */
  188. /* wild_dir, dirname, wildname, matchname[], dirnamelen and notfirstcall  */
  189. /*    are used by do_wild().                                              */
  190. #endif /* __amiga_amiga_h */
  191.