[darwinbuild-changes] [14] trunk/darwinxref/plugins

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 4 01:37:01 PDT 2006


Revision: 14
          http://trac.macosforge.org/projects/darwinbuild/changeset/14
Author:   kevin
Date:     2006-10-04 01:37:00 -0700 (Wed, 04 Oct 2006)

Log Message:
-----------
- use new plugin API

Modified Paths:
--------------
    trunk/darwinxref/plugins/dependencies.c
    trunk/darwinxref/plugins/edit.c
    trunk/darwinxref/plugins/environment.c
    trunk/darwinxref/plugins/exportFiles.c
    trunk/darwinxref/plugins/exportIndex.c
    trunk/darwinxref/plugins/findFile.c
    trunk/darwinxref/plugins/loadDeps.c
    trunk/darwinxref/plugins/loadFiles.c
    trunk/darwinxref/plugins/loadIndex.c
    trunk/darwinxref/plugins/original.c
    trunk/darwinxref/plugins/register.c
    trunk/darwinxref/plugins/resolveDeps.c
    trunk/darwinxref/plugins/source_sites.c
    trunk/darwinxref/plugins/target.c
    trunk/darwinxref/plugins/version.c

Modified: trunk/darwinxref/plugins/dependencies.c
===================================================================
--- trunk/darwinxref/plugins/dependencies.c	2005-06-16 21:31:30 UTC (rev 13)
+++ trunk/darwinxref/plugins/dependencies.c	2006-10-04 08:37:00 UTC (rev 14)
@@ -32,10 +32,10 @@
 
 #include "DBPlugin.h"
 
