Hrm. That does help a little bit. There's definitely still something called
JWd defined in JLib.

Here is what I know so far:
(actually more than when I started typing this, so... I'll probably move
this to the wiki at some point.)

When you write a J frontend, you have to call a function called JSM
(session manager)
and you pass in the addresses of four callback functions that your frontend
implements:

   JWr -> session calls this to output to whatever "terminal" you set up
   JWd -> this window driver thing.
   JRd -> session calls this when it needs to read a line of input
   ???  -> something reserved for future use?

JWd does still seem to be hooked up to 11!:x  (weird to see that called x
instead of n!)

The signature looks like this:

int _stdcall Jwd(JS jt, int x, A parg, A* pres, C* loc);
  -- https://github.com/jsoftware/jsource/blob/master/jsrc/jlib.h#L111

The arguments seem to be:

  jt -> address of j session object
  x -> the 'n' in 11!:n
  parg -> the y argument to (11!n) (a pointer to a J array)
  pres -> the result array (you modify this to put your return value here)
  loc -> a locale name (?)

There is an example J frontend here:

    https://github.com/jsoftware/jsource/blob/master/jsrc/jfex.c

It has this comment for its implementation of Jwd (which is missing the loc
parameter):

// J calls for 11!:x y - demonstrates all features of jwdw and jwdp
// pa is y and result array (if any) is returned in pz
// return  pz
//  0           - MTM i.0 0
// -1      A    - A result
// -2      A    - A is pairs of null terminated strings for event table
//  n           - EVDOMAIN etc


The 'parg' argument has the following fields, which I am expecting to match
the structure defined here:

   https://www.jsoftware.com/ioj/iojNoun.htm

k  -> "offset of ravel with respect to byte 0 of the array"
f -> a flag of some sort
m -> "maximum number of bytes in ravel"
t -> the type
c -> reference count
n -> the length of the data
r -> rank
s -> pointers to shape and value

My implementation of Jwd just prints out the arguments...

   JWd(x:2000, a:[k: 64 f: 0 m: 117321808 t: 2 c: $8000000000000001 n: 5 r:
$BAADF00D062E0001])

I guess really my main problem is I don't understand how to interpret the
"rank" and "reference count" fields.
I'd expect both of these to be small positive integers, like what I see in
the ioj.

Without the rank, I don't know how to parse the shape and value.

Hrm. I guess technically I know from the docs that all (11!:n) are rank 1,
so maybe I can just ignore that field?

I will investigate further.


On Sat, Apr 15, 2023 at 5:01 PM Raul Miller <rauldmil...@gmail.com> wrote:

> Jwd sounds like version 6 of J. This predates Jqt.
>
> There's some docs at
> https://www.jsoftware.com/docs/help602/user/win_driver_cmd_ref_overview.htm
>
> I hope this helps,
>
> --
> Raul
>
> On Sat, Apr 15, 2023 at 4:57 PM Michal Wallace <michal.wall...@gmail.com>
> wrote:
> >
> > Hey all,
> >
> > I've been working on JPrez again -- a console-based presentation tool
> > that can record and play back interactions with a J REPL.
> >
> > It also lets you specify text to be recorded for voice overs to narrate
> the
> > interaction (for making videos), and over the past week I've embedded
> > JPrez inside a windows binary that looks like a normal text console but
> > can peek inside JPrez and actually let me record and play audio for
> > the individual voice over lines.
> >
> > However, right now I'm doing everything from the host application. It
> polls
> > Jprez to see what's on the screen and what the current line of text is
> > (jprez suggests a filename for a corresponding wav file).
> >
> > That all works fine for recording one line at a time, but if I want to
> > actually
> > play the presentation, I'd much rather have J drive the interaction.
> >
> > I basically already have a J front end, but I don't know what to do with
> > Jwd,
> > or how to use it from the J side. I've picked up that it's using 11!:n
> > under the
> > hood, but I haven't found much information about how it's meant to be
> used.
> >
> > Do any docs exist?
> >
> > Where should I look in the jsource and jQt code bases to find examples?
> >
> > Thanks!
> >
> > -Michal
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to