MacOS Classic fixes and MPW support (thanks, Chris!).
authorRyan C. Gordon <icculus@icculus.org>
Wed, 16 Mar 2005 11:42:54 +0000
changeset 695 73bfbbe645a8
parent 694 80bc8858b4ab
child 696 34f82ca6ec49
MacOS Classic fixes and MPW support (thanks, Chris!).
CHANGELOG
CREDITS
physfsMPW.make
physfs_byteorder.c
platform/macclassic.c
zlib121/zconf.h
--- a/CHANGELOG	Wed Mar 16 11:27:31 2005 +0000
+++ b/CHANGELOG	Wed Mar 16 11:42:54 2005 +0000
@@ -2,7 +2,8 @@
  * CHANGELOG.
  */
 
-03162005 - Added missing translation (thanks, Danny!)
+03162005 - Added missing translation (thanks, Danny!). MPW support and several
+           MacOS Classic fixes (thanks, Chris!).
 03132005 - More mount work, added PHYSFS_getMountPoint() and more cleanups.
            Replaced all the C runtime allocations with PhysFS allocation hooks.
            Added pocketpc.c to EXTRA_DIST. Added allocation hooks to some
--- a/CREDITS	Wed Mar 16 11:27:31 2005 +0000
+++ b/CREDITS	Wed Mar 16 11:42:54 2005 +0000
@@ -77,6 +77,10 @@
 Translation work:
     Danny Angelo Carminati Grein
 
