[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fns creation using libapl (c code)

From: enztec
Subject: fns creation using libapl (c code)
Date: Mon, 6 Mar 2023 13:31:45 -0700


it doesn't seem possible to create apl fns with apl_command or apl_exec 
directly using libapl
but i can successfully create a llibapl environment with fns and variables with 
the following setup and workaround


2 files  fns.enz and fns.c


situation 1 : shows good fns created from fns.enz

/usr/local/bin/apl fns.enz

in apl workspace run
f2         not created if it's fns definition header is commented in fns.enz 
but is created if uncommented


situation 2 :


in apl workspace run
)copy fns.enz
f2          not created if it's fns definition header is commented in fns.enz 
but is created if uncommented


situation 3 :

g++ -O2 fns.c -o fns -L /usr/local/lib/apl -lapl
./fns     gives my output below and creates fns1.xml fns2.xml and fns3.xml that 
can hopefully be of use for analysis of what is happening

in fns.c i can use  apl_command(")copy fns.enz"); or apl_exec(")copy fns.enz"); 
with the fns definition header workaround to get working fns f1 and f2
but without the f1 and f2 fns definition headers in fns.c i get no f1 or f2 

in the fns.enz ∇f1 and ∇f2 fns definition headers don't work as would 
hope/expect without the f1 and f2 function definition workaround in fns.c

as you can see in the fns.c after the )copy fns.enz  if i do a workaround  
apl_exec("∇f1"); i get good fns f1 and f2

it seems the ∇f1 fns header doesn't work but the bodies of the fns in fns.enz 
and closing ∇ are in some 'buffer' and get put into the f1 fns when the f1 
function header definitions workarounds is done in fns.c

the interesting thing is is that if i comment the f1 fns definition header in 
the fns.enz the fns are still created by the corresponding workaround line in 
fns.c but if i leave it uncommented (which is what it would be if it worked) 
when i run the correspinding fns header workaround in fns.c it gives the syntax 
error when run but doesn't prevent it from creating the good f1 fns - so it 
seems the f1 function definition header in fns.enz is doing something but not 
creating the fns.

i left the fns.enz f1 function header uncommented and the fns.enz f2 function 
header commented to show the difference
fns f2 is not created in situation 1 or situation 2 if it's fns definition 
header is commented in fns.enz but commenting does not affect it's creation in 
situation 3 (libapl) if f2 workaround fns definition header is used in fns.c

the correct order of the functions in fns.enz and the corresponding fns headers 
workarounds must be maintained to get proper working fns with the correct names

i have been using this workaround successfully but would love to know what is 
happening and see if there can be a fix 

i have added 3  )save  commands at 'strategic' points in fns,c to create the 
fns1.xml fns2.xml and fns3.xml in hope they give some information that can be 
used to analyze what is happening




this is my output from ./fns from libapl situation 3

)copy fns.enz
DUMPED 2023-03-06  12:31:44 (GMT-7) 

)wsid fns1
2023-03-06  13:11:51 (GMT-7)  fns1

∇f1 workaround 1 in fns.c for f1 fns header in fns.enz
Tokenizer: No token for Unicode U+2207 (∇)
Input: ∇f1


)wsid fns2
WAS fns1
2023-03-06  13:11:51 (GMT-7)  fns2

∇f2 workaround 2 in fns,c for f2 fns header in fns.enz

)wsid fns3
WAS fns2
2023-03-06  13:11:51 (GMT-7)  fns3

f1  f2

f1 fns executed
⍴⍕1 2 3 : 5

f2 fns executed
⍴⍎"1 2 3" : 3


Attachment: fns.enz
Description: Binary data

Attachment: fns.c
Description: Binary data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]