[Python-checkins] python/dist/src/Mac/Modules/launch _Launchmodule.c, 1.2, 1.3 launchscan.py, 1.2, 1.3 launchsupport.py, 1.1, 1.2

jackjansen at users.sourceforge.net jackjansen at users.sourceforge.net
Wed Dec 3 18:20:14 EST 2003


Update of /cvsroot/python/python/dist/src/Mac/Modules/launch
In directory sc8-pr-cvs1:/tmp/cvs-serv22913/launch

Modified Files:
	_Launchmodule.c launchscan.py launchsupport.py 
Log Message:
Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.

Completely untested.


Index: _Launchmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/launch/_Launchmodule.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** _Launchmodule.c	3 Dec 2003 20:52:07 -0000	1.2
--- _Launchmodule.c	3 Dec 2003 23:20:12 -0000	1.3
***************
*** 98,101 ****
--- 98,191 ----
  }
  
+ static PyObject *Launch_LSGetExtensionInfo(PyObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	OSStatus _err;
+ 	UniChar *inNameLen__in__;
+ 	UniCharCount inNameLen__len__;
+ 	int inNameLen__in_len__;
+ 	UniCharCount outExtStartIndex;
+ 	if (!PyArg_ParseTuple(_args, "u#",
+ 	                      &inNameLen__in__, &inNameLen__in_len__))
+ 		return NULL;
+ 	inNameLen__len__ = inNameLen__in_len__;
+ 	_err = LSGetExtensionInfo(inNameLen__len__, inNameLen__in__,
+ 	                          &outExtStartIndex);
+ 	if (_err != noErr) return PyMac_Error(_err);
+ 	_res = Py_BuildValue("l",
+ 	                     outExtStartIndex);
+ 	return _res;
+ }
+ 
+ static PyObject *Launch_LSCopyDisplayNameForRef(PyObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	OSStatus _err;
+ 	FSRef inRef;
+ 	CFStringRef outDisplayName;
+ 	if (!PyArg_ParseTuple(_args, "O&",
+ 	                      PyMac_GetFSRef, &inRef))
+ 		return NULL;
+ 	_err = LSCopyDisplayNameForRef(&inRef,
+ 	                               &outDisplayName);
+ 	if (_err != noErr) return PyMac_Error(_err);
+ 	_res = Py_BuildValue("O&",
+ 	                     CFStringRefObj_New, outDisplayName);
+ 	return _res;
+ }
+ 
+ static PyObject *Launch_LSCopyDisplayNameForURL(PyObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	OSStatus _err;
+ 	CFURLRef inURL;
+ 	CFStringRef outDisplayName;
+ 	if (!PyArg_ParseTuple(_args, "O&",
+ 	                      CFURLRefObj_Convert, &inURL))
+ 		return NULL;
+ 	_err = LSCopyDisplayNameForURL(inURL,
+ 	                               &outDisplayName);
+ 	if (_err != noErr) return PyMac_Error(_err);
+ 	_res = Py_BuildValue("O&",
+ 	                     CFStringRefObj_New, outDisplayName);
+ 	return _res;
+ }
+ 
+ static PyObject *Launch_LSSetExtensionHiddenForRef(PyObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	OSStatus _err;
+ 	FSRef inRef;
+ 	Boolean inHide;
+ 	if (!PyArg_ParseTuple(_args, "O&b",
+ 	                      PyMac_GetFSRef, &inRef,
+ 	                      &inHide))
+ 		return NULL;
+ 	_err = LSSetExtensionHiddenForRef(&inRef,
+ 	                                  inHide);
+ 	if (_err != noErr) return PyMac_Error(_err);
+ 	Py_INCREF(Py_None);
+ 	_res = Py_None;
+ 	return _res;
+ }
+ 
+ static PyObject *Launch_LSSetExtensionHiddenForURL(PyObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	OSStatus _err;
+ 	CFURLRef inURL;
+ 	Boolean inHide;
+ 	if (!PyArg_ParseTuple(_args, "O&b",
+ 	                      CFURLRefObj_Convert, &inURL,
+ 	                      &inHide))
+ 		return NULL;
+ 	_err = LSSetExtensionHiddenForURL(inURL,
+ 	                                  inHide);
+ 	if (_err != noErr) return PyMac_Error(_err);
+ 	Py_INCREF(Py_None);
+ 	_res = Py_None;
+ 	return _res;
+ }
+ 
  static PyObject *Launch_LSCopyKindStringForRef(PyObject *_self, PyObject *_args)
  {
***************
*** 324,327 ****
--- 414,427 ----
  	{"LSCopyItemInfoForURL", (PyCFunction)Launch_LSCopyItemInfoForURL, 1,
  	 PyDoc_STR("(CFURLRef inURL, LSRequestedInfo inWhichInfo) -> (LSItemInfoRecord outItemInfo)")},
+ 	{"LSGetExtensionInfo", (PyCFunction)Launch_LSGetExtensionInfo, 1,
+ 	 PyDoc_STR("(Buffer inNameLen) -> (UniCharCount outExtStartIndex)")},
+ 	{"LSCopyDisplayNameForRef", (PyCFunction)Launch_LSCopyDisplayNameForRef, 1,
+ 	 PyDoc_STR("(FSRef inRef) -> (CFStringRef outDisplayName)")},
+ 	{"LSCopyDisplayNameForURL", (PyCFunction)Launch_LSCopyDisplayNameForURL, 1,
+ 	 PyDoc_STR("(CFURLRef inURL) -> (CFStringRef outDisplayName)")},
+ 	{"LSSetExtensionHiddenForRef", (PyCFunction)Launch_LSSetExtensionHiddenForRef, 1,
+ 	 PyDoc_STR("(FSRef inRef, Boolean inHide) -> None")},
+ 	{"LSSetExtensionHiddenForURL", (PyCFunction)Launch_LSSetExtensionHiddenForURL, 1,
+ 	 PyDoc_STR("(CFURLRef inURL, Boolean inHide) -> None")},
  	{"LSCopyKindStringForRef", (PyCFunction)Launch_LSCopyKindStringForRef, 1,
  	 PyDoc_STR("(FSRef inFSRef) -> (CFStringRef outKindString)")},

Index: launchscan.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/launch/launchscan.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** launchscan.py	3 Dec 2003 20:52:07 -0000	1.2
--- launchscan.py	3 Dec 2003 23:20:12 -0000	1.3
***************
*** 40,45 ****
--- 40,47 ----
  	def writeinitialdefs(self):
  		self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+ 		self.defsfile.write("from Carbon.Files import *\n")
  		self.defsfile.write("kLSRequestAllInfo = -1\n")
  		self.defsfile.write("kLSRolesAll = -1\n")
+ 		self.defsfile.write("kLSInvalidExtensionIndex = -1\n")
  
  	def makeblacklistnames(self):
***************
*** 49,52 ****
--- 51,55 ----
  			"kLSRequestAllInfo",
  			"kLSRolesAll",
+ 			"kLSInvalidExtensionIndex",
  			]
  
