Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2d16703

Browse files
committed
gestaltmodule.c: interface to Gestalt Manager.
macosmodule.c: interface to random collection of Managers. macsetfiletype.c: set file type, for import.c.
1 parent bf677ed commit 2d16703

3 files changed

Lines changed: 475 additions & 0 deletions

File tree

Mac/Modules/gestaltmodule.c

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/* Macintosh Gestalt interface */
2+
3+
#include "allobjects.h"
4+
#include "modsupport.h"
5+
6+
#include <Types.h>
7+
#include <GestaltEqu.h>
8+
9+
static object *
10+
gestalt_gestalt(self, args)
11+
object *self;
12+
object *args;
13+
{
14+
OSErr iErr;
15+
char *str;
16+
int size;
17+
OSType selector;
18+
long response;
19+
if (!getargs(args, "s#", &str, &size))
20+
return NULL;
21+
if (size != 4) {
22+
err_setstr(TypeError, "gestalt arg must be 4-char string");
23+
return NULL;
24+
}
25+
selector = *(OSType*)str;
26+
iErr = Gestalt ( selector, &response );
27+
if (iErr != 0) {
28+
char buf[100];
29+
sprintf(buf, "Gestalt error code %d", iErr);
30+
err_setstr(RuntimeError, buf);
31+
return NULL;
32+
}
33+
return newintobject(response);
34+
}
35+
36+
static struct methodlist gestalt_methods[] = {
37+
{"gestalt", gestalt_gestalt},
38+
{NULL, NULL} /* Sentinel */
39+
};
40+
41+
void
42+
initgestalt()
43+
{
44+
initmodule("gestalt", gestalt_methods);
45+
}

0 commit comments

Comments
 (0)