home *** CD-ROM | disk | FTP | other *** search
- /*********************************************************************
- Project : Perl5 -
- File : macish.h - Mac specific things
- Author : Matthias Neeracher
- Started : 29Dec94 Language : MPW C/C++
- Modified : 29Dec94 MN
- Last : 29Dec94
- *********************************************************************/
-
- #include <sys/errno.h>
- #include <compat.h>
- #include <sys/fcntl.h>
- #include <unistd.h>
- #include <stdio.h>
- #include <StdLib.h>
- #include <time.h>
-
- #ifdef __MWERKS__
- FILE *fdopen(int fd, const char *mode);
- #endif
-
- #ifdef MAC_CONTEXT
- #include <Memory.h>
- #include <Events.h>
- #include <Files.h>
- #endif
-
- #include "icemalloc.h"
-
- /* HAS_IOCTL:
- * This symbol, if defined, indicates that the ioctl() routine is
- * available to set I/O characteristics
- */
- #define HAS_IOCTL /**/
-
- /* HAS_UTIME:
- * This symbol, if defined, indicates that the routine utime() is
- * available to update the access and modification times of files.
- */
- #define HAS_UTIME /**/
-
- #include <signal.h>
-
- /*
- * fwrite1() should be a routine with the same calling sequence as fwrite(),
- * but which outputs all of the bytes requested as a single stream (unlike
- * fwrite() itself, which on some systems outputs several distinct records
- * if the number_of_items parameter is >1).
- */
- #define fwrite1 fwrite
-
- /* Look up new %ENV values on the fly */
- #define DYNAMIC_ENV_FETCH 1
- #define ENV_HV_NAME "%EnV%MaC%"
-
- #define Stat(fname,bufptr) stat((fname),(bufptr))
- #define Fstat(fd,bufptr) fstat((fd),(bufptr))
-
- struct tms {
- clock_t tms_utime; /* User CPU time */
- clock_t tms_stime; /* System CPU time */
- clock_t tms_cutime; /* User CPU time of terminated child procs */
- clock_t tms_cstime; /* System CPU time of terminated child procs */
- };
-
- void mac_times(struct tms *);
- #define times(x) mac_times(x)
- double mac_atof(const char *);
- char ** init_env(char ** env);
- #ifndef __MWERKS__
- #define atof(a) mac_atof(a)
- #endif
-
- void SpinMacCursor();
- char * MPWPosIndication(char * buf, char * file, long line);
- char * MPWFileName(char * file);
- int OverrideExtract(char * origname);
- typedef int (*EmulationProc)(FILE *, char *);
- void AddWriteEmulationProc(const char * command, EmulationProc proc);
-
- #ifndef MP_EXT
- #define MP_EXT extern
- #define MP_INIT(x)
- #endif
-
- int run_perl(int, char **, char **);
- void reenter();
-
- #ifdef MAC_CONTEXT
- MP_EXT Handle gPerlReply MP_INIT(nil);
- MP_EXT Handle gSacrificialGoat MP_INIT((Handle) -1);
- MP_EXT FSSpec gFirstErrorFile;
- MP_EXT void (*gHandleEvent)(EventRecord * ev) MP_INIT(nil);
- #endif
-
- MP_EXT FILE * gPerlDbg MP_INIT(stderr);
- MP_EXT int gPerlQuit MP_INIT(0);
- MP_EXT char * gDebugLogName MP_INIT(0);
- MP_EXT short gAppFile;
- MP_EXT short gAppVol MP_INIT(0);
- MP_EXT long gAppDir MP_INIT(0);
- MP_EXT short gPrefsFile;
- MP_EXT void (*gExit)(int) MP_INIT(exit);
- MP_EXT int (*gAtExit)(void (*func)(void)) MP_INIT(atexit);
- MP_EXT char * (*gGetEnv)(const char * name) MP_INIT(getenv);
- MP_EXT char gPseudoFileName[256];
- MP_EXT long gFirstErrorLine MP_INIT(-1);
- MP_EXT clock_t gStartClock;
- MP_EXT char gSyntaxError;
- MP_EXT char gAlwaysExtract MP_INIT(false);
- MP_EXT _mem_pool_ptr gPerlPool MP_INIT(&_mem_system_pool);
- #if defined(powerc) || defined(__powerc)
- #ifdef MAC_CONTEXT
- MP_EXT struct QDGlobals qd;
- #endif
- #endif
-
- #if !defined(ORIGINAL_WRAPPER)
- #define exit(status) gExit(status)
- #define atexit(proc) gAtExit(proc)
- #define getenv(name) gGetEnv(name)
- #endif
-
- #define my_getenv(var) getenv(var)
-