[37625] branches/gsoc08-framework/MacPorts.Framework
armahg at macports.org
armahg at macports.org
Sun Jun 15 19:40:46 PDT 2008
Revision: 37625
http://trac.macosforge.org/projects/macports/changeset/37625
Author: armahg at macports.org
Date: 2008-06-15 19:40:46 -0700 (Sun, 15 Jun 2008)
Log Message:
-----------
Adding preliminary code for Notifications
Modified Paths:
--------------
branches/gsoc08-framework/MacPorts.Framework/MacPorts.Framework.xcodeproj/project.pbxproj
Added Paths:
-----------
branches/gsoc08-framework/MacPorts.Framework/notifications.m
Modified: branches/gsoc08-framework/MacPorts.Framework/MacPorts.Framework.xcodeproj/project.pbxproj
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/MacPorts.Framework.xcodeproj/project.pbxproj 2008-06-16 00:47:14 UTC (rev 37624)
+++ branches/gsoc08-framework/MacPorts.Framework/MacPorts.Framework.xcodeproj/project.pbxproj 2008-06-16 02:40:46 UTC (rev 37625)
@@ -40,6 +40,7 @@
48E9939F0C82CEB000219DDF /* init.tcl in Resources */ = {isa = PBXBuildFile; fileRef = 48E9939E0C82CEB000219DDF /* init.tcl */; };
6E49F37B0DFFAB0B0030C3AF /* MPInterpreterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 489DD92E0C94674B00595506 /* MPInterpreterTest.m */; };
6E49F37F0DFFAFF80030C3AF /* MacPorts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* MacPorts.framework */; };
+ 6EA293580E05C8FC00902D12 /* notifications.m in Sources */ = {isa = PBXBuildFile; fileRef = 6EA293570E05C8FC00902D12 /* notifications.m */; };
8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; };
8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; };
/* End PBXBuildFile section */
@@ -86,6 +87,7 @@
6E88D1CA0DF4B90B00684E9F /* MPMacPortsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPMacPortsTest.h; sourceTree = "<group>"; };
6E88D1CB0DF4B90B00684E9F /* MPMacPortsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPMacPortsTest.m; sourceTree = "<group>"; };
6EA0F56E0DFEB55E00C15082 /* Tcl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Tcl.framework; path = System/Library/Frameworks/Tcl.framework; sourceTree = SDKROOT; };
+ 6EA293570E05C8FC00902D12 /* notifications.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = notifications.m; sourceTree = "<group>"; };
6EAFD8B70DEC614E00E97270 /* dummycommit.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = dummycommit.test; sourceTree = "<group>"; };
8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8DC2EF5B0486A6940098B216 /* MacPorts.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MacPorts.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -124,7 +126,7 @@
0867D691FE84028FC02AAC07 /* MacPorts Foundation */ = {
isa = PBXGroup;
children = (
- 6E88D3280DF5FFA000684E9F /* AlternateClasses */,
+ 6EA293540E05C8C600902D12 /* Tcl Notifications */,
6E88D1760DF46A2600684E9F /* Tests */,
08FB77AEFE84172EC02AAC07 /* Classes */,
32C88DFF0371C24200C91783 /* Other Sources */,
@@ -226,11 +228,12 @@
name = Tests;
sourceTree = "<group>";
};
- 6E88D3280DF5FFA000684E9F /* AlternateClasses */ = {
+ 6EA293540E05C8C600902D12 /* Tcl Notifications */ = {
isa = PBXGroup;
children = (
+ 6EA293570E05C8FC00902D12 /* notifications.m */,
);
- name = AlternateClasses;
+ name = "Tcl Notifications ";
sourceTree = "<group>";
};
/* End PBXGroup section */
@@ -397,6 +400,7 @@
48A866AB0CD364F700B521BC /* MPReceipt.m in Sources */,
481D04A30CDAAAFD00D4A550 /* MPMutableDictionary.m in Sources */,
4825ECC40CE61468006B0385 /* MPRegistry.m in Sources */,
+ 6EA293580E05C8FC00902D12 /* notifications.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -529,7 +533,6 @@
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1)";
ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1 = "ppc i386";
- BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/MacPorts.framework/MacPorts";
COPY_PHASE_STRIP = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(value)",
Added: branches/gsoc08-framework/MacPorts.Framework/notifications.m
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/notifications.m (rev 0)
+++ branches/gsoc08-framework/MacPorts.Framework/notifications.m 2008-06-16 02:40:46 UTC (rev 37625)
@@ -0,0 +1,113 @@
+/*
+ * $Id:$
+ * Authors:
+ * Randall H. Wood <rhwood at macports.org>
+ *
+ * Copyright (c) 2007 Randall H. Wood <rhwood at macports.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright owner nor the names of contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+
+
+#include <tcl.h>
+
+#include <Cocoa/Cocoa.h>
+
+int Notifications_Send(int objc, Tcl_Obj *CONST objv[], int global, Tcl_Interp *interpreter) {
+ NSString *name = nil;
+ NSMutableDictionary *info = nil;
+
+ int tclCount;
+ int tclResult;
+ int i;
+ const char **tclElements;
+
+ name = [NSString stringWithUTF8String:Tcl_GetString(*objv)];
+ ++objv; --objc;
+ tclResult = Tcl_SplitList(interpreter, Tcl_GetString(*objv), &tclCount, &tclElements);
+ if (tclResult == TCL_OK) {
+ info = [NSMutableDictionary dictionaryWithCapacity:(tclCount / 2)];
+ for (i = 0; i < tclCount; i +=2) {
+ [info setObject:[NSString stringWithUTF8String:tclElements[i + 1]] forKey:[NSString stringWithUTF8String:tclElements[i]]];
+ }
+ if (global != 0) {
+ [[NSDistributedNotificationCenter defaultCenter] postNotificationName:name object:nil userInfo:info];
+ } else {
+ [[NSNotificationCenter defaultCenter] postNotificationName:name object:nil userInfo:info];
+ }
+ } else {
+ return TCL_ERROR;
+ }
+
+ return TCL_OK;
+}
+
+int Notifications_Command(ClientData clientData, Tcl_Interp *interpreter, int objc, Tcl_Obj *CONST objv[]) {
+
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
+ NSString *action = nil;
+ int returnCode = TCL_ERROR;
+
+ ++objv, --objc;
+
+ if (objc) {
+ action = [NSString stringWithUTF8String:Tcl_GetString(*objv)];
+ ++objv, --objc;
+ if ([action isEqualToString:@"send"]) {
+ if ([[NSString stringWithUTF8String:Tcl_GetString(*objv)] isEqualToString:@"global"]) {
+ ++objv, --objc;
+ returnCode = Notifications_Send(objc, objv, 1, interpreter);
+ } else {
+ returnCode = Notifications_Send(objc, objv, 0, interpreter);
+ }
+ }
+ }
+
+ [pool release];
+ return returnCode;
+}
+
+int Notifications_Init(Tcl_Interp *interpreter) {
+
+ if (Tcl_InitStubs(interpreter, "8.4", 0) == NULL) {
+ return TCL_ERROR;
+ }
+
+ Tcl_CreateObjCommand(interpreter, "notifications", Notifications_Command, NULL, NULL);
+
+ if (Tcl_PkgProvide(interpreter, "notifications", "1.0") != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ return TCL_OK;
+}
+
+int Notifications_SafeInit(Tcl_Interp *interpreter) {
+
+ return Notifications_Init(interpreter);
+}
\ No newline at end of file
Property changes on: branches/gsoc08-framework/MacPorts.Framework/notifications.m
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080615/91c02923/attachment-0001.htm
More information about the macports-changes
mailing list