diff options
Diffstat (limited to '')
-rw-r--r-- | includes/macemul.h | 168 |
1 files changed, 168 insertions, 0 deletions
diff --git a/includes/macemul.h b/includes/macemul.h new file mode 100644 index 0000000..03b6c68 --- /dev/null +++ b/includes/macemul.h @@ -0,0 +1,168 @@ +#pragma once +#include "common.h" +#include "oslib.h" + +/** + * Functions emulating classic Mac OS on other OSes + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/********************************/ +/* ErrMgr */ +extern char *GetSysErrText(SInt16 msgNbr, char *errMsg); + +/********************************/ +/* Files */ +extern OSErr HCreate(SInt16 volume, SInt32 dirid, ConstStr255Param fileName, OSType creator, OSType type); +extern OSErr HOpen(SInt16 vRefNum, SInt32 dirID, ConstStr255Param fileName, SInt8 permission, SInt16 *refNum); +extern OSErr HOpenDF(SInt16 vRefNum, SInt32 dirID, ConstStr255Param fileName, SInt8 permission, SInt16 *refNum); +extern OSErr HDelete(SInt16 vRefNum, SInt32 dirID, ConstStr255Param fileName); +extern OSErr HRename(SInt16 vRefNum, SInt32 dirID, ConstStr255Param oldName, ConstStr255Param newName); +extern OSErr HGetFInfo(SInt16 vRefNum, SInt32 dirID, ConstStr255Param fileName, FInfo *fndrInfo); +extern OSErr HSetFInfo(SInt16 vRefNum, SInt32 dirID, ConstStr255Param fileName, const FInfo *fndrInfo); +extern OSErr FSpCreate(const FSSpec *fss, OSType creator, OSType fileType, ScriptCode scriptTag); +extern OSErr FSpDirCreate(const FSSpec *fss, ScriptCode scriptTag, SInt32 *createdDirID); +extern OSErr FSpOpenDF(const FSSpec *fss, SInt8 permission, SInt16 *refNum); +extern OSErr FSpDelete(const FSSpec *fss); +extern OSErr FSpRename(const FSSpec *oldfss, ConstStr255Param newName); +extern OSErr FSpGetFInfo(const FSSpec *fss, FInfo *fndrInfo); +extern OSErr FSpSetFInfo(const FSSpec *fss, const FInfo *fndrInfo); +extern OSErr HGetVol(StringPtr volName, SInt16 *vRefNum, SInt32 *dirID); +extern OSErr HSetVol(ConstStr63Param volName, SInt16 vRefNum, SInt32 dirID); +extern OSErr FlushVol(ConstStr63Param volName, SInt16 vRefNum); +extern OSErr FSRead(SInt16 fRefNum, SInt32 *Size, void *Buffer); +extern OSErr FSWrite(SInt16 fRefNum, SInt32 *Size, const void *Buffer); +extern OSErr FSClose(SInt16 fRefNum); +extern OSErr GetEOF(SInt16 fRefNum, SInt32 *curEOF); +extern OSErr SetEOF(SInt16 fRefNum, SInt32 newEOF); +extern OSErr GetFPos(SInt16 fRefNum, SInt32 *pos); +extern OSErr SetFPos(SInt16 fRefNum, SInt16 posMode, SInt32 posOffset); +extern OSErr GetVInfo(SInt16 vRefNum, StringPtr name, SInt16 *vRef, SInt32 *hDir); +extern OSErr PBWriteSync(ParmBlkPtr paramBlock); +extern OSErr PBHGetFInfoSync(HParmBlkPtr paramBlock); +extern OSErr PBHSetFInfoSync(HParmBlkPtr paramBlock); +extern OSErr PBGetCatInfoSync(CInfoPBPtr paramBlock); +extern OSErr ResolveAliasFile(FSSpec *fss, Boolean resolveChains, Boolean *isFolder, Boolean *wasAliased); +extern OSErr FSMakeFSSpec(SInt16 vRefNum, SInt32 dirID, ConstStr255Param pathName, FSSpec *fss); +extern OSErr Allocate(SInt16 refNum, SInt32 *byteCount); + +/********************************/ +/* LowMem */ +extern UInt32 LMGetTicks(); +extern UInt32 LMGetTime(); +extern OSErr LMGetMemErr(); +extern void LMSetMemErr(OSErr value); + +/********************************/ +/* Memory */ +extern OSHandle *OS_PeekMacHandle(Handle h); +extern Handle OS_CreateMacHandle(OSHandle *h); +extern Handle OS_CreateMacHandleDup(OSHandle *h); +extern void OS_DestroyMacHandle(Handle h, OSHandle *ret); + +extern OSErr MemError(); +extern Handle NewHandle(SInt32 dataSize); +extern Handle NewHandleClear(UInt32 dataSize); +extern Handle TempNewHandle(UInt32 dataSize, OSErr *resultCode); +extern void DisposeHandle(Handle h); +extern void HLock(Handle h); +extern void HLockHi(Handle h); +extern void HUnlock(Handle h); +extern void HPurge(Handle theHandle); +extern void HNoPurge(Handle theHandle); +extern SInt8 HGetState(Handle theHandle); +extern void HSetState(Handle theHandle, SInt8 flags); +extern SInt32 GetHandleSize(Handle h); +extern void SetHandleSize(Handle h, SInt32 newSize); +extern OSErr PtrAndHand(const void *srcPtr, Handle destHandle, SInt32 size); +extern OSErr PtrToHand(const void *srcPtr, Handle *destHandle, SInt32 size); +extern OSErr HandToHand(Handle *destHandle); +extern OSErr HandAndHand(Handle src, Handle dst); +extern void MoveHHi(Handle theHandle); +extern void BlockMove(const void *srcPtr, void *destPtr, UInt32 byteCount); +extern void BlockMoveData(const void *srcPtr, void *destPtr, UInt32 byteCount); +extern Ptr NewPtr(SInt32 dataSize); +extern void DisposePtr(Ptr p); +extern Ptr NewPtrClear(SInt32 dataSize); +extern void DebugStr(ConstStringPtr str); +extern struct Zone *HandleZone(); +extern struct Zone *ApplicationZone(); + +/********************************/ +/* Resources */ +extern Boolean OS_UsingMacResourceForkInfo(); +extern void OS_UseMacResourceForkInfo(Boolean which); +extern OSErr SystemInitResources(OSSpec *spec); +extern void OS_AddMacResourceForkRef(int ref, const OSSpec *spec); +extern void OS_RemoveMacResourceForkRef(int ref); +extern OSSpec *OS_GetMacResourceForkFromRef(int ref); +extern Boolean OS_SearchMacResourceForkList(const OSSpec *rspec, int *ref); +extern int OS_SetMacResourceForkCreatorAndType(int ref, OSType creator, OSType type); +extern int OS_GetMacResourceForkCreatorAndType(int ref, OSType *creator, OSType *type); +extern void OS_CleanupMacResourceForkDir(const OSPathSpec *dir); +extern OSErr OS_MacDumpResourceFork(SInt16 ref, Boolean dumpContents); +extern OSErr FSpOpenRF(const FSSpec *fss, SInt8 permission, SInt16 *refNum); +extern OSErr HOpenRF(SInt16 vRefNum, SInt32 dirID, ConstStringPtr fileName, SInt8 permission, SInt16 *refNum); +extern OSErr InitResources(); +extern OSErr ResError(); +extern void FSpCreateResFile(const FSSpec *fss, OSType creator, OSType fileType, ScriptCode scriptTag); +extern void HCreateResFile(SInt16 vRefNum, SInt32 dirID, ConstStringPtr fileName); +extern OSErr FSpOpenResFile(const FSSpec *fss, SInt8 permission); +extern SInt16 HOpenResFile(SInt16 vRefNum, SInt32 dirID, ConstStringPtr fileName, SInt8 permission); +extern SInt16 CurResFile(); +extern void UseResFile(SInt16 refNum); +extern SInt16 HomeResFile(Handle theResource); +extern Handle GetResource(OSType theType, SInt16 theID); +extern Handle Get1Resource(OSType theType, SInt16 theID); +extern Handle GetNamedResource(OSType theType, ConstStringPtr theName); +extern Handle Get1NamedResource(OSType theType, ConstStringPtr theName); +extern void SetResLoad(Boolean load); +extern void MacEmul_LoadResource(Handle theResource); +extern void GetResInfo(Handle theResource, SInt16 *theID, OSType *theType, StringPtr name); +extern void SetResInfo(Handle theResource, SInt16 theID, ConstStringPtr name); +extern SInt16 GetResAttrs(Handle theResource); +extern void SetResAttrs(Handle theResource, SInt16 attrs); +extern void ChangedResource(Handle theResource); +extern void AddResource(Handle theData, OSType theType, SInt16 theID, ConstStringPtr name); +extern void UpdateResFile(SInt16 refnum); +extern void WriteResource(Handle theResource); +extern void SetResPurge(Boolean install); +extern SInt16 CountResources(OSType theType); +extern SInt16 Count1Resources(OSType theType); +extern Handle GetIndResource(OSType theType, SInt16 index); +extern Handle Get1IndResource(OSType theType, SInt16 index); +extern SInt16 Count1Types(); +extern void Get1IndType(OSType *theType, SInt16 index); +extern void ReleaseResource(); +extern void DetachResource(Handle theResource); +extern void RemoveResource(Handle theResource); +extern void CloseResFile(SInt16 refNum); +extern SInt16 GetResFileAttrs(SInt16); +extern Boolean LMGetResLoad(); + +/********************************/ +/* ResourceStrings */ +extern void Res_Initialize(); +extern int Res_AddResource(const char *name, SInt16 rsrcid, const char **strings); +extern const char *Res_GetResource(SInt16 rsrcid, SInt16 index); +extern void Res_Cleanup(); + +/********************************/ +/* TextUtils */ +extern StringPtr c2pstr(char *s); +extern char *p2cstr(StringPtr s); +extern SInt16 CharacterByteType(Ptr textBuf, SInt16 textOffset, ScriptCode script); +extern SInt16 CharByte(); +extern void GetDateTime(UInt32 *secs); +extern Boolean EqualString(ConstStr255Param strA, ConstStr255Param strB, Boolean caseSens, Boolean diacSens); +extern void GetIndString(Str255 theString, SInt16 strListID, SInt16 index); +extern char *getindstring(char *theString, SInt16 strListID, SInt16 index); +extern void NumToString(SInt32 theNum, Str255 theString); +extern void StringToNum(ConstStr255Param theString, SInt32 *theNum); + +#ifdef __cplusplus +} +#endif |