Function pointers issues

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
htuser
Posts: 631
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

Function pointers issues

Post by htuser »

Dear CSPro developpement Team,
Months ago, Greg help me with a workaround to bypass the multi-pass issue of the CSPro logic compiler by using function pointers.
However, today, the first time that i'm trying them, there's an issue.
a) I have three pff objects functions to add, modify and verify cases using a menu.
Function choixQuestionnaire(function EntryPffIpb_add(),function EntryPffIpb_modification(),function EntryPffIpb_verify())
   
if choixPrincipal()=1 then
        numeric
opQuestionnaire=choixMenuQuest.show("SVP, veuillez choisir");
       
if opQuestionnaire=1 then
           
codeAcceuil();
            EntryPffIpb_add();
       
endif;
       
if opQuestionnaire=2 then
           
codeAcceuil();
            EntryPffIpb_modification();
       
endif;
       
if opQuestionnaire=2 then
           
codeAcceuil();
            EntryPffIpb_verify();
       
endif;
   
endif;
end;
It display no errors.

b) However, when i call this in a proc:
if $<>"" then
choixPrincipal();
choixQuestionnaire(EntryPffIpb_add(),EntryPffIpb_modification(), EntryPffIpb_verify());
endif
It display errors: ERROR(57):
Functions called recursively or via function references can only contain local variables of type: numeric, string, and list
Please, how to solve this?
Thanks in advance!
G.VOLNY, a CSProuser from Haiti, since 2004
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Function pointers issues

Post by Gregory Martin »

The error tells you the limitation with CSPro: "function references can only contain local variables of type: numeric, string, and list."

Based on your code, I assume that you are creating a local PFF object within those functions. You will have to make them global objects. Instead of:
function EntryPffIpb_add()

   
pff entry_pff;
Do:
pff entryAddPff;

function EntryPffIpb_add()
Best programming standards are to not use global variables unless necessary, but you will have to if you want to get around this limitation.
htuser
Posts: 631
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

Re: Function pointers issues

Post by htuser »

Thanks Greg for your incredible help and support.
I already send to application to the developer team with others issues. Hope a day, CSPro will have a multiple pass compiler and support user created class and object. This will solve theses issues.

Best,
G.VOLNY, a CSProuser from Haiti, since 2004
Post Reply