This file is indexed.

/usr/include/scim-1.0/scim_debug.h is in libscim-dev 1.4.18-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
/**
 * @file scim_debug.h
 * @brief Defines class scim::DebugOutput and related MACROS.
 *
 * All of the debug information should be output via scim::DebugOutput class.
 * This class provides message filter and redirection ability.
 */

/*
 * Smart Common Input Method
 * 
 * Copyright (c) 2002-2005 James Su <suzhe@tsinghua.org.cn>
 *
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA  02111-1307  USA
 *
 * $Id: scim_debug.h,v 1.18 2005/08/05 01:54:24 suzhe Exp $
 */

#ifndef __SCIM_DEBUG_H
#define __SCIM_DEBUG_H

#define SCIM_DEBUG_MAX_VERBOSE      7

namespace scim {

/**
 * @name The mask for debug messages filtering.
 * @{
 */
#define SCIM_DEBUG_AllMask          ((uint32)~0) /**< Show all messages. */
#define SCIM_DEBUG_MainMask         1    /**< Show messages of main application. */
#define SCIM_DEBUG_ConfigMask       2    /**< Show messages of Config objects */
#define SCIM_DEBUG_IMEngineMask     4    /**< Show messages of IMEngine objects */
#define SCIM_DEBUG_BackEndMask      8    /**< Show messages of BackEnd objects */
#define SCIM_DEBUG_FrontEndMask     16   /**< Show messages of FrontEnd objects */
#define SCIM_DEBUG_ModuleMask       32   /**< Show messages of Module objects */
#define SCIM_DEBUG_UtilityMask      64   /**< Show messages of utility functions */
#define SCIM_DEBUG_IConvMask        128  /**< Show messages of IConvert objects */
#define SCIM_DEBUG_LookupTableMask  256  /**< Show messages of LookupTable objects */
#define SCIM_DEBUG_SocketMask       512  /**< Show messages of Socket objects */
/**
 * @}
 */

/**
 * @name The macros to simplify the debug message print method.
 *
 * You can output debug messages by this way:
 *   SCIM_DEBUG_IMENGINE(1) << "Hello World!\n";
 *
 * @{
 */
#define SCIM_DEBUG(mask,level)        (scim::DebugOutput(mask,level) << scim::DebugOutput::serial_number () << __FILE__ << ":" << __LINE__ << " > ")
#define SCIM_DEBUG_MAIN(level)        SCIM_DEBUG(SCIM_DEBUG_MainMask,level)
#define SCIM_DEBUG_CONFIG(level)      SCIM_DEBUG(SCIM_DEBUG_ConfigMask,level)
#define SCIM_DEBUG_IMENGINE(level)    SCIM_DEBUG(SCIM_DEBUG_IMEngineMask,level)
#define SCIM_DEBUG_BACKEND(level)     SCIM_DEBUG(SCIM_DEBUG_BackEndMask,level)
#define SCIM_DEBUG_FRONTEND(level)    SCIM_DEBUG(SCIM_DEBUG_FrontEndMask,level)
#define SCIM_DEBUG_MODULE(level)      SCIM_DEBUG(SCIM_DEBUG_ModuleMask,level)
#define SCIM_DEBUG_UTILITY(level)     SCIM_DEBUG(SCIM_DEBUG_UtilityMask,level)
#define SCIM_DEBUG_ICONV(level)       SCIM_DEBUG(SCIM_DEBUG_IConvMask,level)
#define SCIM_DEBUG_LOOKUPTABLE(level) SCIM_DEBUG(SCIM_DEBUG_LookupTableMask,level)
#define SCIM_DEBUG_SOCKET(level)      SCIM_DEBUG(SCIM_DEBUG_SocketMask,level)
/**
 * @}
 */

/**
 * @brief The class to filter and redirect the debug messages.
 */
class DebugOutput
{
private:
    static uint32          current_verbose;
    static uint32          current_mask;

    static uint32          verbose_level;
    static uint32          output_mask;
    static std::ostream   *output_stream;

public:
    /**
     * @brief Constructor.
     * @param mask - the debug filter mask.
     * @param verbose - the verbose level of the debug message.
     */
    DebugOutput (uint32 mask = SCIM_DEBUG_AllMask, uint32 verbose = 1);

    /**
     * @brief A template stream output operator.
     *
     * All kinds of data and variables can be output via DebugOutput by
     * this operator.
     */
#if ENABLE_DEBUG
    template <typename T>
    const DebugOutput& operator << (const T& t) const {
        if (output_stream && (current_mask & output_mask) && (current_verbose <= verbose_level))
            (*output_stream) << t;
        return *this;
    }
#else
    template <typename T>
    const DebugOutput& operator << (const T&) const {
        return *this;
    }
#endif

public:
    /** 
     * @brief The global method to enable the debug output.
     * @param debug - the mask to indicate which kind of
     *                debug should be enabled.
     */
    static void enable_debug (uint32 debug);

    /**
     * @brief The global method to enable the debug output by their names.
     * @param debug - the name of the debug type to be enabled. The valid
     *                names are: all, main, config, imengine, backend, frontend,
     *                module, utility, iconv, lookuptable, socket.
     */
    static void enable_debug_by_name (const String &debug);

    /**
     * @brief Disable the debug type indicated by the given mask.
     * @param debug - the mask of the debug type to be disabled.
     */
    static void disable_debug (uint32 debug);

    /**
     * @brief Disable the debug type indicated by the given name.
     * @param debug - the name of the debug type to be disabled.
     */
    static void disable_debug_by_name (const String &debug);

    /**
     * @brief Set the debug verbose level.
     * @param verbose - the debug verbose level, 0 means no debug output.
     */
    static void set_verbose_level (uint32 verbose);

    /**
     * @brief Set the debug output file.
     *
     * @param file - the file to store the debug output.
     *               If equal to "stderr" or "cerr" then the debug
     *               output will be set to std:cerr.
     *               If equal to "stdout" or "cout" then the debug
     *               output will be set to std::cout.
     */
    static void set_output (const String &file);

    static String serial_number ();
};

} // namespace scim

#endif //__SCIM_DEBUG_H
/*
vi:ts=4:nowrap:ai:expandtab
*/