home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / MacPerl 5.0.3 / MacPerl Source ƒ / Perl5 / macish.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-10-19  |  3.5 KB  |  125 lines  |  [TEXT/MPS ]

  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. #ifdef MAC_CONTEXT
  23. #include <Memory.h>
  24. #include <Events.h>
  25. #include <Files.h>
  26. #endif
  27.  
  28. #include "icemalloc.h"
  29.  
  30. /* HAS_IOCTL:
  31.  *    This symbol, if defined, indicates that the ioctl() routine is
  32.  *    available to set I/O characteristics
  33.  */
  34. #define    HAS_IOCTL        /**/
  35.  
  36. /* HAS_UTIME:
  37.  *    This symbol, if defined, indicates that the routine utime() is
  38.  *    available to update the access and modification times of files.
  39.  */
  40. #define HAS_UTIME        /**/
  41.  
  42. #include <signal.h>
  43.  
  44. /*
  45.  * fwrite1() should be a routine with the same calling sequence as fwrite(),
  46.  * but which outputs all of the bytes requested as a single stream (unlike
  47.  * fwrite() itself, which on some systems outputs several distinct records
  48.  * if the number_of_items parameter is >1).
  49.  */
  50. #define fwrite1 fwrite
  51.  
  52. /* Look up new %ENV values on the fly */
  53. #define DYNAMIC_ENV_FETCH 1
  54. #define ENV_HV_NAME "%EnV%MaC%"
  55.  
  56. #define Stat(fname,bufptr) stat((fname),(bufptr))
  57. #define Fstat(fd,bufptr)   fstat((fd),(bufptr))
  58.  
  59. struct tms {
  60.     clock_t tms_utime;    /* User CPU time */
  61.     clock_t tms_stime;    /* System CPU time */
  62.     clock_t tms_cutime;    /* User CPU time of terminated child procs */
  63.     clock_t tms_cstime;    /* System CPU time of terminated child procs */
  64. };
  65.  
  66. void    mac_times(struct tms *);
  67. #define times(x) mac_times(x)
  68. double     mac_atof(const char *);
  69. char ** init_env(char ** env);
  70. #ifndef __MWERKS__
  71. #define atof(a)  mac_atof(a)
  72. #endif
  73.  
  74. void SpinMacCursor();
  75. char * MPWPosIndication(char * buf, char * file, long line);
  76. char * MPWFileName(char * file);
  77. int OverrideExtract(char * origname);
  78. typedef int (*EmulationProc)(FILE *, char *);
  79. void AddWriteEmulationProc(const char * command, EmulationProc proc);
  80.  
  81. #ifndef MP_EXT
  82. #define MP_EXT extern
  83. #define MP_INIT(x)
  84. #endif
  85.  
  86. int                 run_perl(int, char **, char **);
  87. void                 reenter();
  88.  
  89. #ifdef MAC_CONTEXT
  90. MP_EXT Handle    gPerlReply                                        MP_INIT(nil);
  91. MP_EXT Handle    gSacrificialGoat                                 MP_INIT((Handle) -1);
  92. MP_EXT FSSpec    gFirstErrorFile;
  93. MP_EXT void  (*gHandleEvent)(EventRecord * ev)            MP_INIT(nil);
  94. #endif
  95.  
  96. MP_EXT FILE *             gPerlDbg                                    MP_INIT(stderr);
  97. MP_EXT int                gPerlQuit                                MP_INIT(0);
  98. MP_EXT char *             gDebugLogName                            MP_INIT(0);
  99. MP_EXT short             gAppFile;
  100. MP_EXT short            gAppVol                                    MP_INIT(0);
  101. MP_EXT long                gAppDir                                    MP_INIT(0);
  102. MP_EXT short             gPrefsFile;
  103. MP_EXT void           (*gExit)(int)                                MP_INIT(exit);
  104. MP_EXT int            (*gAtExit)(void (*func)(void))         MP_INIT(atexit);
  105. MP_EXT char *         (*gGetEnv)(const char * name)         MP_INIT(getenv);
  106. MP_EXT char             gPseudoFileName[256];
  107. MP_EXT long                gFirstErrorLine                        MP_INIT(-1);
  108. MP_EXT clock_t            gStartClock;
  109. MP_EXT char                gSyntaxError;
  110. MP_EXT char                gAlwaysExtract                            MP_INIT(false);
  111. MP_EXT _mem_pool_ptr    gPerlPool                                MP_INIT(&_mem_system_pool);
  112. #if defined(powerc) || defined(__powerc)
  113. #ifdef MAC_CONTEXT
  114. MP_EXT struct QDGlobals qd;
  115. #endif
  116. #endif
  117.  
  118. #if !defined(ORIGINAL_WRAPPER)
  119. #define exit(status)         gExit(status)
  120. #define atexit(proc)         gAtExit(proc)
  121. #define getenv(name)            gGetEnv(name)
  122. #endif
  123.  
  124. #define my_getenv(var) getenv(var)
  125.