mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
devdraw: cleanup, fix macargv
This commit is contained in:
parent
0e881c054a
commit
7064acbd10
5 changed files with 63 additions and 23 deletions
|
@ -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
|
||||
|
|
34
src/cmd/devdraw/macargv.m
Normal file
34
src/cmd/devdraw/macargv.m
Normal file
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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\
|
||||
|
|
Loading…
Reference in a new issue