Commits

Ronald Oussoren committed edeb233

- Make the generator script less verbose, to avoid scaring users
- Make sure the generator script works correctly on systems without PyObjC
- Get ready for a 1.0b1 release
- Find NSString constants using CFBundle functions, this way a PyObjC build
on a system with WebCore SDK can be used on a system without Safari 1.0

Comments (0)

Files changed (24)

 We also don't support all "difficult" methods yet, implementing these is
 not too hard but it is a lot of work.
 
+NSDecimal (the C-type) is not yet supported.
+
 Pickle support
 ..............
 

Doc/api-notes-macosx.txt

 			""" Actual implementation goes here """
 			pass
 
-		mysheetDidEnd = AppKit.endSheetMethod(mysheetDidEnd)
+		mysheetDidEnd = PyObjCTools.AppHelper.endSheetMethod(
+			mysheetDidEnd)
 
 
 Class NSApplication

Installer Package/Resources/Description.plist

 
 The ObjC package provides the glue needed to interface the Python interpreter with the Objective-C language. The 'objc' module makes Objective-C objects and classes available as first-class Python citizens, it is not only possible to use Objective-C objects but you can also subclass Objective-C classes.
 
-The package also includes support for the Foundation, AppKit and AddressBook frameworks.   As a result, it is possible to build complete Cocoa applications entirely in Python.
+The package also includes support for the Foundation, AppKit, WebKit and AddressBook frameworks.   As a result, it is possible to build complete Cocoa applications entirely in Python.
 
 The package also includes a project template from which the developer can create new Cocoa projects implemented in Python.
 
 	<key>IFPkgDescriptionTitle</key>
 	<string>PyObjC</string>
 	<key>IFPkgDescriptionVersion</key>
-	<string>0.9</string>
+	<string>1.0b1</string>
 </dict>
 </plist>

Installer Package/Resources/ReadMe.txt

 The PyObjC package provides the glue needed to interface the Python interpreter with the Objective-C language. The 'objc' module makes Objective-C objects and classes available as first-class Python citizens, it is not only possible to use Objective-C objects but you can also subclass Objective-C classes.
 
 This package also installs modules that provide convenient access to (most of)
-the Foundation and AppKit frameworks. This makes it easy to build Cocoa 
-applications in Python. 
+the Foundation, AppKit, WebKit and AddressBook frameworks. This makes it easy 
+to build Cocoa applications in Python. 
 
 Other than the python modules the installer also installs Project Builder templates, some examples (in /Library/Developer/Examples/PyObjC) and documentation (in /Library/Developer/Documentation/PyObjC).
 
 
     http://pyobjc.sourceforge.net/
 
-b.bum			Ronald Oussoren
-bbum@codefab.com	oussoren@cistron.nl
+b.bum                   Ronald Oussoren
+bbum@codefab.com        oussoren@cistron.nl

Installer Package/Resources/preflight

 	rm -rf "/usr/lib/python2.2/site-packages/${dn}"
 done
 
+# Clean up any previous install in /usr/lib/python2.2/site-packages/PyObjC.
+# The new release might include fewer files than the previous one.
+rm -rf /usr/lib/python2.2/site-packages/PyObjC
+
+# Likewise for PB templates and documentation
+rm -rf "/Developer/ProjectBuilder Extras/Project Templates/Application/Cocoa-Python Application"
+rm -rf "/Developer/ProjectBuilder Extras/Project Templates/Application/Cocoa-Python Documented-based Application"
+rm -rf "/Developer/ProjectBuilder Extras/Project Templates/Application/Cocoa-Python-ObjC Documented-based Application"
+rm -rf "/Developer/ProjectBuilder Extras/Project Templates/Application/Cocoa-Python-ObjC Application"
+rm -rf /Library/Developer/Documentation/PyObjC
+rm -rf /Library/Developer/Examples/PyObjC
+
 exit 0

Lib/AppKit/__init__.py

 # Define usefull utility methods here
 NSClassForName = _objc.lookUpClass
 
