From: Charlie Turner <chturne@gmail.com>
To: Per Bothner <per@bothner.com>
Cc: Kawa mailing list <kawa@sourceware.org>
Subject: Re: DomTerm - a new console for Kawa (and everyone else)
Date: Fri, 18 Dec 2015 19:28:00 -0000 [thread overview]
Message-ID: <CAPMhJv1Dx_V_QRdEsLFUoj-whSw_vT1C-SjE0Un-UbVM8HFA-w@mail.gmail.com> (raw)
In-Reply-To: <56745B04.7040907@bothner.com>
[-- Attachment #1: Type: text/plain, Size: 5669 bytes --]
I almost got this working on OSX. See my hacks in the attached patch
file if you want to get where I got :-) [where the heck do you get
err_sys from on our box??]
In addition to that patch file, I also had to rename libpty.so to
libpty.jnilib on OSX. I have no idea why. This is my first experience
with Native Java :-)
Sadly, I got lost after managing to get the DomTerm to run. make-pty
completes, and then the DomTerm window pops up with a scroll-bar, but
nothing else. I get this stack trace in the terminal window from which
I launched make run-pty,
netscape.javascript.JSException: ReferenceError: Can't find variable:
makeDomTerm
at com.sun.webkit.dom.JSObject.fwkMakeException(JSObject.java:128)
at com.sun.webkit.WebPage.twkExecuteScript(Native Method)
at com.sun.webkit.WebPage.executeScript(WebPage.java:1427)
at javafx.scene.web.WebEngine.executeScript(WebEngine.java:948)
at org.domterm.javafx.WebTerminal.initialize(WebTerminal.java:226)
at org.domterm.javafx.WebTerminal$1.changed(WebTerminal.java:173)
at org.domterm.javafx.WebTerminal$1.changed(WebTerminal.java:170)
at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:182)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
at javafx.beans.property.ReadOnlyObjectWrapper$ReadOnlyPropertyImpl.fireValueChangedEvent(ReadOnlyObjectWrapper.java:176)
at javafx.beans.property.ReadOnlyObjectWrapper.fireValueChangedEvent(ReadOnlyObjectWrapper.java:142)
at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:112)
at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:146)
at javafx.scene.web.WebEngine$LoadWorker.updateState(WebEngine.java:1226)
at javafx.scene.web.WebEngine$LoadWorker.dispatchLoadEvent(WebEngine.java:1337)
at javafx.scene.web.WebEngine$LoadWorker.access$1100(WebEngine.java:1219)
at javafx.scene.web.WebEngine$PageLoadListener.dispatchLoadEvent(WebEngine.java:1206)
at com.sun.webkit.WebPage.fireLoadEvent(WebPage.java:2388)
at com.sun.webkit.WebPage.fwkFireLoadEvent(WebPage.java:2232)
at com.sun.webkit.network.URLLoader.twkDidFinishLoading(Native Method)
at com.sun.webkit.network.URLLoader.notifyDidFinishLoading(URLLoader.java:830)
at com.sun.webkit.network.URLLoader.lambda$didFinishLoading$95(URLLoader.java:821)
at com.sun.webkit.network.URLLoader$$Lambda$153/1668192911.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$170(PlatformImpl.java:295)
at com.sun.javafx.application.PlatformImpl$$Lambda$51/405125410.run(Unknown
Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$171(PlatformImpl.java:294)
at com.sun.javafx.application.PlatformImpl$$Lambda$50/526533065.run(Unknown
Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
Exception in thread "JavaFX Application Thread"
java.lang.RuntimeException: netscape.javascript.JSException:
ReferenceError: Can't find variable: makeDomTerm
at org.domterm.javafx.WebTerminal.initialize(WebTerminal.java:237)
at org.domterm.javafx.WebTerminal$1.changed(WebTerminal.java:173)
at org.domterm.javafx.WebTerminal$1.changed(WebTerminal.java:170)
at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:182)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
at javafx.beans.property.ReadOnlyObjectWrapper$ReadOnlyPropertyImpl.fireValueChangedEvent(ReadOnlyObjectWrapper.java:176)
at javafx.beans.property.ReadOnlyObjectWrapper.fireValueChangedEvent(ReadOnlyObjectWrapper.java:142)
at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:112)
at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:146)
at javafx.scene.web.WebEngine$LoadWorker.updateState(WebEngine.java:1226)
at javafx.scene.web.WebEngine$LoadWorker.dispatchLoadEvent(WebEngine.java:1337)
at javafx.scene.web.WebEngine$LoadWorker.access$1100(WebEngine.java:1219)
at javafx.scene.web.WebEngine$PageLoadListener.dispatchLoadEvent(WebEngine.java:1206)
at com.sun.webkit.WebPage.fireLoadEvent(WebPage.java:2388)
at com.sun.webkit.WebPage.fwkFireLoadEvent(WebPage.java:2232)
at com.sun.webkit.network.URLLoader.twkDidFinishLoading(Native Method)
at com.sun.webkit.network.URLLoader.notifyDidFinishLoading(URLLoader.java:830)
at com.sun.webkit.network.URLLoader.lambda$didFinishLoading$95(URLLoader.java:821)
at com.sun.webkit.network.URLLoader$$Lambda$153/1668192911.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$170(PlatformImpl.java:295)
at com.sun.javafx.application.PlatformImpl$$Lambda$51/405125410.run(Unknown
Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$171(PlatformImpl.java:294)
at com.sun.javafx.application.PlatformImpl$$Lambda$50/526533065.run(Unknown
Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
Caused by: netscape.javascript.JSException: ReferenceError: Can't find
variable: makeDomTerm
at com.sun.webkit.dom.JSObject.fwkMakeException(JSObject.java:128)
at com.sun.webkit.WebPage.twkExecuteScript(Native Method)
at com.sun.webkit.WebPage.executeScript(WebPage.java:1427)
at javafx.scene.web.WebEngine.executeScript(WebEngine.java:948)
at org.domterm.javafx.WebTerminal.initialize(WebTerminal.java:226)
... 24 more
I didn't understand much from your response Per. Looks like I've got
some reading to do before I get to use my toy :-)
[-- Attachment #2: domterm_osx.patch --]
[-- Type: application/octet-stream, Size: 3430 bytes --]
diff --git a/Makefile b/Makefile
index 3ce01e1..0931aed 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-JAVA_HOME = /opt/jdk1.8
+JAVA_HOME = $(shell /usr/libexec/java_home)
CC = gcc
JAVA = java
JAVAC = javac
@@ -21,10 +21,10 @@ native/pty/org_domterm_pty_PTY.h: domterm.jar
PTY_COMMON_PARAMS = -fno-strict-aliasing -fPIC -W -Wall -Wno-unused -Wno-parentheses -fno-omit-frame-pointer
native/pty/pty.o: native/pty/pty.c native/pty/org_domterm_pty_PTY.h
- $(CC) -O2 -ffast-math $(PTY_COMMON_PARAMS) -Inative/pty -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -c $< -o $@
+ $(CC) -O2 -ffast-math $(PTY_COMMON_PARAMS) -Inative/pty -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -I$(JAVA_HOME)/include/darwin -c $< -o $@
native/pty/pty_fork.o: native/pty/pty_fork.c
- $(CC) -O2 -ffast-math $(PTY_COMMON_PARAMS) -Inative/pty -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -c $< -o $@
+ $(CC) -O2 -ffast-math $(PTY_COMMON_PARAMS) -Inative/pty -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -I$(JAVA_HOME)/include/darwin -c $< -o $@
libpty.so: native/pty/pty.o native/pty/pty_fork.o
$(CC) $(PTY_COMMON_PARAMS) -shared -o $@ $^
@@ -74,7 +74,7 @@ org/classes.stamp: $(DOMTERM_JAR_SOURCES)
touch org/classes.stamp
tmp-repl.in: org/domterm/repl.html Makefile
- sed -e '/domterm-core/i<style>' \
+ gsed -e '/domterm-core/i<style>' \
-e '/domterm-default/a</style>' \
-e 's|<link .*/style/\(.*\).css">|#include "style/\1.css"|' \
-e '/<script type="text.javascript">/d' \
@@ -90,7 +90,7 @@ domterm.jar: org/classes.stamp terminal.js tmp-repl.in
rm -rf tmp-for-jar
mkdir tmp-for-jar
tar cf - org/domterm/*.class org/domterm/*/*.class | (cd tmp-for-jar; tar xf -)
- cpp -traditional-cpp -P <tmp-repl.in >tmp-for-jar/org/domterm/repl.html
+ ~/gcc/bin/cpp -traditional-cpp -P <tmp-repl.in >tmp-for-jar/org/domterm/repl.html
cd tmp-for-jar && \
jar cmf ../domterm-jar-manifest ../domterm.jar org/domterm/*.class org/domterm/*/*.class org/domterm/repl.html
@@ -108,7 +108,7 @@ DOC_IMAGES = \
doc/DomTerm.xml: doc/DomTerm.texi
$(MAKEINFO) -I=doc --docbook doc/DomTerm.texi -o - | \
- sed \
+ gsed \
-e 's|_002d|-|g' \
-e 's|<emphasis></emphasis>||' \
-e 's|<inlinemediaobject><imageobject><imagedata fileref="\(.*\)" format="\(.*\)"></imagedata></imageobject></inlinemediaobject>|<ulink url="\1"><inlinemediaobject><imageobject><imagedata fileref="\1" format="\2"></imagedata></imageobject></inlinemediaobject></ulink>|' \
diff --git a/native/pty/pty.c b/native/pty/pty.c
index e143ce0..112dc81 100644
--- a/native/pty/pty.c
+++ b/native/pty/pty.c
@@ -47,7 +47,33 @@
#include <sys/ioctl.h>
#endif
-extern void err_sys(const char *fmt, ...);
+//extern void err_sys(const char *fmt, ...);
+#include <errno.h>
+#include <stdarg.h>
+
+static void
+err_doit(int errnoflag, int error, const char *fmt, va_list ap)
+{
+ char buf[8094];
+ vsnprintf(buf, 8094, fmt, ap);
+ if (errnoflag)
+ snprintf(buf+strlen(buf), 8094-strlen(buf), ": %s",
+ strerror(error));
+ strcat(buf, "\n");
+ fflush(stdout); /* in case stdout and stderr are the same */
+ fputs(buf, stderr);
+ fflush(NULL); /* flushes all stdio output streams */
+}
+
+void
+err_sys(const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ err_doit(1, errno, fmt, ap);
+ va_end(ap);
+ exit(1);
+}
int log_to_stderr = 1;
#define MAXLINE 512
next prev parent reply other threads:[~2015-12-18 19:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-17 22:52 Per Bothner
2015-12-18 18:43 ` Charlie Turner
2015-12-18 19:14 ` Per Bothner
2015-12-18 19:28 ` Charlie Turner [this message]
2015-12-18 19:41 ` Jamison Hope
2015-12-18 19:46 ` Per Bothner
2015-12-18 20:00 ` Charlie Turner
2015-12-22 7:38 ` Per Bothner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAPMhJv1Dx_V_QRdEsLFUoj-whSw_vT1C-SjE0Un-UbVM8HFA-w@mail.gmail.com \
--to=chturne@gmail.com \
--cc=kawa@sourceware.org \
--cc=per@bothner.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).