home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / MacPerl 5.1.3 / Mac_Perl_513_src / perl5.002 / macish.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-17  |  4.4 KB  |  158 lines  |  [TEXT/KAHL]

  1. /*********************************************************************
  2. Project    :    Perl5                -    
  3. File        :    macish.h            -    Mac specific things
  4. Author    :    Matthias Neeracher
  5. Started    :    29Dec94                                Language    :    MPW C/C++
  6. Modified    :    29Dec94    MN    
  7. Last        :    29Dec94
  8. *********************************************************************/
  9.  
  10. #include <sys/errno.h>
  11. #include <compat.h>
  12. #include <sys/fcntl.h>
  13. #include <unistd.h>
  14. #include <stdio.h>
  15. #include <StdLib.h>
  16. #include <time.h>
  17.  
  18. #ifdef __MWERKS__
  19. FILE *fdopen(int fd, const char *mode);
  20. #endif
  21.  
  22. #include <Types.h>
  23.  
  24. #ifdef MAC_CONTEXT
  25. #include <Memory.h>
  26. #include <Events.h>
  27. #include <Files.h>
  28. #endif
  29.  
  30. #include "icemalloc.h"
  31.  
  32. /* HAS_IOCTL:
  33.  *    This symbol, if defined, indicates that the ioctl() routine is
  34.  *    available to set I/O characteristics
  35.  */
  36. #define    HAS_IOCTL        /**/
  37.  
  38. /* HAS_UTIME:
  39.  *    This symbol, if defined, indicates that the routine utime() is
  40.  *    available to update the access and modification times of files.
  41.  */
  42. #define HAS_UTIME        /**/
  43.  
  44. #include <signal.h>
  45.  
  46. #define mktemp tmpnam
  47.  
  48. #define ABORT() abort();
  49.  
  50. #define BIT_BUCKET "Dev:Null"
  51. #define PERL_SYS_INIT(c,v) { mac_initminiperl(); env = init_env(env); }
  52. #define PERL_SYS_TERM()
  53. #define dXSUB_SYS int dummy
  54.  
  55. /*
  56.  * fwrite1() should be a routine with the same calling sequence as fwrite(),
  57.  * but which outputs all of the bytes requested as a single stream (unlike
  58.  * fwrite() itself, which on some systems outputs several distinct records
  59.  * if the number_of_items parameter is >1).
  60.  */
  61. #define fwrite1 fwrite
  62.  
  63. /* Look up new %ENV values on the fly */
  64. #define DYNAMIC_ENV_FETCH 1
  65. #define ENV_HV_NAME "%EnV%MaC%"
  66.  
  67. #define Stat(fname,bufptr) stat((fname),(bufptr))
  68. #define Fstat(fd,bufptr)   fstat((fd),(bufptr))
  69. #define Fflush(fp)         fflush(fp)
  70.  
  71. struct tms {
  72.     clock_t tms_utime;    /* User CPU time */
  73.     clock_t tms_stime;    /* System CPU time */
  74.     clock_t tms_cutime;    /* User CPU time of terminated child procs */
  75.     clock_t tms_cstime;    /* System CPU time of terminated child procs */
  76. };
  77.  
  78. clock_t    mac_times(struct tms *);
  79. #define times(x) mac_times(x)
  80. double     mac_atof(const char *);
  81. char ** init_env(char ** env);
  82. #ifndef __MWERKS__
  83. #define atof(a)  mac_atof(a)
  84. #endif
  85. #define open(name, flags, perm) (open)(name, flags)
  86. #define mkdir(name, perm) (mkdir)(name)
  87. #define Perl_debug_log        gPerlDbg
  88.  
  89. void SpinMacCursor();
  90. char * MPWPosIndication(char * buf, char * file, long line);
  91. void     MPWPosCommit();
  92. char * MPWFileName(char * file);
  93. int OverrideExtract(char * origname);
  94. typedef int (*EmulationProc)(FILE *, char *);
  95. void AddWriteEmulationProc(const char * command, EmulationProc proc);
  96. extern char *GetSysErrText(short msgNbr, char *errMsg);
  97.  
  98. #ifndef MP_EXT
  99. #define MP_EXT extern
  100. #define MP_INIT(x)
  101. #endif
  102.  
  103. int                 run_perl(int, char **, char **);
  104. void                 reenter();
  105.  
  106. #ifdef MAC_CONTEXT
  107. MP_EXT Handle    gPerlReply                                        MP_INIT(nil);
  108. MP_EXT Handle    gSacrificialGoat                                 MP_INIT((Handle) -1);
  109. MP_EXT FSSpec    gFirstErrorFile;
  110. MP_EXT Boolean    gReturnTrueFSSpecs                                MP_INIT(false);
  111. MP_EXT void      (*gHandleEvent)(EventRecord * ev)            MP_INIT(nil);
  112. MP_EXT void        (*gFilterEvent)(EventRecord * ev)            MP_INIT(nil);
  113. MP_EXT Boolean    (*gFilterMenu)(long menuSelection)            MP_INIT(nil);
  114. #endif
  115.  
  116. MP_EXT FILE *             gPerlDbg                                    MP_INIT(stderr);
  117. MP_EXT int                gPerlQuit                                MP_INIT(0);
  118. MP_EXT char *             gDebugLogName                            MP_INIT(0);
  119. MP_EXT short             gAppFile;
  120. MP_EXT short            gAppVol                                    MP_INIT(0);
  121. MP_EXT long                gAppDir                                    MP_INIT(0);
  122. MP_EXT short             gPrefsFile;
  123. MP_EXT void           (*gExit)(int)                                MP_INIT(exit);
  124. MP_EXT int            (*gAtExit)(void (*func)(void))         MP_INIT(atexit);
  125. MP_EXT char *         (*gGetEnv)(const char * name)         MP_INIT(getenv);
  126. MP_EXT char             gPseudoFileName[256];
  127. MP_EXT long                gFirstErrorLine                        MP_INIT(-1);
  128. MP_EXT clock_t            gStartClock;
  129. MP_EXT char                gSyntaxError;
  130. MP_EXT char                gAlwaysExtract                            MP_INIT(false);
  131. MP_EXT _mem_pool_ptr    gPerlPool                                MP_INIT(&_mem_system_pool);
  132. MP_EXT short            gLastMacOSErr;
  133. #if defined(powerc) || defined(__powerc)
  134. #ifdef MAC_CONTEXT
  135. MP_EXT struct QDGlobals qd;
  136. #endif
  137. #endif
  138. #ifdef MAC_CONTEXT
  139. typedef short    MacOSRet;
  140. typedef Handle    HandleRet;
  141. typedef Ptr        PtrRet;
  142. typedef Ptr        RawPtr;
  143. #endif
  144.  
  145. #if !defined(ORIGINAL_WRAPPER)
  146. #define exit(status)         gExit(status)
  147. #define atexit(proc)         gAtExit(proc)
  148. #define getenv(name)            gGetEnv(name)
  149. #endif
  150.  
  151. #define my_getenv(var) getenv(var)
  152. extern void install_env(Handle env);
  153. extern Handle retrieve_env();
  154.  
  155. #define sys_nerr    80
  156.  
  157. char * sys_errlist[];
  158.