amiga.h 6.4 KB

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