+MacOS Classic fixes,
+MPW support:
+    Chris Taylor
+
 Other stuff:
     Your name here! Patches go to icculus@clutteredmind.org ...
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/physfsMPW.make	Wed Mar 16 11:42:54 2005 +0000
@@ -0,0 +1,145 @@
+#   File:       PhysicsFS.make
+#   Target:     PhysicsFS
+#   Created:    Saturday, November 20, 2004 09:37:58 PM
+
+
+MAKEFILE        = PhysicsFS.make
+MondoBuild    = {MAKEFILE}  # Make blank to avoid rebuilds when makefile is modified
+
+ObjDir          = :obj:
+Includes        = -i : 
+				  -i ":zlib121:"
+
+Sym-PPC         = -sym on
+
+PPCCOptions     = {Includes} {Sym-PPC} -prefix ":Mac Classic Support:codewarrior_predefs.h" -enum int -alloca
+
+
+### Source Files ###
+
+SrcFiles        =  
+				  :archivers:dir.c 
+				  :archivers:grp.c 
+				  :archivers:hog.c 
+				  :archivers:mix.c 
+				  :archivers:mvl.c 
+				  :archivers:qpak.c 
+				  :archivers:wad.c 
+				  :archivers:zip.c 
+				  physfs.c 
+				  physfs_byteorder.c 
+				  :platform:macclassic.c 
+				  :zlib121:adler32.c 
+				  :zlib121:compress.c 
+				  :zlib121:crc32.c 
+				  :zlib121:deflate.c 
+				  :zlib121:gzio.c 
+				  :zlib121:infback.c 
+				  :zlib121:inffast.c 
+				  :zlib121:inflate.c 
+				  :zlib121:inftrees.c 
+				  :zlib121:trees.c 
+				  :zlib121:uncompr.c 
+				  :zlib121:zutil.c
+
+
+### Object Files ###
+
+ObjFiles-PPC    =  
+				  "{ObjDir}dir.c.x" 
+				  "{ObjDir}grp.c.x" 
+				  "{ObjDir}hog.c.x" 
+				  "{ObjDir}mix.c.x" 
+				  "{ObjDir}mvl.c.x" 
+				  "{ObjDir}qpak.c.x" 
+				  "{ObjDir}wad.c.x" 
+				  "{ObjDir}zip.c.x" 
+				  "{ObjDir}physfs.c.x" 
+				  "{ObjDir}physfs_byteorder.c.x" 
+				  "{ObjDir}macclassic.c.x" 
+				  "{ObjDir}adler32.c.x" 
+				  "{ObjDir}compress.c.x" 
+				  "{ObjDir}crc32.c.x" 
+				  "{ObjDir}deflate.c.x" 
+				  "{ObjDir}gzio.c.x" 
+				  "{ObjDir}infback.c.x" 
+				  "{ObjDir}inffast.c.x" 
+				  "{ObjDir}inflate.c.x" 
+				  "{ObjDir}inftrees.c.x" 
+				  "{ObjDir}trees.c.x" 
+				  "{ObjDir}uncompr.c.x" 
+				  "{ObjDir}zutil.c.x"
+
+
+### Libraries ###
+
+LibFiles-PPC    =  
+				  "{SharedLibraries}InterfaceLib" 
+				  "{SharedLibraries}StdCLib" 
+				  "{SharedLibraries}MathLib" 
+				  "{PPCLibraries}StdCRuntime.o" 
+				  "{PPCLibraries}PPCCRuntime.o" 
+				  "{PPCLibraries}PPCToolLibs.o"
+
+
+### Default Rules ###
+
+.c.x    .c  {MondoBuild}
+	{PPCC} {depDir}{default}.c -o {targDir}{default}.c.x {PPCCOptions}
+
+
+### Build Rules ###
+
+PhysicsFS    {ObjFiles-PPC} {LibFiles-PPC} {MondoBuild}
+	PPCLink 
+		-o {Targ} 
+		{ObjFiles-PPC} 
+		{LibFiles-PPC} 
+		{Sym-PPC} 
+		-@export ":Mac Classic Support:physfs.exp" 
+		-t 'shlb' 
+		-c '????' 
+		-xm s
+
+
+
+### Required Dependencies ###
+
+"{ObjDir}dir.c.x"    :archivers:dir.c
+"{ObjDir}grp.c.x"    :archivers:grp.c
+"{ObjDir}hog.c.x"    :archivers:hog.c
+"{ObjDir}mix.c.x"    :archivers:mix.c
+"{ObjDir}mvl.c.x"    :archivers:mvl.c
+"{ObjDir}qpak.c.x"    :archivers:qpak.c
+"{ObjDir}wad.c.x"    :archivers:wad.c
+"{ObjDir}zip.c.x"    :archivers:zip.c
+"{ObjDir}physfs.c.x"    physfs.c
+"{ObjDir}physfs_byteorder.c.x"    physfs_byteorder.c
+"{ObjDir}macclassic.c.x"    :platform:macclassic.c
+"{ObjDir}adler32.c.x"    :zlib121:adler32.c
+"{ObjDir}compress.c.x"    :zlib121:compress.c
+"{ObjDir}crc32.c.x"    :zlib121:crc32.c
+"{ObjDir}deflate.c.x"    :zlib121:deflate.c
+"{ObjDir}gzio.c.x"    :zlib121:gzio.c
+"{ObjDir}infback.c.x"    :zlib121:infback.c
+"{ObjDir}inffast.c.x"    :zlib121:inffast.c
+"{ObjDir}inflate.c.x"    :zlib121:inflate.c
+"{ObjDir}inftrees.c.x"    :zlib121:inftrees.c
+"{ObjDir}trees.c.x"    :zlib121:trees.c
+"{ObjDir}uncompr.c.x"    :zlib121:uncompr.c
+"{ObjDir}zutil.c.x"    :zlib121:zutil.c
+
+
+### Optional Dependencies ###
+### Build this target to generate "include file" dependencies. ###
+
+Dependencies    $OutOfDate
+	MakeDepend 
+		-append {MAKEFILE} 
+		-ignore "{CIncludes}" 
+		-objdir "{ObjDir}" 
+		-objext .x 
+		{Includes} 
+		{SrcFiles}
+
+
--- a/physfs_byteorder.c	Wed Mar 16 11:27:31 2005 +0000
+++ b/physfs_byteorder.c	Wed Mar 16 11:42:54 2005 +0000
@@ -30,6 +30,10 @@
 #endif
 #endif /* linux */
 
