diff options
author | Russ Cox <rsc@swtch.com> | 2011-10-12 13:18:32 -0400 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2011-10-12 13:18:32 -0400 |
commit | 7064acbd104d7c1af5a94533213d2bb124a7a60e (patch) | |
tree | 748cbe0dc3520ff93ab3e38f605f03809412d34e | |
parent | 0e881c054a76801032e640db3947e0602cfccbeb (diff) | |
download | plan9port-7064acbd104d7c1af5a94533213d2bb124a7a60e.tar.gz plan9port-7064acbd104d7c1af5a94533213d2bb124a7a60e.tar.bz2 plan9port-7064acbd104d7c1af5a94533213d2bb124a7a60e.zip |
devdraw: cleanup, fix macargv
-rwxr-xr-x | mac/Plumb.app/Contents/MacOS/plumb | 27 | ||||
-rw-r--r-- | src/cmd/devdraw/macargv.m | 34 | ||||
-rw-r--r-- | src/cmd/devdraw/mkfile | 20 | ||||
-rw-r--r-- | src/cmd/devdraw/mkwsysrules.sh | 4 | ||||
-rw-r--r-- | src/mkfile | 1 |
5 files changed, 63 insertions, 23 deletions
diff --git a/mac/Plumb.app/Contents/MacOS/plumb b/mac/Plumb.app/Contents/MacOS/plumb index 80918aa2..fc5e2c30 100755 --- a/mac/Plumb.app/Contents/MacOS/plumb +++ b/mac/Plumb.app/Contents/MacOS/plumb @@ -1,12 +1,21 @@ #!/bin/bash + . ~/.bashrc PLAN9=${PLAN9:-/usr/local/plan9} -filename="$($PLAN9/bin/macargv)" -# Blank are problematic in the file name. Make them go away but keep the content. -if echo "$filename" | grep -q " " -then - base=$(basename "$filename" | sed 's/ /_/g') - cat "$filename" | plumb -i -d edit -a "action=showdata filename=/BadName/$base" -else - $PLAN9/bin/plumb -d edit "$filename" -fi + +bin=$PLAN9/bin +IFS=$'\n' + +for file in $($bin/macargv) +do + # Blanks are problematic in filenames: just plumb + # the file's content. + if echo "$file" | grep -q " " + then + base=$(basename "$file" | sed 's/ /_/g') + attr="action=showdata filename=/BadName/$base" + cat $file | "$bin/plumb" -i -d edit -a "$attr" + else + "$bin/plumb" -d edit "$file" + fi +done diff --git a/src/cmd/devdraw/macargv.m b/src/cmd/devdraw/macargv.m new file mode 100644 index 00000000..cf3e2282 --- /dev/null +++ b/src/cmd/devdraw/macargv.m @@ -0,0 +1,34 @@ +#import <Cocoa/Cocoa.h> + +#include <u.h> +#include <libc.h> + +AUTOFRAMEWORK(Cocoa) + +@interface appdelegate : NSObject @end + +void +main(void) +{ + if(OSX_VERSION < 100700) + [NSAutoreleasePool new]; + + [NSApplication sharedApplication]; + [NSApp setDelegate:[appdelegate new]]; + [NSApp run]; +} + +@implementation appdelegate +- (void)application:(id)arg openFiles:(NSArray*)file +{ + int i,n; + NSString *s; + + n = [file count]; + for(i=0; i<n; i++){ + s = [file objectAtIndex:i]; + print("%s\n", [s UTF8String]); + } + [NSApp terminate:self]; +} +@end diff --git a/src/cmd/devdraw/mkfile b/src/cmd/devdraw/mkfile index 1e7ac0bf..1194c79a 100644 --- a/src/cmd/devdraw/mkfile +++ b/src/cmd/devdraw/mkfile @@ -32,24 +32,20 @@ latin1.$O: latin1.h latin1.h: $PLAN9/lib/keyboard $O.mklatinkbd ./$O.mklatinkbd -r $PLAN9/lib/keyboard | sed 's/, }/ }/' >$target -CLEANFILES=latin1.h $O.mklatinkbd - -# Still in progress: Cocoa/Objective C version of devdraw +$O.macargv: $MACARGV + $LD -o $target $prereq %-objc.$O: %.m $CC $CFLAGS -o $target $stem.m -cocoa: devdraw.o latin1.o mouseswap.o winsize.o osx-draw.o cocoa-screen-objc.o cocoa-srv.o cocoa-thread.o - $LD -o $target $prereq +CLEANFILES=$O.macargv $O.mklatinkbd latin1.h +# old attempt 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 - -install: $MACARGV install: mklatinkbd.install +install:Q: + if [ $MACARGV ]; then + mk $MKFLAGS macargv.install + fi diff --git a/src/cmd/devdraw/mkwsysrules.sh b/src/cmd/devdraw/mkwsysrules.sh index 0554ff84..dde44c81 100644 --- a/src/cmd/devdraw/mkwsysrules.sh +++ b/src/cmd/devdraw/mkwsysrules.sh @@ -57,10 +57,10 @@ 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 'MACARGV=install-macargv' + echo 'MACARGV=macargv.o' elif [ $WSYSTYPE = osx-cocoa ]; then echo 'WSYSOFILES=$WSYSOFILES osx-draw.o cocoa-screen-objc.o cocoa-srv.o cocoa-thread.o' - echo 'MACARGV=install-macargv' + echo 'MACARGV=macargv-objc.o' elif [ $WSYSTYPE = nowsys ]; then echo 'WSYSOFILES=nowsys.o' fi @@ -16,6 +16,7 @@ libs-%:V: do (cd $i; echo cd `pwd`';' mk $MKFLAGS $stem; mk $MKFLAGS $stem) done + [ "$SYSNAME" != Darwin ] || ranlib ../lib/*.a MKDIRS=\ libbio\ |