On Tue, Sep 16, 2008 at 23:53, Oleg Kobchenko <[EMAIL PROTECTED]> wrote:
> Do you have at least one question, that you hope
> such documentation would provide an answer for?

<rant> Ok, here's how much I understand and how much I don't.  I hope
I get them right for I have forgotten a bit since I messed with this.

The situation probably isn't as bad as much I'm whining, but it's
still true that I tried it hard to figure everything out from the
documentation and I still could achieve less than with jep.  Firstly,
as I understand there are two ways to extract data from the J
interpreter.

One way is the JGetM function.  The example
"system/examples/dll/jdll.ijs" tells you how to use this.  That's
fine, you can even extract boxed data with it I think, if you follow
some pointers.  That is at least until you only want to get data from
J.  Now if you want to use its pair JSetM it gets more complicated,
for that function copies your data from a temp buffer to the J
interpreter, and at that point I've no idea really how to make it act
on a boxed noun.  But that's not the real problem with the J?etM
functions.  The problem is how jsoftware seems to suggest that these
are internal functions close to J so you're supposed to use the
_other_ pair of functions instead, and in fact the wd callback gives
you data in the other format.

The second way is the J?etA functions, which are documented in
system/examples/jfe/*.  There you get a declaration of the structure A
which is the format the J?etA functions and the wd callback use.  It
even explains you some of the fields.  My problem with this is that
I've no idea how to extract boxed data.  There's a full example in
this directory, but it only shows you how to call the interpreter, not
how to get and set data with the functions.

So my questions are.

0. Is there a way to extract any noun (with possibly boxes and bigints
in it) from the J interpreter as an opaque byte string that I can save
and later restore to another J interpreter?  JGetM doesn't work for
this because it doesn't give you a single continuous string, but a
pointer-driven tree.  JGetA might as well work, but I don't know how
to tell the length of the string to save, even though I _really_ have
looked at all the fields in the structure experimentally and still
can't figure it out.  I currently emulate this by flattening the data
inside the interpreter with the 3!:v verbs.

1. Is there a way to get a boxed data from the y value of the wd
callback (which gives you data like the JGetM call does)?  Also, how
exactly am I supposed to return stuff as the return value of wd?  From
the j side, the wd call seems to be the most convenient way to call a
callback in the executable from j, and in fact I could get it to work
experimentally in the jevalbot when it used jep from j601.

2. Is there a way to infuse boxed data I build to the J interpreter?
I assume I might be able to do this with the 3!:v verbs as well,
though I've never tried, but it would be nice if there was a direct
way.

3. Do I have to keep the command string I pass to JDo till it returns,
or can I modify or free it the first time it calls one of my callbacks
(input, output, or wd)?

All in all, I somehow feel that jsoftware doesn't really care as much
as I would have liked to make either of the foreign interfaces
workable.  What shows this is the bugs in secure mode; that bug about
exporting long arrays from jep; the annoying bug of jep that it went
to a busy loop if the controller socket got closed and that there's no
proper way to quit jep anyway; and what I wrote about the new foreign
interface above.

Please, jsoftware, let me use foreign interface more easily.  It
wouldn't be that much work to you, yet is very hard for me who doesn't
know the j internals.

Thanks, </rant>

Ambrus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to