summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-01-21 13:46:04 (GMT)
committerGuido van Rossum <guido@python.org>1995-01-21 13:46:04 (GMT)
commit9aa3d1370eafa5f5a62eba73585ea6932b169821 (patch)
tree5ceeb49df67b5cd61574e082b5c97e4a9216fc55 /Mac
parent796b259a1cc402711c530c996be94cef13c4e350 (diff)
downloadcpython-9aa3d1370eafa5f5a62eba73585ea6932b169821.zip
cpython-9aa3d1370eafa5f5a62eba73585ea6932b169821.tar.gz
cpython-9aa3d1370eafa5f5a62eba73585ea6932b169821.tar.bz2
renamed Get routines to PyMac_Get; added macfs to config.c
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Include/macglue.h4
-rw-r--r--Mac/Modules/config.c4
-rw-r--r--Mac/Modules/macfsmodule.c8
-rw-r--r--Mac/Modules/macosmodule.c8
-rw-r--r--Mac/Python/macglue.c13
5 files changed, 17 insertions, 20 deletions
diff --git a/Mac/Include/macglue.h b/Mac/Include/macglue.h
index 89d10d1..e5c4014 100644
--- a/Mac/Include/macglue.h
+++ b/Mac/Include/macglue.h
@@ -10,7 +10,3 @@ int PyMac_GetStr255 Py_PROTO((PyObject *, Str255)); /* argument parser for Str25
int PyMac_GetFSSpec Py_PROTO((PyObject *, FSSpec *)); /* argument parser for FSSpec */
PyObject *PyMac_BuildFSSpec Py_PROTO((FSSpec *)); /* Convert FSSpec to PyObject */
PyObject *PyMac_BuildOSType Py_PROTO((OSType)); /* Convert OSType to PyObject */
-
-#define GetOSType PyMac_GetOSType
-#define GetStr255 PyMac_GetStr255
-#define GetFSSpec PyMac_GetFSSpec
diff --git a/Mac/Modules/config.c b/Mac/Modules/config.c
index b1b7779..e7418eb 100644
--- a/Mac/Modules/config.c
+++ b/Mac/Modules/config.c
@@ -261,10 +261,9 @@ extern void initnew();
extern void initdl();
extern void initsyslog();
extern void initgestalt();
-#ifdef THINK_C
extern void initmacconsole();
-#endif
extern void initctb();
+extern void initmacfs();
extern void initmacspeech();
extern void initmacdnr();
extern void initmactcp();
@@ -302,6 +301,7 @@ struct {
{"macconsole", initmacconsole},
#endif
{"ctb", initctb},
+ {"macfs", initmacfs},
#ifdef __MWERKS__
/* This is really "Jack Jansen" specific for now :-) */
{"macspeech", initmacspeech},
diff --git a/Mac/Modules/macfsmodule.c b/Mac/Modules/macfsmodule.c
index 014ff6b..3ef337f 100644
--- a/Mac/Modules/macfsmodule.c
+++ b/Mac/Modules/macfsmodule.c
@@ -48,7 +48,7 @@ mfs_NewAlias(self, args)
FSSpec src, dst, *dstptr;
src.name[0] = 0;
- if (!newgetargs(args, "O&|O&", GetFSSpec, &dst, GetFSSpec, &src))
+ if (!newgetargs(args, "O&|O&", PyMac_GetFSSpec, &dst, PyMac_GetFSSpec, &src))
return NULL;
/* XXXX */
@@ -90,7 +90,7 @@ mfs_StandardPutFile(self, args)
StandardFileReply reply;
dft[0] = 0;
- if (!newgetargs(args, "O&|O&", GetStr255, &prompt, GetStr255, &dft) )
+ if (!newgetargs(args, "O&|O&", PyMac_GetStr255, &prompt, PyMac_GetStr255, &dft) )
return NULL;
StandardPutFile(prompt, dft, &reply);
return mkvalue("(iO)", reply.sfGood, PyMac_BuildFSSpec(&reply.sfFile));
@@ -126,7 +126,7 @@ mfs_FSSpecNormalize(self, args)
{
FSSpec fss;
- if (!newgetargs(args, "O&", GetFSSpec, &fss))
+ if (!newgetargs(args, "O&", PyMac_GetFSSpec, &fss))
return NULL;
return PyMac_BuildFSSpec(&fss);
}
@@ -140,7 +140,7 @@ mfs_FSSpecPath(self, args)
char strbuf[257];
OSErr err;
- if (!newgetargs(args, "O&", GetFSSpec, &fss))
+ if (!newgetargs(args, "O&", PyMac_GetFSSpec, &fss))
return NULL;
err = nfullpath(&fss, strbuf);
if ( err ) {
diff --git a/Mac/Modules/macosmodule.c b/Mac/Modules/macosmodule.c
index 833ef42..215fd72 100644
--- a/Mac/Modules/macosmodule.c
+++ b/Mac/Modules/macosmodule.c
@@ -157,7 +157,7 @@ MacOS_GetResource(PyObject *self, PyObject *args)
ResType rt;
int id;
Handle h;
- if (!PyArg_ParseTuple(args, "O&i", GetOSType, &rt, &id))
+ if (!PyArg_ParseTuple(args, "O&i", PyMac_GetOSType, &rt, &id))
return NULL;
h = GetResource(rt, id);
return (PyObject *)Rsrc_FromHandle(h);
@@ -169,7 +169,7 @@ MacOS_GetNamedResource(PyObject *self, PyObject *args)
ResType rt;
Str255 name;
Handle h;
- if (!PyArg_ParseTuple(args, "O&O&", GetOSType, &rt, GetStr255, &name))
+ if (!PyArg_ParseTuple(args, "O&O&", PyMac_GetOSType, &rt, PyMac_GetStr255, &name))
return NULL;
h = GetNamedResource(rt, name);
return (PyObject *)Rsrc_FromHandle(h);
@@ -186,7 +186,7 @@ MacOS_GetFileType(PyObject *self, PyObject *args)
PyObject *type, *creator, *res;
OSErr err;
- if (!PyArg_ParseTuple(args, "O&", GetStr255, &name))
+ if (!PyArg_ParseTuple(args, "O&", PyMac_GetStr255, &name))
return NULL;
if ((err = GetFInfo(name, 0, &info)) != noErr) {
errno = err;
@@ -210,7 +210,7 @@ MacOS_SetFileType(PyObject *self, PyObject *args)
OSErr err;
if (!PyArg_ParseTuple(args, "O&O&O&",
- GetStr255, &name, GetOSType, &type, GetOSType, &creator))
+ PyMac_GetStr255, &name, PyMac_GetOSType, &type, PyMac_GetOSType, &creator))
return NULL;
if ((err = GetFInfo(name, 0, &info)) != noErr) {
errno = err;
diff --git a/Mac/Python/macglue.c b/Mac/Python/macglue.c
index 741e985..7767515 100644
--- a/Mac/Python/macglue.c
+++ b/Mac/Python/macglue.c
@@ -31,6 +31,8 @@ Pstring(char *str)
int len;
len = strlen(str);
+ if (len > 255)
+ len = 255;
buf[0] = (unsigned char)len;
strncpy((char *)buf+1, str, len);
return buf;
@@ -147,20 +149,19 @@ PyMac_GetFSSpec(PyObject *v, FSSpec *fs)
if ( PyString_Check(v) ) {
/* It's a pathname */
- if( !PyArg_Parse(v, "O&", GetStr255, &path) )
+ if( !PyArg_Parse(v, "O&", PyMac_GetStr255, &path) )
return 0;
refnum = 0; /* XXXX Should get CurWD here... */
parid = 0;
} else {
- PyErr_Clear();
- if( !PyArg_Parse(v, "(hlO&); FSSpec should be fullpath or (int,int,string)",
- &refnum, &parid, GetStr255, &path))
+ if( !PyArg_Parse(v, "(hlO&); FSSpec should be fullpath or (vrefnum,dirid,path)",
+ &refnum, &parid, PyMac_GetStr255, &path)) {
return 0;
+ }
}
err = FSMakeFSSpec(refnum, parid, path, fs);
if ( err && err != fnfErr ) {
- PyErr_SetString(PyExc_TypeError,
- "FSMakeFSSpec error");
+ PyErr_Mac(PyExc_ValueError, err);
return 0;
}
return 1;