10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Calling Procedures• In this call to a procedure “q”:callproc q (1 + 2, 2.3, 'This is a string');the following declarations are required:q(x, y, z)long x;double y; char *z;{...To receive x and y that are passed by reference, make the following changesto their formal argument declarations:long *x;double *y;No changes are necessary to receive z that is passed by reference.A C procedure must return an int, a long, a double, or a char * value, asshown in the following examples.• To return an integer:intreti(){return 10;}• To return a floating-point value:doubleretf(){return 10.5;}• To return a character string:char *rets(){return "Returned from rets";}Any C procedure that returns a char * value to 4GL must return a pointer to avalid address (a string constant or static or global character buffer). Theprocedure cannot return a pointer to a local character buffer.Calling ProceduresIn OpenROAD, the frame or procedure that includes the callproc statement isreferred to as the calling frame or procedure. The procedure you specify in thecallproc statement is referred to as the called procedure.Writing Scripts and Procedures 83

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!