added the _reportStack(3) routine

This commit is contained in:
gdr-ftp 1998-03-28 16:46:59 +00:00
parent 04ed2e0e19
commit 92ee492794
2 changed files with 15 additions and 2 deletions

View File

@ -2,7 +2,7 @@
* gno/gno.h This collection of declarations are for routines that
* reside in libc, but are Apple IIgs or GNO specific.
*
* $Id: gno.h,v 1.2 1997/12/21 19:58:15 gdr Exp $
* $Id: gno.h,v 1.3 1998/03/28 16:46:59 gdr-ftp Exp $
*/
#ifndef _GNO_GNO_H_
@ -59,6 +59,7 @@ void _assertStack __P((unsigned int, int, const char *));
void _beginStackCheck __P((void));
int _endStackCheck __P((void));
unsigned int _getStackBottom __P((void));
void _reportStack __P((void));
/* String Conversions */
#define GIfree(a) free(a)

View File

@ -4,7 +4,7 @@
*
* This file is formatted for tab stops every eight columns.
*
* $Id: stack2.c,v 1.1 1997/12/21 20:11:17 gdr Exp $
* $Id: stack2.c,v 1.2 1998/03/28 16:46:56 gdr-ftp Exp $
*/
#ifdef __ORCAC__
@ -14,9 +14,21 @@
segment "libc_gno__";
#endif
#include <stdlib.h>
#include <err.h>
#include <gno/gno.h>
static void
_printStack (void) {
warnx("stack usage: %d bytes", _endStackCheck());
}
void
_reportStack (void) {
_beginStackCheck();
atexit(_printStack);
}
void
_assertStack (unsigned int bytes, int line, const char *file) {
static const char *fname = "_assertStack";