aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2020-01-08 19:54:43 -0500
committerRuss Cox <rsc@swtch.com>2020-01-13 16:46:14 -0500
commitdb20f89c3286f277945ac4307f789a9980d31bf6 (patch)
treef8017b36dd8338bc665a9ec84a37eb79e7809d0d /src
parentf177c0ba18193fb89ad1b5d84eac2906e8c3b4f1 (diff)
downloadplan9port-db20f89c3286f277945ac4307f789a9980d31bf6.tar.gz
plan9port-db20f89c3286f277945ac4307f789a9980d31bf6.tar.bz2
plan9port-db20f89c3286f277945ac4307f789a9980d31bf6.zip
devdraw: simplify mac file names
Now that we only have Metal, we can drop the -metal. Also now that Carbon is gone we can drop the macargv.c, and then the -objc from object file names.
Diffstat (limited to 'src')
-rw-r--r--src/cmd/devdraw/cocoa-screen.m (renamed from src/cmd/devdraw/cocoa-screen-metal.m)0
-rw-r--r--src/cmd/devdraw/macargv.c90
-rw-r--r--src/cmd/devdraw/mkfile9
-rw-r--r--src/cmd/devdraw/mkwsysrules.sh4
4 files changed, 5 insertions, 98 deletions
diff --git a/src/cmd/devdraw/cocoa-screen-metal.m b/src/cmd/devdraw/cocoa-screen.m
index 984ede03..984ede03 100644
--- a/src/cmd/devdraw/cocoa-screen-metal.m
+++ b/src/cmd/devdraw/cocoa-screen.m
diff --git a/src/cmd/devdraw/macargv.c b/src/cmd/devdraw/macargv.c
deleted file mode 100644
index a5ea1ade..00000000
--- a/src/cmd/devdraw/macargv.c
+++ /dev/null
@@ -1,90 +0,0 @@
-#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 e60b427f..27613239 100644
--- a/src/cmd/devdraw/mkfile
+++ b/src/cmd/devdraw/mkfile
@@ -37,13 +37,10 @@ latin1.h: $PLAN9/lib/keyboard $O.mklatinkbd
$O.macargv: $MACARGV
$LD -o $target $prereq
-cocoa-screen-metal-objc.$O: cocoa-screen-metal.m
- $CC $CFLAGS $OBJCFLAGS -o $target cocoa-screen-metal.m
+%.$O: %.m
+ $CC $CFLAGS $OBJCFLAGS -o $target $stem.m
-%-objc.$O: %.m
- $CC $CFLAGS -o $target $stem.m
-
-CLEANFILES=$O.macargv $O.mklatinkbd latin1.h
+CLEANFILES=$O.devdraw $O.macargv $O.mklatinkbd latin1.h
install: mklatinkbd.install
install:Q:
diff --git a/src/cmd/devdraw/mkwsysrules.sh b/src/cmd/devdraw/mkwsysrules.sh
index a1dc56d3..8ab67f76 100644
--- a/src/cmd/devdraw/mkwsysrules.sh
+++ b/src/cmd/devdraw/mkwsysrules.sh
@@ -53,8 +53,8 @@ if [ $WSYSTYPE = x11 ]; then
echo 'WSYSOFILES=$WSYSOFILES '$XO
elif [ $WSYSTYPE = osx-cocoa ]; then
echo 'OBJCFLAGS=$OBJCFLAGS -fobjc-arc'
- echo 'WSYSOFILES=$WSYSOFILES osx-draw.o cocoa-screen-metal-objc.o cocoa-srv.o cocoa-thread.o'
- echo 'MACARGV=macargv-objc.o'
+ echo 'WSYSOFILES=$WSYSOFILES osx-draw.o cocoa-screen.o cocoa-srv.o cocoa-thread.o'
+ echo 'MACARGV=macargv.o'
elif [ $WSYSTYPE = nowsys ]; then
echo 'WSYSOFILES=nowsys.o'
fi