***************
*** 68,71 ****
--- 71,80 ----
  			([('CFStringRef', 'inName', 'InMode')],
      		 [('OptCFStringRef', 'inName', 'InMode')]),
+ 
+ 			# Unicode filenames passed as length, buffer. LSGetExtensionInfo
+ 			([('UniCharCount', '*', 'InMode'),
+ 			  ('UniChar_ptr', '*', 'InMode')],
+ 			 [('UnicodeReverseInBuffer', '*', 'InMode')]
+ 			),
  			]
  			

Index: launchsupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/launch/launchsupport.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** launchsupport.py	2 Dec 2003 23:01:43 -0000	1.1
--- launchsupport.py	3 Dec 2003 23:20:12 -0000	1.2
***************
*** 25,44 ****
  LSRequestedInfo = Type("LSRequestedInfo", "l")
  LSRolesMask = Type("LSRolesMask", "l")
  OptCFStringRef = OpaqueByValueType("CFStringRef", "OptCFStringRefObj")
  LSItemInfoRecord = OpaqueType("LSItemInfoRecord", "LSItemInfoRecord")
- #MenuRef = OpaqueByValueType("MenuRef", "MenuObj")
- #MenuItemIndex = Type("MenuItemIndex", "H")
- 
- #WindowPeek = OpaqueByValueType("WindowPeek", OBJECTPREFIX)
- 
- #RgnHandle = FakeType("(RgnHandle)0")
- # XXXX Should be next, but this will break a lot of code...
- # RgnHandle = OpaqueByValueType("RgnHandle", "OptResObj")
- 
- #KeyMap = ArrayOutputBufferType("KeyMap")
- ##MacOSEventKind = Type("MacOSEventKind", "h") # Old-style
- ##MacOSEventMask = Type("MacOSEventMask", "h") # Old-style
- #EventMask = Type("EventMask", "H")
- #EventKind = Type("EventKind", "H")
  
  includestuff = includestuff + """
--- 25,31 ----
  LSRequestedInfo = Type("LSRequestedInfo", "l")
  LSRolesMask = Type("LSRolesMask", "l")
+ UniCharCount = Type("UniCharCount", "l")
  OptCFStringRef = OpaqueByValueType("CFStringRef", "OptCFStringRefObj")
  LSItemInfoRecord = OpaqueType("LSItemInfoRecord", "LSItemInfoRecord")
  
  includestuff = includestuff + """





More information about the Python-checkins mailing list