Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Blinker 5.10 Online Reference - <b> ca-clipper dgroup and eval stack faults</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 CA-Clipper DGROUP and Eval stack faults
------------------------------------------------------------------------------
 At program run time, CA-Clipper uses as much as possible of the default data
 group (DGROUP) to store temporary values such as locals, statics and
 function parameters. The infamous `667 Eval stack fault' error occurs if
 there is insufficient space for the requirements of the program, which
 becomes more and more likely as the size of a program increases.

 Adding the string //INFO to the command line of a CA-Clipper program causes
 CA-Clipper to display a usage summary of DGROUP at program start up and at
 program termination. Please refer to the CA-Clipper documentation for
 further information on the meaning of the various values displayed.

 The most important figure as far as the Eval stack is concerned is the `DS
 avail' figure, which is an approximation of the space available in the
 default data segment for the Eval stack. By adding and eliminating parts of
 a program, this figure can be used to determine which (if any) 3rd party
 library, or which section of CA-Clipper code, is using up the space.

 Note that increasing the system stack (using STACK nnn or BLINKER PROCEDURE
 DEPTH nnn) will actually decrease the `DS avail' figure, and therefore the
 size of the Eval stack, because it has used up more of DGROUP for the system
 stack.

    Increased Eval stack in DOS extended and Windows programs
    MSGSYSnn.ZIP replacement error messages

 Increased Eval stack in DOS extended and Windows programs

 When linking CA-Clipper DOS extended and Windows programs, Blinker
 automatically includes code to greatly increase the space available for the
 CA-Clipper Eval stack by moving a major part of it outside DGROUP. This
 should virtually eliminate occurrences of the infamous 667 error, as it
 completely removes all static variables from the Eval stack, leaving far
 more room for the other information CA-Clipper needs to store there.

 The Eval stack enhancement code is enabled by default, and causes all
 CA-Clipper static variables to be allocated from a separate 64 Kb segment,
 rather than sharing DGROUP with all locals, privates, the system stack and
 other CA-Clipper data.

 Each variable, of any type or value, and whether private, public, local or
 static, always occupies 14 bytes of memory in these areas, so an approximate
 theoretical maximum number of variables can be calculated from the sizes of
 these areas.

 The Blinker functions BLILOCAVL(), BLILOCTOT(), BLILOCUSE(), BLISTCSHR(),
 BLISTCAVL(), BLISTCTOT() and BLISTCUSE() can be used to display the memory
 usage for the CA-Clipper local and static variables. Please refer to their
 entries in the function reference in the online help file for more details.
 The Eval stack enhancement code is enabled by default, but can easily be
 disabled, in order to compare the relative improvements with and without it,
 or for debugging purposes. To disable the enhancement code, simply run the
 program with the //NOEVAL command line parameter. This will cause the
 program to emulate the default behaviour of CA-Clipper when linked with all
 other linkers, including versions of Blinker prior to 5.x.

 Blinker provides 7 status functions which can be called directly from
 CA-Clipper at any time to monitor the memory usage of the Eval stack (local
 and private variables) and the static variables area.

 BLILOCAVL()    Get available local and private variables space
 BLILOCTOT()    Get total local and private variables space
 BLILOCUSE()    Get used local and private variables space
 BLISTCSHR()    Get whether static variables share space with locals
                .T. indicates shared, CA-Clipper default
                .F. indicates not shared, Blinker default behaviour
 BLISTCAVL()    Get available static variables space
 BLISTCTOT()    Get total static variables space
 BLISTCUSE()    Get used static variables space

 The following CA-Clipper function can be used to create a string containing
 a summary of all this information which can be displayed using a print
 statement in DOS extended programs or a MessageBox() function call in
 Windows programs.

 **************************************************
 *
 * Blinker function to return DGROUP status string
 *
 * Parameters : String to separate each line
 *
 * E.g.   DOS : cVar = BLIDGRSTS (chr(13) + chr(10))
 *
 *     Win : cVar = BLIDGRSTS (chr(13))
 *
 **************************************************
 function BLIDGRSTS param cSeparator

 local cStr := ""

 cStr = cStr + "LOCAL and PRIVATE variables space" + cSeparator
 cStr = cStr + " Total = " + str (BLILOCTOT(),5) + cSeparator
 cStr = cStr + " Used = " + str (BLILOCUSE(),5) + cSeparator
 cStr = cStr + " Avail = " + str (BLILOCAVL(),5) + cSeparator

 cStr = cStr + "STATIC variable space"
 cStr = cStr + iif (BLISTCSHR (), " * SHARED * ", "") + cSeparator

 cStr = cStr + " Total = " + str (BLISTCTOT(),5) + cSeparator
 cStr = cStr + " Used = " + str (BLISTCUSE(),5) + cSeparator
 cStr = cStr + " Avail = " + str (BLISTCAVL(),5) + cSeparator

 return cStr

 MSGSYSnn.ZIP replacement error messages

 Included in the CLP subdirectory of the Blinker installation directory is
 the file MSGSYSnn.ZIP, which contains the files necessary to create national
 versions of various Clipper error messages, and at the same time move them
 out of DGROUP, saving another 1.5 Kb of valuable 'DS avail' space. This file
 was kindly supplied by Matteo Baccan of the Italian Software Agency.

 Please note that Blinkinc is simply distributing the files as a service to
 CA-Clipper users, and is providing it on an as-is basis, so cannot and will
 not provide technical support or help on the contents of this file. As
 directed in its documentation, please direct all questions and feedback to
 Matteo Baccan at baccan@isanet.it.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson