2 * The Regina Rexx Interpreter
3 * Copyright (C) 1992-1994 Anders Christensen <anders@pvv.unit.no>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #ifdef REGINA_DEBUG_MEMORY
26 streng
*dbg_freelists( tsd_t
*TSD
, cparamboxptr dummy
)
29 return nullstringptr() ;
33 streng
*dbg_traceback( tsd_t
*TSD
, cparamboxptr dummy
)
36 dummy
= dummy
; /* keep compiler happy */
37 return nullstringptr() ;
43 streng
*dbg_dumpvars( tsd_t
*TSD
, cparamboxptr dummy
)
46 dummy
= dummy
; /* keep compiler happy */
47 return nullstringptr() ;
52 streng
*dbg_memorystats( tsd_t
*TSD
, cparamboxptr parms
)
55 return nullstringptr() ;
59 streng
*dbg_allocated( tsd_t
*TSD
, cparamboxptr parms
)
64 checkparam( parms
, 0, 1 , "ALLOCATED" ) ;
68 ch
= getonechar( TSD
, parms
->value
, "ALLOCATED", 1 ) ;
73 ptr
= int_to_streng( TSD
,have_allocated(TSD
, MEM_ALLOC
)) ;
77 ptr
= int_to_streng( TSD
,have_allocated(TSD
, MEM_LEAKED
)) ;
81 ptr
= int_to_streng( TSD
,have_allocated(TSD
, MEM_CURRENT
)) ;
85 ptr
= Str_makeTSD( 132 ) ;
86 sprintf( ptr
->value
,"Memory: Allocated=%d, Current=%d, Leaked=%d",
87 have_allocated(TSD
, MEM_ALLOC
),
88 have_allocated(TSD
, MEM_CURRENT
),
89 have_allocated(TSD
, MEM_LEAKED
)) ;
91 ptr
->len
= strlen( ptr
->value
) ;
92 assert( ptr
->len
<= ptr
->max
) ;
96 exiterror( ERR_INCORRECT_CALL
, 28, "ALLOCATED", "ALCS", tmpstr_of( TSD
, parms
->value
) ) ;
104 streng
*dbg_dumptree( tsd_t
*TSD
, cparamboxptr dummy
)
106 dumptree( TSD
, TSD
->systeminfo
->tree
.root
, 1, 1 ) ;
107 dummy
= dummy
; /* keep compiler happy */
108 return nullstringptr() ;
115 streng
*dbg_listleaked( tsd_t
*TSD
, cparamboxptr parms
)
120 checkparam( parms
, 0, 1 , "LISTLEAKED" ) ;
122 ch
= getonechar( TSD
, parms
->value
, "LISTLEAKED", 1 ) ;
127 i
= listleaked( TSD
, MEMTRC_NONE
) ;
129 i
= listleaked( TSD
, MEMTRC_LEAKED
) ;
131 i
= listleaked( TSD
, MEMTRC_ALL
) ;
133 exiterror( ERR_INCORRECT_CALL
, 28, "LISTLEAKED", "ALN", tmpstr_of( TSD
, parms
->value
) ) ;
135 return int_to_streng( TSD
, i
) ;