Its works ! to have it working I did the following changes I have added the global BINPATH_z_ =: '/usr/share/j/8.07/ and 0!:10 <'/etc/j/8.07/profile.ijs' (if I use the 0!:2 it gives "assertion error" , but if I use the 0!:10 it continue as stated in the documentation and probably bring the setup to a valid state)
here the working code : ret = JDo(jt,"BINPATH_z_ =: '/usr/share/j/8.07/'"); ret = JDo(jt,"0!:10 <'/etc/j/8.07/profile.ijs'"); I p; JErrorTextM( jt, ret, & p); the instruction ret = JDo(jt,"load 'graphics/plot'"); now return 0 success. '/usr/share/j/8.07/ holds the following directories: drwxr-xr-x 28 root root 4096 Nov 25 21:04 addons drwxr-xr-x 2 root root 4096 Nov 25 21:02 icons -rw-r--r-- 1 root root 191 Apr 4 2019 ijconsole.desktop drwxr-xr-x 7 root root 4096 Nov 25 21:02 system drwxr-xr-x 3 root root 4096 Nov 25 21:02 tools Thankyou all for the help On Fri, Jan 3, 2020 at 1:48 AM bill lam <[email protected]> wrote: > BINPATH_z_ is the path to J bin folder. > > On Fri, Jan 3, 2020, 7:35 AM bill lam <[email protected]> wrote: > > > you need you define BINPATH_z_ first > > > > BINPATH_z_=: jpathsep BINPATH_z_ > > > > On Fri, Jan 3, 2020, 6:17 AM Strale <[email protected]> wrote: > > > >> Thank you > >> But probably I miss something, > >> may be the #include "jfex.h", #include "jlib.h" are too few or > different > >> version I have downloaded from github and installed I have the /8.07for > >> debian > >> > >> here my results : > >> > >> J jt = JInit(); > >> int ret; > >> ret = JDo(jt,"0!:2 <'/etc/j/8.07/profile.ijs'"); -> ret 3 domain error > >> ret = JDo(jt,"0!:3 <'/etc/j/8.07/profile.ijs'"); -> ret 0 result of 0 > >> if > >> an assertion failed, 1 if they all succeeded. > >> > >> I tried on the ijconsole and with surprise I see an assertion, but > >> probably just because ijconsole already load the profile. > >> > >> 0!:2 < '/etc/j/8.07/profile.ijs' > >> NB. J profile > >> NB. JFE sets BINPATH_z_ and ARGV_z_ > >> NB. add your sentences in startup.ijs > >> > >> systype=. 9!:12'' > >> jpathsep_z_=: '/'&(('\' I.@:= ])}) > >> BINPATH_z_=: jpathsep BINPATH_z_ > >> > >> NB. create SystemFolders > >> bin=. BINPATH > >> install=. (bin i: '/'){.bin > >> fhs=. > >> > >> > (FHS"_)^:(0=4!:0<'FHS')(5=systype)*.0=#1!:0<BINPATH,'/../system/util/boot.ijs' > >> install=. (0&~:fhs){::install;'/usr/share/j/8.07' > >> install=. (INSTALLROOT"_)^:(0=4!:0<'INSTALLROOT') install > >> addons=. install,'/addons' > >> system=. install,'/system' > >> tools=. install,'/tools' > >> home=. >(systype-5){(2!:5'HOME');2!:5'USERPROFILE' > >> home=. >(0-:home){home;,'/' > >> isroot=. (0=#1!:0'/data') *. ('root'-:2!:5'USER') +. (<home) e. > >> '/var/root';'/root';'';,'/' > >> userx=. '/j',('64-'#~16={:$3!:3[2),'807-user' > >> user=. home,userx > >> user=. >isroot{user;install,'/user' > >> home=. >isroot{home;install > >> break=. user,'/break' > >> config=. user,'/config' > >> snap=. user,'/snap' > >> temp=. user,'/temp' > >> temp=. > >> > >> > >isroot{temp;(*#1!:0'/tmp'){::'/tmp';~(0-:2!:5'TMPDIR'){::(2!:5'TMPDIR');temp > >> ids=. ;:'addons bin break config home install snap system tools temp > >> user' > >> > >> 0!:0 :: ] <(({.~ i:&'/') jpathsep >{.4!:3''),'/profilex.ijs' NB. > >> override > >> ┌────────────────────────┐ > >> │/etc/j/8.07/profilex.ijs│ > >> └────────────────────────┘ > >> |assertion failure > >> |[-31] /etc/j/8.07/profile.ijs > >> > >> > >> > >> > >> > >> On Thu, Jan 2, 2020 at 10:54 PM Raul Miller <[email protected]> > >> wrote: > >> > >> > Or, if you want the "quick reference" version of that wiki page: > >> > > >> > https://www.jsoftware.com/help/dictionary/dx000.htm > >> > > >> > Thanks, > >> > > >> > -- > >> > Raul > >> > > >> > On Thu, Jan 2, 2020 at 4:12 PM Henry Rich <[email protected]> > wrote: > >> > > > >> > > https://code.jsoftware.com/wiki/Vocabulary/Foreigns#m0 > >> > > > >> > > Henry Rich > >> > > > >> > > On 1/2/2020 4:08 PM, Strale wrote: > >> > > > slowly I begin to understand, > >> > > > first of all I have to define the load but I am not able to find > the > >> > > > information on how to use the foreign command 0!:x to load > >> profile.ijs > >> > > > > >> > > > once I will be able to load modules, to make a verb should not be > a > >> big > >> > > > problem > >> > > > I can embedded J command and macro functions in C++ classes > >> > > > > >> > > > > >> > > > > >> > > > > >> > > > On Thu, Jan 2, 2020 at 6:55 PM Henry Rich <[email protected]> > >> > wrote: > >> > > > > >> > > >> It appears that multiline definitions cannot be handled through a > >> > single > >> > > >> call to JDo: > >> > > >> > >> > > >> ". 't =: verb define' , LF , 'a =: 111 ' , LF , ')' , LF > >> > > >> |spelling error > >> > > >> > >> > > >> Here's a keyboard session, annotated > >> > > >> ".'t =: verb define' NB. enter this line > >> > > >> > >> > > >> Here you get a prompt of 0 spaces, indicating that the JE is > >> waiting > >> > for > >> > > >> keyboard input for the definition > >> > > >> > >> > > >> a =: 111 > >> > > >> ) > >> > > >> > >> > > >> > >> > > >> After entering ), I get the 3-space prompt indicating the ". verb > >> > > >> completed execution. > >> > > >> > >> > > >> t > >> > > >> 3 : 'a=:111' > >> > > >> > >> > > >> > >> > > >> > >> > > >> I don't know whether there is any way to create a multiline > >> definition > >> > > >> using LF without going through 0!:x. If it's short yo could > create > >> > > >> boxed strings: > >> > > >> > >> > > >> ". 't =: 3 : (''a =: 112'' ; ''b =: 113'')' > >> > > >> > >> > > >> > >> > > >> > >> > > >> load is not defined until you have used 0!:x to load the base > >> library, > >> > > >> as Bill pointed out. > >> > > >> > >> > > >> Henry Rich > >> > > >> > >> > > >> > >> > > >> > >> > > >> > >> > > >> On 1/2/2020 12:37 PM, Strale wrote: > >> > > >>> The \r is the right one thank you > >> > > >>> but even with the correct end of line I tried several > >> combinations \r > >> > > >> and \n > >> > > >>> but without success the error is value error or spelling error > >> > > >>> also the profile.ijs when I try to load it with JDo give me > back > >> > "value > >> > > >>> error" > >> > > >>> I have also put it in the executable directory but without > >> success. > >> > > >>> > >> > > >>> > >> > > >>> On Thu, Jan 2, 2020 at 4:06 PM David Lambert < > >> [email protected]> > >> > > >> wrote: > >> > > >>>> Perhaps those /r should be \r ? > >> > > >>>>> Date: Thu, 2 Jan 2020 12:18:00 +0100 > >> > > >>>>> From: Strale<[email protected]> > >> > > >>>>> To:[email protected] > >> > > >>>>> Subject: [Jprogramming] J lib question > >> > > >>>>> Message-ID: > >> > > >>>>> < > >> > > >>>> > >> cal2u57zrpqnx32dag7v3bdgao6ufhunn6ycq61sgiic6oag...@mail.gmail.com> > >> > > >>>>> Content-Type: text/plain; charset="UTF-8" > >> > > >>>>> > >> > > >>>>> Hello > >> > > >>>>> > >> > > >>>>> I am trying to mix J with C++ in Linux > >> > > >>>>> I have included in my C++ project jfex.h libj.h and libj.so > >> > > >>>>> after calling JInit() I am able to execute simple sentences > >> with > >> > JDo > >> > > >> and > >> > > >>>>> get the result with JGetA > >> > > >>>>> but I am not able to define more sofisticate behaviours ex. > >> define > >> > J > >> > > >>>>> function with verb define > >> > > >>>>> ex. > >> > > >>>>> int JDo(jt,"testverb =: verb define /r a=: 111 /r )"); > >> > > >>>>> fails with error: domain error > >> > > >>>>> or loading module ex plot.ijs > >> > > >>>>> fails with error: value error > >> > > >>>>> > >> > > >>>>> do I am doing something wrong as missing some initialisation? > >> > > >>>>> > >> > > >>>>> Cheers > >> > > >>>>> Paolo > >> > > >>>>> > >> > > >>>> > >> > ---------------------------------------------------------------------- > >> > > >>>> 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 > >> > > >> > >> > >> -- > >> We are made of star dust > >> (Carl Sagan) > >> ---------------------------------------------------------------------- > >> For information about J forums see http://www.jsoftware.com/forums.htm > >> > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > -- We are made of star dust (Carl Sagan) ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
