[57365] users/toby/objcports
toby at macports.org
toby at macports.org
Thu Sep 10 00:14:42 PDT 2009
Revision: 57365
http://trac.macports.org/changeset/57365
Author: toby at macports.org
Date: 2009-09-10 00:14:42 -0700 (Thu, 10 Sep 2009)
Log Message:
-----------
cleanup
Modified Paths:
--------------
users/toby/objcports/MPDictionaryAdditions.c
users/toby/objcports/port.m
Modified: users/toby/objcports/MPDictionaryAdditions.c
===================================================================
--- users/toby/objcports/MPDictionaryAdditions.c 2009-09-10 07:13:51 UTC (rev 57364)
+++ users/toby/objcports/MPDictionaryAdditions.c 2009-09-10 07:14:42 UTC (rev 57365)
@@ -16,13 +16,13 @@
count2 = count / 2;
- const void *keys[count2];
- const void *values[count2];
+ CFStringRef keys[count2];
+ CFStringRef values[count2];
for (i = 0; i < count2; i++) {
keys[i] = CFStringCreateWithTclObject(allocator, objects[i * 2]);
values[i] = CFStringCreateWithTclObject(allocator, objects[i * 2 + 1]);
}
- result = CFDictionaryCreate(allocator, keys, values, count2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+ result = CFDictionaryCreate(allocator, (const void **)keys, (const void **)values, count2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
for (i = 0; i < count2; i++) {
CFRelease(keys[i]);
CFRelease(values[i]);
Modified: users/toby/objcports/port.m
===================================================================
--- users/toby/objcports/port.m 2009-09-10 07:13:51 UTC (rev 57364)
+++ users/toby/objcports/port.m 2009-09-10 07:14:42 UTC (rev 57365)
@@ -1,34 +1,39 @@
#include <Foundation/Foundation.h>
#include <tcl.h>
+#include "MPConfig.h"
#include "MPIndex.h"
#include "MPPort.h"
-#include "MPConfig.h"
-int
-main(int argc, char *argv[])
+static void
+do_showconfig()
{
-#if 0
- CFDictionaryRef config = MPCopyConfig();
+ CFDictionaryRef config;
+
+ config = MPCopyConfig();
CFShow(config);
CFRelease(config);
- return 0;
-#endif
+}
- if (argc < 2)
- exit(1);
+static void
+do_showindex(char *f)
+{
+ CFStringRef filename;
+ CFDictionaryRef index;
-#if 0
- CFStringRef filename = CFStringCreateWithCString(NULL, argv[1], kCFStringEncodingUTF8);
- CFDictionaryRef index = MPCopyPortIndex(filename);
+ filename = CFStringCreateWithCString(NULL, f, kCFStringEncodingUTF8);
+ index = MPCopyPortIndex(filename);
CFShow(index);
CFRelease(index);
CFRelease(filename);
- return 0;
-#endif
+}
+static void
+do_info(int argc, char *argv[])
+{
+ printf("%d\n", argc);
NSAutoreleasePool *pool = [NSAutoreleasePool new];
-
+
while (--argc) {
MPPort *port = [[MPPort alloc] initWithPath:[NSString stringWithUTF8String:*++argv] options:nil];
NSLog(@"%@ @%@ (%@)", [port variable:@"name"], [port variable:@"version"], [port variable:@"categories"]);
@@ -45,5 +50,27 @@
}
[pool release];
+}
+
+int
+main(int argc, char *argv[])
+{
+
+ if (argc < 2)
+ exit(1);
+
+ if (!strcmp(argv[1], "showconfig")) {
+ do_showconfig();
+ } else {
+ if (argc < 3)
+ exit(1);
+
+ if (!strcmp(argv[1], "showindex")) {
+ do_showindex(argv[2]);
+ } else {
+ do_info(argc - 1, argv + 1);
+ }
+ }
+
return 0;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090910/133a504b/attachment.html>
More information about the macports-changes
mailing list