disable the unrecognized nls flag
[AROS-Contrib.git] / regina / dbgfuncs.c
blob3583b12b91a094014feb1d5c56872fc3fb52abf4
1 /*
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.
20 #include "rexx.h"
21 #include <stdio.h>
22 #include <string.h>
23 #include <assert.h>
25 #ifdef REGINA_DEBUG_MEMORY
26 streng *dbg_freelists( tsd_t *TSD, cparamboxptr dummy )
28 show_free_lists(TSD);
29 return nullstringptr() ;
31 #endif
33 streng *dbg_traceback( tsd_t *TSD, cparamboxptr dummy )
35 traceback(TSD) ;
36 dummy = dummy; /* keep compiler happy */
37 return nullstringptr() ;
40 #ifndef NDEBUG
43 streng *dbg_dumpvars( tsd_t *TSD, cparamboxptr dummy )
45 dumpvars(TSD);
46 dummy = dummy; /* keep compiler happy */
47 return nullstringptr() ;
51 #ifdef TRACEMEM
52 streng *dbg_memorystats( tsd_t *TSD, cparamboxptr parms )
54 memory_stats(TSD) ;
55 return nullstringptr() ;
59 streng *dbg_allocated( tsd_t *TSD, cparamboxptr parms )
61 char ch=' ' ;
62 streng *ptr=NULL ;
64 checkparam( parms, 0, 1 , "ALLOCATED" ) ;
65 if (!parms->value)
66 ch = 'S' ;
67 else
68 ch = getonechar( TSD, parms->value, "ALLOCATED", 1 ) ;
70 switch ( ch )
72 case 'A' :
73 ptr = int_to_streng( TSD,have_allocated(TSD, MEM_ALLOC)) ;
74 break ;
76 case 'L' :
77 ptr = int_to_streng( TSD,have_allocated(TSD, MEM_LEAKED)) ;
78 break ;
80 case 'C' :
81 ptr = int_to_streng( TSD,have_allocated(TSD, MEM_CURRENT)) ;
82 break ;
84 case 'S' :
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 ) ;
93 break ;
95 default:
96 exiterror( ERR_INCORRECT_CALL, 28, "ALLOCATED", "ALCS", tmpstr_of( TSD, parms->value ) ) ;
99 return( ptr ) ;
101 #endif
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() ;
112 #ifdef TRACEMEM
115 streng *dbg_listleaked( tsd_t *TSD, cparamboxptr parms )
117 char ch=0 ;
118 int i=0 ;
120 checkparam( parms, 0, 1 , "LISTLEAKED" ) ;
121 if (parms->value)
122 ch = getonechar( TSD, parms->value, "LISTLEAKED", 1 ) ;
123 else
124 ch = 'L' ;
126 if (ch=='N')
127 i = listleaked( TSD, MEMTRC_NONE ) ;
128 else if (ch=='L')
129 i = listleaked( TSD, MEMTRC_LEAKED ) ;
130 else if (ch=='A')
131 i = listleaked( TSD, MEMTRC_ALL ) ;
132 else
133 exiterror( ERR_INCORRECT_CALL, 28, "LISTLEAKED", "ALN", tmpstr_of( TSD, parms->value ) ) ;
135 return int_to_streng( TSD, i ) ;
137 #endif
139 #endif /* !NDEBUG */