+#if (defined macintosh) && !(defined __MWERKS__)
+#define __inline__
+#endif
+
 #if (defined _MSC_VER)
 #define __inline__ __inline
 #endif
--- a/platform/macclassic.c	Wed Mar 16 11:27:31 2005 +0000
+++ b/platform/macclassic.c	Wed Mar 16 11:42:54 2005 +0000
@@ -14,7 +14,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
-#include <alloca.h>
 
 /*
  * Most of the API calls in here are, according to ADC, available since
@@ -138,7 +137,7 @@
     const char *errstr = get_macos_error_string(retval);
     if (strcmp(errstr, ERR_MACOS_GENERIC) == 0)
     {
-        snprintf(buf, sizeof (buf), ERR_MACOS_GENERIC, (int) retval);
+        sprintf(buf, ERR_MACOS_GENERIC, (int) retval);
         errstr = buf;
     } /* if */
 
@@ -767,16 +766,10 @@
                                     PHYSFS_uint32 size, PHYSFS_uint32 count)
 {
     SInt16 ref = *((SInt16 *) opaque);
-    SInt32 br;
-    PHYSFS_uint32 i;
+    SInt32 br = size*count;
 
-    for (i = 0; i < count; i++)
-    {
-        br = size;
-        BAIL_IF_MACRO(oserr(FSRead(ref, &br, buffer)) != noErr, NULL, i);
-        BAIL_IF_MACRO(br != size, NULL, i);  /* !!! FIXME: seek back if only read part of an object! */
-        buffer = ((PHYSFS_uint8 *) buffer) + size;
-    } /* for */
+	BAIL_IF_MACRO(oserr(FSRead(ref, &br, buffer)) != noErr, NULL, br/size);
+	BAIL_IF_MACRO(br != size*count, NULL, br/size);  /* !!! FIXME: seek back if only read part of an object! */
 
     return(count);
 } /* __PHYSFS_platformRead */
@@ -786,16 +779,10 @@
                                      PHYSFS_uint32 size, PHYSFS_uint32 count)
 {
     SInt16 ref = *((SInt16 *) opaque);
-    SInt32 bw;
-    PHYSFS_uint32 i;
+    SInt32 bw = size*count;
 
-    for (i = 0; i < count; i++)
-    {
-        bw = size;
-        BAIL_IF_MACRO(oserr(FSWrite(ref, &bw, buffer)) != noErr, NULL, i);
-        BAIL_IF_MACRO(bw != size, NULL, i); /* !!! FIXME: seek back if only wrote part of an object! */
-        buffer = ((PHYSFS_uint8 *) buffer) + size;
-    } /* for */
+	BAIL_IF_MACRO(oserr(FSWrite(ref, &bw, buffer)) != noErr, NULL, bw/size);
+	BAIL_IF_MACRO(bw != size*count, NULL, bw/size); /* !!! FIXME: seek back if only wrote part of an object! */
 
     return(count);
 } /* __PHYSFS_platformWrite */
--- a/zlib121/zconf.h	Wed Mar 16 11:27:31 2005 +0000
+++ b/zlib121/zconf.h	Wed Mar 16 11:42:54 2005 +0000
@@ -3,7 +3,7 @@
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
-/* @(#) $Id: zconf.h,v 1.2 2003/12/22 18:19:09 bhook Exp $ */
+/* @(#) $Id$ */
 
 #ifndef ZCONF_H
 #define ZCONF_H
@@ -127,6 +127,9 @@
 #if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
 #  define STDC
 #endif
+#if !defined(STDC) && defined(macintosh)
+#  define STDC
+#endif
 
 #if defined(__OS400__) && !defined(STDC)    /* iSeries (formerly AS/400). */
 #  define STDC
@@ -139,7 +142,7 @@
 #endif
 
 /* Some Mac compilers merge all .h files incorrectly: */
-#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
+#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)||defined(__MRC__)
 #  define NO_DUMMY_DECL
 #endif