File: debug.h

package info (click to toggle)
magic 8.3.105%2Bds.1-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 17,128 kB
  • sloc: ansic: 175,615; sh: 7,634; tcl: 4,536; lisp: 2,554; makefile: 946; cpp: 587; python: 389; csh: 148; awk: 140
file content (78 lines) | stat: -rw-r--r-- 2,989 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
 * debug.h --
 *
 * Defines the interface to the debugging module.
 * The debugging module provides a standard collection of
 * procedures for setting, examining, and testing debugging flags.
 * Also measurement code.
 *
 *     *********************************************************************
 *     * Copyright (C) 1985, 1990 Regents of the University of California. *
 *     * Permission to use, copy, modify, and distribute this              *
 *     * software and its documentation for any purpose and without        *
 *     * fee is hereby granted, provided that the above copyright          *
 *     * notice appear in all copies.  The University of California        *
 *     * makes no representations about the suitability of this            *
 *     * software for any purpose.  It is provided "as is" without         *
 *     * express or implied warranty.  Export of this software outside     *
 *     * of the United States of America may require an export license.    *
 *     *********************************************************************
 *
 * rcsid $Header: /usr/cvsroot/magic-8.0/debug/debug.h,v 1.1.1.1 2008/02/03 20:43:50 tim Exp $
 */

#ifndef _DEBUG_H
#define _DEBUG_H

#include "utils/magic.h"

struct debugClient
{
    char		*dc_name;	/* Name of client */
    int			 dc_maxflags;	/* Maximum number of flags */
    int			 dc_nflags;	/* Number flags now in array */
    struct debugFlag	*dc_flags;	/* Array of flags */
};

struct debugFlag
{
    char	*df_name;	/* Name of debugging flag */
    bool	 df_value;	/* Current value of the flag */
};

/* A histogram counts of the number of data items in each of
 * a number of ranges.  It is defined by a low value, a bin size, and
 * the number of bins.  Items falling in the range hi_lo..hi_lo+n*hi_step-1
 * go into hi_data[n], for n=1 to the number of bins.  Values outside the
 * range are stored in locations 0 and n+1.
 */
typedef struct histogram
{
    int                hi_lo;		/* Lowest bin value		*/
    int		       hi_step;		/* Size of a bin    		*/
    int                hi_bins;		/* Number of bins in histogram	*/
    int		       hi_max;		/* Largest item in the histogram*/
    int		       hi_min;		/* Smallest item in the histogram*/
    int		       hi_cum;		/* Cumulative item total 	*/
    char             * hi_title;	/* Histogram identifier 	*/
    bool	       hi_ptrKeys;	/* TRUE if title is a pointer   */
    int              * hi_data;		/* Buckets for histogram counts	*/
    struct histogram * hi_next;		/* Linked list to next histogram*/
} Histogram;

/* constants */
#define	MAXDEBUGCLIENTS	50	/* Maximum # of clients of debug module */

extern struct debugClient debugClients[];

#define	DebugIsSet(cid, f)	debugClients[(spointertype) cid].dc_flags[f].df_value

/* procedures */
extern void HistCreate();
extern void HistAdd();
extern void HistPrint();
extern ClientData DebugAddClient();
extern int DebugAddFlag();
extern void DebugShow(), DebugSet();

#endif /* _DEBUG_H */