classic mac os
Some checks failed
pyrite-dev/milsko/pipeline/head There was a failure building this commit
Some checks failed
pyrite-dev/milsko/pipeline/head There was a failure building this commit
This commit is contained in:
parent
6f9b3c12a7
commit
5315f4ec4d
34 changed files with 369 additions and 51 deletions
|
|
@ -6,6 +6,10 @@ typedef struct dir {
|
|||
WIN32_FIND_DATA ffd;
|
||||
int next;
|
||||
} dir_t;
|
||||
#elif defined(CLASSIC_MAC_OS)
|
||||
typedef struct dir {
|
||||
int dummy;
|
||||
} dir_t;
|
||||
#else
|
||||
typedef struct dir {
|
||||
DIR* dir;
|
||||
|
|
@ -31,6 +35,8 @@ void* MwDirectoryOpen(const char* path) {
|
|||
}
|
||||
free(p);
|
||||
dir->next = 1;
|
||||
#elif defined(CLASSIC_MAC_OS)
|
||||
/* todo */
|
||||
#else
|
||||
if((dir->dir = opendir(path)) == NULL) {
|
||||
free(dir);
|
||||
|
|
@ -47,6 +53,8 @@ void MwDirectoryClose(void* handle) {
|
|||
dir_t* dir = handle;
|
||||
#ifdef _WIN32
|
||||
FindClose(dir->hFind);
|
||||
#elif defined(CLASSIC_MAC_OS)
|
||||
/* todo */
|
||||
#else
|
||||
closedir(dir->dir);
|
||||
free(dir->base);
|
||||
|
|
@ -80,6 +88,8 @@ MwDirectoryEntry* MwDirectoryRead(void* handle) {
|
|||
entry->mtime = l->QuadPart / 10000000 - 11644473600;
|
||||
|
||||
dir->next = FindNextFile(dir->hFind, &dir->ffd);
|
||||
#elif defined(CLASSIC_MAC_OS)
|
||||
/* todo */
|
||||
#else
|
||||
struct dirent* d;
|
||||
struct stat s;
|
||||
|
|
@ -123,6 +133,8 @@ char* MwDirectoryCurrent(void) {
|
|||
GetCurrentDirectory(len, out);
|
||||
|
||||
return out;
|
||||
#elif CLASSIC_MAC_OS
|
||||
return "";
|
||||
#else
|
||||
return getcwd(NULL, 0);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -12,6 +12,36 @@ void* MwDynamicSymbol(void* handle, const char* symbol) {
|
|||
void MwDynamicClose(void* handle) {
|
||||
FreeLibrary(handle);
|
||||
}
|
||||
#elif defined(CLASSIC_MAC_OS)
|
||||
void* MwDynamicOpen(const char* path) {
|
||||
CFragConnectionID connID;
|
||||
Ptr* addr;
|
||||
unsigned char err[255];
|
||||
|
||||
if(GetSharedLibrary((ConstStr63Param)path, kPowerPCCFragArch, kPrivateCFragCopy,
|
||||
&connID, addr, err)) {
|
||||
printf("Error getting %s: %s\n", path, err);
|
||||
return NULL;
|
||||
};
|
||||
return connID;
|
||||
}
|
||||
|
||||
void* MwDynamicSymbol(void* handle, const char* symbol) {
|
||||
CFragConnectionID connID = (CFragConnectionID)handle;
|
||||
Ptr* symAddr;
|
||||
CFragSymbolClass* symClass;
|
||||
OSErr err;
|
||||
if((err = FindSymbol(connID, (ConstStr63Param)symbol, symAddr, symClass))) {
|
||||
printf("Error getting %s: %d\n", symbol, err);
|
||||
return NULL;
|
||||
};
|
||||
return symAddr;
|
||||
}
|
||||
|
||||
void MwDynamicClose(void* handle) {
|
||||
CFragConnectionID connID = (CFragConnectionID)handle;
|
||||
CloseConnection(&connID);
|
||||
}
|
||||
#elif defined(__unix__) || defined(__APPLE__)
|
||||
void* MwDynamicOpen(const char* path) {
|
||||
return dlopen(path, RTLD_LOCAL | RTLD_LAZY);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,27 @@ void MwTimeSleep(int ms) {
|
|||
|
||||
nanosleep(&ts, NULL);
|
||||
}
|
||||
#elif defined(CLASSIC_MAC_OS)
|
||||
static TMTask tm;
|
||||
static int timer;
|
||||
void timerUpdateFunc(void) {
|
||||
timer += 1;
|
||||
PrimeTime((QElemPtr)&tm, 1);
|
||||
};
|
||||
|
||||
long MwTimeGetTick(void) {
|
||||
UnsignedWide h;
|
||||
Microseconds(&h);
|
||||
return *(long*)&h;
|
||||
}
|
||||
void MwTimeSleep(int ms) {
|
||||
tm.tmAddr = NewTimerProc(timerUpdateFunc);
|
||||
tm.tmWakeUp = 0;
|
||||
tm.tmReserved = 0;
|
||||
|
||||
InsTime((QElemPtr)&tm);
|
||||
PrimeTime((QElemPtr)&tm, 1);
|
||||
}
|
||||
#elif defined(__unix__)
|
||||
long MwTimeGetTick(void) {
|
||||
struct timespec ts;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue