1 /***********************************************************
2 Copyright 1991-1997 by Stichting Mathematisch Centrum, Amsterdam,
7 Permission to use, copy, modify, and distribute this software and its
8 documentation for any purpose and without fee is hereby granted,
9 provided that the above copyright notice appear in all copies and that
10 both that copyright notice and this permission notice appear in
11 supporting documentation, and that the names of Stichting Mathematisch
12 Centrum or CWI not be used in advertising or publicity pertaining to
13 distribution of the software without specific, written prior permission.
15 STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
16 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17 FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
18 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
20 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
21 OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 ******************************************************************/
31 #include <StandardFile.h>
35 #include "getapplbycreator.h"
37 /* Should this be in macglue.h? */
38 extern FSSpec
*mfs_GetFSSpecFSSpec(PyObject
*);
40 static PyObject
*ErrorObject
;
42 /* ----------------------------------------------------- */
43 /* Declarations for objects of type Alias */
50 staticforward PyTypeObject Mfsatype
;
52 #define is_mfsaobject(v) ((v)->ob_type == &Mfsatype)
54 /* ---------------------------------------------------------------- */
55 /* Declarations for objects of type FSSpec */
62 staticforward PyTypeObject Mfsstype
;
64 #define is_mfssobject(v) ((v)->ob_type == &Mfsstype)
67 /* ---------------------------------------------------------------- */
68 /* Declarations for objects of type FInfo */
75 staticforward PyTypeObject Mfsitype
;
77 #define is_mfsiobject(v) ((v)->ob_type == &Mfsitype)
80 mfssobject
*newmfssobject(FSSpec
*fss
); /* Forward */
82 /* ---------------------------------------------------------------- */
85 mfsa_Resolve(self
, args
)
89 FSSpec from
, *fromp
, result
;
94 if (!PyArg_ParseTuple(args
, "|O&", PyMac_GetFSSpec
, &from
))
100 err
= ResolveAlias(fromp
, self
->alias
, &result
, &changed
);
101 if ( err
&& err
!= fnfErr
) {
102 PyErr_Mac(ErrorObject
, err
);
105 return Py_BuildValue("(Oi)", newmfssobject(&result
), (int)changed
);
109 mfsa_GetInfo(self
, args
)
117 if (!PyArg_ParseTuple(args
, "i", &i
))
119 err
= GetAliasInfo(self
->alias
, (AliasInfoType
)i
, value
);
121 PyErr_Mac(ErrorObject
, err
);
124 return PyString_FromStringAndSize((char *)&value
[1], value
[0]);
128 mfsa_Update(self
, args
)
132 FSSpec target
, fromfile
, *fromfilep
;
136 fromfile
.name
[0] = 0;
137 if (!PyArg_ParseTuple(args
, "O&|O&", PyMac_GetFSSpec
, &target
,
138 PyMac_GetFSSpec
, &fromfile
))
140 if ( fromfile
.name
[0] )
141 fromfilep
= &fromfile
;
144 err
= UpdateAlias(fromfilep
, &target
, self
->alias
, &changed
);
146 PyErr_Mac(ErrorObject
, err
);
149 return Py_BuildValue("i", (int)changed
);
152 static struct PyMethodDef mfsa_methods
[] = {
153 {"Resolve", (PyCFunction
)mfsa_Resolve
, 1},
154 {"GetInfo", (PyCFunction
)mfsa_GetInfo
, 1},
155 {"Update", (PyCFunction
)mfsa_Update
, 1},
157 {NULL
, NULL
} /* sentinel */
163 mfsa_getattr(self
, name
)
167 if ( strcmp(name
, "data") == 0 ) {
171 size
= GetHandleSize((Handle
)self
->alias
);
172 HLock((Handle
)self
->alias
);
173 rv
= PyString_FromStringAndSize(*(Handle
)self
->alias
, size
);
174 HUnlock((Handle
)self
->alias
);
177 return Py_FindMethod(mfsa_methods
, (PyObject
*)self
, name
);
181 newmfsaobject(AliasHandle alias
)
185 self
= PyObject_NEW(mfsaobject
, &Mfsatype
);
199 should we
do something here
?
206 statichere PyTypeObject Mfsatype
= {
207 PyObject_HEAD_INIT(&PyType_Type
)
210 sizeof(mfsaobject
), /*tp_basicsize*/
213 (destructor
)mfsa_dealloc
, /*tp_dealloc*/
214 (printfunc
)0, /*tp_print*/
215 (getattrfunc
)mfsa_getattr
, /*tp_getattr*/
216 (setattrfunc
)0, /*tp_setattr*/
217 (cmpfunc
)0, /*tp_compare*/
218 (reprfunc
)0, /*tp_repr*/
220 0, /*tp_as_sequence*/
222 (hashfunc
)0, /*tp_hash*/
225 /* End of code for Alias objects */
226 /* -------------------------------------------------------- */
228 /* ---------------------------------------------------------------- */
230 static struct PyMethodDef mfsi_methods
[] = {
232 {NULL
, NULL
} /* sentinel */
242 self
= PyObject_NEW(mfsiobject
, &Mfsitype
);
245 memset((char *)&self
->finfo
, '\0', sizeof(self
->finfo
));
257 mfsi_getattr(self
, name
)
261 if ( strcmp(name
, "Type") == 0 )
262 return PyMac_BuildOSType(self
->finfo
.fdType
);
263 else if ( strcmp(name
, "Creator") == 0 )
264 return PyMac_BuildOSType(self
->finfo
.fdCreator
);
265 else if ( strcmp(name
, "Flags") == 0 )
266 return Py_BuildValue("i", (int)self
->finfo
.fdFlags
);
267 else if ( strcmp(name
, "Location") == 0 )
268 return PyMac_BuildPoint(self
->finfo
.fdLocation
);
269 else if ( strcmp(name
, "Fldr") == 0 )
270 return Py_BuildValue("i", (int)self
->finfo
.fdFldr
);
272 return Py_FindMethod(mfsi_methods
, (PyObject
*)self
, name
);
277 mfsi_setattr(self
, name
, v
)
286 PyErr_SetString(PyExc_AttributeError
, "Cannot delete attribute");
289 if ( strcmp(name
, "Type") == 0 )
290 rv
= PyMac_GetOSType(v
, &self
->finfo
.fdType
);
291 else if ( strcmp(name
, "Creator") == 0 )
292 rv
= PyMac_GetOSType(v
, &self
->finfo
.fdCreator
);
293 else if ( strcmp(name
, "Flags") == 0 ) {
294 rv
= PyArg_Parse(v
, "i", &i
);
295 self
->finfo
.fdFlags
= (short)i
;
296 } else if ( strcmp(name
, "Location") == 0 )
297 rv
= PyMac_GetPoint(v
, &self
->finfo
.fdLocation
);
298 else if ( strcmp(name
, "Fldr") == 0 ) {
299 rv
= PyArg_Parse(v
, "i", &i
);
300 self
->finfo
.fdFldr
= (short)i
;
302 PyErr_SetString(PyExc_AttributeError
, "No such attribute");
311 static PyTypeObject Mfsitype
= {
312 PyObject_HEAD_INIT(&PyType_Type
)
315 sizeof(mfsiobject
), /*tp_basicsize*/
318 (destructor
)mfsi_dealloc
, /*tp_dealloc*/
319 (printfunc
)0, /*tp_print*/
320 (getattrfunc
)mfsi_getattr
, /*tp_getattr*/
321 (setattrfunc
)mfsi_setattr
, /*tp_setattr*/
322 (cmpfunc
)0, /*tp_compare*/
323 (reprfunc
)0, /*tp_repr*/
325 0, /*tp_as_sequence*/
327 (hashfunc
)0, /*tp_hash*/
330 /* End of code for FInfo object objects */
331 /* -------------------------------------------------------- */
335 ** Helper routine for other modules: return an FSSpec * if the
336 ** object is a python fsspec object, else NULL
339 mfs_GetFSSpecFSSpec(PyObject
*self
)
341 if ( is_mfssobject(self
) )
342 return &((mfssobject
*)self
)->fsspec
;
347 ** Two generally useful routines
350 PyMac_GetFileDates(fss
, crdat
, mddat
, bkdat
)
352 unsigned long *crdat
, *mddat
, *bkdat
;
357 pb
.dirInfo
.ioNamePtr
= fss
->name
;
358 pb
.dirInfo
.ioFDirIndex
= 0;
359 pb
.dirInfo
.ioVRefNum
= fss
->vRefNum
;
360 pb
.dirInfo
.ioDrDirID
= fss
->parID
;
361 error
= PBGetCatInfoSync(&pb
);
362 if ( error
) return error
;
363 *crdat
= pb
.hFileInfo
.ioFlCrDat
;
364 *mddat
= pb
.hFileInfo
.ioFlMdDat
;
365 *bkdat
= pb
.hFileInfo
.ioFlBkDat
;
370 PyMac_SetFileDates(fss
, crdat
, mddat
, bkdat
)
372 unsigned long crdat
, mddat
, bkdat
;
377 pb
.dirInfo
.ioNamePtr
= fss
->name
;
378 pb
.dirInfo
.ioFDirIndex
= 0;
379 pb
.dirInfo
.ioVRefNum
= fss
->vRefNum
;
380 pb
.dirInfo
.ioDrDirID
= fss
->parID
;
381 error
= PBGetCatInfoSync(&pb
);
382 if ( error
) return error
;
383 pb
.dirInfo
.ioNamePtr
= fss
->name
;
384 pb
.dirInfo
.ioFDirIndex
= 0;
385 pb
.dirInfo
.ioVRefNum
= fss
->vRefNum
;
386 pb
.dirInfo
.ioDrDirID
= fss
->parID
;
387 pb
.hFileInfo
.ioFlCrDat
= crdat
;
388 pb
.hFileInfo
.ioFlMdDat
= mddat
;
389 pb
.hFileInfo
.ioFlBkDat
= bkdat
;
390 error
= PBSetCatInfoSync(&pb
);
395 mfss_as_pathname(self
, args
)
402 if (!PyArg_ParseTuple(args
, ""))
404 err
= PyMac_GetFullPath(&self
->fsspec
, strbuf
);
406 PyErr_Mac(ErrorObject
, err
);
409 return PyString_FromString(strbuf
);
413 mfss_as_tuple(self
, args
)
417 if (!PyArg_ParseTuple(args
, ""))
419 return Py_BuildValue("(iis#)", self
->fsspec
.vRefNum
, self
->fsspec
.parID
,
420 &self
->fsspec
.name
[1], self
->fsspec
.name
[0]);
424 mfss_NewAlias(self
, args
)
433 if (!PyArg_ParseTuple(args
, "|O&", PyMac_GetFSSpec
, &src
))
439 err
= NewAlias(srcp
, &self
->fsspec
, &alias
);
441 PyErr_Mac(ErrorObject
, err
);
445 return (PyObject
*)newmfsaobject(alias
);
449 mfss_NewAliasMinimal(self
, args
)
456 if (!PyArg_ParseTuple(args
, ""))
458 err
= NewAliasMinimal(&self
->fsspec
, &alias
);
460 PyErr_Mac(ErrorObject
, err
);
463 return (PyObject
*)newmfsaobject(alias
);
466 /* XXXX These routines should be replaced by a wrapper to the *FInfo routines */
468 mfss_GetCreatorType(self
, args
)
475 if (!PyArg_ParseTuple(args
, ""))
477 err
= FSpGetFInfo(&self
->fsspec
, &info
);
479 PyErr_Mac(ErrorObject
, err
);
482 return Py_BuildValue("(O&O&)",
483 PyMac_BuildOSType
, info
.fdCreator
, PyMac_BuildOSType
, info
.fdType
);
487 mfss_SetCreatorType(self
, args
)
492 OSType creator
, type
;
495 if (!PyArg_ParseTuple(args
, "O&O&", PyMac_GetOSType
, &creator
, PyMac_GetOSType
, &type
))
497 err
= FSpGetFInfo(&self
->fsspec
, &info
);
499 PyErr_Mac(ErrorObject
, err
);
503 info
.fdCreator
= creator
;
504 err
= FSpSetFInfo(&self
->fsspec
, &info
);
506 PyErr_Mac(ErrorObject
, err
);
514 mfss_GetFInfo(self
, args
)
522 if (!PyArg_ParseTuple(args
, ""))
524 if ( (fip
=newmfsiobject()) == NULL
)
526 err
= FSpGetFInfo(&self
->fsspec
, &fip
->finfo
);
528 PyErr_Mac(ErrorObject
, err
);
532 return (PyObject
*)fip
;
536 mfss_SetFInfo(self
, args
)
543 if (!PyArg_ParseTuple(args
, "O!", &Mfsitype
, &fip
))
545 err
= FSpSetFInfo(&self
->fsspec
, &fip
->finfo
);
547 PyErr_Mac(ErrorObject
, err
);
555 mfss_GetDates(self
, args
)
560 unsigned long crdat
, mddat
, bkdat
;
562 if (!PyArg_ParseTuple(args
, ""))
564 err
= PyMac_GetFileDates(&self
->fsspec
, &crdat
, &mddat
, &bkdat
);
566 PyErr_Mac(ErrorObject
, err
);
569 return Py_BuildValue("ddd", (double)crdat
, (double)mddat
, (double)bkdat
);
573 mfss_SetDates(self
, args
)
578 double crdat
, mddat
, bkdat
;
580 if (!PyArg_ParseTuple(args
, "ddd", &crdat
, &mddat
, &bkdat
))
582 err
= PyMac_SetFileDates(&self
->fsspec
, (unsigned long)crdat
,
583 (unsigned long)mddat
, (unsigned long)bkdat
);
585 PyErr_Mac(ErrorObject
, err
);
592 static struct PyMethodDef mfss_methods
[] = {
593 {"as_pathname", (PyCFunction
)mfss_as_pathname
, 1},
594 {"as_tuple", (PyCFunction
)mfss_as_tuple
, 1},
595 {"NewAlias", (PyCFunction
)mfss_NewAlias
, 1},
596 {"NewAliasMinimal", (PyCFunction
)mfss_NewAliasMinimal
, 1},
597 {"GetCreatorType", (PyCFunction
)mfss_GetCreatorType
, 1},
598 {"SetCreatorType", (PyCFunction
)mfss_SetCreatorType
, 1},
599 {"GetFInfo", (PyCFunction
)mfss_GetFInfo
, 1},
600 {"SetFInfo", (PyCFunction
)mfss_SetFInfo
, 1},
601 {"GetDates", (PyCFunction
)mfss_GetDates
, 1},
602 {"SetDates", (PyCFunction
)mfss_SetDates
, 1},
604 {NULL
, NULL
} /* sentinel */
610 mfss_getattr(self
, name
)
614 if ( strcmp(name
, "data") == 0)
615 return PyString_FromStringAndSize((char *)&self
->fsspec
, sizeof(FSSpec
));
616 return Py_FindMethod(mfss_methods
, (PyObject
*)self
, name
);
625 self
= PyObject_NEW(mfssobject
, &Mfsstype
);
645 sprintf(buf
, "FSSpec((%d, %d, '%.*s'))",
646 self
->fsspec
.vRefNum
,
648 self
->fsspec
.name
[0], self
->fsspec
.name
+1);
649 return PyString_FromString(buf
);
659 if ( v
->fsspec
.vRefNum
< w
->fsspec
.vRefNum
) return -1;
660 if ( v
->fsspec
.vRefNum
> w
->fsspec
.vRefNum
) return 1;
661 if ( v
->fsspec
.parID
< w
->fsspec
.parID
) return -1;
662 if ( v
->fsspec
.parID
> w
->fsspec
.parID
) return 1;
663 minlen
= v
->fsspec
.name
[0];
664 if ( w
->fsspec
.name
[0] < minlen
) minlen
= w
->fsspec
.name
[0];
665 res
= strncmp((char *)v
->fsspec
.name
+1, (char *)w
->fsspec
.name
+1, minlen
);
666 if ( res
) return res
;
667 if ( v
->fsspec
.name
[0] < w
->fsspec
.name
[0] ) return -1;
668 if ( v
->fsspec
.name
[0] > w
->fsspec
.name
[0] ) return 1;
672 statichere PyTypeObject Mfsstype
= {
673 PyObject_HEAD_INIT(&PyType_Type
)
675 "FSSpec", /*tp_name*/
676 sizeof(mfssobject
), /*tp_basicsize*/
679 (destructor
)mfss_dealloc
, /*tp_dealloc*/
680 (printfunc
)0, /*tp_print*/
681 (getattrfunc
)mfss_getattr
, /*tp_getattr*/
682 (setattrfunc
)0, /*tp_setattr*/
683 (cmpfunc
)mfss_compare
, /*tp_compare*/
684 (reprfunc
)mfss_repr
, /*tp_repr*/
686 0, /*tp_as_sequence*/
688 (hashfunc
)0, /*tp_hash*/
691 /* End of code for FSSpec objects */
692 /* -------------------------------------------------------- */
695 mfs_ResolveAliasFile(self
, args
)
696 PyObject
*self
; /* Not used */
700 Boolean chain
= 1, isfolder
, wasaliased
;
703 if (!PyArg_ParseTuple(args
, "O&|i", PyMac_GetFSSpec
, &fss
, &chain
))
705 err
= ResolveAliasFile(&fss
, chain
, &isfolder
, &wasaliased
);
707 PyErr_Mac(ErrorObject
, err
);
710 return Py_BuildValue("Oii", newmfssobject(&fss
), (int)isfolder
, (int)wasaliased
);
713 #if !TARGET_API_MAC_CARBON
715 mfs_StandardGetFile(self
, args
)
716 PyObject
*self
; /* Not used */
721 StandardFileReply reply
;
723 list
[0] = list
[1] = list
[2] = list
[3] = 0;
725 if (!PyArg_ParseTuple(args
, "|O&O&O&O&", PyMac_GetOSType
, &list
[0],
726 PyMac_GetOSType
, &list
[1], PyMac_GetOSType
, &list
[2],
727 PyMac_GetOSType
, &list
[3]) )
729 while ( numtypes
< 4 && list
[numtypes
] ) {
734 StandardGetFile((FileFilterUPP
)0, numtypes
, list
, &reply
);
735 return Py_BuildValue("(Oi)", newmfssobject(&reply
.sfFile
), reply
.sfGood
);
739 mfs_PromptGetFile(self
, args
)
740 PyObject
*self
; /* Not used */
745 StandardFileReply reply
;
748 list
[0] = list
[1] = list
[2] = list
[3] = 0;
750 if (!PyArg_ParseTuple(args
, "s|O&O&O&O&", &prompt
, PyMac_GetOSType
, &list
[0],
751 PyMac_GetOSType
, &list
[1], PyMac_GetOSType
, &list
[2],
752 PyMac_GetOSType
, &list
[3]) )
754 while ( numtypes
< 4 && list
[numtypes
] ) {
759 PyMac_PromptGetFile(numtypes
, list
, &reply
, prompt
);
760 return Py_BuildValue("(Oi)", newmfssobject(&reply
.sfFile
), reply
.sfGood
);
764 mfs_StandardPutFile(self
, args
)
765 PyObject
*self
; /* Not used */
769 StandardFileReply reply
;
772 if (!PyArg_ParseTuple(args
, "O&|O&", PyMac_GetStr255
, &prompt
, PyMac_GetStr255
, &dft
) )
774 StandardPutFile(prompt
, dft
, &reply
);
775 return Py_BuildValue("(Oi)",newmfssobject(&reply
.sfFile
), reply
.sfGood
);
779 ** Set initial directory for file dialogs */
781 mfs_SetFolder(self
, args
)
791 orefnum
= -LMGetSFSaveDisk();
792 oparid
= LMGetCurDirStore();
793 (void)FSMakeFSSpec(orefnum
, oparid
, "\pplaceholder", &ospec
);
795 /* Go to working directory by default */
796 (void)FSMakeFSSpec(0, 0, "\p:placeholder", &spec
);
797 if (!PyArg_ParseTuple(args
, "|O&", PyMac_GetFSSpec
, &spec
))
799 /* Set standard-file working directory */
800 LMSetSFSaveDisk(-spec
.vRefNum
);
801 LMSetCurDirStore(spec
.parID
);
802 return (PyObject
*)newmfssobject(&ospec
);
807 mfs_FSSpec(self
, args
)
808 PyObject
*self
; /* Not used */
813 if (!PyArg_ParseTuple(args
, "O&", PyMac_GetFSSpec
, &fss
))
815 return (PyObject
*)newmfssobject(&fss
);
819 mfs_RawFSSpec(self
, args
)
820 PyObject
*self
; /* Not used */
826 if (!PyArg_ParseTuple(args
, "s#", &fssp
, &size
))
828 if ( size
!= sizeof(FSSpec
) ) {
829 PyErr_SetString(PyExc_TypeError
, "Incorrect size for FSSpec record");
832 return (PyObject
*)newmfssobject(fssp
);
836 mfs_RawAlias(self
, args
)
837 PyObject
*self
; /* Not used */
844 if (!PyArg_ParseTuple(args
, "s#", &dataptr
, &size
))
852 memcpy((char *)*h
, dataptr
, size
);
854 return (PyObject
*)newmfsaobject((AliasHandle
)h
);
857 #if !TARGET_API_MAC_CARBON
859 mfs_GetDirectory(self
, args
)
860 PyObject
*self
; /* Not used */
867 if (!PyArg_ParseTuple(args
, "|s", &prompt
) )
870 ok
= PyMac_GetDirectory(&fsdir
, prompt
);
871 return Py_BuildValue("(Oi)", newmfssobject(&fsdir
), ok
);
876 mfs_FindFolder(self
, args
)
877 PyObject
*self
; /* Not used */
887 if (!PyArg_ParseTuple(args
, "hO&i", &where
, PyMac_GetOSType
, &which
, &create
) )
889 err
= FindFolder(where
, which
, (Boolean
)create
, &refnum
, &dirid
);
891 PyErr_Mac(ErrorObject
, err
);
894 return Py_BuildValue("(ii)", refnum
, dirid
);
898 mfs_FindApplication(self
, args
)
899 PyObject
*self
; /* Not used */
906 if (!PyArg_ParseTuple(args
, "O&", PyMac_GetOSType
, &which
) )
908 err
= FindApplicationFromCreator(which
, &fss
);
910 PyErr_Mac(ErrorObject
, err
);
913 return (PyObject
*)newmfssobject(&fss
);
917 mfs_FInfo(self
, args
)
921 return (PyObject
*)newmfsiobject();
925 mfs_NewAliasMinimalFromFullPath(self
, args
)
926 PyObject
*self
; /* Not used */
936 if (!PyArg_ParseTuple(args
, "s#", &fullpath
, &fullpathlen
) )
940 err
= NewAliasMinimalFromFullPath(fullpathlen
, (Ptr
)fullpath
, zonename
,
943 PyErr_Mac(ErrorObject
, err
);
946 return (PyObject
*)newmfsaobject(alias
);
950 /* List of methods defined in the module */
952 static struct PyMethodDef mfs_methods
[] = {
953 {"ResolveAliasFile", mfs_ResolveAliasFile
, 1},
954 #if !TARGET_API_MAC_CARBON
955 {"StandardGetFile", mfs_StandardGetFile
, 1},
956 {"PromptGetFile", mfs_PromptGetFile
, 1},
957 {"StandardPutFile", mfs_StandardPutFile
, 1},
958 {"GetDirectory", mfs_GetDirectory
, 1},
959 {"SetFolder", mfs_SetFolder
, 1},
961 {"FSSpec", mfs_FSSpec
, 1},
962 {"RawFSSpec", mfs_RawFSSpec
, 1},
963 {"RawAlias", mfs_RawAlias
, 1},
964 {"FindFolder", mfs_FindFolder
, 1},
965 {"FindApplication", mfs_FindApplication
, 1},
966 {"FInfo", mfs_FInfo
, 1},
967 {"NewAliasMinimalFromFullPath", mfs_NewAliasMinimalFromFullPath
, 1},
969 {NULL
, NULL
} /* sentinel */
973 /* Initialization function for the module (*must* be called initmacfs) */
980 /* Create the module and add the functions */
981 m
= Py_InitModule("macfs", mfs_methods
);
983 /* Add some symbolic constants to the module */
984 d
= PyModule_GetDict(m
);
985 ErrorObject
= PyMac_GetOSErrException();
986 PyDict_SetItemString(d
, "error", ErrorObject
);
988 Mfsatype
.ob_type
= &PyType_Type
;
989 Py_INCREF(&Mfsatype
);
990 PyDict_SetItemString(d
, "AliasType", (PyObject
*)&Mfsatype
);
991 Mfsstype
.ob_type
= &PyType_Type
;
992 Py_INCREF(&Mfsstype
);
993 PyDict_SetItemString(d
, "FSSpecType", (PyObject
*)&Mfsstype
);
994 Mfsitype
.ob_type
= &PyType_Type
;
995 Py_INCREF(&Mfsitype
);
996 PyDict_SetItemString(d
, "FInfoType", (PyObject
*)&Mfsitype
);
997 /* XXXX Add constants here */