functions and section editor

psuter

New Member
Hello everybody

I'm working in a company that uses Progress 9.1B.
There is always the same problem working with functions. If the functions need more than 64kB size the section editor is not able to open the whole code. Is there a newer version of the section editor in 9.1d or 91.e or is there another possiblity to force the section editor to handle such big function-files?

Thank you for helping me in that matter
Pascal
 

leowie

New Member
hi, maybe via include-file?
...
FUNCTION a RETURNS bug:

/* too big for the section-editor: */
{big_function_a.i}

END FUNCTION.
 

psuter

New Member
Even then there is a limitation after abaout 100 functions, because all the functions, definitions and main-block share the same section. Progress sends an error message during compile time.

P.Suter
 

smithxxl

New Member
I had a similar problem because I kept all the functions in one include file. The best solution is to break up the functions into separate ".p" files and then add them to the SUPER-PROCEDURES. Keep in mind that my example is based that every program I write uses a function from a common list of functions.

".p" Example....
mathfunctions.p - contains mathematical functions/procedures
guifuntions.p - contations funtions/procedures that manipulate widgets
validatefunctions.p - contations funtions/procedures used to validate form data

Once you break up the functions into seperate ".p" files, you need to create ".i" files to point that these functions are going to be run in the super procedures. The Procedures defined in the ".p" files do NOT need to be forwarded/pointed. Just functions only.

".i" Forwarder Example....
{mathfuntions.i} contains:
Code:
FUNCTION AreaOfRectangle RETURNS DECI (iHeight AS DECI, iWidth AS DECI) IN SUPER.
FUNCTION AddVars RETURNS DECI (iNum1 AS DECI, iNum2 AS DECI) IN SUPER.

Next, add the includes to the function/procedure programs so if a function that is called in mathfunctions.p from guifunctions.p will work.

Include in ".p" Example....
mathfunctions.i contains:
Code:
{guifunctions.i}.
{validatefunctions.i}.
guifunctions.i contains:
Code:
{mathfunctions.i}.
{validatefunctions.i}.
validatefunctions.i contains:
Code:
{guifunctions.i}.
{mathfunctions.i}.

Finally, one more include file that will run the procedures (if not allready in memory) and add them to the SUPER-PROCEDURES.

"mainfunctions.i" Example:
Code:
/**  mainfunctions.i  **/

DEF VAR hnMathFunctions AS HANDLE NO-UNDO.
DEF VAR hnGUIFunctions  AS HANDLE NO-UNDO.
DEF VAR hnValFunctions  AS HANDLE NO-UNDO.

DEF VAR xHasMath        AS LOGI NO-UNDO.
DEF VAR xHasGUI         AS LOGI NO-UNDO.
DEF VAR xHasVal         AS LOGI NO-UNDO.
DEF VAR hnLoop          AS HANDLE NO-UNDO.

hnLoop = SESSION:FIRST-PROCEDURE.

REPEAT:
  IF hnLoop = ? THEN
    LEAVE.

  ASSIGN
    xHasGUI = (IF hnLoop:FILE-NAME = "guifunctions.p" THEN YES ELSE xHasGUI)
    xHasVal = (IF hnLoop:FILE-NAME = "validatefunctions.p" THEN YES ELSE xHasVal)
    xHasMath = (IF hnLoop:FILE-NAME = "mathfunctions.p" THEN YES ELSE xHasMath)

    hnLoop = hnLoop:NEXT-SIBLING.
END.

IF NOT xHasGUI THEN
  DO:
    RUN guifunctions.p PERSISTENT SET hnGUIFunctions. /** Run and store into HANDLE */
    SESSION:ADD-SUPER-PROCEDURE(hnGUIFunctions). /** Add to SUPER */
  END.
{guifunctions.i}. /** Include GUI Function pointers **/

IF NOT xHasMath THEN
  DO:
    RUN validatefunctions.p PERSISTENT SET hnValFunctions. /** Run and store into HANDLE */
    SESSION:ADD-SUPER-PROCEDURE(hnValFunctions). /** Add program from HANDLE to SUPER */
  END.
{validatefunctions.i}. /** Include Validation Function pointers **/

IF NOT xHasMath THEN
  DO:
    RUN mathfunctions.p PERSISTENT SET hnMathFunctions. /** Run and store into HANDLE */
    SESSION:ADD-SUPER-PROCEDURE(hnMathFunctions). /** Add to SUPER */
  END.
{mathfunctions.i}. /** Include Math Function pointers **/

Now all you have to do is have the {mainfunctions.i} to all programs that use these common functions. It will never need to Run the programs again and you will get by those pesky segment size limitations.

Hope This helps,

Bradley Worrell-Smith
http://www.stompfest.com
 

smithxxl

New Member
Oops, I said something wrong from above.... :blush1:

Where i said:
Include in ".p" Example....
mathfunctions.i contains:
- AND -
guifunctions.i contains:
- AND -
validatefunctions.i contains:

Should of been.....
mathfunctions.p contains:
guifunctions.p contains:
validatefunctions.p contains:
.... Then the includes that were given.

Sorry about that.
 
Top