[Python-checkins] CVS: python/dist/src/Mac/Modules macosmodule.c,1.55,1.56 macfsmodule.c,1.41,1.42
Jack Jansen
jackjansen@users.sourceforge.net
2001年8月08日 06:46:52 -0700
Update of /cvsroot/python/python/dist/src/Mac/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv26235
Modified Files:
macosmodule.c macfsmodule.c
Log Message:
- Don't return mac-style pathnames in unix-Python.
- Fixed up a lot more prototypes (gcc also wants them on static routines)
- Fixed various other gcc warnings.
Index: macosmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macosmodule.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -C2 -d -r1.55 -r1.56
*** macosmodule.c 2001年05月19日 12:50:05 1.55
--- macosmodule.c 2001年08月08日 13:46:49 1.56
***************
*** 45,50 ****
#endif
- static PyObject *ErrorObject;
-
/* ----------------------------------------------------- */
--- 45,48 ----
***************
*** 64,69 ****
static void
! do_close(self)
! rfobject *self;
{
if (self->isclosed ) return;
--- 62,66 ----
static void
! do_close(rfobject *self)
{
if (self->isclosed ) return;
***************
*** 77,83 ****
static PyObject *
! rf_read(self, args)
! rfobject *self;
! PyObject *args;
{
long n;
--- 74,78 ----
static PyObject *
! rf_read(rfobject *self, PyObject *args)
{
long n;
***************
*** 113,119 ****
static PyObject *
! rf_write(self, args)
! rfobject *self;
! PyObject *args;
{
char *buffer;
--- 108,112 ----
static PyObject *
! rf_write(rfobject *self, PyObject *args)
{
char *buffer;
***************
*** 142,148 ****
static PyObject *
! rf_seek(self, args)
! rfobject *self;
! PyObject *args;
{
long amount, pos;
--- 135,139 ----
static PyObject *
! rf_seek(rfobject *self, PyObject *args)
{
long amount, pos;
***************
*** 158,167 ****
return NULL;
! if ( err = GetEOF(self->fRefNum, &eof))
goto ioerr;
switch (whence) {
case SEEK_CUR:
! if (err = GetFPos(self->fRefNum, &pos))
goto ioerr;
break;
--- 149,158 ----
return NULL;
! if ((err = GetEOF(self->fRefNum, &eof)))
goto ioerr;
switch (whence) {
case SEEK_CUR:
! if ((err = GetFPos(self->fRefNum, &pos)))
goto ioerr;
break;
***************
*** 185,189 ****
}
! if ( err = SetFPos(self->fRefNum, fsFromStart, pos) ) {
ioerr:
PyMac_Error(err);
--- 176,180 ----
}
! if ((err = SetFPos(self->fRefNum, fsFromStart, pos)) ) {
ioerr:
PyMac_Error(err);
***************
*** 200,206 ****
static PyObject *
! rf_tell(self, args)
! rfobject *self;
! PyObject *args;
{
long where;
--- 191,195 ----
static PyObject *
! rf_tell(rfobject *self, PyObject *args)
{
long where;
***************
*** 213,217 ****
if (!PyArg_ParseTuple(args, ""))
return NULL;
! if ( err = GetFPos(self->fRefNum, &where) ) {
PyMac_Error(err);
return NULL;
--- 202,206 ----
if (!PyArg_ParseTuple(args, ""))
return NULL;
! if ((err = GetFPos(self->fRefNum, &where)) ) {
PyMac_Error(err);
return NULL;
***************
*** 225,231 ****
static PyObject *
! rf_close(self, args)
! rfobject *self;
! PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
--- 214,218 ----
static PyObject *
! rf_close(rfobject *self, PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
***************
*** 238,246 ****
static struct PyMethodDef rf_methods[] = {
! {"read", rf_read, 1, rf_read__doc__},
! {"write", rf_write, 1, rf_write__doc__},
! {"seek", rf_seek, 1, rf_seek__doc__},
! {"tell", rf_tell, 1, rf_tell__doc__},
! {"close", rf_close, 1, rf_close__doc__},
{NULL, NULL} /* sentinel */
--- 225,233 ----
static struct PyMethodDef rf_methods[] = {
! {"read", (PyCFunction)rf_read, 1, rf_read__doc__},
! {"write", (PyCFunction)rf_write, 1, rf_write__doc__},
! {"seek", (PyCFunction)rf_seek, 1, rf_seek__doc__},
! {"tell", (PyCFunction)rf_tell, 1, rf_tell__doc__},
! {"close", (PyCFunction)rf_close, 1, rf_close__doc__},
{NULL, NULL} /* sentinel */
***************
*** 251,255 ****
static rfobject *
! newrfobject()
{
rfobject *self;
--- 238,242 ----
static rfobject *
! newrfobject(void)
{
rfobject *self;
***************
*** 264,269 ****
static void
! rf_dealloc(self)
! rfobject *self;
{
do_close(self);
--- 251,255 ----
static void
! rf_dealloc(rfobject *self)
{
do_close(self);
***************
*** 272,278 ****
static PyObject *
! rf_getattr(self, name)
! rfobject *self;
! char *name;
{
return Py_FindMethod(rf_methods, (PyObject *)self, name);
--- 258,262 ----
static PyObject *
! rf_getattr(rfobject *self, char *name)
{
return Py_FindMethod(rf_methods, (PyObject *)self, name);
***************
*** 458,464 ****
static PyObject *
! MacOS_SetEventHandler(self, args)
! PyObject *self;
! PyObject *args;
{
PyObject *evh = NULL;
--- 442,446 ----
static PyObject *
! MacOS_SetEventHandler(PyObject *self, PyObject *args)
{
PyObject *evh = NULL;
***************
*** 615,618 ****
--- 597,601 ----
err = HOpenRF(fss.vRefNum, fss.parID, fss.name, permission, &fp->fRefNum);
+ #if !TARGET_API_MAC_OSX
if ( err == fnfErr ) {
/* In stead of doing complicated things here to get creator/type
***************
*** 636,639 ****
--- 619,623 ----
err = HOpenRF(fss.vRefNum, fss.parID, fss.name, permission, &fp->fRefNum);
}
+ #endif
if ( err ) {
Py_DECREF(fp);
***************
*** 743,747 ****
void
! initMacOS()
{
PyObject *m, *d;
--- 727,731 ----
void
! initMacOS(void)
{
PyObject *m, *d;
***************
*** 770,776 ****
--- 754,762 ----
return;
}
+ #if !TARGET_API_MAC_OSX
if (PyDict_SetItemString(d, "AppearanceCompliant",
Py_BuildValue("i", PyMac_AppearanceCompliant)) != 0)
return;
+ #endif
#if TARGET_API_MAC_OSX
#define PY_RUNTIMEMODEL "macho"
Index: macfsmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macfsmodule.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** macfsmodule.c 2001年08月07日 15:28:52 1.41
--- macfsmodule.c 2001年08月08日 13:46:49 1.42
***************
*** 102,108 ****
static PyObject *
! mfsa_Resolve(self, args)
! mfsaobject *self;
! PyObject *args;
{
FSSpec from, *fromp, result;
--- 102,106 ----
static PyObject *
! mfsa_Resolve(mfsaobject *self, PyObject *args)
{
FSSpec from, *fromp, result;
***************
*** 126,132 ****
static PyObject *
! mfsa_GetInfo(self, args)
! mfsaobject *self;
! PyObject *args;
{
Str63 value;
--- 124,128 ----
static PyObject *
! mfsa_GetInfo(mfsaobject *self, PyObject *args)
{
Str63 value;
***************
*** 145,151 ****
static PyObject *
! mfsa_Update(self, args)
! mfsaobject *self;
! PyObject *args;
{
FSSpec target, fromfile, *fromfilep;
--- 141,145 ----
static PyObject *
! mfsa_Update(mfsaobject *self, PyObject *args)
{
FSSpec target, fromfile, *fromfilep;
***************
*** 180,186 ****
static PyObject *
! mfsa_getattr(self, name)
! mfsaobject *self;
! char *name;
{
if ( strcmp(name, "data") == 0 ) {
--- 174,178 ----
static PyObject *
! mfsa_getattr(mfsaobject *self, char *name)
{
if ( strcmp(name, "data") == 0 ) {
***************
*** 211,216 ****
static void
! mfsa_dealloc(self)
! mfsaobject *self;
{
#if 0
--- 203,207 ----
static void
! mfsa_dealloc(mfsaobject *self)
{
#if 0
***************
*** 255,259 ****
static mfsiobject *
! newmfsiobject()
{
mfsiobject *self;
--- 246,250 ----
static mfsiobject *
! newmfsiobject(void)
{
mfsiobject *self;
***************
*** 267,272 ****
static void
! mfsi_dealloc(self)
! mfsiobject *self;
{
PyMem_DEL(self);
--- 258,262 ----
static void
! mfsi_dealloc(mfsiobject *self)
{
PyMem_DEL(self);
***************
*** 274,280 ****
static PyObject *
! mfsi_getattr(self, name)
! mfsiobject *self;
! char *name;
{
if ( strcmp(name, "Type") == 0 )
--- 264,268 ----
static PyObject *
! mfsi_getattr(mfsiobject *self, char *name)
{
if ( strcmp(name, "Type") == 0 )
***************
*** 294,301 ****
static int
! mfsi_setattr(self, name, v)
! mfsiobject *self;
! char *name;
! PyObject *v;
{
int rv;
--- 282,286 ----
static int
! mfsi_setattr(mfsiobject *self, char *name, PyObject *v)
{
int rv;
***************
*** 414,420 ****
*/
static OSErr
! PyMac_GetFileDates(fss, crdat, mddat, bkdat)
! FSSpec *fss;
! unsigned long *crdat, *mddat, *bkdat;
{
CInfoPBRec pb;
--- 399,404 ----
*/
static OSErr
! PyMac_GetFileDates(FSSpec *fss, unsigned long *crdat, unsigned long *mddat,
! unsigned long *bkdat)
{
CInfoPBRec pb;
***************
*** 434,440 ****
static OSErr
! PyMac_SetFileDates(fss, crdat, mddat, bkdat)
! FSSpec *fss;
! unsigned long crdat, mddat, bkdat;
{
CInfoPBRec pb;
--- 418,423 ----
static OSErr
! PyMac_SetFileDates(FSSpec *fss, unsigned long crdat, unsigned long mddat,
! unsigned long bkdat)
{
CInfoPBRec pb;
***************
*** 459,466 ****
static PyObject *
! mfss_as_pathname(self, args)
! mfssobject *self;
! PyObject *args;
{
char strbuf[257];
OSErr err;
--- 442,451 ----
static PyObject *
! mfss_as_pathname(mfssobject *self, PyObject *args)
{
+ #if TARGET_API_MAC_OSX
+ PyErr_SetString(PyExc_NotImplementedError, "FSSpec.as_pathname not supported on this platform");
+ return 0;
+ #else
char strbuf[257];
OSErr err;
***************
*** 474,483 ****
}
return PyString_FromString(strbuf);
}
static PyObject *
! mfss_as_tuple(self, args)
! mfssobject *self;
! PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
--- 459,467 ----
}
return PyString_FromString(strbuf);
+ #endif
}
static PyObject *
! mfss_as_tuple(mfssobject *self, PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
***************
*** 488,494 ****
static PyObject *
! mfss_NewAlias(self, args)
! mfssobject *self;
! PyObject *args;
{
FSSpec src, *srcp;
--- 472,476 ----
static PyObject *
! mfss_NewAlias(mfssobject *self, PyObject *args)
{
FSSpec src, *srcp;
***************
*** 513,519 ****
static PyObject *
! mfss_NewAliasMinimal(self, args)
! mfssobject *self;
! PyObject *args;
{
OSErr err;
--- 495,499 ----
static PyObject *
! mfss_NewAliasMinimal(mfssobject *self, PyObject *args)
{
OSErr err;
***************
*** 531,537 ****
static PyObject *
! mfss_FSpMakeFSRef(self, args)
! mfssobject *self;
! PyObject *args;
{
#if TARGET_API_MAC_OS8
--- 511,515 ----
static PyObject *
! mfss_FSpMakeFSRef(mfssobject *self, PyObject *args)
{
#if TARGET_API_MAC_OS8
***************
*** 555,561 ****
/* XXXX These routines should be replaced by a wrapper to the *FInfo routines */
static PyObject *
! mfss_GetCreatorType(self, args)
! mfssobject *self;
! PyObject *args;
{
OSErr err;
--- 533,537 ----
/* XXXX These routines should be replaced by a wrapper to the *FInfo routines */
static PyObject *
! mfss_GetCreatorType(mfssobject *self, PyObject *args)
{
OSErr err;
***************
*** 574,580 ****
static PyObject *
! mfss_SetCreatorType(self, args)
! mfssobject *self;
! PyObject *args;
{
OSErr err;
--- 550,554 ----
static PyObject *
! mfss_SetCreatorType(mfssobject *self, PyObject *args)
{
OSErr err;
***************
*** 601,607 ****
static PyObject *
! mfss_GetFInfo(self, args)
! mfssobject *self;
! PyObject *args;
{
OSErr err;
--- 575,579 ----
static PyObject *
! mfss_GetFInfo(mfssobject *self, PyObject *args)
{
OSErr err;
***************
*** 623,629 ****
static PyObject *
! mfss_SetFInfo(self, args)
! mfssobject *self;
! PyObject *args;
{
OSErr err;
--- 595,599 ----
static PyObject *
! mfss_SetFInfo(mfssobject *self, PyObject *args)
{
OSErr err;
***************
*** 642,648 ****
static PyObject *
! mfss_GetDates(self, args)
! mfssobject *self;
! PyObject *args;
{
OSErr err;
--- 612,616 ----
static PyObject *
! mfss_GetDates(mfssobject *self, PyObject *args)
{
OSErr err;
***************
*** 660,666 ****
static PyObject *
! mfss_SetDates(self, args)
! mfssobject *self;
! PyObject *args;
{
OSErr err;
--- 628,632 ----
static PyObject *
! mfss_SetDates(mfssobject *self, PyObject *args)
{
OSErr err;
***************
*** 699,705 ****
static PyObject *
! mfss_getattr(self, name)
! mfssobject *self;
! char *name;
{
if ( strcmp(name, "data") == 0)
--- 665,669 ----
static PyObject *
! mfss_getattr(mfssobject *self, char *name)
{
if ( strcmp(name, "data") == 0)
***************
*** 709,714 ****
mfssobject *
! newmfssobject(fss)
! FSSpec *fss;
{
mfssobject *self;
--- 673,677 ----
mfssobject *
! newmfssobject(FSSpec *fss)
{
mfssobject *self;
***************
*** 722,727 ****
static void
! mfss_dealloc(self)
! mfssobject *self;
{
PyMem_DEL(self);
--- 685,689 ----
static void
! mfss_dealloc(mfssobject *self)
{
PyMem_DEL(self);
***************
*** 729,738 ****
static PyObject *
! mfss_repr(self)
! mfssobject *self;
{
char buf[512];
! sprintf(buf, "FSSpec((%d, %d, '%.*s'))",
self->fsspec.vRefNum,
self->fsspec.parID,
--- 691,699 ----
static PyObject *
! mfss_repr(mfssobject *self)
{
char buf[512];
! sprintf(buf, "FSSpec((%d, %ld, '%.*s'))",
self->fsspec.vRefNum,
self->fsspec.parID,
***************
*** 742,747 ****
static int
! mfss_compare(v, w)
! mfssobject *v, *w;
{
int minlen;
--- 703,707 ----
static int
! mfss_compare(mfssobject *v, mfssobject *w)
{
int minlen;
***************
*** 784,790 ****
#if !TARGET_API_MAC_OS8
static PyObject *
! mfsr_as_fsspec(self, args)
! mfsrobject *self;
! PyObject *args;
{
OSErr err;
--- 744,748 ----
#if !TARGET_API_MAC_OS8
static PyObject *
! mfsr_as_fsspec(mfsrobject *self, PyObject *args)
{
OSErr err;
***************
*** 823,829 ****
static PyObject *
! mfsr_getattr(self, name)
! mfsrobject *self;
! char *name;
{
if ( strcmp(name, "data") == 0)
--- 781,785 ----
static PyObject *
! mfsr_getattr(mfsrobject *self, char *name)
{
if ( strcmp(name, "data") == 0)
***************
*** 833,838 ****
mfsrobject *
! newmfsrobject(fsr)
! FSRef *fsr;
{
mfsrobject *self;
--- 789,793 ----
mfsrobject *
! newmfsrobject(FSRef *fsr)
{
mfsrobject *self;
***************
*** 846,851 ****
static int
! mfsr_compare(v, w)
! mfsrobject *v, *w;
{
OSErr err;
--- 801,805 ----
static int
! mfsr_compare(mfsrobject *v, mfsrobject *w)
{
OSErr err;
***************
*** 861,866 ****
static void
! mfsr_dealloc(self)
! mfsrobject *self;
{
PyMem_DEL(self);
--- 815,819 ----
static void
! mfsr_dealloc(mfsrobject *self)
{
PyMem_DEL(self);
***************
*** 891,897 ****
static PyObject *
! mfs_ResolveAliasFile(self, args)
! PyObject *self; /* Not used */
! PyObject *args;
{
FSSpec fss;
--- 844,848 ----
static PyObject *
! mfs_ResolveAliasFile(PyObject *self, PyObject *args)
{
FSSpec fss;
***************
*** 911,917 ****
#if !TARGET_API_MAC_CARBON
static PyObject *
! mfs_StandardGetFile(self, args)
! PyObject *self; /* Not used */
! PyObject *args;
{
SFTypeList list;
--- 862,866 ----
#if !TARGET_API_MAC_CARBON
static PyObject *
! mfs_StandardGetFile(PyObject *self, PyObject *args)
{
SFTypeList list;
***************
*** 935,941 ****
static PyObject *
! mfs_PromptGetFile(self, args)
! PyObject *self; /* Not used */
! PyObject *args;
{
SFTypeList list;
--- 884,888 ----
static PyObject *
! mfs_PromptGetFile(PyObject *self, PyObject *args)
{
SFTypeList list;
***************
*** 960,966 ****
static PyObject *
! mfs_StandardPutFile(self, args)
! PyObject *self; /* Not used */
! PyObject *args;
{
Str255 prompt, dft;
--- 907,911 ----
static PyObject *
! mfs_StandardPutFile(PyObject *self, PyObject *args)
{
Str255 prompt, dft;
***************
*** 977,983 ****
** Set initial directory for file dialogs */
static PyObject *
! mfs_SetFolder(self, args)
! PyObject *self;
! PyObject *args;
{
FSSpec spec;
--- 922,926 ----
** Set initial directory for file dialogs */
static PyObject *
! mfs_SetFolder(PyObject *self, PyObject *args)
{
FSSpec spec;
***************
*** 1003,1009 ****
static PyObject *
! mfs_FSSpec(self, args)
! PyObject *self; /* Not used */
! PyObject *args;
{
FSSpec fss;
--- 946,950 ----
static PyObject *
! mfs_FSSpec(PyObject *self, PyObject *args)
{
FSSpec fss;
***************
*** 1015,1021 ****
static PyObject *
! mfs_FSRef(self, args)
! PyObject *self; /* Not used */
! PyObject *args;
{
#if TARGET_API_MAC_OS8
--- 956,960 ----
static PyObject *
! mfs_FSRef(PyObject *self, PyObject *args)
{
#if TARGET_API_MAC_OS8
***************
*** 1032,1038 ****
static PyObject *
! mfs_RawFSSpec(self, args)
! PyObject *self; /* Not used */
! PyObject *args;
{
FSSpec *fssp;
--- 971,975 ----
static PyObject *
! mfs_RawFSSpec(PyObject *self, PyObject *args)
{
FSSpec *fssp;
***************
*** 1049,1055 ****
static PyObject *
! mfs_RawAlias(self, args)
! PyObject *self; /* Not used */
! PyObject *args;
{
char *dataptr;
--- 986,990 ----
static PyObject *
! mfs_RawAlias(PyObject *self, PyObject *args)
{
char *dataptr;
***************
*** 1072,1078 ****
#if !TARGET_API_MAC_CARBON
static PyObject *
! mfs_GetDirectory(self, args)
! PyObject *self; /* Not used */
! PyObject *args;
{
FSSpec fsdir;
--- 1007,1011 ----
#if !TARGET_API_MAC_CARBON
static PyObject *
! mfs_GetDirectory(PyObject *self, PyObject *args)
{
FSSpec fsdir;
***************
*** 1089,1095 ****
static PyObject *
! mfs_FindFolder(self, args)
! PyObject *self; /* Not used */
! PyObject *args;
{
OSErr err;
--- 1022,1026 ----
static PyObject *
! mfs_FindFolder(PyObject *self, PyObject *args)
{
OSErr err;
***************
*** 1111,1117 ****
static PyObject *
! mfs_FindApplication(self, args)
! PyObject *self; /* Not used */
! PyObject *args;
{
OSErr err;
--- 1042,1046 ----
static PyObject *
! mfs_FindApplication(PyObject *self, PyObject *args)
{
OSErr err;
***************
*** 1130,1136 ****
static PyObject *
! mfs_FInfo(self, args)
! PyObject *self;
! PyObject *args;
{
return (PyObject *)newmfsiobject();
--- 1059,1063 ----
static PyObject *
! mfs_FInfo(PyObject *self, PyObject *args)
{
return (PyObject *)newmfsiobject();
***************
*** 1138,1144 ****
static PyObject *
! mfs_NewAliasMinimalFromFullPath(self, args)
! PyObject *self; /* Not used */
! PyObject *args;
{
OSErr err;
--- 1065,1069 ----
static PyObject *
! mfs_NewAliasMinimalFromFullPath(PyObject *self, PyObject *args)
{
OSErr err;
***************
*** 1278,1282 ****
void
! initmacfs()
{
PyObject *m, *d;
--- 1203,1207 ----
void
! initmacfs(void)
{
PyObject *m, *d;