home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / unzip531.zip / amiga / amiga.h < prev    next >
C/C++ Source or Header  |  1997-04-20  |  5KB  |  141 lines

  1. /* amiga.h
  2.  *
  3.  * Globular definitions that affect all of AmigaDom.
  4.  *
  5.  * Originally included in unzip.h, extracted for simplicity and eeze of
  6.  * maintenance by John Bush.
  7.  *
  8.  * THIS FILE IS #INCLUDE'd by unzip.h
  9.  *
  10.  */
  11.  
  12. #ifndef __amiga_amiga_h
  13. #define __amiga_amiga_h
  14. #include <time.h>
  15. #include <fcntl.h>
  16. #include <limits.h>
  17.  
  18. #ifdef AZTEC_C                       /* Manx Aztec C, 5.0 or newer only */
  19. #  include <clib/dos_protos.h>
  20. #  include <pragmas/dos_lib.h>           /* do inline dos.library calls */
  21. #  define O_BINARY 0
  22. #  include "amiga/z-stat.h"   /* substitute for <stat.h> and <direct.h> */
  23. #  define direct dirent
  24.  
  25. #  define DECLARE_TIMEZONE
  26. #  define ASM_INFLATECODES
  27. #  define ASM_CRC
  28.  
  29. /* Note that defining REENTRANT will not eliminate all global/static */
  30. /* variables.  The functions we use from c.lib, including stdio, are */
  31. /* not reentrant.  Neither are the stuff in amiga/stat.c or the time */
  32. /* functions in amiga/filedate.c, because they just augment c.lib.   */
  33. /* If you want a fully reentrant and reexecutable "pure" UnZip with  */
  34. /* Aztec C, assemble and link in the startup module purify.a by Paul */
  35. /* Kienitz.  REENTRANT should be used just to reduce memory waste.   */
  36. #endif /* AZTEC_C */
  37.  
  38.  
  39. #ifdef __SASC
  40. /* includes */
  41. #  include <sys/types.h>
  42. #  include <sys/stat.h>
  43. #  include <sys/dir.h>
  44. #  include <dos.h>
  45. #  include <exec/memory.h>
  46. #  include <exec/execbase.h>
  47. #  if (defined(_M68020) && (!defined(__USE_SYSBASE)))
  48.                             /* on 68020 or higher processors it is faster   */
  49. #    define __USE_SYSBASE   /* to use the pragma libcall instead of syscall */
  50. #  endif                    /* to access functions of the exec.library      */
  51. #  include <proto/exec.h>   /* see SAS/C manual:part 2,chapter 2,pages 6-7  */
  52. #  include <proto/dos.h>
  53. #  include <proto/locale.h>
  54.  
  55. #  ifdef DEBUG
  56. #    include <sprof.h>      /* profiler header file */
  57. #  endif
  58.  
  59. #  if ( (!defined(O_BINARY)) && defined(O_RAW))
  60. #    define O_BINARY O_RAW
  61. #  endif
  62.  
  63. #  if (defined(_SHORTINT) && !defined(USE_FWRITE))
  64. #    define USE_FWRITE      /* define if write() returns 16-bit int */
  65. #  endif
  66.  
  67. #  if (!defined(REENTRANT) && !defined(FUNZIP))
  68. #    define REENTRANT      /* define if unzip is going to be pure */
  69. #  endif
  70.  
  71. #  if defined(REENTRANT) && defined(DYNALLOC_CRCTAB)
  72. #    undef DYNALLOC_CRCTAB
  73. #  endif
  74.  
  75. #  ifdef MWDEBUG
  76. #    include <stdio.h>      /* both stdio.h and stdlib.h must be included */
  77. #    include <stdlib.h>     /* before memwatch.h                          */
  78. #    include "memwatch.h"
  79. #    undef getenv
  80. #  endif /* MWDEBUG */
  81.  
  82. #if 0   /* disabled for now - we don't have alloc_remember() yet */
  83. /* SAS/C built-in getenv() calls malloc to store the envvar string.       */
  84. /* Therefore we need to remember the allocation in order to free it later */
  85. #  include <stdlib.h>       /* getenv() prototype in stdlib.h */
  86. #  ifdef getenv
  87. #    undef getenv           /* remove previously preprocessor symbol */
  88. #  endif
  89. #  ifndef MWDEBUG
  90. /* #    define getenv(name)    ((char *)remember_alloc((zvoid *)getenv(name))) */
  91. #  else                     /* MWGetEnv() ripped from memlib's memwatch.h */
  92. #    define getenv(name)    ((char *)remember_alloc((zvoid *)MWGetEnv(name, __FILE__, __LINE__)))
  93. #  endif
  94. #endif /* 0 */
  95.  
  96. #endif /* SASC */
  97.  
  98.  
  99. #define MALLOC_WORK
  100. #define USE_EF_UT_TIME
  101.  
  102. #define AMIGA_FILENOTELEN 80
  103. #define DATE_FORMAT       DF_MDY
  104. #define lenEOL            1
  105. #define PutNativeEOL      *q++ = native(LF);
  106. #define PIPE_ERROR        0
  107.  
  108. #ifdef GLOBAL         /* crypt.c usage conflicts with AmigaDOS headers */
  109. #  undef GLOBAL
  110. #endif
  111.  
  112. /* Funkshine Prough Toe Taipes */
  113.  
  114. LONG FileDate (char *, time_t[]);
  115. void tzset(void);
  116. int windowheight (BPTR fh);
  117. void _abort(void);              /* ctrl-C trap */
  118.  
  119. #define SCREENLINES windowheight(Output())
  120.  
  121.  
  122. /* Static variables that we have to add to struct Globals: */
  123. #define SYSTEM_SPECIFIC_GLOBALS \
  124.     int N_flag;\
  125.     int filenote_slot;\
  126.     char *(filenotes[DIR_BLKSIZ]);\
  127.     int created_dir, renamed_fullpath, rootlen;\
  128.     char *rootpath, *buildpath, *build_end;\
  129.     DIR *wild_dir;\
  130.     char *dirname, *wildname, matchname[FILNAMSIZ];\
  131.     int dirnamelen, notfirstcall;
  132.  
  133. /* N_flag, filenotes[], and filenote_slot are for the -N option that      */
  134. /*    restores zipfile comments as AmigaDOS filenotes.  The others        */
  135. /*    are used by functions in amiga/amiga.c only.                        */
  136. /* created_dir and renamed_fullpath are used by mapname() and checkdir(). */
  137. /* rootlen, rootpath, buildpath, and build_end are used by checkdir().    */
  138. /* wild_dir, dirname, wildname, matchname[], dirnamelen and notfirstcall  */
  139. /*    are used by do_wild().                                              */
  140. #endif /* __amiga_amiga_h */
  141.