| tdevdraw: cleanup, fix macargv - plan9port - [fork] Plan 9 from user space |
| git clone git://src.adamsgaard.dk/plan9port |
| Log |
| Files |
| Refs |
| README |
| LICENSE |
| --- |
| commit 7064acbd104d7c1af5a94533213d2bb124a7a60e |
| parent 0e881c054a76801032e640db3947e0602cfccbeb |
| Author: Russ Cox |
| Date: Wed, 12 Oct 2011 13:18:32 -0400
devdraw: cleanup, fix macargv
Diffstat:
M mac/Plumb.app/Contents/MacOS/plumb | 27 ++++++++++++++++++---------
A src/cmd/devdraw/macargv.m | 34 +++++++++++++++++++++++++++++++
M src/cmd/devdraw/mkfile | 20 ++++++++------------
M src/cmd/devdraw/mkwsysrules.sh | 4 ++--
M 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 |
| t@@ -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 |
| t@@ -0,0 +1,34 @@
+#import
+
+#include
+#include
+
+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 |
| diff --git a/src/cmd/devdraw/mkfile b/src/cmd/devdraw/mkfile |
| t@@ -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 |
| t@@ -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 |
| diff --git a/src/mkfile b/src/mkfile |
| t@@ -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\ |