I'm getting the following error when trying to build latest:
file.c:4:10: fatal error: 'unicode/ustdio.h' file not found
#include "unicode/ustdio.h"
^
1 error generated.
make[1]: *** [file.o] Error 1
@mfikes: What dependency am I missing?
[on Mac OS X]
Try brew install icu4c
. I think I failed to update the build docs with that one.
That worked! And yep seems to be missing from the docs.
@johanatan: Sorry about that. I was careful about all of the Unixes but forgot about OS X.
Do you know what the cause of this stack trace is?
goog.global.setTimeout is not a function. (In 'goog.global.setTimeout(cb, 0)', 'goog.global.setTimeout' is undefined)
cljs.core.async.impl.dispatch/queue-dispatcher (cljs/core/async/impl/dispatch.cljs:29:6)
cljs.core.async.impl.dispatch/run (cljs/core/async/impl/dispatch.cljs:33:4)
[in planck 2.0]
Yes… hah! I was actually thinking about that one.
The problem is that setTimeout
is not part of JavaScriptCore. We inject it in under 1.x, but with the C-based 2.0 we need some sort of timer implementation to back it up.
Perhaps some crude thing built off of setitimer
Ahh, perhaps this would do it: http://man7.org/linux/man-pages/man2/timer_create.2.html
Exactly, except for OS X
OS X is POSIX compliant no?
If timer_create
exists on OS X, that would do the trick.
Looks like setitimer
is definitely supported on OS X so that may be the better option.
Yes. It is there, I believe. It is fairly limited, so difficult to program against. But it would suffice.
We could almost use timer_create
on Linux and perhaps something else on OS X, with #ifdef
s if easier.
Ya, that could work. Are you planning to do this soon? If not, I can do it if you show me where the code needs to be hooked in. <-- @mfikes
@johanatan: No, I probably won’t get to it right away. There is a TODO on the Wiki that you could put your name next to if you’d like to pursue it. Also, there is stuff in 1.x which could be used as inspiration on how the general mechanism works. (It is just another global function like the PLANCK_*
functions, just with the name setTimeout
.) It turns out we already need timers in the bit of code that “hops” the cursor back after typing a closing delimiter like ]
or )
, and in that code you can see that we simply burn a thread that sleeps in order to crudely implement a timer. Planck 2.0’s initial setTimeout
implementation could actually be implemented using the same strategy, just go get something in the codebase that works (thus allowing core.async
to work, etc., and we can figure out a better implementation using timer_create
, setitimer
, or even kqueue
.
Mmm, ok. But how to hook goog.global.setTimeout
into it?
Oh.. let’s see...
This https://github.com/mfikes/planck/blob/master/planck/PLKClojureScriptEngine.m#L168 and perhaps this https://github.com/mfikes/planck/blob/edbf005f1da9d9b38573a04a8218ab3c90112ef6/planck-c/cljs.c#L302
In other words @johanatan I think that var global = this;
might have a consequence that var setTimeout = …
being automatically hooked into goog.global
. (But, I’m not a JavaScript expert.) I know I got that from Nolen: https://github.com/omcljs/ambly/commit/da21de24f63e11d6faf93e47d1e6a2e0b75091d6
(Some Planck code is based on Ambly 🙂 )
And that setTimeout
came from this SO: http://stackoverflow.com/questions/21100190/using-setinterval-settimeout-in-javascriptcore-framework-for-objectivec/21170761#21170761 (it has been in use in Planck for quite a while now.)
Mmm, ok
We'll see how it goes. 🙂