Hello Jim,

Thanks for your participation in the discussion :)

> Are writing a pure C program and wish to call in to subroutines etc? 
Yes, that's the idea. Actually the final goal is wider, namely to write a 
Python extension in C that would call JBC functions. Basically I managed to 
do it but this excessive session is something would be good to get rid of.

I've applied jbc -S myrtn.b for a simple code already which results in 
producing 2 files: myrtn.c and the myrtn.j, the latter one being included 
into the .c one via #include "myrtn.j". 
But in the .j file already we can see the lines like
    #define DEF_SEL_VAR JLibReturnDefaultSelect(dp) /* Default select list 
for this program */
    #define DEF_FILE_VAR JLibReturnDefaultFile(dp) /* Default file 
descriptor for this program */

i.e. dp is supposed to be initialized already by the moment myrtn is called.

I've managed to find the next dp related functions mentioned in some 
libraries
jbase_getdp() - this works, i.e. initializes dp, but creates a new session
jbase_getdp_nocreate() - not working if called alone. but it works and 
returns the dp1 value when called after jbase_getdp(), and dp1 = dp in this 
case
jbase_getdpEX() - not sure what it should do
jbase_setdpEX() - not sure what it should do       


Please see the sample piece of code

#include <jsystem.h>
extern "C" DPSTRUCT *jbase_getdp();

...

PyMODINIT_FUNC
jbc_oconv(PyObject*, PyObject* _args)
{
...
DPSTRUCT *dp = jbase_getdp();
OCONV_BBBBB(result, tmp, VarHelper(arg1), VarHelper(arg2));  // this if 
defined in jsystem.h as   #define OCONV_BBBBB(Target, ConvReg, Source, 
Conversion) JLibGConvRun(*dp*, ConvReg, Target, Source, Conversion, 1)
...
}



I've tried to read the jmainfunction.obj  as well where some other jbase 
related functions are mentioned but could not figure out any useful one...

Maybe there is something I am missing or some non-documented function?

Would appreciate any hints! :)
Thanks
Igor

среда, 4 марта 2020 г., 8:11:30 UTC+1 пользователь Jim Idle написал:
>
> Wow - it has been a long time since that code ;) However, what you ask is 
> possible I believe. It depends on your context. Are writing a pure C 
> program and wish to call in to subroutines etc? 
>
> Probably the best place to start is to generate the C code for a very 
> small jBC program:
>
> lufc.b
> CRT "Leeds United are Magic!"
>
> jbc -S lufc.b
>
> Then you will see the startup sequence for a standard executable and can 
> copy the code. 
>
> However, my memory is vague, but I think that we had a C function you can 
> call to do what you are doing and that will return the dp for reuse. It 
> get's passed to subroutines for instance. 
>
> Perhaps you can post the code you currently have.
>
> Jim
>
> On Wed, Mar 4, 2020 at 3:19 AM Igor Osmolovskiy <igo...@gmail.com 
> <javascript:>> wrote:
>
>> Dear all
>>
>> I need the jBase DP (data pointer) to be initialized. I've actually 
>> managed to initialize it by calling the jbase_getdp(). But in both cases 
>> the new child session is created in jshell (and gets removed automatically 
>> after the code has been executed).
>>
>> So I am wondering: is there a possibility to retrieve and use the current 
>> session DP somehow? So that no child session would get created
>>
>> Any advice would be highly appreciated
>>
>> Thanks in advance
>>
>>
>> PS: to the admin, it is actually a jBase related question rather than 
>> TAFC. Thanks
>>
>>
>> Kind regards,
>> Igor
>>
>> -- 
>> -- 
>> IMPORTANT: T24/Globus posts are no longer accepted on this forum.
>>  
>> To post, send email to jb...@googlegroups.com <javascript:>
>> To unsubscribe, send email to jbase-un...@googlegroups.com <javascript:>
>> For more options, visit this group at 
>> http://groups.google.com/group/jBASE?hl=en
>>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "jBASE" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to jb...@googlegroups.com <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jbase/73153581-25ae-493a-95f6-8afc5cdf7813%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jbase/73153581-25ae-493a-95f6-8afc5cdf7813%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
-- 
IMPORTANT: T24/Globus posts are no longer accepted on this forum.

To post, send email to jBASE@googlegroups.com
To unsubscribe, send email to jbase-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"jBASE" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jbase+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jbase/c010b5b5-199a-42b8-a7fa-2b351052c29f%40googlegroups.com.

Reply via email to