There is another j ide written in javascript and python. search
for qjide in jwiki and you may find something useful.

Сб, 19 июл 2014, Jon Hough написал(а):
> Well, my plam, which may be stupid, is to create a pythin, tkinter UI and 
> call j from this.
> 
> --- Original Message ---
> 
> From: "Devon McCormick" <devon...@gmail.com>
> Sent: July 19, 2014 1:01 PM
> To: "J-programming forum" <programm...@jsoftware.com>
> Subject: Re: [Jprogramming] Calling j.dll from python
> 
> For what you want to do, could you do it the other way around: call Python
> from J?  Or, alternatively, invoke J on a command-line from Python?
> 
> 
> On Fri, Jul 18, 2014 at 10:31 PM, Jon Hough <jgho...@outlook.com> wrote:
> 
> > I slightly modified the python script in the link (I removed references to
> > odedell, whatever that is, and I called thecdll.LoadLibrary(...)
> > Here  are my very minor edits:
> >
> > import operatorfrom ctypes import *
> > IDEN="jcmd_python"
> > def mulall(arr):    return reduce(operator.mul,arr,1)def run_jcmd( js):
> >  j.JDo(p,IDEN+'=:'+js)def get_result(jdll,variable=IDEN):
> >  pi=[pointer(c_int()) for _ in xrange(4)]    j.JGetM(jdll,variable,*pi)
> > #datatype,rank, *shape, *value    type=pi[0].contents.value    if type==0:
> > #error        return None,None,None,None    rank=pi[1].contents.value
> >  shape=list((c_int*rank).from_address(pi[2].contents.value))
> >  flat_size=mulall(shape)
> >  data=list((c_int*flat_size).from_address(pi[3].contents.value))    return
> > type,rank,shape,resize(shape,data)def resize(shap,dat):    shap=shap[:]
> >  flat_size=mulall(shap)    while len(shap)>1:        shd=[]        start=0
> >        last_size=shap.pop()        while start<flat_size:
> >  shd.append(dat[start:start+last_size])            start+=last_size
> >  flat_size=len(shd)        dat=shd    else:        shd=dat    return shd
> > cdll.LoadLibrary("j801/bin/libj.so")j =
> > CDLL("j801/bin/libj.so")p=j.JInit()run_jcmd("i. 3
> > 3")type,rank,shape,data=get_result(p) #returns the last resultprint
> > shape,datarun_jcmd("abc=: i: 5")print get_result(p,"abc")
> >
> > This worked!
> > I ran it and output:
> > [3, 3] [[0, 1, 2], [3, 4, 5], [6, 7, 8]](4, 1, [11], [-5, -4, -3, -2, -1,
> > 0, 1, 2, 3, 4, 5])
> >
> > Thanks!
> >
> > > Date: Fri, 18 Jul 2014 22:19:47 -0400
> > > From: joebog...@gmail.com
> > > To: programm...@jsoftware.com
> > > Subject: Re: [Jprogramming] Calling j.dll from python
> > >
> > > Jon - it's trickier than I thought.
> > >
> > >
> > > I have a partial implementation working that I can tinker with tomorrow
> > >
> > > You need to use WinDLL on windows to get the calling convention right
> > >
> > > J = WinDLL("c:/users/jbogner/downloads/j801_win32/bin/j.dll")
> > > jt = J.JInit()
> > > J.JDo(jt, "A=:i.5")
> > > Out[34]: 0
> > >
> > > see
> > http://www.jsoftware.com/pipermail/programming/2013-November/033974.html
> > > for details on how to get the values. I have modified the code  to work
> > > with WinDLL and have something roughly working but ran out of time to
> > work
> > > on it more tonight
> > >
> > >
> > > On Fri, Jul 18, 2014 at 7:54 PM, Jon Hough <jgho...@outlook.com> wrote:
> > >
> > > > I am interested in calling J specifically from Python, preferably on
> > Linux
> > > > and Windows (and Mac).
> > > > As Joe suggested, I've tried playing with jdll.ijs.
> > > > I still can't get JGetM to work, but I'll have another bash at it later
> > > > today.
> > > > Thanks!
> > > >
> > > > > From: bbill....@gmail.com
> > > > > Date: Sat, 19 Jul 2014 07:27:03 +0800
> > > > > To: programm...@jsoftware.com
> > > > > Subject: Re: [Jprogramming] Calling j.dll from python
> > > > >
> > > > > Set and get data using j.dll can be quite involving. If you use
> > windows,
> > > > it is much easier you to use to ole/com interface, search jwiki for
> > more
> > > > info.  Note that j8 only support the jdllserver interface.
> > > > >
> > > > > On 18.07.2014, at 23:05, Jon Hough <jgho...@outlook.com> wrote:
> > > > >
> > > > > > Thanks,
> > > > > > My test script, so far, is
> > > > > >
> > > > > > from ctypes import *
> > > > > >
> > > > > > cdll.LoadLibrary("j801/bin/libj.so")
> > > > > > j = CDLL("j801/bin/libj.so")
> > > > > > jt = j.JInit()
> > > > > >
> > > > > > j.JDo(jt, "a =: 1")
> > > > > >
> > > > > > a =j.JGetM(  "a")
> > > > > >
> > > > > > print a
> > > > > >
> > > > > > This returns 4, even though I set a to be 1. I'm assuming 4 is the
> > > > number of bytes returned (i.e. an int)??(By the way, if I do
> > j.JGetM(jt,
> > > > "a") I get a seg fault.Regarding jdll.ijs, unfortunately my J-skills
> > are
> > > > not powerful enough yet to make much sense of it:
> > > > > > jget=: 3 : 0cmd=. libj,' JGetM i x *c *x *x *x *x''e p n t r s d'=.
> > > > cmd cd pJ,(,y);4#<,0if. e do.  smoutput 'error code: ',":e
> > > >  return.end.(t,r,s) jfix d)
> > > > > > In particular
> > > > > > JGetM i x *c *x *x *x *x
> > > > > > is confusing.
> > > > > >> Date: Fri, 18 Jul 2014 10:53:44 -0400
> > > > > >> From: joebog...@gmail.com
> > > > > >> To: programm...@jsoftware.com
> > > > > >> Subject: Re: [Jprogramming] Calling j.dll from python
> > > > > >>
> > > > > >> JGetM is what you need, but I strongly suggest reviewing
> > > > > >> http://jsoftware.com/wsvn/addons/trunk/general/misc/jdll.ijs (or
> > > > your local
> > > > > >> version) to get a better understanding of how things work
> > > > > >>
> > > > > >> This part addresses your question:
> > > > > >>
> > > > > >> jget=: 3 : 0
> > > > > >> cmd=. libj,' JGetM i x *c *x *x *x *x'
> > > > > >> 'e p n t r s d'=. cmd cd pJ,(,y);4#<,0
> > > > > >> if. e do.
> > > > > >>  smoutput 'error code: ',":e
> > > > > >>  return.
> > > > > >> end.
> > > > > >> (t,r,s) jfix d
> > > > > >> )
> > > > > >>
> > > > > >>
> > > > > >> On Fri, Jul 18, 2014 at 10:51 AM, Jon Hough <jgho...@outlook.com>
> > > > wrote:
> > > > > >>
> > > > > >>> Please ignore the last sentence from my previous email. Copied
> > and
> > > > pasted
> > > > > >>> by accident.
> > > > > >>>
> > > > > >>>> From: jgho...@outlook.com
> > > > > >>>> To: programm...@jsoftware.com
> > > > > >>>> Date: Fri, 18 Jul 2014 15:50:41 +0100
> > > > > >>>> Subject: Re: [Jprogramming] Calling j.dll from python
> > > > > >>>>
> > > > > >>>> Joe, thanks. Your suggestion seems to work.
> > > > > >>>> However JGets seems to not exist.How do I then get the variable,
> > > > once
> > > > > >>> assigned?
> > > > > >>>> I tried to search through the .so/.dll for "get" functions:
> > > > > >>>>
> > > > > >>>> nm -g libj.so | grep Get
> > > > > >>>> Although jdll.ijs seems to contain jget, when I tried to call
> > this
> > > > (in
> > > > > >>> Python)   I get " undefined symbol: jget" (with variations on
> > upper
> > > > and
> > > > > >>> lower cases)
> > > > > >>>>
> > > > > >>>>
> > > > > >>>>
> > > > > >>>>
> > > > > >>>> and couldn't find a function that seemed to get the
> > variables.Also
> > > > I'm
> > > > > >>> having trouble finding libj.dll
> > > > > >>>>> Date: Fri, 18 Jul 2014 10:36:06 -0400
> > > > > >>>>> From: joebog...@gmail.com
> > > > > >>>>> To: programm...@jsoftware.com
> > > > > >>>>> Subject: Re: [Jprogramming] Calling j.dll from python
> > > > > >>>>>
> > > > > >>>>> JInit() returns the instance that you need to invoke against
> > > > > >>>>>
> > > > > >>>>> see addons/general/misc/jdll.ijs
> > > > > >>>>>
> > > > > >>>>> jdo is defined as:
> > > > > >>>>>
> > > > > >>>>> jdo=: 3 : 0
> > > > > >>>>>
> > > > > >>>>> (libj,' JDo i x *c') cd pJ, boxopen y
> > > > > >>>>>
> > > > > >>>>> )
> > > > > >>>>>
> > > > > >>>>>
> > > > > >>>>> so I suspect you need to be passing that pointer address with
> > > > python
> > > > > >>> too...
> > > > > >>>>>
> > > > > >>>>>
> > > > > >>>>> jt =  j.JInit()
> > > > > >>>>>
> > > > > >>>>> j.JDo(jt, "x =: 3")
> > > > > >>>>>
> > > > > >>>>>
> > > > > >>>>> [untested]
> > > > > >>>>>
> > > > > >>>>>
> > > > > >>>>>
> > > > > >>>>>
> > > > > >>>>>
> > > > > >>>>>
> > > > > >>>>> On Fri, Jul 18, 2014 at 10:33 AM, Thomas Costigliola <
> > > > > >>> tcost...@gmail.com>
> > > > > >>>>> wrote:
> > > > > >>>>>
> > > > > >>>>>> Bill, Jon, sorry if that suggestion did not apply. I
> > remembered it
> > > > > >>> was a
> > > > > >>>>>> common pitfall when calling from C. Maybe that is not the case
> > > > now.
> > > > > >>>>>>
> > > > > >>>>>>
> > > > > >>>>>> On Fri, Jul 18, 2014 at 10:29 AM, Jon Hough <
> > jgho...@outlook.com>
> > > > > >>> wrote:
> > > > > >>>>>>
> > > > > >>>>>>> My previous email was regarding Windows (7 with J801)
> > > > > >>>>>>> I just tried to do the same in Ubuntu (J801)
> > > > > >>>>>>> cdll.LoadLibrary("j801/bin/libj.so")
> > > > > >>>>>>> j = CDLL("j801/bin/libj.so")>>> j.JInit()158010848
> > > > > >>>>>>> No idea what the above output means. Is that the pointer
> > address
> > > > of
> > > > > >>>>>>> something?
> > > > > >>>>>>> And then:
> > > > > >>>>>>>>>> j.JDo("x =: 3")Segmentation fault (core dumped)
> > > > > >>>>>>> And Python (2.7) crashed.
> > > > > >>>>>>>
> > > > > >>>>>>>> Date: Fri, 18 Jul 2014 22:09:28 +0800
> > > > > >>>>>>>> From: bbill....@gmail.com
> > > > > >>>>>>>> To: programm...@jsoftware.com
> > > > > >>>>>>>> Subject: Re: [Jprogramming] Calling j.dll from python
> > > > > >>>>>>>>
> > > > > >>>>>>>> From which resource did you learn that(not python)? It
> > should be
> > > > > >>> very
> > > > > >>>>>> out
> > > > > >>>>>>>> dated.
> > > > > >>>>>>>> On Jul 18, 2014 6:00 PM, "Jon Hough" <jgho...@outlook.com>
> > > > > >>> wrote:
> > > > > >>>>>>>>
> > > > > >>>>>>>>> I am trying to call jdll.JDo from python but I get the
> > error
> > > > > >>> message,
> > > > > >>>>>>>>> access violation.
> > > > > >>>>>>>>>
> > > > > >>>>>>>>> Here is my python.
> > > > > >>>>>>>>>
> > > > > >>>>>>>>> Cdll.LoadLibrary(path to j.dll)
> > > > > >>>>>>>>> J =CDLL(path to j.dll)
> > > > > >>>>>>>>>
> > > > > >>>>>>>>> J.JDo("x =: i. 3")
> > > > > >>>>>>>>>
> > > > > >>>>>>>>> This gives am error. In fact any string gives the error.
> > > > > >>>>>>>>>
> > > > > >>>>>>>>> J.JGet doesnt seem to give errors, but since I cannot set
> > any j
> > > > > >>>>>>> variables,
> > > > > >>>>>>>>> it is not easy to test.
> > > > > >>>>>>>>>
> > > > > >>>>>>>>>
> > > > > >>>>>>
> > > > > >>>
> > > > ----------------------------------------------------------------------
> > > > > >>>>>>>>> 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
> > > > > >>>>>>>
> > > > > >>>>>>
> > > > > >>>
> > > > ----------------------------------------------------------------------
> > > > > >>>>>> 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
> > > > > >>>
> > > > > >>>
> > > > ----------------------------------------------------------------------
> > > > > >>> 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
> > > > >
> > ----------------------------------------------------------------------
> > > > > 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
> >
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> 
> 
> 
> --
> Devon McCormick, CFA
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to