gno/usr.man/man3/stack.3
1997-02-27 07:32:31 +00:00

69 lines
1.5 KiB
Groff

.\" Man page by Devin Reade.
.\"
.\" $Id: stack.3,v 1.1 1997/02/27 07:32:25 gdr Exp $
.\"
.TH STACK 3 "11 December 1996" GNO "Library Routines"
.SH NAME
.BR _beginStackCheck ,
.BR _endStackCheck
\- report stack usage
.SH SYNOPSIS
.nf
#include <gno/gno.h>
void _beginStackCheck(void);
int _endStackCheck(void);
.nf
.SH DESCRIPTION
These routines are intended to determine the required stack usage
for a program during the development cycle.
.LP
.BR _beginStackCheck
should be called as soon as possible after the program starts.
.BR _endStackCheck
should be called just prior to program exit.
.BR _endStackCheck
will return the number of bytes of stack space used by the program. The
result can then be used as a
.I lower
bound for the argument to
.BR occ 's
.BR -s
flag, or the
.I stacksize
pragma for Orca/C.
.SH EXAMPLE
An easy way to use these set of routines is to make use of the
.BR atexit (3)
function, so that you don't have to determine all the possible exit
points of your program.
.nf
#include <stdio.h>
#include <gno/gno.h>
void cleanup (void) {
fprintf(stderr,"Stack Usage: %d bytes\n", _endStackCheck());
}
void main (int argc, char **argv) {
_beginStackCheck();
atexit(cleanup);
... <program continues> ...
.fi
.SH AUTHOR
Phillip Vandry <vandry@cam.org>
.SH HISTORY
These routines first appeared as stand-along object file, under the names
.BR begin_stack_check
and
.BR end_stack_check .
They were first incorporated into GNO in v2.0.6.
.SH "SEE ALSO"
.BR occ (1),
.BR atexit (1),
Orca/C Reference Manual, Chapter 12.