diff options
author | Russ Cox <rsc@swtch.com> | 2010-10-27 18:22:03 -0700 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2010-10-27 18:22:03 -0700 |
commit | afea5fc3fd16a2865d0af52563f601a4c03d8256 (patch) | |
tree | b81993a174c8cdf7b49466120322ed9feb781adf | |
parent | c84e737c3f64030dc9b66ddb931cac757e9ba986 (diff) | |
download | plan9port-afea5fc3fd16a2865d0af52563f601a4c03d8256.tar.gz plan9port-afea5fc3fd16a2865d0af52563f601a4c03d8256.tar.bz2 plan9port-afea5fc3fd16a2865d0af52563f601a4c03d8256.zip |
mac: add 9term.app, Plumb.app
R=rsc
http://codereview.appspot.com/2783041
-rw-r--r-- | lib/moveplan9.files | 2 | ||||
-rw-r--r-- | mac/9term.app/Contents/Info.plist | 28 | ||||
-rwxr-xr-x | mac/9term.app/Contents/MacOS/9term | 5 | ||||
-rw-r--r-- | mac/9term.app/Contents/PkgInfo | 2 | ||||
-rw-r--r-- | mac/9term.app/Contents/Resources/spaceglenda.icns | bin | 0 -> 148345 bytes | |||
-rw-r--r-- | mac/Plumb.app/Contents/Info.plist | 78 | ||||
-rwxr-xr-x | mac/Plumb.app/Contents/MacOS/plumb | 4 | ||||
-rw-r--r-- | mac/Plumb.app/Contents/PkgInfo | 2 | ||||
-rw-r--r-- | mac/Plumb.app/Contents/Resources/pjw.icns | bin | 0 -> 84640 bytes | |||
-rw-r--r-- | mac/spaceglenda.icns | bin | 0 -> 148345 bytes | |||
-rw-r--r-- | mac/spaceglenda.png | bin | 0 -> 1395356 bytes | |||
-rw-r--r-- | src/cmd/devdraw/macargv.c | 90 | ||||
-rw-r--r-- | src/cmd/devdraw/mkfile | 5 | ||||
-rw-r--r-- | src/cmd/devdraw/mkwsysrules.sh | 1 | ||||
-rw-r--r-- | src/cmd/rio/mkfile | 3 |
15 files changed, 220 insertions, 0 deletions
diff --git a/lib/moveplan9.files b/lib/moveplan9.files index f3fcf7cc..c46b9095 100644 --- a/lib/moveplan9.files +++ b/lib/moveplan9.files @@ -23,6 +23,8 @@ bin/unmount bin/vwhois bin/vmount bin/yesterday +mac/9term.app/Contents/MacOS/9term +mac/Plumb.app/Contents/MacOS/plumb mail/lib/qmail mail/lib/remotemail man/mkindex diff --git a/mac/9term.app/Contents/Info.plist b/mac/9term.app/Contents/Info.plist new file mode 100644 index 00000000..b6fbda79 --- /dev/null +++ b/mac/9term.app/Contents/Info.plist @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>9term</string> + <key>CFBundleGetInfoString</key> + <string>0.1-1</string> + <key>CFBundleIconFile</key> + <string>spaceglenda.icns</string> + <key>CFBundleIdentifier</key> + <string>com.swtch.9term</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>9term</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>0.1</string> + <key>CFBundleSignature</key> + <string>9term1</string> + <key>CFBundleVersion</key> + <string>1</string> +</dict> +</plist> diff --git a/mac/9term.app/Contents/MacOS/9term b/mac/9term.app/Contents/MacOS/9term new file mode 100755 index 00000000..ef6692c3 --- /dev/null +++ b/mac/9term.app/Contents/MacOS/9term @@ -0,0 +1,5 @@ +#!/bin/bash +cd $HOME +. ~/.bashrc +PLAN9=${PLAN9:-/usr/local/plan9} +$PLAN9/bin/9term -W600x800 & diff --git a/mac/9term.app/Contents/PkgInfo b/mac/9term.app/Contents/PkgInfo new file mode 100644 index 00000000..494274ce --- /dev/null +++ b/mac/9term.app/Contents/PkgInfo @@ -0,0 +1,2 @@ +APPL9term + diff --git a/mac/9term.app/Contents/Resources/spaceglenda.icns b/mac/9term.app/Contents/Resources/spaceglenda.icns Binary files differnew file mode 100644 index 00000000..058efbfd --- /dev/null +++ b/mac/9term.app/Contents/Resources/spaceglenda.icns diff --git a/mac/Plumb.app/Contents/Info.plist b/mac/Plumb.app/Contents/Info.plist new file mode 100644 index 00000000..cff94bb8 --- /dev/null +++ b/mac/Plumb.app/Contents/Info.plist @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>plumb</string> + <key>CFBundleGetInfoString</key> + <string>1</string> + <key>CFBundleIconFile</key> + <string>pjw.icns</string> + <key>CFBundleIdentifier</key> + <string>com.swtch.plan9port.plumb</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>Plumb</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>1</string> + <key>CFBundleSignature</key> + <string>Plumb1</string> + <key>CFBundleVersion</key> + <string>1</string> + <key>CFBundleDocumentTypes</key> + <array> + <dict> + <key>CFBundleTypeExtensions</key> + <array> + <string>C</string> + <string>asm</string> + <string>b</string> + <string>c</string> + <string>cc</string> + <string>cgi</string> + <string>cgo</string> + <string>cpp</string> + <string>cs</string> + <string>go</string> + <string>goc</string> + <string>h</string> + <string>java</string> + <string>l</string> + <string>lx</string> + <string>m</string> + <string>ms</string> + <string>pl</string> + <string>py</string> + <string>s</string> + <string>tex</string> + <string>txt</string> + <string>xy</string> + <string>y</string> + </array> + <key>CFBundleTypeIconFile</key> + <string>spaceglenda.icns</string> + <key>CFBundleTypeMIMETypes</key> + <array> + <string>text/plain</string> + </array> + <key>LSItemContentTypes</key> + <array> + <string>public.plain-text</string> + <string>public.source-code</string> + </array> + <key>CFBundleTypeName</key> + <string>Program Files</string> + <key>CFBundleTypeOSTypes</key> + <array> + </array> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + </dict> + </array> +</dict> +</plist> diff --git a/mac/Plumb.app/Contents/MacOS/plumb b/mac/Plumb.app/Contents/MacOS/plumb new file mode 100755 index 00000000..87e355aa --- /dev/null +++ b/mac/Plumb.app/Contents/MacOS/plumb @@ -0,0 +1,4 @@ +#!/bin/bash +. ~/.bashrc +PLAN9=${PLAN9:-/usr/local/plan9} +$PLAN9/bin/plumb $($PLAN9/bin/macargv) diff --git a/mac/Plumb.app/Contents/PkgInfo b/mac/Plumb.app/Contents/PkgInfo new file mode 100644 index 00000000..05192d30 --- /dev/null +++ b/mac/Plumb.app/Contents/PkgInfo @@ -0,0 +1,2 @@ +APPLPlumb + diff --git a/mac/Plumb.app/Contents/Resources/pjw.icns b/mac/Plumb.app/Contents/Resources/pjw.icns Binary files differnew file mode 100644 index 00000000..1f49f2cb --- /dev/null +++ b/mac/Plumb.app/Contents/Resources/pjw.icns diff --git a/mac/spaceglenda.icns b/mac/spaceglenda.icns Binary files differnew file mode 100644 index 00000000..058efbfd --- /dev/null +++ b/mac/spaceglenda.icns diff --git a/mac/spaceglenda.png b/mac/spaceglenda.png Binary files differnew file mode 100644 index 00000000..40d6ef03 --- /dev/null +++ b/mac/spaceglenda.png diff --git a/src/cmd/devdraw/macargv.c b/src/cmd/devdraw/macargv.c new file mode 100644 index 00000000..a5ea1ade --- /dev/null +++ b/src/cmd/devdraw/macargv.c @@ -0,0 +1,90 @@ +#include <u.h> +#include <stdio.h> +#include <Carbon/Carbon.h> + +AUTOFRAMEWORK(Carbon) + +static OSErr Handler(const AppleEvent *event, AppleEvent *reply, long handlerRefcon); + +int +main(void) +{ + AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, Handler, 0, false); + RunApplicationEventLoop(); + return 0; +} + +static OSErr +GetFullPathname(FSSpec *fss, char *path, int len) +{ + FSRef fsr; + OSErr err; + + *path = '\0'; + err = FSpMakeFSRef(fss, &fsr); + if (err == fnfErr) { + /* FSSpecs can point to non-existing files, fsrefs can't. */ + FSSpec fss2; + int tocopy; + + err = FSMakeFSSpec(fss->vRefNum, fss->parID, + (unsigned char*)"", &fss2); + if (err) + return err; + err = FSpMakeFSRef(&fss2, &fsr); + if (err) + return err; + err = (OSErr)FSRefMakePath(&fsr, (unsigned char*)path, len-1); + if (err) + return err; + /* This part is not 100% safe: we append the filename part, but + ** I'm not sure that we don't run afoul of the various 8bit + ** encodings here. Will have to look this up at some point... + */ + strcat(path, "/"); + tocopy = fss->name[0]; + if ((strlen(path) + tocopy) >= len) + tocopy = len - strlen(path) - 1; + if (tocopy > 0) + strncat(path, (char*)fss->name+1, tocopy); + } + else { + if (err) + return err; + err = (OSErr)FSRefMakePath(&fsr, (unsigned char*)path, len); + if (err) + return err; + } + return 0; +} + +static void +chk(int err) +{ + if(err != 0) { + printf("err %d\n", err); + exit(1); + } +} + +static OSErr +Handler(const AppleEvent *event, AppleEvent *reply, long handlerRefcon) +{ + AEDesc list; + DescType type; + FSSpec f; + AEKeyword keyword; + Size actual; + long len; + char s[1000]; + + chk(AEGetParamDesc(event, keyDirectObject, typeAEList, &list)); + chk(AECountItems(&list, &len)); + chk(AEGetNthPtr(&list, 1, typeFSS, &keyword, &type, (Ptr*)&f, sizeof(FSSpec), &actual)); + chk(GetFullPathname(&f, s, sizeof s)); + printf("%s\n", s); + fflush(stdout); + + // uncomment to keep handling more open events + exit(0); +} diff --git a/src/cmd/devdraw/mkfile b/src/cmd/devdraw/mkfile index eda896d9..67a865c0 100644 --- a/src/cmd/devdraw/mkfile +++ b/src/cmd/devdraw/mkfile @@ -41,3 +41,8 @@ CLEANFILES=latin1.h $O.mklatinkbd devdraw-cocoa: devdraw.o latin1.o mouseswap.o winsize.o osx-screen-objc.o osx-draw.o osx-srv-objc.o osx-delegate-objc.o $LD -o $target $prereq +install-macargv: $O.macargv + install $O.macargv $PLAN9/bin/macargv + +$O.macargv: macargv.$O + $LD -o $target $prereq diff --git a/src/cmd/devdraw/mkwsysrules.sh b/src/cmd/devdraw/mkwsysrules.sh index 5e65a29c..788a0e61 100644 --- a/src/cmd/devdraw/mkwsysrules.sh +++ b/src/cmd/devdraw/mkwsysrules.sh @@ -52,6 +52,7 @@ elif [ $WSYSTYPE = osx ]; then echo 'LDFLAGS=$LDFLAGS -F/System/Library/PrivateFrameworks' fi echo 'WSYSOFILES=$WSYSOFILES osx-screen-carbon-objc.o osx-draw.o osx-srv.o' + echo 'install: install-macargv' elif [ $WSYSTYPE = nowsys ]; then echo 'WSYSOFILES=nowsys.o' fi diff --git a/src/cmd/rio/mkfile b/src/cmd/rio/mkfile index e5426865..ec8710eb 100644 --- a/src/cmd/rio/mkfile +++ b/src/cmd/rio/mkfile @@ -41,3 +41,6 @@ error.$O: showevent/ShowEvent.c $O.xshove: xshove.$O $LD -o $O.xshove xshove.$O -lX11 +# bug in reusing mksysrules.sh +install-macargv: + true |