Fork me on GitHub
#planck
<
2016-07-05
>
johanatan02:07:40

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

johanatan02:07:47

@mfikes: What dependency am I missing?

johanatan02:07:51

[on Mac OS X]

mfikes02:07:56

Try brew install icu4c. I think I failed to update the build docs with that one.

johanatan02:07:49

That worked! And yep seems to be missing from the docs.

mfikes02:07:54

@johanatan: Sorry about that. I was careful about all of the Unixes but forgot about OS X.

johanatan02:07:08

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)

johanatan02:07:13

[in planck 2.0]

mfikes02:07:32

Yes… hah! I was actually thinking about that one.

mfikes02:07:12

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.

mfikes02:07:41

Perhaps some crude thing built off of setitimer

mfikes02:07:01

Exactly, except for OS X

johanatan02:07:15

OS X is POSIX compliant no?

mfikes02:07:31

If timer_create exists on OS X, that would do the trick.

johanatan02:07:40

Looks like setitimer is definitely supported on OS X so that may be the better option.

mfikes02:07:53

Yes. It is there, I believe. It is fairly limited, so difficult to program against. But it would suffice.

mfikes02:07:27

We could almost use timer_create on Linux and perhaps something else on OS X, with #ifdefs if easier.

johanatan03:07:18

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

mfikes03:07:06

@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.

johanatan03:07:00

Mmm, ok. But how to hook goog.global.setTimeout into it?

mfikes03:07:16

Oh.. let’s see...

mfikes03:07:13

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

mfikes03:07:40

(Some Planck code is based on Ambly 🙂 )

johanatan03:07:43

We'll see how it goes. 🙂