Compare commits
9 Commits
4ab9716634
...
7d6c75d737
Author | SHA1 | Date |
---|---|---|
Jonathan Schleifer | 7d6c75d737 | |
Wolfgang Thaller | 1ed09307a7 | |
Wolfgang Thaller | 99de31d45a | |
Adam Goode | 5157624174 | |
Adam Goode | 05a3f397e1 | |
Wolfgang Thaller | f31e9d99ff | |
Adam Goode | 9ea4529d12 | |
Adam Goode | 085ef7e333 | |
Jonathan Schleifer | ad0dce421b |
|
@ -237,7 +237,7 @@ if [ $SKIP_THIRDPARTY != true ]; then
|
|||
cd gcc-build
|
||||
export target_configargs="--disable-nls --enable-libstdcxx-dual-abi=no --disable-libstdcxx-verbose"
|
||||
$SRC/gcc/configure --target=m68k-apple-macos --prefix=$PREFIX \
|
||||
--enable-languages=c,c++ --with-arch=m68k --with-cpu=m68000 \
|
||||
--enable-languages=c,c++,objc,obj-c++ --with-arch=m68k --with-cpu=m68000 \
|
||||
--disable-libssp MAKEINFO=missing
|
||||
# There seems to be a build failure in parallel builds; ignore any errors and try again without -j8.
|
||||
make -j8 || make
|
||||
|
@ -280,7 +280,7 @@ if [ $SKIP_THIRDPARTY != true ]; then
|
|||
cd gcc-build-ppc
|
||||
export target_configargs="--disable-nls --enable-libstdcxx-dual-abi=no --disable-libstdcxx-verbose"
|
||||
$SRC/gcc/configure --target=powerpc-apple-macos --prefix=$PREFIX \
|
||||
--enable-languages=c,c++ --disable-libssp --disable-lto MAKEINFO=missing
|
||||
--enable-languages=c,c++,objc,obj-c++ --disable-libssp --disable-lto MAKEINFO=missing
|
||||
make -j8
|
||||
make install
|
||||
unset target_configargs
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
"multiversal": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1703617805,
|
||||
"narHash": "sha256-GngLWR9i+hC7hJ+ZkKlRK4K63lIJ4D/CMXZwefcVAqw=",
|
||||
"lastModified": 1712682701,
|
||||
"narHash": "sha256-/bHk7tU3+xxIs4YGLUyJVG9RsVO23ek41R//eO1F22Q=",
|
||||
"owner": "autc04",
|
||||
"repo": "multiversal",
|
||||
"rev": "27c08c654bbd48d23f025741e3a584b59374904a",
|
||||
"rev": "32dff28d1d618972cc2f544c86ee017b6464fa89",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -1126,7 +1126,6 @@ configure-target: \
|
|||
maybe-configure-target-libbacktrace \
|
||||
maybe-configure-target-libquadmath \
|
||||
maybe-configure-target-libgfortran \
|
||||
maybe-configure-target-libobjc \
|
||||
maybe-configure-target-libgo \
|
||||
maybe-configure-target-libphobos \
|
||||
maybe-configure-target-libtermcap \
|
||||
|
@ -1316,7 +1315,6 @@ all-target: maybe-all-target-libbacktrace
|
|||
@endif target-libbacktrace-no-bootstrap
|
||||
all-target: maybe-all-target-libquadmath
|
||||
all-target: maybe-all-target-libgfortran
|
||||
all-target: maybe-all-target-libobjc
|
||||
all-target: maybe-all-target-libgo
|
||||
@if target-libphobos-no-bootstrap
|
||||
all-target: maybe-all-target-libphobos
|
||||
|
@ -1419,7 +1417,6 @@ info-target: maybe-info-target-libgcc
|
|||
info-target: maybe-info-target-libbacktrace
|
||||
info-target: maybe-info-target-libquadmath
|
||||
info-target: maybe-info-target-libgfortran
|
||||
info-target: maybe-info-target-libobjc
|
||||
info-target: maybe-info-target-libgo
|
||||
info-target: maybe-info-target-libphobos
|
||||
info-target: maybe-info-target-libtermcap
|
||||
|
@ -1509,7 +1506,6 @@ dvi-target: maybe-dvi-target-libgcc
|
|||
dvi-target: maybe-dvi-target-libbacktrace
|
||||
dvi-target: maybe-dvi-target-libquadmath
|
||||
dvi-target: maybe-dvi-target-libgfortran
|
||||
dvi-target: maybe-dvi-target-libobjc
|
||||
dvi-target: maybe-dvi-target-libgo
|
||||
dvi-target: maybe-dvi-target-libphobos
|
||||
dvi-target: maybe-dvi-target-libtermcap
|
||||
|
@ -1599,7 +1595,6 @@ pdf-target: maybe-pdf-target-libgcc
|
|||
pdf-target: maybe-pdf-target-libbacktrace
|
||||
pdf-target: maybe-pdf-target-libquadmath
|
||||
pdf-target: maybe-pdf-target-libgfortran
|
||||
pdf-target: maybe-pdf-target-libobjc
|
||||
pdf-target: maybe-pdf-target-libgo
|
||||
pdf-target: maybe-pdf-target-libphobos
|
||||
pdf-target: maybe-pdf-target-libtermcap
|
||||
|
@ -1689,7 +1684,6 @@ html-target: maybe-html-target-libgcc
|
|||
html-target: maybe-html-target-libbacktrace
|
||||
html-target: maybe-html-target-libquadmath
|
||||
html-target: maybe-html-target-libgfortran
|
||||
html-target: maybe-html-target-libobjc
|
||||
html-target: maybe-html-target-libgo
|
||||
html-target: maybe-html-target-libphobos
|
||||
html-target: maybe-html-target-libtermcap
|
||||
|
@ -1779,7 +1773,6 @@ TAGS-target: maybe-TAGS-target-libgcc
|
|||
TAGS-target: maybe-TAGS-target-libbacktrace
|
||||
TAGS-target: maybe-TAGS-target-libquadmath
|
||||
TAGS-target: maybe-TAGS-target-libgfortran
|
||||
TAGS-target: maybe-TAGS-target-libobjc
|
||||
TAGS-target: maybe-TAGS-target-libgo
|
||||
TAGS-target: maybe-TAGS-target-libphobos
|
||||
TAGS-target: maybe-TAGS-target-libtermcap
|
||||
|
@ -1869,7 +1862,6 @@ install-info-target: maybe-install-info-target-libgcc
|
|||
install-info-target: maybe-install-info-target-libbacktrace
|
||||
install-info-target: maybe-install-info-target-libquadmath
|
||||
install-info-target: maybe-install-info-target-libgfortran
|
||||
install-info-target: maybe-install-info-target-libobjc
|
||||
install-info-target: maybe-install-info-target-libgo
|
||||
install-info-target: maybe-install-info-target-libphobos
|
||||
install-info-target: maybe-install-info-target-libtermcap
|
||||
|
@ -2049,7 +2041,6 @@ install-pdf-target: maybe-install-pdf-target-libgcc
|
|||
install-pdf-target: maybe-install-pdf-target-libbacktrace
|
||||
install-pdf-target: maybe-install-pdf-target-libquadmath
|
||||
install-pdf-target: maybe-install-pdf-target-libgfortran
|
||||
install-pdf-target: maybe-install-pdf-target-libobjc
|
||||
install-pdf-target: maybe-install-pdf-target-libgo
|
||||
install-pdf-target: maybe-install-pdf-target-libphobos
|
||||
install-pdf-target: maybe-install-pdf-target-libtermcap
|
||||
|
@ -2139,7 +2130,6 @@ install-html-target: maybe-install-html-target-libgcc
|
|||
install-html-target: maybe-install-html-target-libbacktrace
|
||||
install-html-target: maybe-install-html-target-libquadmath
|
||||
install-html-target: maybe-install-html-target-libgfortran
|
||||
install-html-target: maybe-install-html-target-libobjc
|
||||
install-html-target: maybe-install-html-target-libgo
|
||||
install-html-target: maybe-install-html-target-libphobos
|
||||
install-html-target: maybe-install-html-target-libtermcap
|
||||
|
@ -2229,7 +2219,6 @@ installcheck-target: maybe-installcheck-target-libgcc
|
|||
installcheck-target: maybe-installcheck-target-libbacktrace
|
||||
installcheck-target: maybe-installcheck-target-libquadmath
|
||||
installcheck-target: maybe-installcheck-target-libgfortran
|
||||
installcheck-target: maybe-installcheck-target-libobjc
|
||||
installcheck-target: maybe-installcheck-target-libgo
|
||||
installcheck-target: maybe-installcheck-target-libphobos
|
||||
installcheck-target: maybe-installcheck-target-libtermcap
|
||||
|
@ -2319,7 +2308,6 @@ mostlyclean-target: maybe-mostlyclean-target-libgcc
|
|||
mostlyclean-target: maybe-mostlyclean-target-libbacktrace
|
||||
mostlyclean-target: maybe-mostlyclean-target-libquadmath
|
||||
mostlyclean-target: maybe-mostlyclean-target-libgfortran
|
||||
mostlyclean-target: maybe-mostlyclean-target-libobjc
|
||||
mostlyclean-target: maybe-mostlyclean-target-libgo
|
||||
mostlyclean-target: maybe-mostlyclean-target-libphobos
|
||||
mostlyclean-target: maybe-mostlyclean-target-libtermcap
|
||||
|
@ -2409,7 +2397,6 @@ clean-target: maybe-clean-target-libgcc
|
|||
clean-target: maybe-clean-target-libbacktrace
|
||||
clean-target: maybe-clean-target-libquadmath
|
||||
clean-target: maybe-clean-target-libgfortran
|
||||
clean-target: maybe-clean-target-libobjc
|
||||
clean-target: maybe-clean-target-libgo
|
||||
clean-target: maybe-clean-target-libphobos
|
||||
clean-target: maybe-clean-target-libtermcap
|
||||
|
@ -2499,7 +2486,6 @@ distclean-target: maybe-distclean-target-libgcc
|
|||
distclean-target: maybe-distclean-target-libbacktrace
|
||||
distclean-target: maybe-distclean-target-libquadmath
|
||||
distclean-target: maybe-distclean-target-libgfortran
|
||||
distclean-target: maybe-distclean-target-libobjc
|
||||
distclean-target: maybe-distclean-target-libgo
|
||||
distclean-target: maybe-distclean-target-libphobos
|
||||
distclean-target: maybe-distclean-target-libtermcap
|
||||
|
@ -2589,7 +2575,6 @@ maintainer-clean-target: maybe-maintainer-clean-target-libgcc
|
|||
maintainer-clean-target: maybe-maintainer-clean-target-libbacktrace
|
||||
maintainer-clean-target: maybe-maintainer-clean-target-libquadmath
|
||||
maintainer-clean-target: maybe-maintainer-clean-target-libgfortran
|
||||
maintainer-clean-target: maybe-maintainer-clean-target-libobjc
|
||||
maintainer-clean-target: maybe-maintainer-clean-target-libgo
|
||||
maintainer-clean-target: maybe-maintainer-clean-target-libphobos
|
||||
maintainer-clean-target: maybe-maintainer-clean-target-libtermcap
|
||||
|
@ -2737,7 +2722,6 @@ check-target: \
|
|||
maybe-check-target-libbacktrace \
|
||||
maybe-check-target-libquadmath \
|
||||
maybe-check-target-libgfortran \
|
||||
maybe-check-target-libobjc \
|
||||
maybe-check-target-libgo \
|
||||
maybe-check-target-libphobos \
|
||||
maybe-check-target-libtermcap \
|
||||
|
@ -2929,7 +2913,6 @@ install-target: \
|
|||
maybe-install-target-libbacktrace \
|
||||
maybe-install-target-libquadmath \
|
||||
maybe-install-target-libgfortran \
|
||||
maybe-install-target-libobjc \
|
||||
maybe-install-target-libgo \
|
||||
maybe-install-target-libphobos \
|
||||
maybe-install-target-libtermcap \
|
||||
|
@ -3039,7 +3022,6 @@ install-strip-target: \
|
|||
maybe-install-strip-target-libbacktrace \
|
||||
maybe-install-strip-target-libquadmath \
|
||||
maybe-install-strip-target-libgfortran \
|
||||
maybe-install-strip-target-libobjc \
|
||||
maybe-install-strip-target-libgo \
|
||||
maybe-install-strip-target-libphobos \
|
||||
maybe-install-strip-target-libtermcap \
|
||||
|
|
|
@ -16,3 +16,11 @@
|
|||
#undef CPP_SPEC
|
||||
#define CPP_SPEC "-Wno-trigraphs"
|
||||
|
||||
#undef TARGET_OS_CPP_BUILTINS
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_define ("macintosh"); \
|
||||
builtin_define ("Macintosh"); \
|
||||
} \
|
||||
while (0)
|
||||
|
|
|
@ -152,6 +152,8 @@
|
|||
builtin_define ("__PPC__"); \
|
||||
builtin_define ("__POWERPC__"); \
|
||||
builtin_define ("__NATURAL_ALIGNMENT__"); \
|
||||
builtin_define ("macintosh"); \
|
||||
builtin_define ("Macintosh"); \
|
||||
builtin_assert ("system=macos"); \
|
||||
builtin_assert ("cpu=powerpc"); \
|
||||
builtin_assert ("machine=powerpc"); \
|
||||
|
|
|
@ -30,7 +30,6 @@ if(CMAKE_SYSTEM_NAME MATCHES Retro68)
|
|||
PoorMansDebugging.h
|
||||
MultiSegApp.c
|
||||
LoadSeg.s
|
||||
# glue.c
|
||||
qdglobals.c
|
||||
Retro68.r
|
||||
Retro68APPL.r
|
||||
|
|
477
libretro/glue.c
477
libretro/glue.c
|
@ -1,477 +0,0 @@
|
|||
/*
|
||||
Copyright 2015 Wolfgang Thaller.
|
||||
|
||||
This file is part of Retro68.
|
||||
|
||||
Retro68 is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Retro68 is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <MacMemory.h>
|
||||
#include <Files.h>
|
||||
#include <string.h>
|
||||
#include <Files.h>
|
||||
#include <Devices.h>
|
||||
#include <Resources.h>
|
||||
#include <SegLoad.h>
|
||||
#include <LowMem.h>
|
||||
|
||||
#pragma parameter __D0 _GetPtrSize(__A0)
|
||||
pascal long _GetPtrSize(Ptr ptr) = { 0xA021 };
|
||||
|
||||
pascal Size GetPtrSize(Ptr ptr)
|
||||
{
|
||||
long tmp = _GetPtrSize(ptr);
|
||||
if(tmp > 0)
|
||||
return (Size) tmp;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma parameter __D0 _GetHandleSize(__A0)
|
||||
pascal long _GetHandleSize(Handle h) = { 0xA025 };
|
||||
|
||||
pascal Size GetHandleSize(Handle h)
|
||||
{
|
||||
long tmp = _GetHandleSize(h);
|
||||
if(tmp > 0)
|
||||
return (Size) tmp;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma parameter __A0 _PtrToHand(__A0, __D0)
|
||||
pascal Handle _PtrToHand(const void *srcPtr, long size) = { 0xA9E3 };
|
||||
|
||||
EXTERN_API( OSErr )
|
||||
PtrToHand(
|
||||
const void * srcPtr,
|
||||
Handle * dstHndl,
|
||||
long size)
|
||||
{
|
||||
*dstHndl = _PtrToHand(srcPtr, size);
|
||||
|
||||
return MemError();
|
||||
}
|
||||
|
||||
#pragma parameter __A0 _HandToHand(__A0)
|
||||
pascal Handle _HandToHand(Handle h) = { 0xA9E1 };
|
||||
|
||||
EXTERN_API( OSErr )
|
||||
HandToHand(Handle * theHndl)
|
||||
{
|
||||
*theHndl = _HandToHand(*theHndl);
|
||||
|
||||
return MemError();
|
||||
}
|
||||
|
||||
#pragma parameter __D0 _StringToNum(__A0)
|
||||
pascal long _StringToNum(ConstStr255Param theString) = { 0x3F3C, 0x0001, 0xA9EE };
|
||||
|
||||
EXTERN_API( void )
|
||||
StringToNum(
|
||||
ConstStr255Param theString,
|
||||
long * theNum)
|
||||
{
|
||||
*theNum = _StringToNum(theString);
|
||||
}
|
||||
|
||||
#pragma parameter _NumToString(__D0, __A0)
|
||||
pascal long _NumToString(long theNum, ConstStr255Param theString) = { 0x4267, 0xA9EE };
|
||||
|
||||
EXTERN_API( void )
|
||||
NumToString(
|
||||
long theNum,
|
||||
Str255 theString)
|
||||
{
|
||||
_NumToString(theNum, theString);
|
||||
}
|
||||
|
||||
#pragma parameter __D0 _CmpString(__A0, __A1, __D0)
|
||||
pascal long _CmpString(const char *a, const char *b, long lens) = { 0xA03C };
|
||||
#pragma parameter __D0 _CmpStringCase(__A0, __A1, __D0)
|
||||
pascal long _CmpStringCase(const char *a, const char *b, long lens) = { 0xA43C };
|
||||
#pragma parameter __D0 _CmpStringMarks(__A0, __A1, __D0)
|
||||
pascal long _CmpStringMarks(const char *a, const char *b, long lens) = { 0xA23C };
|
||||
#pragma parameter __D0 _CmpStringCaseMarks(__A0, __A1, __D0)
|
||||
pascal long _CmpStringCaseMarks(const char *a, const char *b, long lens) = { 0xA63C };
|
||||
|
||||
EXTERN_API( Boolean )
|
||||
EqualString(
|
||||
ConstStr255Param str1,
|
||||
ConstStr255Param str2,
|
||||
Boolean caseSensitive,
|
||||
Boolean diacSensitive)
|
||||
{
|
||||
long lens = (str1[0] << 16) | str2[0];
|
||||
long result;
|
||||
if(caseSensitive)
|
||||
{
|
||||
if(diacSensitive)
|
||||
result = _CmpStringCase(str1+1, str2+1, lens);
|
||||
else
|
||||
result = _CmpStringCaseMarks(str1+1, str2+1, lens);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(diacSensitive)
|
||||
result = _CmpString(str1+1, str2+1, lens);
|
||||
else
|
||||
result = _CmpStringMarks(str1+1, str2+1, lens);
|
||||
}
|
||||
return result == 0;
|
||||
}
|
||||
|
||||
pascal void GetIndString(Str255 theString, short strListID, short index)
|
||||
{
|
||||
Handle h = GetResource('STR#', strListID);
|
||||
theString[0] = 0;
|
||||
if(index > *(short*)*h)
|
||||
return;
|
||||
unsigned char *p = ((unsigned char*) *h) + 2;
|
||||
while(--index > 0)
|
||||
p += *p + 1;
|
||||
if(index == 0)
|
||||
memcpy(theString, p, p[0]+1);
|
||||
}
|
||||
|
||||
EXTERN_API( UniversalProcPtr )
|
||||
NGetTrapAddress(
|
||||
UInt16 trapNum,
|
||||
TrapType tTyp)
|
||||
{
|
||||
if(tTyp == kOSTrapType)
|
||||
return GetOSTrapAddress(trapNum);
|
||||
else
|
||||
return GetToolTrapAddress(trapNum);
|
||||
}
|
||||
|
||||
EXTERN_API( void )
|
||||
CountAppFiles(
|
||||
short * message,
|
||||
short * count)
|
||||
{
|
||||
Handle h = LMGetAppParmHandle();
|
||||
if(!GetHandleSize(h))
|
||||
return;
|
||||
*message = ((short*)*h)[0];
|
||||
*count = ((short*)*h)[1];
|
||||
}
|
||||
|
||||
static AppFile* AppFilePtr(short index)
|
||||
{
|
||||
Handle h = LMGetAppParmHandle();
|
||||
if(!GetHandleSize(h))
|
||||
return NULL;
|
||||
short count = ((short*)*h)[1];
|
||||
if(index < 1 || index > count)
|
||||
return NULL;
|
||||
index--;
|
||||
|
||||
Ptr p = *h + 4;
|
||||
while(index)
|
||||
{
|
||||
AppFile *f = (AppFile*) p;
|
||||
p += (8 + 1 + f->fName[0] + 1) & ~1;
|
||||
}
|
||||
return (AppFile*) p;
|
||||
}
|
||||
|
||||
EXTERN_API( void )
|
||||
GetAppFiles(
|
||||
short index,
|
||||
AppFile * theFile)
|
||||
{
|
||||
AppFile *ptr = AppFilePtr(index);
|
||||
if(ptr)
|
||||
memcpy(theFile, ptr, 8 + 1 + ptr->fName[0]);
|
||||
}
|
||||
|
||||
EXTERN_API( void )
|
||||
ClrAppFiles(short index)
|
||||
{
|
||||
AppFile *ptr = AppFilePtr(index);
|
||||
if(ptr)
|
||||
ptr->fType = 0;
|
||||
}
|
||||
|
||||
|
||||
pascal OSErr SetVol (ConstStr63Param volName, short vRefNum)
|
||||
{
|
||||
ParamBlockRec pb;
|
||||
memset(&pb, 0, sizeof(pb));
|
||||
pb.volumeParam.ioNamePtr = (StringPtr)volName;
|
||||
pb.volumeParam.ioVRefNum = vRefNum;
|
||||
return PBSetVolSync(&pb);
|
||||
}
|
||||
|
||||
EXTERN_API( OSErr )
|
||||
GetVol(
|
||||
StringPtr volName,
|
||||
short * vRefNum)
|
||||
{
|
||||
ParamBlockRec pb;
|
||||
memset(&pb, 0, sizeof(pb));
|
||||
pb.volumeParam.ioNamePtr = volName;
|
||||
OSErr err = PBGetVolSync(&pb);
|
||||
*vRefNum = pb.volumeParam.ioVRefNum;
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
pascal OSErr UnmountVol (ConstStr63Param volName, short vRefNum)
|
||||
{
|
||||
ParamBlockRec pb;
|
||||
memset(&pb, 0, sizeof(pb));
|
||||
pb.volumeParam.ioNamePtr = (StringPtr)volName;
|
||||
pb.volumeParam.ioVRefNum = vRefNum;
|
||||
return PBUnmountVolImmed(&pb);
|
||||
}
|
||||
|
||||
pascal OSErr Eject (ConstStr63Param volName, short vRefNum)
|
||||
{
|
||||
ParamBlockRec pb;
|
||||
memset(&pb, 0, sizeof(pb));
|
||||
pb.volumeParam.ioNamePtr = (StringPtr)volName;
|
||||
pb.volumeParam.ioVRefNum = vRefNum;
|
||||
return PBEject(&pb);
|
||||
}
|
||||
|
||||
pascal OSErr FSOpen (ConstStr255Param fileName, short vRefNum, short *refNum)
|
||||
{
|
||||
OSErr err;
|
||||
ParamBlockRec pb;
|
||||
memset(&pb, 0, sizeof(pb));
|
||||
pb.ioParam.ioNamePtr = (StringPtr)fileName;
|
||||
pb.ioParam.ioVRefNum = vRefNum;
|
||||
|
||||
// Try newer OpenDF first, because it does not open drivers
|
||||
err = PBOpenDFSync(&pb);
|
||||
if (err == paramErr) {
|
||||
// OpenDF not implemented, so use regular Open.
|
||||
err = PBOpenSync(&pb);
|
||||
}
|
||||
|
||||
*refNum = pb.ioParam.ioRefNum;
|
||||
return err;
|
||||
}
|
||||
|
||||
pascal OSErr OpenDF (ConstStr255Param fileName, short vRefNum, short *refNum)
|
||||
{
|
||||
return FSOpen(fileName, vRefNum, refNum);
|
||||
}
|
||||
|
||||
pascal OSErr FSClose (short refNum)
|
||||
{
|
||||
ParamBlockRec pb;
|
||||
memset(&pb, 0, sizeof(pb));
|
||||
pb.ioParam.ioRefNum = refNum;
|
||||
return PBCloseSync(&pb);
|
||||
}
|
||||
|
||||
pascal OSErr FSRead (short refNum, long *count, void *buffPtr)
|
||||
{
|
||||
OSErr err;
|
||||
ParamBlockRec pb;
|
||||
memset(&pb, 0, sizeof(pb));
|
||||
pb.ioParam.ioRefNum = refNum;
|
||||
pb.ioParam.ioBuffer = buffPtr;
|
||||
pb.ioParam.ioReqCount = *count;
|
||||
|
||||
err = PBReadSync(&pb);
|
||||
*count = pb.ioParam.ioActCount;
|
||||
return err;
|
||||
}
|
||||
|
||||
pascal OSErr FSWrite (short refNum, long *count, const void *buffPtr)
|
||||
{
|
||||
OSErr err;
|
||||
ParamBlockRec pb;
|
||||
memset(&pb, 0, sizeof(pb));
|
||||
pb.ioParam.ioRefNum = refNum;
|
||||
pb.ioParam.ioBuffer = (void *)buffPtr;
|
||||
pb.ioParam.ioReqCount = *count;
|
||||
|
||||
err = PBWriteSync(&pb);
|
||||
*count = pb.ioParam.ioActCount;
|
||||
return err;
|
||||
}
|
||||
|
||||
pascal OSErr GetEOF (short refNum, long *logEOF)
|
||||
{
|
||||
OSErr err;
|
||||
ParamBlockRec pb;
|
||||
memset(&pb, 0, sizeof(pb));
|
||||
pb.ioParam.ioRefNum = refNum;
|
||||
err = PBGetEOFSync(&pb);
|
||||
*logEOF = (long)pb.ioParam.ioMisc;
|
||||
return err;
|
||||
}
|
||||
|
||||
pascal OSErr SetEOF (short refNum, long logEOF)
|
||||
{
|
||||
OSErr err;
|
||||
ParamBlockRec pb;
|
||||
memset(&pb, 0, sizeof(pb));
|
||||
pb.ioParam.ioRefNum = refNum;
|
||||
pb.ioParam.ioMisc = (Ptr)logEOF;
|
||||
return PBGetEOFSync(&pb);
|
||||
}
|
||||
|
||||
pascal OSErr GetFPos (short refNum, long *filePos)
|
||||
{
|
||||
OSErr err;
|
||||
ParamBlockRec pb;
|
||||
pb.ioParam.ioRefNum = refNum;
|
||||
err = PBGetFPosSync(&pb);
|
||||
*filePos = pb.ioParam.ioPosOffset;
|
||||
return err;
|
||||
}
|
||||
|
||||
pascal OSErr SetFPos (short refNum, short posMode, long posOff)
|
||||
{
|
||||
ParamBlockRec pb;
|
||||
memset(&pb, 0, sizeof(pb));
|
||||
pb.ioParam.ioRefNum = refNum;
|
||||
pb.ioParam.ioPosMode = posMode;
|
||||
pb.ioParam.ioPosOffset = posOff;
|
||||
return PBSetFPosSync(&pb);
|
||||
}
|
||||
|
||||
pascal OSErr Create (ConstStr255Param fileName, short vRefNum, OSType creator,
|
||||
OSType fileType)
|
||||
{
|
||||
ParamBlockRec pb;
|
||||
OSErr err;
|
||||
memset(&pb, 0, sizeof(pb));
|
||||
pb.fileParam.ioVRefNum = vRefNum;
|
||||
pb.fileParam.ioNamePtr = (StringPtr)fileName;
|
||||
// create the file
|
||||
err = PBCreateSync(&pb);
|
||||
if (err != noErr) return err;
|
||||
// get previous finder info
|
||||
err = PBGetFInfoSync(&pb);
|
||||
if (err != noErr) return err;
|
||||
// clear directory index
|
||||
pb.fileParam.ioFDirIndex = 0;
|
||||
// copy finder info words
|
||||
pb.fileParam.ioFlFndrInfo.fdType = fileType;
|
||||
pb.fileParam.ioFlFndrInfo.fdCreator = creator;
|
||||
// save finder info
|
||||
return PBSetFInfoSync(&pb);
|
||||
}
|
||||
|
||||
pascal OSErr GetWDInfo(short wdRefNum, short *vRefNum, long *dirID,
|
||||
long *procID)
|
||||
{
|
||||
OSErr err;
|
||||
WDPBRec pb;
|
||||
memset(&pb, 0, sizeof(pb));
|
||||
pb.ioVRefNum = wdRefNum;
|
||||
err = PBGetWDInfo(&pb, false);
|
||||
*vRefNum = pb.ioWDVRefNum;
|
||||
*dirID = pb.ioWDDirID;
|
||||
*procID = pb.ioWDProcID;
|
||||
return err;
|
||||
}
|
||||
|
||||
EXTERN_API( OSErr )
|
||||
GetFInfo(
|
||||
ConstStr255Param fileName,
|
||||
short vRefNum,
|
||||
FInfo * fndrInfo)
|
||||
{
|
||||
ParamBlockRec pb;
|
||||
OSErr err;
|
||||
memset(&pb, 0, sizeof(pb));
|
||||
pb.fileParam.ioVRefNum = vRefNum;
|
||||
pb.fileParam.ioNamePtr = (StringPtr)fileName;
|
||||
err = PBGetFInfoSync(&pb);
|
||||
*fndrInfo = pb.fileParam.ioFlFndrInfo;
|
||||
return err;
|
||||
}
|
||||
|
||||
EXTERN_API( OSErr )
|
||||
HDelete(
|
||||
short vRefNum,
|
||||
long dirID,
|
||||
ConstStr255Param fileName)
|
||||
{
|
||||
HParamBlockRec pb;
|
||||
pb.fileParam.ioVRefNum = vRefNum;
|
||||
pb.fileParam.ioNamePtr = (StringPtr)fileName;
|
||||
pb.fileParam.ioDirID = dirID;
|
||||
pb.fileParam.ioFVersNum = 0; // ???
|
||||
return PBHDeleteSync(&pb);
|
||||
}
|
||||
|
||||
EXTERN_API( OSErr )
|
||||
HGetFInfo(
|
||||
short vRefNum,
|
||||
long dirID,
|
||||
ConstStr255Param fileName,
|
||||
FInfo * fndrInfo)
|
||||
{
|
||||
HParamBlockRec pb;
|
||||
OSErr err;
|
||||
pb.fileParam.ioVRefNum = vRefNum;
|
||||
pb.fileParam.ioNamePtr = (StringPtr)fileName;
|
||||
pb.fileParam.ioFVersNum = 0; // ???
|
||||
pb.fileParam.ioFDirIndex = 0;
|
||||
pb.fileParam.ioDirID = dirID;
|
||||
err = PBHGetFInfoSync(&pb);
|
||||
*fndrInfo = pb.fileParam.ioFlFndrInfo;
|
||||
return err;
|
||||
}
|
||||
|
||||
EXTERN_API( OSErr )
|
||||
HSetFInfo(
|
||||
short vRefNum,
|
||||
long dirID,
|
||||
ConstStr255Param fileName,
|
||||
const FInfo * fndrInfo)
|
||||
{
|
||||
HParamBlockRec pb;
|
||||
OSErr err;
|
||||
pb.fileParam.ioVRefNum = vRefNum;
|
||||
pb.fileParam.ioNamePtr = (StringPtr)fileName;
|
||||
pb.fileParam.ioFVersNum = 0; // ???
|
||||
pb.fileParam.ioFDirIndex = 0;
|
||||
pb.fileParam.ioDirID = dirID;
|
||||
pb.fileParam.ioFlFndrInfo = *fndrInfo;
|
||||
return PBHSetFInfoSync(&pb);
|
||||
}
|
||||
|
||||
pascal OSErr OpenDriver(ConstStr255Param name, short *drvrRefNum)
|
||||
{
|
||||
ParamBlockRec pb;
|
||||
OSErr err;
|
||||
memset(&pb, 0, sizeof(pb));
|
||||
|
||||
pb.ioParam.ioNamePtr = (StringPtr)name;
|
||||
|
||||
err = PBOpenSync(&pb);
|
||||
*drvrRefNum = pb.ioParam.ioRefNum;
|
||||
return err;
|
||||
}
|
||||
|
||||
pascal OSErr CloseDriver(short refNum)
|
||||
{
|
||||
return FSClose(refNum);
|
||||
}
|
|
@ -135,8 +135,14 @@ int _open_r(struct _reent *reent, const char* name, int flags, int mode)
|
|||
|
||||
int _close_r(struct _reent *reent, int fd)
|
||||
{
|
||||
if(fd >= kMacRefNumOffset)
|
||||
FSClose(fd - kMacRefNumOffset);
|
||||
if(fd >= kMacRefNumOffset) {
|
||||
short refNum = fd - kMacRefNumOffset;
|
||||
short vRefNum;
|
||||
OSErr err = GetVRefNum(refNum, &vRefNum);
|
||||
FSClose(refNum);
|
||||
if (err == noErr)
|
||||
FlushVol(NULL, vRefNum);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 27c08c654bbd48d23f025741e3a584b59374904a
|
||||
Subproject commit 32dff28d1d618972cc2f544c86ee017b6464fa89
|
Loading…
Reference in New Issue