-void printDependencies(void* session, CFStringRef* types, CFStringRef* recursiveTypes, CFMutableSetRef visited, CFStringRef build, CFStringRef project);
+void printDependencies(CFStringRef* types, CFStringRef* recursiveTypes, CFMutableSetRef visited, CFStringRef build, CFStringRef project);
 
 
-static int run(void* session, CFArrayRef argv) {
+static int run(CFArrayRef argv) {
 	CFIndex count = CFArrayGetCount(argv);
 	if (count != 2) return -1;
 
@@ -44,47 +44,40 @@
 	CFStringRef type = CFArrayGetValueAtIndex(argv, 0);
 	if (CFEqual(type, CFSTR("-run"))) {
 		CFStringRef types[] = { CFSTR("lib"), CFSTR("run"), NULL };
-		printDependencies(session, types, types, NULL, DBGetCurrentBuild(session), project);
+		printDependencies(types, types, NULL, DBGetCurrentBuild(), project);
 	} else if (CFEqual(type, CFSTR("-build"))) {
 		CFStringRef types[] = { CFSTR("lib"), CFSTR("run"), CFSTR("build"), NULL };
 		CFStringRef recursive[] = { CFSTR("lib"), CFSTR("run"), NULL };
-		printDependencies(session, types, recursive, NULL, DBGetCurrentBuild(session), project);
+		printDependencies(types, recursive, NULL, DBGetCurrentBuild(), project);
 	} else if (CFEqual(type, CFSTR("-header"))) {
 		CFStringRef types[] = { CFSTR("header"), NULL };
-		printDependencies(session, types, types, NULL, DBGetCurrentBuild(session), project);
+		printDependencies(types, types, NULL, DBGetCurrentBuild(), project);
 	} else {
 		return -1;
 	}
 	return 0;
 }
 
-static CFStringRef usage(void* session) {
+static CFStringRef usage() {
 	return CFRetain(CFSTR("-run | -build | -header <project>"));
 }
 
-DBPropertyPlugin* initialize(int version) {
-	DBPropertyPlugin* plugin = NULL;
-
-	if (version != kDBPluginCurrentVersion) return NULL;
+int initialize(int version) {
+	//if ( version < kDBPluginCurrentVersion ) return -1;
 	
-	plugin = malloc(sizeof(DBPropertyPlugin));
-	if (plugin == NULL) return NULL;
-	
-	plugin->base.version = kDBPluginCurrentVersion;
-	plugin->base.type = kDBPluginPropertyType;
-	plugin->base.name = CFSTR("dependencies");
-	plugin->base.run = &run;
-	plugin->base.usage = &usage;
-	plugin->datatype = CFDictionaryGetTypeID();
-
-	return plugin;
+	DBPluginSetType(kDBPluginPropertyType);
+	DBPluginSetName(CFSTR("dependencies"));
+	DBPluginSetRunFunc(&run);
+	DBPluginSetUsageFunc(&usage);
+	DBPluginSetDataType(CFDictionaryGetTypeID());
+	return 0;
 }
 
 
-void printDependencies(void* session, CFStringRef* types, CFStringRef* recursiveTypes, CFMutableSetRef visited, CFStringRef build, CFStringRef project) {
+void printDependencies(CFStringRef* types, CFStringRef* recursiveTypes, CFMutableSetRef visited, CFStringRef build, CFStringRef project) {
 	if (!visited) visited = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
 	
-	CFDictionaryRef dependencies = DBCopyPropDictionary(session, build, project, CFSTR("dependencies"));
+	CFDictionaryRef dependencies = DBCopyPropDictionary(build, project, CFSTR("dependencies"));
 	if (dependencies) {
 		CFStringRef* type = types;
 		while (*type != NULL) {
@@ -103,7 +96,7 @@
 					if (!CFSetContainsValue(visited, newproject)) {
 						cfprintf(stdout, "%@\n", newproject);
 						CFSetAddValue(visited, newproject);
-						printDependencies(session, recursiveTypes, recursiveTypes, visited, build, newproject);
+						printDependencies(recursiveTypes, recursiveTypes, visited, build, newproject);
 					}
 				}
 				

Modified: trunk/darwinxref/plugins/edit.c
===================================================================
--- trunk/darwinxref/plugins/edit.c	2005-06-16 21:31:30 UTC (rev 13)
+++ trunk/darwinxref/plugins/edit.c	2006-10-04 08:37:00 UTC (rev 14)
@@ -33,39 +33,32 @@
 #include "DBPlugin.h"
 #include <sys/stat.h>
 
-int editPlist(void* session, CFStringRef project);
+int editPlist(CFStringRef project);
 static int execEditor(const char* tmpfile);
 
-static int run(void* session, CFArrayRef argv) {
+static int run(CFArrayRef argv) {
 	CFStringRef project = NULL;
 	CFIndex count = CFArrayGetCount(argv);
 	if (count > 1)  return -1;
 	if (count == 1) {
 		project = CFArrayGetValueAtIndex(argv, 0);
 	}
-	int res = editPlist(session, project);
+	int res = editPlist(project);
 	return res;
 }
 
-static CFStringRef usage(void* session) {
+static CFStringRef usage() {
 	return CFRetain(CFSTR("[<project>]"));
 }
 
-DBPlugin* initialize(int version) {
-	DBPlugin* plugin = NULL;
-
-	if (version != kDBPluginCurrentVersion) return NULL;
+int initialize(int version) {
+	//if ( version < kDBPluginCurrentVersion ) return -1;
 	
-	plugin = malloc(sizeof(DBPlugin));
-	if (plugin == NULL) return NULL;
-	
-	plugin->version = kDBPluginCurrentVersion;
-	plugin->type = kDBPluginType;
-	plugin->name = CFSTR("edit");
-	plugin->run = &run;
-	plugin->usage = &usage;
-
-	return plugin;
+	DBPluginSetType(kDBPluginBasicType);
+	DBPluginSetName(CFSTR("edit"));
+	DBPluginSetRunFunc(&run);
+	DBPluginSetUsageFunc(&usage);
+	return 0;
 }
 
 static inline int min(int a, int b) {
@@ -73,14 +66,14 @@
 }
 
 
-int editPlist(void* session, CFStringRef project) {
-		CFStringRef build = DBGetCurrentBuild(session);
+int editPlist(CFStringRef project) {
+		CFStringRef build = DBGetCurrentBuild();
         struct stat before, after;
         CFDictionaryRef p = NULL;
         if (project) {
-                p = DBCopyProjectPlist(session, build, project);
+                p = DBCopyProjectPlist(build, project);
         } else {
-                p = DBCopyBuildPlist(session, build);
+                p = DBCopyBuildPlist(build);
         }
 
         ////
@@ -118,7 +111,7 @@
                         while (!done) {
                                 p = read_plist(tmpfile);
                                 // Check if plist parsed successfully, if so import it
-								if (DBSetPlist(session, build, p) == 0) {
+								if (DBSetPlist(build, p) == 0) {
 										done = 1;
                                         CFRelease(p);
                                 } else {

Modified: trunk/darwinxref/plugins/environment.c
===================================================================
--- trunk/darwinxref/plugins/environment.c	2005-06-16 21:31:30 UTC (rev 13)
+++ trunk/darwinxref/plugins/environment.c	2006-10-04 08:37:00 UTC (rev 14)
@@ -32,15 +32,15 @@
 
 #include "DBPlugin.h"
 
-static int run(void* session, CFArrayRef argv) {
+static int run(CFArrayRef argv) {
 	if (CFArrayGetCount(argv) > 1)  return -1;
-	CFStringRef build = DBGetCurrentBuild(session);
+	CFStringRef build = DBGetCurrentBuild();
 	CFStringRef project = NULL;
 	CFDictionaryRef projectEnv = NULL;
-	CFDictionaryRef globalEnv = DBCopyPropDictionary(session, build, NULL, CFSTR("environment"));
+	CFDictionaryRef globalEnv = DBCopyPropDictionary(build, NULL, CFSTR("environment"));
 	if (CFArrayGetCount(argv) == 1) {
 		project = CFArrayGetValueAtIndex(argv, 0);
-		projectEnv = DBCopyPropDictionary(session, build, project, CFSTR("environment"));
+		projectEnv = DBCopyPropDictionary(build, project, CFSTR("environment"));
 	}
 	
 	CFMutableDictionaryRef env = NULL;
@@ -92,24 +92,17 @@
 	return 0;
 }
 
-static CFStringRef usage(void* session) {
+static CFStringRef usage() {
 	return CFRetain(CFSTR("[<project>]"));
 }
 
-DBPropertyPlugin* initialize(int version) {
-	DBPropertyPlugin* plugin = NULL;
-
-	if (version != kDBPluginCurrentVersion) return NULL;
+int initialize(int version) {
+	//if ( version < kDBPluginCurrentVersion ) return -1;
 	
-	plugin = malloc(sizeof(DBPropertyPlugin));
-	if (plugin == NULL) return NULL;
-	
-	plugin->base.version = kDBPluginCurrentVersion;
-	plugin->base.type = kDBPluginPropertyType;
-	plugin->base.name = CFSTR("environment");
-	plugin->base.run = &run;
-	plugin->base.usage = &usage;
-	plugin->datatype = CFDictionaryGetTypeID();
-
-	return plugin;
+	DBPluginSetType(kDBPluginPropertyType);
+	DBPluginSetName(CFSTR("environment"));
+	DBPluginSetRunFunc(&run);
+	DBPluginSetUsageFunc(&usage);
+	DBPluginSetDataType(CFDictionaryGetTypeID());
+	return 0;
 }

Modified: trunk/darwinxref/plugins/exportFiles.c
===================================================================
--- trunk/darwinxref/plugins/exportFiles.c	2005-06-16 21:31:30 UTC (rev 13)
+++ trunk/darwinxref/plugins/exportFiles.c	2006-10-04 08:37:00 UTC (rev 14)
@@ -35,9 +35,9 @@
 #include <stdio.h>
 #include <regex.h>
 
-static int exportFiles(void* db, char* buildparam, char* project);
+static int exportFiles(char* buildparam, char* project);
 
-static int run(void* session, CFArrayRef argv) {
+static int run(CFArrayRef argv) {
 	int res = 0;
 	CFIndex count = CFArrayGetCount(argv);
 	if (count > 1)  return -1;
@@ -47,31 +47,24 @@
 		project = strdup_cfstr(CFArrayGetValueAtIndex(argv, 0));
 	}
 	
-	char* build = strdup_cfstr(DBGetCurrentBuild(session));
-	exportFiles(session, build, project);
+	char* build = strdup_cfstr(DBGetCurrentBuild());
+	exportFiles(build, project);
 	if (project) free(project);
 	return res;
 }
 
-static CFStringRef usage(void* session) {
+static CFStringRef usage() {
 	return CFRetain(CFSTR("[<project>]"));
 }
 
-DBPlugin* initialize(int version) {
-	DBPlugin* plugin = NULL;
-
-	if (version != kDBPluginCurrentVersion) return NULL;
+int initialize(int version) {
+	//if ( version < kDBPluginCurrentVersion ) return -1;
 	
-	plugin = malloc(sizeof(DBPlugin));
-	if (plugin == NULL) return NULL;
-	
-	plugin->version = kDBPluginCurrentVersion;
-	plugin->type = kDBPluginType;
-	plugin->name = CFSTR("exportFiles");
-	plugin->run = &run;
-	plugin->usage = &usage;
-
-	return plugin;
+	DBPluginSetType(kDBPluginBasicType);
+	DBPluginSetName(CFSTR("exportFiles"));
+	DBPluginSetRunFunc(&run);
+	DBPluginSetUsageFunc(&usage);
+	return 0;
 }
 
 int printFiles(void* pArg, int argc, char **argv, char** columnNames) {
@@ -79,30 +72,30 @@
 	return 0;
 }
 
-static int exportFiles(void* session, char* build, char* project) {
+static int exportFiles(char* build, char* project) {
 	int res;
 
 	char* table = "CREATE TABLE files (build text, project text, path text)";
 	char* index = "CREATE INDEX files_index ON files (build, project, path)";
-	SQL_NOERR(session, table);
-	SQL_NOERR(session, index);
+	SQL_NOERR(table);
+	SQL_NOERR(index);
 
 	fprintf(stdout, "# BUILD %s\n", build);
 
 	if (project) {
 		fprintf(stdout, "%s:\n", project);
-		res = SQL_CALLBACK(session, &printFiles, NULL,
+		res = SQL_CALLBACK(&printFiles, NULL,
 			"SELECT path FROM files WHERE build=%Q AND project=%Q",
 			build, project);
 	} else {
-		CFArrayRef projects = DBCopyProjectNames(session, DBGetCurrentBuild(session));
+		CFArrayRef projects = DBCopyProjectNames(DBGetCurrentBuild());
 		if (projects) {
 			CFIndex i, count = CFArrayGetCount(projects);
 			for (i = 0; i < count; ++i) {
 				CFStringRef name = CFArrayGetValueAtIndex(projects, i);
 				char* project = strdup_cfstr(name);
 				fprintf(stdout, "%s:\n", project);
-				res = SQL_CALLBACK(session, &printFiles, NULL,
+				res = SQL_CALLBACK(&printFiles, NULL,
 					"SELECT path FROM files WHERE build=%Q AND project=%Q",
 					build, project);
 				free(project);

Modified: trunk/darwinxref/plugins/exportIndex.c
===================================================================
--- trunk/darwinxref/plugins/exportIndex.c	2005-06-16 21:31:30 UTC (rev 13)
+++ trunk/darwinxref/plugins/exportIndex.c	2006-10-04 08:37:00 UTC (rev 14)
@@ -34,7 +34,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-static int run(void* session, CFArrayRef argv) {
+static int run(CFArrayRef argv) {
 	int res = 0;
 	CFIndex count = CFArrayGetCount(argv);
 	if (count > 1)  return -1;
@@ -46,8 +46,8 @@
 		if (!xml) return -1;
 	}
 	
-	CFStringRef build = DBGetCurrentBuild(session);
-	CFPropertyListRef plist = DBCopyBuildPlist(session, build);
+	CFStringRef build = DBGetCurrentBuild();
+	CFPropertyListRef plist = DBCopyBuildPlist(build);
 	if (xml) {
 		CFDataRef data = CFPropertyListCreateXMLData(NULL, plist);
 		res = write(STDOUT_FILENO, CFDataGetBytePtr(data), CFDataGetLength(data));
@@ -57,23 +57,17 @@
 	return res;
 }
 
-static CFStringRef usage(void* session) {
+static CFStringRef usage() {
 	return CFRetain(CFSTR("[-xml]"));
 }
 
-DBPlugin* initialize(int version) {
-	DBPlugin* plugin = NULL;
-
-	if (version != kDBPluginCurrentVersion) return NULL;
+int initialize(int version) {
+	//if ( version < kDBPluginCurrentVersion ) return -1;
 	
-	plugin = malloc(sizeof(DBPlugin));
-	if (plugin == NULL) return NULL;
-	
-	plugin->version = kDBPluginCurrentVersion;
-	plugin->type = kDBPluginType;
-	plugin->name = CFSTR("exportIndex");
-	plugin->run = &run;
-	plugin->usage = &usage;
+	DBPluginSetType(kDBPluginBasicType);
+	DBPluginSetName(CFSTR("exportIndex"));
+	DBPluginSetRunFunc(&run);
+	DBPluginSetUsageFunc(&usage);
+	return 0;
+}
 
-	return plugin;
-}
\ No newline at end of file

Modified: trunk/darwinxref/plugins/findFile.c
===================================================================
--- trunk/darwinxref/plugins/findFile.c	2005-06-16 21:31:30 UTC (rev 13)
+++ trunk/darwinxref/plugins/findFile.c	2006-10-04 08:37:00 UTC (rev 14)
@@ -35,41 +35,34 @@
 #include <stdio.h>
 #include <regex.h>
 
-static int findFile(void* db, char* file, char* build);
+static int findFile(char* file, char* build);
 
-static int run(void* session, CFArrayRef argv) {
+static int run(CFArrayRef argv) {
 	int res = 0;
 	CFIndex count = CFArrayGetCount(argv);
 	if (count != 1)  return -1;
 
 	char* file = strdup_cfstr(CFArrayGetValueAtIndex(argv, 0));	
-	char* build = strdup_cfstr(DBGetCurrentBuild(session));
+	char* build = strdup_cfstr(DBGetCurrentBuild());
 	
-	findFile(session, file, build);
+	findFile(file, build);
 
 	if (file) free(file);
 	return res;
 }
 
-static CFStringRef usage(void* session) {
+static CFStringRef usage() {
 	return CFRetain(CFSTR("<file>"));
 }
 
-DBPlugin* initialize(int version) {
-	DBPlugin* plugin = NULL;
-
-	if (version != kDBPluginCurrentVersion) return NULL;
+int initialize(int version) {
+	//if ( version < kDBPluginCurrentVersion ) return -1;
 	
-	plugin = malloc(sizeof(DBPlugin));
-	if (plugin == NULL) return NULL;
-	
-	plugin->version = kDBPluginCurrentVersion;
-	plugin->type = kDBPluginType;
-	plugin->name = CFSTR("findFile");
-	plugin->run = &run;
-	plugin->usage = &usage;
-
-	return plugin;
+	DBPluginSetType(kDBPluginBasicType);
+	DBPluginSetName(CFSTR("findFile"));
+	DBPluginSetRunFunc(&run);
+	DBPluginSetUsageFunc(&usage);
+	return 0;
 }
 
 int printFiles(void* pArg, int argc, char **argv, char** columnNames) {
@@ -82,12 +75,12 @@
 	return 0;
 }
 
-static int findFile(void* db, char* file, char* build) {
+static int findFile(char* file, char* build) {
 	char* errmsg;
 	char project[BUFSIZ];
 	project[0] = 0;
 	asprintf(&file, "%%%s", file);
-	int res = SQL_CALLBACK(db, &printFiles, project,
+	int res = SQL_CALLBACK(&printFiles, project,
 		"SELECT project,path FROM files WHERE build=%Q AND path LIKE %Q ORDER BY project, path",
 		build, file);
 	return 0;

Modified: trunk/darwinxref/plugins/loadDeps.c
===================================================================
--- trunk/darwinxref/plugins/loadDeps.c	2005-06-16 21:31:30 UTC (rev 13)
+++ trunk/darwinxref/plugins/loadDeps.c	2006-10-04 08:37:00 UTC (rev 14)
@@ -34,38 +34,31 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
-int loadDeps(void* session, const char* build, const char* project);
+int loadDeps(const char* build, const char* project);
 
-static int run(void* session, CFArrayRef argv) {
+static int run(CFArrayRef argv) {
 	int res = 0;
 	CFIndex count = CFArrayGetCount(argv);
 	if (count != 1)  return -1;
 	char* project = strdup_cfstr(CFArrayGetValueAtIndex(argv, 0));
-	char* build = strdup_cfstr(DBGetCurrentBuild(session));
-	loadDeps(session, build, project);
+	char* build = strdup_cfstr(DBGetCurrentBuild());
+	loadDeps(build, project);
 	free(project);
 	return res;
 }
 
-static CFStringRef usage(void* session) {
+static CFStringRef usage() {
 	return CFRetain(CFSTR("<project>"));
 }
 
-DBPlugin* initialize(int version) {
-	DBPlugin* plugin = NULL;
-
-	if (version != kDBPluginCurrentVersion) return NULL;
+int initialize(int version) {
+	//if ( version < kDBPluginCurrentVersion ) return -1;
 	
-	plugin = malloc(sizeof(DBPlugin));
-	if (plugin == NULL) return NULL;
-	
-	plugin->version = kDBPluginCurrentVersion;
-	plugin->type = kDBPluginType;
-	plugin->name = CFSTR("loadDeps");
-	plugin->run = &run;
-	plugin->usage = &usage;
-
-	return plugin;
+	DBPluginSetType(kDBPluginBasicType);
+	DBPluginSetName(CFSTR("loadDeps"));
+	DBPluginSetRunFunc(&run);
+	DBPluginSetUsageFunc(&usage);
+	return 0;
 }
 
 static int has_suffix(const char* big, const char* little) {
@@ -140,7 +133,7 @@
 #endif
 }
 
-int loadDeps(void* db, const char* build, const char* project) {
+int loadDeps(const char* build, const char* project) {
 	size_t size;
 	char* line;
 	int count = 0;
@@ -148,10 +141,10 @@
 	char* table = "CREATE TABLE unresolved_dependencies (build TEXT, project TEXT, type TEXT, dependency TEXT)";
 	char* index = "CREATE INDEX unresolved_dependencies_index ON unresolved_dependencies (build, project, type, dependency)";
 
-	SQL_NOERR(db, table);
-	SQL_NOERR(db, index);
+	SQL_NOERR(table);
+	SQL_NOERR(index);
 
-	if (SQL(db, "BEGIN")) { return -1; }
+	if (SQL("BEGIN")) { return -1; }
 
 	while ((line = fgetln(stdin, &size)) != NULL) {
 		if (line[size-1] == '\n') line[size-1] = 0; // chomp newline
@@ -180,7 +173,7 @@
 			int res = lstat(canonicalized, &sb);
 			// for now, skip if the path points to a directory
 			if (!(res == 0 && (sb.st_mode & S_IFDIR) == S_IFDIR)) {
-				SQL(db, "INSERT INTO unresolved_dependencies (build,project,type,dependency) VALUES (%Q,%Q,%Q,%Q)",
+				SQL("INSERT INTO unresolved_dependencies (build,project,type,dependency) VALUES (%Q,%Q,%Q,%Q)",
 					build, project, type, canonicalized);
 			}
 			free(canonicalized);
@@ -191,7 +184,7 @@
 		++count;
 	}
 
-	if (SQL(db, "COMMIT")) { return -1; }
+	if (SQL("COMMIT")) { return -1; }
 
 	fprintf(stderr, "loaded %d unresolved dependencies.\n", count);
 }

Modified: trunk/darwinxref/plugins/loadFiles.c
===================================================================
--- trunk/darwinxref/plugins/loadFiles.c	2005-06-16 21:31:30 UTC (rev 13)
+++ trunk/darwinxref/plugins/loadFiles.c	2006-10-04 08:37:00 UTC (rev 14)
@@ -35,39 +35,32 @@
 #include <stdio.h>
 #include <regex.h>
 
-static int loadFiles(void* db, const char* buildparam, const char* path);
+static int loadFiles(const char* buildparam, const char* path);
 
-static int run(void* session, CFArrayRef argv) {
+static int run(CFArrayRef argv) {
 	int res = 0;
 	CFStringRef project = NULL;
 	CFIndex count = CFArrayGetCount(argv);
 	if (count != 1)  return -1;
 	char* filename = strdup_cfstr(CFArrayGetValueAtIndex(argv, 0));
-	char* build = strdup_cfstr(DBGetCurrentBuild(session));
-	loadFiles(session, build, filename);
+	char* build = strdup_cfstr(DBGetCurrentBuild());
+	loadFiles(build, filename);
 	free(filename);
 	return res;
 }
 
-static CFStringRef usage(void* session) {
+static CFStringRef usage() {
 	return CFRetain(CFSTR("<logfile>"));
 }
 
-DBPlugin* initialize(int version) {
-	DBPlugin* plugin = NULL;
-
-	if (version != kDBPluginCurrentVersion) return NULL;
+int initialize(int version) {
+	//if ( version < kDBPluginCurrentVersion ) return -1;
 	
-	plugin = malloc(sizeof(DBPlugin));
-	if (plugin == NULL) return NULL;
-	
-	plugin->version = kDBPluginCurrentVersion;
-	plugin->type = kDBPluginType;
-	plugin->name = CFSTR("loadFiles");
-	plugin->run = &run;
-	plugin->usage = &usage;
-
-	return plugin;
+	DBPluginSetType(kDBPluginBasicType);
+	DBPluginSetName(CFSTR("loadFiles"));
+	DBPluginSetRunFunc(&run);
+	DBPluginSetUsageFunc(&usage);
+	return 0;
 }
 
 static inline int min(int a, int b) {
@@ -79,7 +72,7 @@
 // This way we can do intelligent sql queries on the index
 // data.
 //
-int loadFiles(void* db, const char* buildparam, const char* path) {
+int loadFiles(const char* buildparam, const char* path) {
 	FILE* fp = fopen(path, "r");
 	int loaded = 0, total = 0;
 	if (fp) {
@@ -89,7 +82,7 @@
 		// Create the projects table if it does not already exist
 		//
 				
-		if (SQL(db, "BEGIN")) { return -1; }
+		if (SQL("BEGIN")) { return -1; }
 
 		char project[PATH_MAX];
 		char build[PATH_MAX];
@@ -142,8 +135,7 @@
 				int len = min(matches[1].rm_eo - matches[1].rm_so, PATH_MAX);
 				strncpy(path, line + matches[1].rm_so, len);
 				path[len] = 0;
-				int res = SQL(db,
-					"INSERT INTO files (build,project,path) VALUES (%Q, %Q, %Q)",
+				int res = SQL("INSERT INTO files (build,project,path) VALUES (%Q, %Q, %Q)",
 					build, project, path);
 				if (res != 0) { return res; }
 				++loaded;
@@ -159,8 +151,7 @@
 				int len = matches[1].rm_eo - matches[1].rm_so;
 				strncpy(project, line + matches[1].rm_so, len);
 				project[len] = 0;
-				int res = SQL(db,
-					"DELETE FROM files WHERE build=%Q AND project=%Q",
+				int res = SQL("DELETE FROM files WHERE build=%Q AND project=%Q",
 					build, project);
 				if (res != 0) { return res; }
 				++total;
@@ -174,7 +165,7 @@
 		}
 		fclose(fp);
 
-		if (SQL(db, "COMMIT")) { return -1; }
+		if (SQL("COMMIT")) { return -1; }
 
 	} else {
 		perror(path);

Modified: trunk/darwinxref/plugins/loadIndex.c
===================================================================
--- trunk/darwinxref/plugins/loadIndex.c	2005-06-16 21:31:30 UTC (rev 13)
+++ trunk/darwinxref/plugins/loadIndex.c	2006-10-04 08:37:00 UTC (rev 14)
@@ -33,7 +33,7 @@
 #include "DBPlugin.h"
 #include <sys/stat.h>
 
-static int run(void* session, CFArrayRef argv) {
+static int run(CFArrayRef argv) {
 	int res = 0;
 	CFStringRef project = NULL;
 	CFIndex count = CFArrayGetCount(argv);
@@ -41,29 +41,22 @@
 	char* filename = strdup_cfstr(CFArrayGetValueAtIndex(argv, 0));
 	CFPropertyListRef plist = read_plist(filename);
 	if (plist) {
-		res = DBSetPlist(session, NULL, plist);
+		res = DBSetPlist(NULL, plist);
 	}
 	free(filename);
 	return res;
 }
 
-static CFStringRef usage(void* session) {
+static CFStringRef usage() {
 	return CFRetain(CFSTR("<plist>"));
 }
 
-DBPlugin* initialize(int version) {
-	DBPlugin* plugin = NULL;
-
-	if (version != kDBPluginCurrentVersion) return NULL;
+int initialize(int version) {
+	//if ( version < kDBPluginCurrentVersion ) return -1;
 	
-	plugin = malloc(sizeof(DBPlugin));
-	if (plugin == NULL) return NULL;
-	
-	plugin->version = kDBPluginCurrentVersion;
-	plugin->type = kDBPluginType;
-	plugin->name = CFSTR("loadIndex");
-	plugin->run = &run;
-	plugin->usage = &usage;
-
-	return plugin;
+	DBPluginSetType(kDBPluginBasicType);
+	DBPluginSetName(CFSTR("loadIndex"));
+	DBPluginSetRunFunc(&run);
+	DBPluginSetUsageFunc(&usage);
+	return 0;
 }

Modified: trunk/darwinxref/plugins/original.c
===================================================================
--- trunk/darwinxref/plugins/original.c	2005-06-16 21:31:30 UTC (rev 13)
+++ trunk/darwinxref/plugins/original.c	2006-10-04 08:37:00 UTC (rev 14)
@@ -32,33 +32,26 @@
 
 #include "DBPlugin.h"
 
-static int run(void* session, CFArrayRef argv) {
+static int run(CFArrayRef argv) {
 	if (CFArrayGetCount(argv) != 1)  return -1;
-	CFStringRef build = DBGetCurrentBuild(session);
+	CFStringRef build = DBGetCurrentBuild();
 	CFStringRef project = CFArrayGetValueAtIndex(argv, 0);
-	CFStringRef original = DBCopyPropString(session, build, project, CFSTR("original"));
+	CFStringRef original = DBCopyPropString(build, project, CFSTR("original"));
 	cfprintf(stdout, "%@\n", original);
 	return 0;
 }
 
-static CFStringRef usage(void* session) {
+static CFStringRef usage() {
 	return CFRetain(CFSTR("<project>"));
 }
 
-DBPropertyPlugin* initialize(int version) {
-	DBPropertyPlugin* plugin = NULL;
-
-	if (version != kDBPluginCurrentVersion) return NULL;
+int initialize(int version) {
+	//if ( version < kDBPluginCurrentVersion ) return -1;
 	
-	plugin = malloc(sizeof(DBPropertyPlugin));
-	if (plugin == NULL) return NULL;
-	
-	plugin->base.version = kDBPluginCurrentVersion;
-	plugin->base.type = kDBPluginPropertyType;
-	plugin->base.name = CFSTR("original");
-	plugin->base.run = &run;
-	plugin->base.usage = &usage;
-	plugin->datatype = CFStringGetTypeID();
-
-	return plugin;
+	DBPluginSetType(kDBPluginPropertyType);
+	DBPluginSetName(CFSTR("original"));
+	DBPluginSetRunFunc(&run);
+	DBPluginSetUsageFunc(&usage);
+	DBPluginSetDataType(CFStringGetTypeID());
+	return 0;
 }

Modified: trunk/darwinxref/plugins/register.c
===================================================================
--- trunk/darwinxref/plugins/register.c	2005-06-16 21:31:30 UTC (rev 13)
+++ trunk/darwinxref/plugins/register.c	2006-10-04 08:37:00 UTC (rev 14)
@@ -37,41 +37,34 @@
 #include <fts.h>
 #include <fcntl.h>
 
-int register_files(void* db, char* build, char* project, char* path);
+int register_files(char* build, char* project, char* path);
 
-static int run(void* session, CFArrayRef argv) {
+static int run(CFArrayRef argv) {
 	int res = 0;
 	CFIndex count = CFArrayGetCount(argv);
 	if (count != 2)  return -1;
-	char* build = strdup_cfstr(DBGetCurrentBuild(session));
+	char* build = strdup_cfstr(DBGetCurrentBuild());
 	char* project = strdup_cfstr(CFArrayGetValueAtIndex(argv, 0));
 	char* dstroot = strdup_cfstr(CFArrayGetValueAtIndex(argv, 1));
-	res = register_files(session, build, project, dstroot);
+	res = register_files(build, project, dstroot);
 	free(build);
 	free(project);
 	free(dstroot);
 	return res;
 }
 
-static CFStringRef usage(void* session) {
+static CFStringRef usage() {
 	return CFRetain(CFSTR("<project> <dstroot>"));
 }
 
-DBPlugin* initialize(int version) {
-	DBPlugin* plugin = NULL;
-
-	if (version != kDBPluginCurrentVersion) return NULL;
+int initialize(int version) {
+	//if ( version < kDBPluginCurrentVersion ) return -1;
 	
-	plugin = malloc(sizeof(DBPlugin));
-	if (plugin == NULL) return NULL;
-	
-	plugin->version = kDBPluginCurrentVersion;
-	plugin->type = kDBPluginType;
-	plugin->name = CFSTR("register");
-	plugin->run = &run;
-	plugin->usage = &usage;
-
-	return plugin;
+	DBPluginSetType(kDBPluginBasicType);
+	DBPluginSetName(CFSTR("register"));
+	DBPluginSetRunFunc(&run);
+	DBPluginSetUsageFunc(&usage);
+	return 0;
 }
 
 static int buildpath(char* path, size_t bufsiz, FTSENT* ent) {
@@ -96,7 +89,7 @@
 #include <mach-o/fat.h>
 #include <mach-o/swap.h>
 
-static int register_mach_header(void* db, char* build, char* project, struct mach_header* mh, int fd) {
+static int register_mach_header(char* build, char* project, struct mach_header* mh, int fd) {
 	int swap = 0;
 	if (mh->magic != MH_MAGIC && mh->magic != MH_CIGAM) return 0;
 	if (mh->magic == MH_CIGAM) { 
@@ -139,8 +132,7 @@
 			if (res < sizeof(strsize)) { return 0; }
 			str[strsize] = 0; // NUL-terminate
 						
-			res = SQL(db,
-			"INSERT INTO unresolved_dependencies (build,project,type,dependency) VALUES (%Q,%Q,%Q,%Q)",
+			res = SQL("INSERT INTO unresolved_dependencies (build,project,type,dependency) VALUES (%Q,%Q,%Q,%Q)",
 			build, project, "lib", str);
 			
 			//fprintf(stdout, "\t%s\n", str);
@@ -155,7 +147,7 @@
 	return 0;
 }
 
-int register_libraries(void* db, char* project, char* version, char* path) {
+int register_libraries(char* project, char* version, char* path) {
 	int res;
 	int fd = open(path, O_RDONLY);
 	if (fd == -1) {
@@ -194,12 +186,12 @@
 
 			res = read(fd, &mh, sizeof(mh));
 			if (res < sizeof(mh)) { goto error_out; }
-			register_mach_header(db, project, version, &mh, fd);
+			register_mach_header(project, version, &mh, fd);
 			
 			lseek(fd, save, SEEK_SET);
 		}
 	} else {
-		register_mach_header(db, project, version, &mh, fd);
+		register_mach_header(project, version, &mh, fd);
 	}
 error_out:
 	close(fd);
@@ -207,24 +199,24 @@
 }
 
 
-int register_files(void* db, char* build, char* project, char* path) {
+int register_files(char* build, char* project, char* path) {
 	char* errmsg;
 	int res;
 	int loaded = 0;
 	
 	char* table = "CREATE TABLE files (build text, project text, path text)";
 	char* index = "CREATE INDEX files_index ON files (build, project, path)";
-	SQL_NOERR(db, table);
-	SQL_NOERR(db, index);
+	SQL_NOERR(table);
+	SQL_NOERR(index);
+	table = "CREATE TABLE unresolved_dependencies (build text, project text, type text, dependency)";
+	SQL_NOERR(table);
 	
-	if (SQL(db, "BEGIN")) { return -1; }
+	if (SQL("BEGIN")) { return -1; }
 	
-	res = SQL(db,
-		"DELETE FROM files WHERE build=%Q AND project=%Q",
+	res = SQL("DELETE FROM files WHERE build=%Q AND project=%Q",
 		build, project);
 
-	SQL(db,
-		"DELETE FROM unresolved_dependencies WHERE build=%Q AND project=%Q", 
+	SQL("DELETE FROM unresolved_dependencies WHERE build=%Q AND project=%Q", 
 		build, project);
 
 	//
@@ -236,7 +228,7 @@
 	// Skip the first result, since that is . of the DSTROOT itself.
 	int skip = 1;
 	char* path_argv[] = { path, NULL };
-	FTS* fts = fts_open(path_argv, FTS_PHYSICAL | FTS_XDEV, NULL);
+	FTS* fts = fts_open(path_argv, FTS_PHYSICAL | FTS_COMFOLLOW | FTS_XDEV, NULL);
 	if (fts != NULL) {
 		FTSENT* ent;
 		while (ent = fts_read(fts)) {
@@ -249,8 +241,7 @@
 				if (!skip) {
 					printf("%s\n", path);
 					++loaded;
-					res = SQL(db,
-	"INSERT INTO files (build, project, path) VALUES (%Q,%Q,%Q)",
+					res = SQL("INSERT INTO files (build, project, path) VALUES (%Q,%Q,%Q)",
 						build, project, path);
 				} else {
 					skip = 0;
@@ -259,16 +250,16 @@
 				ent->fts_number = 1;
 
 				if (ent->fts_info == FTS_F) {
-					res = register_libraries(db, build, project, ent->fts_accpath);
+					res = register_libraries(build, project, ent->fts_accpath);
 				}
 			}
 		}
 		fts_close(fts);
 	}
 	
-	if (SQL(db, "COMMIT")) { return -1; }
+	if (SQL("COMMIT")) { return -1; }
 
-	fprintf(stdout, "%d files registered.\n", loaded);
+	fprintf(stdout, "%s - %d files registered.\n", project, loaded);
 	
 	return res;
 }

Modified: trunk/darwinxref/plugins/resolveDeps.c
===================================================================
--- trunk/darwinxref/plugins/resolveDeps.c	2005-06-16 21:31:30 UTC (rev 13)
+++ trunk/darwinxref/plugins/resolveDeps.c	2006-10-04 08:37:00 UTC (rev 14)
@@ -34,38 +34,31 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
-int resolve_dependencies(void* session, const char* build, const char* project);
+int resolve_dependencies(const char* build, const char* project);
 
-static int run(void* session, CFArrayRef argv) {
+static int run(CFArrayRef argv) {
 	int res = 0;
 	CFIndex count = CFArrayGetCount(argv);
 	if (count >= 1)  return -1;
 	char* project = (count == 1) ? strdup_cfstr(CFArrayGetValueAtIndex(argv, 0)) : NULL;
-	char* build = strdup_cfstr(DBGetCurrentBuild(session));
-	resolve_dependencies(session, build, project);
+	char* build = strdup_cfstr(DBGetCurrentBuild());
+	resolve_dependencies(build, project);
 	free(project);
 	return res;
 }
 
-static CFStringRef usage(void* session) {
+static CFStringRef usage() {
 	return CFRetain(CFSTR("[<project>]"));
 }
 
-DBPlugin* initialize(int version) {
-	DBPlugin* plugin = NULL;
-
-	if (version != kDBPluginCurrentVersion) return NULL;
+int initialize(int version) {
+	//if ( version < kDBPluginCurrentVersion ) return -1;
 	
-	plugin = malloc(sizeof(DBPlugin));
-	if (plugin == NULL) return NULL;
-	
-	plugin->version = kDBPluginCurrentVersion;
-	plugin->type = kDBPluginType;
-	plugin->name = CFSTR("resolveDeps");
-	plugin->run = &run;
-	plugin->usage = &usage;
-
-	return plugin;
+	DBPluginSetType(kDBPluginBasicType);
+	DBPluginSetName(CFSTR("resolveDeps"));
+	DBPluginSetRunFunc(&run);
+	DBPluginSetUsageFunc(&usage);
+	return 0;
 }
 
 static int addToCStrArrays(void* pArg, int argc, char** argv, char** columnNames) {
@@ -77,14 +70,14 @@
 	return 0;
 }
 
-int resolve_project_dependencies(void* db, const char* build, const char* project, int* resolvedCount, int* unresolvedCount) {
+int resolve_project_dependencies( const char* build, const char* project, int* resolvedCount, int* unresolvedCount) {
 	CFMutableArrayRef files = CFArrayCreateMutable(NULL, 0, &cfArrayCStringCallBacks);
 	CFMutableArrayRef types = CFArrayCreateMutable(NULL, 0, &cfArrayCStringCallBacks);
 	CFMutableArrayRef params[2] = { files, types };
 
-	if (SQL(db, "BEGIN")) { return -1; }
+	if (SQL("BEGIN")) { return -1; }
 
-	SQL_CALLBACK(db, &addToCStrArrays, params,
+	SQL_CALLBACK(&addToCStrArrays, params,
 		"SELECT DISTINCT dependency,type FROM unresolved_dependencies WHERE build=%Q AND project=%Q",
 		build, project);
 
@@ -94,31 +87,31 @@
 		const char* type = CFArrayGetValueAtIndex(types, i);
 		// XXX
 		// This assumes a 1-to-1 mapping between files and projects.
-		char* dep = (char*)SQL_STRING(db, "SELECT project FROM files WHERE path=%Q", file);
+		char* dep = (char*)SQL_STRING("SELECT project FROM files WHERE path=%Q", file);
 		if (dep) {
 			// don't add duplicates
-			int exists = SQL_BOOLEAN(db, "SELECT 1 FROM dependencies WHERE build=%Q AND project=%Q AND type=%Q AND dependency=%Q",
+			int exists = SQL_BOOLEAN("SELECT 1 FROM dependencies WHERE build=%Q AND project=%Q AND type=%Q AND dependency=%Q",
 				build, project, type, dep);
 			if (!exists) {
-				SQL(db, "INSERT INTO dependencies (build,project,type,dependency) VALUES (%Q,%Q,%Q,%Q)",
+				SQL("INSERT INTO dependencies (build,project,type,dependency) VALUES (%Q,%Q,%Q,%Q)",
 					build, project, type, dep);
 				*resolvedCount += 1;
 				fprintf(stderr, "\t%s (%s)\n", dep, type);
 			}
-			SQL(db, "DELETE FROM unresolved_dependencies WHERE build=%Q AND project=%Q AND type=%Q AND dependency=%Q",
+			SQL("DELETE FROM unresolved_dependencies WHERE build=%Q AND project=%Q AND type=%Q AND dependency=%Q",
 				build, project, type, file);
 		} else {
 			*unresolvedCount += 1;
 		}
 	}
 
-	if (SQL(db, "COMMIT")) { return -1; }
+	if (SQL("COMMIT")) { return -1; }
 	
 	CFRelease(files);
 	CFRelease(types);
 }
 
-int resolve_dependencies(void* db, const char* build, const char* project) {
+int resolve_dependencies(const char* build, const char* project) {
 	CFMutableArrayRef builds = CFArrayCreateMutable(NULL, 0, &cfArrayCStringCallBacks);
 	CFMutableArrayRef projects = CFArrayCreateMutable(NULL, 0, &cfArrayCStringCallBacks);
 	int resolvedCount = 0, unresolvedCount = 0;
@@ -129,16 +122,16 @@
 	// Otherwise, resolve only that project or version.
 	//
 	if (build == NULL && project == NULL) {
-		SQL_CALLBACK(db, &addToCStrArrays, params, "SELECT DISTINCT build,project FROM unresolved_dependencies");
+		SQL_CALLBACK(&addToCStrArrays, params, "SELECT DISTINCT build,project FROM unresolved_dependencies");
 	} else {
-		SQL_CALLBACK(db, &addToCStrArrays, params, "SELECT DISTINCT build,project FROM unresolved_dependencies WHERE project=%Q", project);
+		SQL_CALLBACK(&addToCStrArrays, params, "SELECT DISTINCT build,project FROM unresolved_dependencies WHERE project=%Q", project);
 	}
 	CFIndex i, count = CFArrayGetCount(projects);
 	for (i = 0; i < count; ++i) {
 		const char* build = CFArrayGetValueAtIndex(builds, i);
 		const char* project = CFArrayGetValueAtIndex(projects, i);
 		fprintf(stderr, "%s (%s)\n", project, build);
-		resolve_project_dependencies(db, build, project, &resolvedCount, &unresolvedCount);
+		resolve_project_dependencies(build, project, &resolvedCount, &unresolvedCount);
 	}
 
 	fprintf(stderr, "%d dependencies resolved, %d remaining.\n", resolvedCount, unresolvedCount);

Modified: trunk/darwinxref/plugins/source_sites.c
===================================================================
--- trunk/darwinxref/plugins/source_sites.c	2005-06-16 21:31:30 UTC (rev 13)
+++ trunk/darwinxref/plugins/source_sites.c	2006-10-04 08:37:00 UTC (rev 14)
@@ -32,18 +32,18 @@
 
 #include "DBPlugin.h"
 
-static int run(void* session, CFArrayRef argv) {
+static int run(CFArrayRef argv) {
 	CFIndex i, count = CFArrayGetCount(argv);
-	CFStringRef build = DBGetCurrentBuild(session);
+	CFStringRef build = DBGetCurrentBuild();
 	CFStringRef project = NULL;
 	if (count > 1)  return -1;
 	if (count == 1) {
 		project = CFArrayGetValueAtIndex(argv, 0);
 	}
-	CFArrayRef source_sites = DBCopyPropArray(session, build, project, CFSTR("source_sites"));
+	CFArrayRef source_sites = DBCopyPropArray(build, project, CFSTR("source_sites"));
 	count = CFArrayGetCount(source_sites);
 	if (count == 0) {
-		source_sites = DBCopyPropArray(session, build, NULL, CFSTR("source_sites"));
+		source_sites = DBCopyPropArray(build, NULL, CFSTR("source_sites"));
 		count = CFArrayGetCount(source_sites);
 	}
 	for (i = 0; i < count; ++i) {
@@ -52,24 +52,17 @@
 	return 0;
 }
 
-static CFStringRef usage(void* session) {
+static CFStringRef usage() {
 	return CFRetain(CFSTR("[<project>]"));
 }
 
-DBPropertyPlugin* initialize(int version) {
-	DBPropertyPlugin* plugin = NULL;
-
-	if (version != kDBPluginCurrentVersion) return NULL;
+int initialize(int version) {
+	//if ( version < kDBPluginCurrentVersion ) return -1;
 	
-	plugin = malloc(sizeof(DBPropertyPlugin));
-	if (plugin == NULL) return NULL;
-	
-	plugin->base.version = kDBPluginCurrentVersion;
-	plugin->base.type = kDBPluginPropertyType;
-	plugin->base.name = CFSTR("source_sites");
-	plugin->base.run = &run;
-	plugin->base.usage = &usage;
-	plugin->datatype = CFArrayGetTypeID();
-
-	return plugin;
+	DBPluginSetType(kDBPluginPropertyType);
+	DBPluginSetName(CFSTR("source_sites"));
+	DBPluginSetRunFunc(&run);
+	DBPluginSetUsageFunc(&usage);
+	DBPluginSetDataType(CFArrayGetTypeID());
+	return 0;
 }

Modified: trunk/darwinxref/plugins/target.c
===================================================================
--- trunk/darwinxref/plugins/target.c	2005-06-16 21:31:30 UTC (rev 13)
+++ trunk/darwinxref/plugins/target.c	2006-10-04 08:37:00 UTC (rev 14)
@@ -32,33 +32,26 @@
 
 #include "DBPlugin.h"
 
-static int run(void* session, CFArrayRef argv) {
+static int run(CFArrayRef argv) {
 	if (CFArrayGetCount(argv) != 1)  return -1;
-	CFStringRef build = DBGetCurrentBuild(session);
+	CFStringRef build = DBGetCurrentBuild();
 	CFStringRef project = CFArrayGetValueAtIndex(argv, 0);
-	CFStringRef target = DBCopyPropString(session, build, project, CFSTR("target"));
+	CFStringRef target = DBCopyPropString(build, project, CFSTR("target"));
 	cfprintf(stdout, "%@\n", target);
 	return 0;
 }
 
-static CFStringRef usage(void* session) {
+static CFStringRef usage() {
 	return CFRetain(CFSTR("<project>"));
 }
 
-DBPropertyPlugin* initialize(int version) {
-	DBPropertyPlugin* plugin = NULL;
-
-	if (version != kDBPluginCurrentVersion) return NULL;
+int initialize(int version) {
+	//if ( version < kDBPluginCurrentVersion ) return -1;
 	
-	plugin = malloc(sizeof(DBPropertyPlugin));
-	if (plugin == NULL) return NULL;
-	
-	plugin->base.version = kDBPluginCurrentVersion;
-	plugin->base.type = kDBPluginPropertyType;
-	plugin->base.name = CFSTR("target");
-	plugin->base.run = &run;
-	plugin->base.usage = &usage;
-	plugin->datatype = CFStringGetTypeID();
-
-	return plugin;
+	DBPluginSetType(kDBPluginPropertyType);
+	DBPluginSetName(CFSTR("target"));
+	DBPluginSetRunFunc(&run);
+	DBPluginSetUsageFunc(&usage);
+	DBPluginSetDataType(CFStringGetTypeID());
+	return 0;
 }

Modified: trunk/darwinxref/plugins/version.c
===================================================================
--- trunk/darwinxref/plugins/version.c	2005-06-16 21:31:30 UTC (rev 13)
+++ trunk/darwinxref/plugins/version.c	2006-10-04 08:37:00 UTC (rev 14)
@@ -32,47 +32,40 @@
 
 #include "DBPlugin.h"
 
-void printProjectVersion(void* session, CFStringRef project) {
-	CFStringRef build = DBGetCurrentBuild(session);
-	CFStringRef version = DBCopyPropString(session, build, project, CFSTR("version"));
+void printProjectVersion(CFStringRef project) {
+	CFStringRef build = DBGetCurrentBuild();
+	CFStringRef version = DBCopyPropString(build, project, CFSTR("version"));
 	cfprintf(stdout, "%@-%@\n", project, version);
 }
 
-static int run(void* session, CFArrayRef argv) {
+static int run(CFArrayRef argv) {
 	if (CFArrayGetCount(argv) != 1)  return -1;
 	CFStringRef project = CFArrayGetValueAtIndex(argv, 0);
 	
 	if (CFEqual(project, CFSTR("*"))) {
-		CFArrayRef projects = DBCopyProjectNames(session, NULL);
+		CFArrayRef projects = DBCopyProjectNames(NULL);
 		CFIndex i, count = CFArrayGetCount(projects);
 		for (i = 0; i < count; ++i) {
-			printProjectVersion(session, CFArrayGetValueAtIndex(projects, i));
+			printProjectVersion(CFArrayGetValueAtIndex(projects, i));
 		}
 	} else {
-		printProjectVersion(session, project);
+		printProjectVersion(project);
 	}
 	
 	return 0;
 }
 
-static CFStringRef usage(void* session) {
+static CFStringRef usage() {
 	return CFRetain(CFSTR("<project>"));
 }
 
-DBPropertyPlugin* initialize(int version) {
-	DBPropertyPlugin* plugin = NULL;
-
-	if (version != kDBPluginCurrentVersion) return NULL;
+int initialize(int version) {
+	//if ( version < kDBPluginCurrentVersion ) return -1;
 	
-	plugin = malloc(sizeof(DBPropertyPlugin));
-	if (plugin == NULL) return NULL;
-	
-	plugin->base.version = kDBPluginCurrentVersion;
-	plugin->base.type = kDBPluginPropertyType;
-	plugin->base.name = CFSTR("version");
-	plugin->base.run = &run;
-	plugin->base.usage = &usage;
-	plugin->datatype = CFStringGetTypeID();
-
-	return plugin;
+	DBPluginSetType(kDBPluginPropertyType);
+	DBPluginSetName(CFSTR("version"));
+	DBPluginSetRunFunc(&run);
+	DBPluginSetUsageFunc(&usage);
+	DBPluginSetDataType(CFStringGetTypeID());
+	return 0;
 }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20061004/cdd4e0de/attachment-0001.html


More information about the darwinbuild-changes mailing list