summaryrefslogtreecommitdiff
path: root/includes/macemul.h
blob: ac52e0a00d83d717bf148ea154d8cb6139486540 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
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(void);
extern UInt32 LMGetTime(void);
extern OSErr LMGetMemErr(void);
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(void);
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(void);
extern struct Zone *ApplicationZone(void);

/********************************/
/* Resources */
extern Boolean OS_UsingMacResourceForkInfo(void);
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(void);
extern OSErr ResError(void);
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 *spec, SInt8 permission);
extern SInt16 HOpenResFile(SInt16 vRefNum, SInt32 dirID, ConstStringPtr fileName, SInt8 permission);
extern SInt16 CurResFile(void);
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(void);
extern void Get1IndType(OSType *theType, SInt16 index);
extern void ReleaseResource(Handle theResource);
extern void DetachResource(Handle theResource);
extern void RemoveResource(Handle theResource);
extern void CloseResFile(SInt16 refNum);
extern SInt16 GetResFileAttrs(SInt16);
extern Boolean LMGetResLoad(void);

/********************************/
/* ResourceStrings */
extern void Res_Initialize(void);
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(void);

/********************************/
/* TextUtils */
extern StringPtr c2pstr(char *s);
extern char *p2cstr(StringPtr s);
extern SInt16 CharacterByteType(Ptr textBuf, SInt16 textOffset, ScriptCode script);
extern SInt16 CharByte(void);
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