-
-def endSheetMethod(meth):
-    """
-    Return a selector that can be used as the delegate callback for
-    sheet methods
-    """
-    return _objc.selector(meth, signature='v@:@ii')
-
 def NSMakePoint(p1, p2):
     return (float(p1), float(p2))
 

Lib/PyObjCTools/AppHelper.py

-"""Application helpers.
+"""AppKit helpers.
 
-Currently only a single function is exported: runEventLoop().
+Exported functions:
+* runEventLoop - run NSApplicationMain in a safer way
+* sheetEndMethod - set correct signature for NSSheet callbacks
 """
 
 from AppKit import NSApplicationMain, NSApp, NSRunAlertPanel
 from Foundation import NSLog
 import sys
 import traceback
+import objc as _objc
+
+
+def endSheetMethod(meth):
+    """
+    Return a selector that can be used as the delegate callback for
+    sheet methods
+    """
+    return _objc.selector(meth, signature='v@:@ii')
+
 
 
 def unexpectedErrorAlert():
 prune Examples/*/*/*~.nib
 global-exclude .DS_Store
 global-exclude *.pbxuser
+exclude Modules/*/_*_Enum.inc
+exclude Modules/*/_*_Str.inc
+exclude Modules/*/_*_Var.inc
+exclude Modules/*/_*_Functions.inc

Modules/AddressBook/_AddressBook.m

 #include <Python.h>
 
 #import <AddressBook/AddressBook.h>
+#import <CoreFoundation/CoreFoundation.h>
 
 #include "pyobjc-api.h"
 #include "wrapper-const-table.h"
 void init_AddressBook(void)
 {
 	PyObject *m, *d;
+	CFBundleRef bundle;
 
 	m = Py_InitModule4("_AddressBook", addressbook_methods, 
 		addressbook_doc, NULL, PYTHON_API_VERSION);
 		return;
 	}
 
+	bundle = CFBundleCreate(NULL,
+		(CFURLRef)[NSURL fileURLWithPath:@"/System/Library/Frameworks/AddressBook.framework"]);
+
+
 	if (register_ints(d, enum_table) < 0) return;
-	if (register_strings(d, string_table) < 0) return;
+	if (register_variableList(d, bundle, string_table, 
+		(sizeof(string_table)/sizeof(string_table[0])-1)) < 0) return;
+
+	//CFRelease(bundle);
 }

Modules/AppKit/_AppKit.m

  * - exceptions 
  * - global functions (TODO)
  */
+#import <AppKit/AppKit.h>
+#import <AppKit/NSGraphics.h>
+#import <CoreFoundation/CoreFoundation.h>
+
 #include <Python.h>
 #include "pyobjc-api.h"
 #include "wrapper-const-table.h"
 
-#import <AppKit/AppKit.h>
-#import <AppKit/NSGraphics.h>
-
 #ifndef GNUSTEP
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
 void init_AppKit(void)
 {
 	PyObject *m, *d;
+	CFBundleRef bundle;
 
 	m = Py_InitModule4("_AppKit", appkit_methods, appkit_doc, 
 		NULL, PYTHON_API_VERSION);
 		return;
 	}
 
+	bundle = CFBundleCreate(NULL,
+		(CFURLRef)[NSURL fileURLWithPath:@"/System/Library/Frameworks/AppKit.framework"]);
+
 	if (register_ints(d, enum_table) < 0) return;
-	if (register_strings(d, string_table) < 0) return;
+	if (register_variableList(d, bundle, string_table, (sizeof(string_table)/sizeof(string_table[0]))-1) < 0) return;
+
+	//CFRelease(bundle);
 
 #ifdef GNUSTEP
 

Modules/Foundation/_Foundation.m

 #include <Python.h>
 #import <Foundation/Foundation.h>
 #import <Foundation/NSDebug.h>
+#import <CoreFoundation/CoreFoundation.h>
 
 #ifdef MACOSX
 #include <pymactoolbox.h>
 void init_Foundation(void)
 {
 	PyObject *m, *d;
+	CFBundleRef bundle;
 
 	m = Py_InitModule4("_Foundation", foundation_methods, foundation_doc, 
 			NULL, PYTHON_API_VERSION);
 		return;
 	}
 
+	bundle = CFBundleCreate(NULL,
+		(CFURLRef)[NSURL fileURLWithPath:@"/System/Library/Frameworks/Foundation.framework"]);
+
 	/* Register information in generated tables */
 	if (register_ints(d, enum_table) < 0) return;
-	if (register_strings(d, string_table) < 0) return;
+	if (register_variableList(d, bundle, string_table, (sizeof(string_table)/sizeof(string_table[0]))-1) < 0) return;
+	
+	//CFRelease(bundle);
 
 #ifdef  GNUSTEP 
 #	include "_Fnd_Var.GNUstep.inc"

Modules/InterfaceBuilder/_InterfaceBuilder.m

 #include <Python.h>
 
 #import <InterfaceBuilder/InterfaceBuilder.h>
+#import <CoreFoundation/CoreFoundation.h>
 
 #include "pyobjc-api.h"
 #include "wrapper-const-table.h"
 void init_InterfaceBuilder(void)
 {
 	PyObject *m, *d;
+	CFBundleRef bundle;
 
 	m = Py_InitModule4("_InterfaceBuilder", ib_methods, 
 		ib_doc, NULL, PYTHON_API_VERSION);
 		return;
 	}
 
+	bundle = CFBundleCreate(NULL,
+		(CFURLRef)[NSURL fileURLWithPath:@"/System/Library/Frameworks/InterfaceBuilder.framework"]);
+
 	if (register_ints(d, enum_table) < 0) return;
-	if (register_strings(d, string_table) < 0) return;
+	if (register_variableList(d, bundle, string_table, (sizeof(string_table)/sizeof(string_table[0]))-1) < 0) return;
+
+	//CFRelease(bundle);
 }

Modules/PreferencePanes/_PreferencePanes.m

 #include <Python.h>
 
 #import <PreferencePanes/PreferencePanes.h>
+#import <CoreFoundation/CoreFoundation.h>
 
 #include "pyobjc-api.h"
 #include "wrapper-const-table.h"
 void init_PreferencePanes(void)
 {
 	PyObject *m, *d;
+	CFBundleRef bundle;
 
 	m = Py_InitModule4("_PreferencePanes", prefpanes_methods, 
 		prefpanes_doc, NULL, PYTHON_API_VERSION);
 		return;
 	}
 
+	bundle = CFBundleCreate(NULL,
+		(CFURLRef)[NSURL fileURLWithPath:@"/System/Library/Frameworks/PreferencePanes.framework"]);
+
 	if (register_ints(d, enum_table) < 0) return;
-	if (register_strings(d, string_table) < 0) return;
+	if (register_variableList(d, bundle, string_table,
+		(sizeof(string_table)/sizeof(string_table[0]))-1) < 0) return;
+	
+	//CFRelease(bundle);
 }

Modules/WebKit/_WebKit.m

 #include <Python.h>
 
 #import <WebKit/WebKit.h>
+#import <CoreFoundation/CoreFoundation.h>
 
 #include "pyobjc-api.h"
 #include "wrapper-const-table.h"
 void init_WebKit(void)
 {
 	PyObject *m, *d;
+	CFBundleRef bundle;
 
 	m = Py_InitModule4("_WebKit", ib_methods, 
 		ib_doc, NULL, PYTHON_API_VERSION);
 		return;
 	}
 
+	bundle = CFBundleCreate(NULL,
+		(CFURLRef)[NSURL fileURLWithPath:@"/System/Library/Frameworks/WebKit.framework"]);
+
 	if (register_ints(d, enum_table) < 0) return;
-	if (register_strings(d, string_table) < 0) return;
+	if (register_variableList(d, bundle, string_table, 
+		(sizeof(string_table)/sizeof(string_table[0]))-1) < 0) return;
+
+	//CFRelease(bundle);
 }

Modules/objc/py2.2bool.c

 	0,                                      /* tp_cache */
 	0,                                      /* tp_subclasses */
 	0,                                      /* tp_weaklist */
+#if PY_VERSION_HEX >= 0x020300A2
 	0                                       /* tp_del */
+#endif
 };
 
 

Modules/objc/pyobjc-api.m

 	fill_super,			/* fill_super */
 	fill_super_cls,			/* fill_super_cls*/
 	PyObjCPointerWrapper_Register,	/* register_pointer_wrapper */
-	unsupported_method_imp,		/* unsupported_method_imp */
+	(IMP)unsupported_method_imp,	/* unsupported_method_imp */
 	unsupported_method_caller	/* unsupported_method_caller */
 };
 

Modules/objc/pyobjc.h

 #define PyDoc_STRVAR(name, str) PyDoc_VAR(name) = PyDoc_STR(str)
 #endif
 
-#define OBJC_VERSION "0.10CVS"
+#define OBJC_VERSION "1.0b1"
 
 #ifdef MACOSX
 

Modules/objc/wrapper-const-table.h

  */
 
 #import <Foundation/NSString.h>
+#import <Foundation/NSArray.h>
+
+struct vartable {
+	NSString* name;
+	char* type;
+};
 
 struct inttable {
 	char* 	name;
 	return 0;
 }
 
+static inline int
+register_variableList(PyObject* d, CFBundleRef bundle, struct vartable* table, size_t count)
+{
+	void** ptrs = NULL;
+	NSMutableArray* names = nil;
+	size_t i;
+	int retVal = 0;
+
+	ptrs = malloc(sizeof(void*) * count);
+	if (ptrs == NULL) {
+		PyErr_NoMemory();
+		return -1;
+	}
+
+	names = [[NSMutableArray alloc] init];
+	if (names == NULL) {
+		PyErr_NoMemory();
+		retVal = -1;
+		goto cleanup;
+	}
+
+	for (i = 0; i < count; i++) {
+		[names addObject:table[i].name];
+	}
+
+	CFBundleGetDataPointersForNames(bundle,
+		(CFArrayRef)names, ptrs);
+
+	for (i = 0; i < count; i++) {
+		if (ptrs[i] == NULL) continue; /* Skip undefined names */
+
+		PyObject* val = PyObjC_ObjCToPython(table[i].type, ptrs[i]);
+		if (val == NULL) {
+			retVal = -1;
+			goto cleanup;
+		}
+		PyDict_SetItemString(d, (char*)[table[i].name cString], val);
+		Py_DECREF(val);
+	}
+
+cleanup:
+	if (ptrs) {
+		free(ptrs);
+	}
+
+	[names release];
+
+	return retVal;
+}
+
+
 
 WHAT'S NEW:
 
-Version 0.10CVS (Work in progress):
+Version 1.0b1 (2003-07-03 [preliminary date]):
+
+- More tutorials
+  Two new tutorials were added: 'Adding Python code to an existing ObjC 
+  application' and 'Understanding existing PyObjC examples'. The former
+  explains how you can use Python to add new functionality to an already
+  existing Objective-C application, the latter explains how to understand
+  PyObjC programs written by other people.
 
 - More examples
   Three examples were added: DotView, ClassBrowser and PythonBrowser,
   Note: The port to MacOS X 10.1 is not as well supported as the 10.2 port.
   The developers do not have full-time access to a MacOS X 10.1 system.
 
-- All suppport for non-FFI builds has been removed.
+- Support for the WebKit framework, included with Safari 1.0.
+  If you build PyObjC from source you will have to build on a system that has
+  the WebKit SDK installed to make use of this. Note that the additional 
+  functionality will only be usuable on systems that have Safari 1.0 installed,
+  however as long as you don't use the additional functionality it is safe
+  to run a 'WebKit-enabled' PyObjC on systems without Safari 1.0.
+
+- It is no longer necessary to specify which protocols are implemented by
+  a class, this information is automaticly deduced from the list of implemented
+  methods. You'll still a runtime error if you implement some methods of a 
+  protocol and one of the unimplemented methods is required.
 
 - Support for "toll-free bridging" of Carbon.CF types to Objective-C objects.
   It is now possible to use instances of Carbon.CF types in places where 
   * NSMovie.initWithMovie_ and NSMovie.QTMovie now use QT.Movie objects instead
     of generic pointer wrappers.
 
+  * NSWindow.initWithWindowRef_ and Window.windowRef now use Carbon.Window 
+    objects instead of generic pointer wrappers.
+
   * Methods returning CoreFoundation objects will return MacPython objects,
     and likewise, methods with CoreFoundation arguments will accept MacPython
     objects.
 
+- It is now possible to write plugin bundles, such as preference panes for 
+  use in System Preferences, in Python. See Examples/PrefPanes for an example
+  of this feature.
+ 
+- The methods ``pyobjcPopPool`` and ``pyobjcPushPool`` of ``NSAutoreleasePool``
+  are deprecated. These were introduced when PyObjC did not yet support the
+  usual method for creating autorelease pools and are no longer necessary.
+
 - Improved unittests, greatly increasing the confidence in the correctness
   of the bridge.
 
+- All suppport for non-FFI builds has been removed.
+
 - Object state is completely stored in the Objective-C object.  This has no
   user-visible effects, but makes the implementation a lot easier to 
   comprehend and maintain.
   Objective-C object died, therefore code that uses weakrefs to Objective-C
   objects is almost certainly incorrect.
 
-- It is no longer necessary to specify which protocols are implemented by
-  a class, this information is automaticly deduced from the list of implemented
-  methods. You'll still a runtime error if you implement some methods of a 
-  protocol and one of the unimplemented methods is required.
-
 - Added support for custom conversion for pointer types. The end result is that
   we support more Cocoa APIs without special mappings.
 
-- It is now possible to write plugin bundles, such as preference panes for 
-  use in System Preferences, in Python. See Examples/PrefPanes for an example
-  of this feature.
- 
-- The methods ``pyobjcPopPool`` and ``pyobjcPushPool`` of ``NSAutoreleasePool``
-  are deprecated. These were introduced when PyObjC did not yet support the
-  usual method for creating autorelease pools and are no longer necessary.
+- The generator scripts are automaticly called when building PyObjC. This
+  should make it easier to support multiple versions of MacOS X.
+
 
 Version 0.9 (May-02-2003):
 - This version includes numerous bugfixes and improvements.

Scripts/CodeGenerators/cocoa_generator.py

 var_generator.generate(APPKIT_HDRS, 'Modules/AppKit/_App_Var.inc', APPKIT_PREFIX, APPKIT_IGNORE_LIST)
 
 FOUNDATION_IGNORE_LIST=(
-	# Private functions in NSException.h 
-	'_NSAddHandler2',
-	'_NSRemoveHandler2',
-	'_NSExceptionObjectFromHandler2'
+	# Private functions 
+	'_NSAddHandler2(',
+	'_NSRemoveHandler2(',
+	'_NSExceptionObjectFromHandler2(',
+        '_NSAutoreleaseNoPool(',
+        '_NSAutoreleaseFreedObject(',
+        '_NSAutoreleaseHighWaterLog(',
+        'NXReadNSObjectFromCoder(',
+
 
         # List of functions that are not usefull from Python:
+        'NSFrameAddress(',
+        'NSReturnAddress(',
+        'NSRecordAllocationEvent(',
+        'NSCreateHashTableWithZone(',
+        'NSCreateHashTable(',
+        'NSFreeHashTable(',
+        'NSResetHashTable(',
+        'NSCompareHashTables(',
+        'NSCopyHashTableWithZone(',
+        'NSHashGet(',
+        'NSHashInsert(',
+        'NSHashInsertKnownAbsent(',
+        'NSHashInsertIfAbsent(',
+        'NSHashRemove(',
+        'NSEnumerateHashTable(',
+        'NSNextHashEnumeratorItem(',
+        'NSEndHashTableEnumeration(',
+        'NSCountHashTable(',
+        'NSStringFromHashTable(',
+        'NSAllHashTableObjects(',
+        'NSJavaClassesFromPath(',
+        'NSJavaClassesForBundle(',
+        'NSCreateMapTableWithZone(',
+        'NSCreateMapTable(',
+        'NSFreeMapTable(',
+        'NSResetMapTable(',
+        'NSCompareMapTables(',
+        'NSCopyMapTableWithZone(',
+        'NSMapMember(',
+        'NSMapGet(',
+        'NSMapInsert(',
+        'NSMapInsertKnownAbsent(',
+        'NSMapInsertIfAbsent(',
+        'NSMapRemove(',
+        'NSEnumerateMapTable(',
+        'NSNextMapEnumeratorPair(',
+        'NSEndMapTableEnumeration(',
+        'NSCountMapTable(',
+        'NSStringFromMapTable(',
+        'NSAllMapTableKeys(',
+        'NSAllMapTableValues(',
+        'NSGetSizeAndAlignment(', # Hmm, shouldn't we use this in the bridge?
+        'NSLogv(',
+        'NSAllocateObject(',
+        'NSCopyObject(',
+        'NSShouldRetainWithZone(',
+        'NSAllocateMemoryPages(',
+        'NSDeallocateMemoryPages(',
+        'NSCopyMemoryPages(',
+
 
         # List of manually wrapped functions:
+        'NSFileTypeForHFSTypeCode(',
+        'NSHFSTypeCodeFromFileType(',
+        'NSStringFromPoint',
+
+        # NSDecimal support, should wrap type
+        'NSDecimalCopy(',
+        'NSDecimalCompact(',
+        'NSDecimalCompare(',
+        'NSDecimalRound(',
+        'NSDecimalNormalize(',
+        'NSDecimalAdd(',
+        'NSDecimalSubtract(',
+        'NSDecimalMultiply(',
+        'NSDecimalDivide(',
+        'NSDecimalPower(',
+        'NSDecimalMultiplyByPowerOf10(',
+        'NSDecimalString(',
+
+        # Zones might be usefull someday
+        'NSCreateZone(',
+        'NSRecycleZone(',
+        'NSSetZoneName(',
+        'NSZoneName(',
+        'NSZoneFromPointer(',
+        'NSZoneMalloc(',
+        'NSZoneCalloc(',
+        'NSZoneRealloc(',
+        'NSZoneFree(',
+
+
+        # TODO
+        'NSUncaughtExceptionHandler(',
+        'NSSetUncaughtExceptionHandler(',
+        'NSGetUncaughtExceptionHandler(',
+        'NSDivideRect(',
+        'NSDefaultMallocZone(',
 )
+
+
 APPKIT_IGNORE_LIST=(
 
         # List of manually wrapped functions:
         'NSAvailableWindowDepths(',
         'NSRectFillList(',
         'NSGetWindowServerMemory(',
+
+
+        #TODO:
+        'NSBestDepth (',
+        'NSAvailableWindowDepths (',
+        'NSRectFillListWithGrays(',
+        'NSRectFillListWithColors(',
+        'NSRectFillListUsingOperation(',
+        'NSRectFillListWithColorsUsingOperation(',
+        'NSRectClipList(',
+        'NSDrawTiledRects(',
+        'NSDrawBitmap(',
+        'NSWindowList(',
+        'NSWindowListForContext(',
+        'NSDrawColorTiledRects(',
 )
 func_collector.generate(FOUNDATION_HDRS, 'Modules/Foundation/Foundation.prototypes', 
 	FOUNDATION_PREFIX, FOUNDATION_IGNORE_LIST)

Scripts/CodeGenerators/enum_generator.py

 
 import re
 import os
+import sys
 
 START_RE=re.compile('(typedef[\w]|)enum.*{')
 END_RE=re.compile('}')
 	if fn:
 		fp = open(fn, 'w')
 	else:
-		import sys
 		fp = sys.stdout
-		del sys
 
 	fp.write("/*\n")
 	fp.write(" * Enumeration constants. This file is generated from files in\n")
 		process_file(fp, f)
 	fp.write("\t{0, 0} /* Sentinel */\n")
 	fp.write("};\n")
+        fp.close()
 
 if __name__ == "__main__":
 	import sys

Scripts/CodeGenerators/func_builder.py

 # has only 'by value' arguments, and return a simple object or an 'id'
 #
 
+verbose=0
+
 try:
     import objc
 except ImportError:
             except:
                     return 0
         else:
+            # These types are used in function definition (OSX 10.2), this
+            # list is necessary for people that build without an installed
+            # PyObjC.
+            if typestr[:-1] in ('NSString', 'NSArray', 'NSWindow', 'NSColor', 'NSPasteboard', 'NSBundle', 'NSDictionary', 'NSResponder'):
+                return 1
             return 0
 
 # TODO: actually use this, and add more types (when using: always check here
 		if l[0] == '#': continue
 		total_count += 1
 		try:
-			sys.stderr.write("Converting '%s' ..."%l.strip())
-			sys.stderr.flush()
 
 			funcs.append((process_function(fp, l), l))
-			sys.stderr.write("done\n")
+                        if verbose:
+			    sys.stderr.write("Converting '%s' ..."%l.strip())
+                            sys.stderr.write("done\n")
 			sys.stderr.flush()
 			ok_count += 1
 		except ValueError, msg:
+			sys.stderr.write("Converting '%s' ..."%l.strip())
 			sys.stderr.write("failed: %s\n"%msg)
 			sys.stderr.flush()
 
 		fp.write("\t/* END */\n")
 
 
-	sys.stderr.write("Converted %d of %d functions\n"%(ok_count, total_count))
+        if verbose:
+            sys.stderr.write("Converted %d of %d functions\n"%(ok_count, total_count))
 
 if __name__ == "__main__":
 	import sys

Scripts/CodeGenerators/strconst_generator.py

 	vals = val.split(',')
 	if len(vals) == 1:
                 if val in ignore: return
-		fp.write('\t { "%s", &%s },\n'%(val, val))
+		fp.write('\t { @"%s", @encode(NSString*) },\n'%(val, ))
 	else:
 		for  v in vals:
 			v = v.strip()
 			if v[0] == '*':
 				v = v[1:].strip()
                         if v in ignore: continue
-			fp.write('\t { "%s", &%s },\n'%(v, v))
+			fp.write('\t { @"%s", @encode(NSString*) },\n'%(v, ))
 
 def process_file(outfp, filename, ignore):
 	fp = open(filename, 'r')
 	fp.write(" * String constants. This file is generated from files in\n")
 	fp.write(" * %s\n"%dirname)
 	fp.write(" */\n")
-	fp.write("static struct stringtable string_table[] = {\n")
+	fp.write("static struct vartable string_table[] = {\n")
 	fnames = [ os.path.join(dirname, fn)
 				for fn in os.listdir(dirname)
 				if fn.endswith('.h') and filter(fn) ]
         ]
 
     FND_LDFLAGS=[
-        '-framework', 'Foundation',
+        '-framework CoreFoundation', '-framework', 'Foundation',
         ]
 
     APPKIT_LDFLAGS=[
-        '-framework', 'AppKit',
+        '-framework CoreFoundation', '-framework', 'AppKit',
         ]
 
     FNDMAP_LDFLAGS=[
-        '-framework', 'Foundation',
+        '-framework CoreFoundation', '-framework', 'Foundation',
         ]
 
     APPMAP_LDFLAGS=[
-        '-framework', 'AppKit',
+        '-framework CoreFoundation', '-framework', 'AppKit',
         ]
 
     ADDRESSBOOK_LDFLAGS=[
-        '-framework', 'AddressBook', '-framework', 'Foundation',
+        '-framework CoreFoundation', '-framework', 'AddressBook', '-framework', 'Foundation',
     ]
 
     PREFPANES_LDFLAGS=[
-        '-framework', 'PreferencePanes', '-framework', 'Foundation',
+        '-framework CoreFoundation', '-framework', 'PreferencePanes', '-framework', 'Foundation',
     ]
 
 else:
     ]
 CocoaPackages = [ 'Foundation', 'AppKit' ]
 
+# XXX: Should not do this every time setup.py is called!
 subprocess("Generating wrappers & stubs", "%s Scripts/CodeGenerators/cocoa_generator.py" % (sys.executable,), None)
 
 # Provide some dependency information on Python 2.3 and later, this