home *** CD-ROM | disk | FTP | other *** search
- /* DISPATCH_START */
- #define MAC_CONTEXT
- #define MP_EXT
- #define MP_INIT(x) = x
-
- #include <time.h>
- #include <stdio.h>
- #include <Folders.h>
- #include <Events.h>
- #include <OSUtils.h>
- #include <LowMem.h>
- #include <GUSI.h>
- #include <TFileSpec.h>
- #include <TFileGlob.h>
- #include <fp.h>
- #include <LowMem.h>
-
- #define MEM_SIZE Size_t
-
- #include "config.h"
- #include "handy.h"
- #include "macish.h"
- #include "SubLaunch.h"
- /* DISPATCH_END */
- /* DISPATCH_START */
- #define ROOT_UID 0
- #define ROOT_GID 0
- int
- (getuid)(void)
- {
- return ROOT_UID;
- }
-
- int
- (geteuid)(void)
- {
- return ROOT_UID;
- }
-
- int
- (getgid)(void)
- {
- return ROOT_GID;
- }
-
- int
- (getegid)(void)
- {
- return ROOT_GID;
- }
-
- int
- (setuid)(int uid)
- {
- return (uid==ROOT_UID?0:-1);
- }
-
- int
- setgid(int gid)
- {
- return (gid==ROOT_GID?0:-1);
- }
-
- #undef execv
-
- (execv)()
- {
- croak("execv() not implemented on the Macintosh");
- }
-
- #undef execvp
-
- (execvp)()
- {
- croak("execvp() not implemented on the Macintosh");
- }
-
- kill()
- {
- croak("kill() not implemented on the Macintosh");
- }
- /* DISPATCH_END */
- /* DISPATCH_START */
- struct tm * gmtime(const time_t * timer)
- {
- MachineLocation loc;
- struct tm * swatch;
- long delta;
- time_t rolex;
-
- ReadLocation(&loc);
-
- if (!loc.latitude && !loc.longitude)
- return localtime(timer); /* This is incorrect unless you live in Greenwich */
-
- delta = loc.u.gmtDelta & 0xFFFFFF;
-
- if (delta & 0x800000)
- delta = (long) ((unsigned long) delta | 0xFF000000);
-
- rolex = (unsigned long) ((long) *timer - delta);
-
- swatch = localtime(&rolex);
-
- swatch->tm_isdst = (loc.u.dlsDelta & 0x80) != 0;
-
- return swatch;
- }
- /* DISPATCH_END */
- /* DISPATCH_START */
- pid_t (getpid)()
- {
- return 1;
- }
- /* DISPATCH_END */
- /* DISPATCH_START */
- #include <Types.h>
- #include <Memory.h>
- #include <Files.h>
-
- #include <stdarg.h>
-
- #include "icemalloc.h"
-
- #define mNEWPTR(size) ( NewPtr ( (size) ) )
- #define mDISPOSPTR(ptr) ( DisposPtr ( (ptr) ) )
-
- _mem_pool _mem_system_pool = {
- 0, /* id */
- SUGGESTED_BLK_SIZE, /* pref_blk_size */
- 0, /* blk_list */
- 0, /* next */
- #ifdef _PM_STATS
- 0, /* total_memory */
- 0, /* total_storage */
- 0, /* total_malloc */
- 0, /* max_blk_size */
- 0.0, /* ave_req_size */
- 0, /* ave_req_total */
- 0.0, /* ave_blk_size */
- 0, /* ave_blk_total */
- #endif
- };
- _mem_pool_ptr _mem_pool_forest = & _mem_system_pool;
-
- #define DEBUG
- /* DISPATCH_END */
- /* DISPATCH_START */
- void *
- malloc (size_t size )
- {
- _mem_pool_ptr pool;
- char * mem;
-
- pool = _default_mem_pool;
- if (pool == (_mem_pool_ptr)0)
- return (char *)0;
-
- mem = pool_malloc(pool, size);
-
- #ifdef MALLOC_LOG
- MallocLog("%d %d\n", (int) mem, (int) size);
- #endif
-
- return mem;
- }
- /* DISPATCH_END */
- /* DISPATCH_START */
- void free(void * ptr)
- {
-
- #ifdef MALLOC_LOG
- MallocLog("%d\n", (int) ptr);
- #endif
-
- pool_free((char *) ptr);
- }
- /* DISPATCH_END */
- /* DISPATCH_START */
- void * realloc(void * old, u_long size)
- {
- void * nu;
-
- nu = malloc(size);
-
- if (!old || !nu)
- return nu;
-
- memcpy(nu, old, size);
-
- free(old);
-
- return nu;
- }
- /* DISPATCH_END */
- /* DISPATCH_START */
- void *
- calloc(u_long nmemb, u_long size)
- {
- return malloc(nmemb*size);
- }
- /* DISPATCH_END */
-