This file is indexed.

/usr/include/klfbackend/klfdebug.h is in libklatexformula3-dev 3.2.8-0ubuntu1.

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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
/***************************************************************************
 *   file klfdebug.h
 *   This file is part of the KLatexFormula Project.
 *   Copyright (C) 2011 by Philippe Faist
 *   philippe.faist at bluewin.ch
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program 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 General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU 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: klfdebug.h 862 2013-11-23 11:10:54Z phfaist $ */

#ifndef KLFDEBUG_H
#define KLFDEBUG_H

#include <qmap.h>

#include <klfdefs.h>

// Note: function definitions are in klfdefs.cpp


// DEBUG UTILITIES (SOME WITH TIME PRINTING FOR TIMING OPERATIONS)


KLF_EXPORT QByteArray klfShortFuncSignature(const QByteArray& fullFuncName);
inline QByteArray klfShortFuncSignature(const char *fullFuncName)
#ifdef KLFBACKEND_QT4
{ return klfShortFuncSignature(QByteArray(fullFuncName)); }
#else
{ return klfShortFuncSignature(QByteArray().duplicate(fullFuncName, strlen(fullFuncName))); }
#endif

KLF_EXPORT QString klfTimeOfDay(bool shortFmt = true);

#ifdef KLFBACKEND_QT4
#  define KLF_SHORT_TIME qPrintable(klfTimeOfDay())
#else
#  define KLF_SHORT_TIME (klfTimeOfDay().ascii())
#endif


class KLF_EXPORT KLFDebugBlock
{
public:
  KLFDebugBlock(const QString& blockName);
  KLFDebugBlock(bool printmsg, const QString& blockName);

  virtual ~KLFDebugBlock();

protected:
  QString pBlockName;
private:
  bool pPrintMsg;
};

class KLF_EXPORT KLFDebugBlockTimer : public KLFDebugBlock
{
public:
  KLFDebugBlockTimer(const QString& blockName);
  virtual ~KLFDebugBlockTimer();
};

#ifndef KLFBACKEND_QT4
class KLF_EXPORT __klf_dbg_string_obj  {
  QString hdr;
public:
  __klf_dbg_string_obj(const QString& h) : hdr(h) { }
  __klf_dbg_string_obj(const __klf_dbg_string_obj& other) : hdr(other.hdr) { }
  int operator=(const QString& msg);
};
#endif

class KLFDebugObjectWatcherPrivate;

class KLF_EXPORT KLFDebugObjectWatcher : public QObject
{
  Q_OBJECT
public:
  static KLFDebugObjectWatcher *getWatcher();

  void registerObjectRefInfo(QObject *object, const QString& refInfo);
public slots:
  void debugObjectDestroyedFromSender() { debugObjectDestroyed(const_cast<QObject*>(sender())); }
  void debugObjectDestroyed(QObject *object);
private:

  KLFDebugObjectWatcher();
  virtual ~KLFDebugObjectWatcher();
  static KLFDebugObjectWatcher *instance;

  KLFDebugObjectWatcherPrivate *p;
};


#ifdef KLFBACKEND_QT4
#  include <QDebug>
#endif

#ifdef KLF_DEBUG

template<class T>
inline const T& __klf_debug_tee(const T& expr)
#  ifdef KLFBACKEND_QT4
{ qDebug()<<"TEE VALUE: "<<expr; return expr; }
#  else
{ return expr; } // sorry, no  qDebug()<<(anything you want)  in Qt 3 ...
#  endif


#  ifdef KLFBACKEND_QT4
KLF_EXPORT  QDebug
/* */ __klf_dbg_hdr(QDebug dbg, const char * funcname, const char *refinstance, const char * shorttime);
#  else
KLF_EXPORT  __klf_dbg_string_obj
/* */ __klf_dbg_hdr_qt3(const char *funcname, const char *refinstance, const char *shorttime) ;
#  endif

inline QString __klf_debug_ref_instance() { return QString(); }
#  define KLF_DEBUG_DECLARE_REF_INSTANCE( expr )			\
  protected: inline QString __klf_debug_ref_instance() const { return QString("[")+ (expr) + "]" ; }

#  define KLF_DEBUG_DECLARE_ASSIGNABLE_REF_INSTANCE()			\
  public: QString __klf_debug_this_ref_instance;			\
  protected: inline QString __klf_debug_ref_instance() const { return __klf_debug_this_ref_instance; }
#  define KLF_DEBUG_ASSIGN_REF_INSTANCE(object, ref_instance)	\
  (object)->__klf_debug_this_ref_instance = QString("[%1]").arg((ref_instance))
#  define KLF_DEBUG_ASSIGN_SAME_REF_INSTANCE(object)			\
  (object)->__klf_debug_this_ref_instance = __klf_debug_ref_instance();

#  define KLF_DEBUG_TIME_BLOCK(msg) KLFDebugBlockTimer __klf_debug_timer_block(QString("")+msg)
#  define KLF_DEBUG_BLOCK(msg) KLFDebugBlock __klf_debug_block(QString("")+msg)
#  define KLF_DEBUG_TEE(expr) __klf_debug_tee(expr)
#  ifdef KLFBACKEND_QT4
#    define klfDbg( streamableItems )				\
  __klf_dbg_hdr(qDebug(), KLF_FUNC_NAME, qPrintable(__klf_debug_ref_instance()), NULL) << streamableItems
#    define klfDbgT( streamableItems )					\
  __klf_dbg_hdr(qDebug(), KLF_FUNC_NAME, qPrintable(__klf_debug_ref_instance()), KLF_SHORT_TIME) << streamableItems
#    define klfDbgSt( streamableItems )				\
  __klf_dbg_hdr(qDebug(), KLF_FUNC_NAME, NULL, NULL) << streamableItems
#    define klfDbgStT( streamableItems )					\
  __klf_dbg_hdr(qDebug(), KLF_FUNC_NAME, NULL, KLF_SHORT_TIME) << streamableItems
#  else
#    define klfDbg( string )						\
  __klf_dbg_hdr_qt3(KLF_FUNC_NAME, __klf_debug_ref_instance().local8Bit(), NULL) = QString("") + (string)
#    define klfDbgT( string )						\
  __klf_dbg_hdr_qt3(KLF_FUNC_NAME, __klf_debug_ref_instance().local8Bit(), KLF_SHORT_TIME) = QString("") + (string)
#    define klfDbgSt( string )						\
  __klf_dbg_hdr_qt3(KLF_FUNC_NAME, NULL, NULL) = QString("") + (string)
#    define klfDbgStT( string )						\
  __klf_dbg_hdr_qt3(KLF_FUNC_NAME, NULL, KLF_SHORT_TIME) = QString("") + (string)
#  endif

#  define KLF_DEBUG_WATCH_OBJECT( qobj )				\
  { KLFDebugObjectWatcher::getWatcher()->registerObjectRefInfo((qobj), #qobj) ; \
    connect((qobj), SIGNAL(destroyed()),				\
	    KLFDebugObjectWatcher::getWatcher(), SLOT(debugObjectDestroyedFromSender())); \
  }


#else // KLF_DEBUG



#  define KLF_DEBUG_DECLARE_REF_INSTANCE( expr )
#  define KLF_DEBUG_DECLARE_ASSIGNABLE_REF_INSTANCE()
#  define KLF_DEBUG_ASSIGN_REF_INSTANCE(object, ref_instance)
#  define KLF_DEBUG_ASSIGN_SAME_REF_INSTANCE(object)


#  define KLF_DEBUG_TIME_BLOCK(msg)
#  define KLF_DEBUG_BLOCK(msg)

#  define KLF_DEBUG_TEE(expr) (expr)

#  define klfDbg( streamableItems )
#  define klfDbgT( streamableItems )
#  define klfDbgSt( streamableItems )
#  define klfDbgStT( streamableItems )

#  define KLF_DEBUG_WATCH_OBJECT( qobj )

#endif // KLF_DEBUG



/* Ensure a usable __func__ symbol */
#if defined(__STDC_VERSION__) && __STDC_VERSION__ < 199901L
#  if defined(__GNUC__) && __GNUC__ >= 2
#    define __func__ __FUNCTION__
#  else
#    ifdef KLFBACKEND_QT4
#      define __func__ (qPrintable(QString("<in %2 line %1>").arg(__LINE__).arg(__FILE__)))
#    else
#      define __func__ (QString("<in %2 line %1>").arg(__LINE__).arg(__FILE__).ascii().data())
#    endif
#  endif
#endif
/* The following declaration tests are inspired from "qglobal.h" in Qt 4.6.2 source code */
#ifndef KLF_FUNC_NAME
#  if (defined(Q_CC_GNU) && !defined(Q_OS_SOLARIS)) || defined(Q_CC_HPACC) || defined(Q_CC_DIAB)
#    define KLF_FUNC_NAME  (klfShortFuncSignature(__PRETTY_FUNCTION__).data())
#  elif defined(_MSC_VER)
    /* MSVC 2002 doesn't have __FUNCSIG__ */
#    if _MSC_VER <= 1300
#        define KLF_FUNC_NAME  __func__
#    else
#        define KLF_FUNC_NAME  (klfShortFuncSignature(__FUNCSIG__).data())
#    endif
#  else
#    define KLF_FUNC_NAME __func__
#  endif
#endif




#ifdef KLFBACKEND_QT4
#define KLF_ASSERT_CONDITION(expr, msg, failaction)		       \
  if ( !(expr) ) {						       \
    qWarning().nospace()<<"In function "<<KLF_FUNC_NAME<<":\n\t"<<msg; \
    failaction;							       \
  }
#else
#define KLF_ASSERT_CONDITION(expr, msg, failaction)			\
  if ( !(expr) ) {							\
    qWarning("In function %s:\n\t%s", KLF_FUNC_NAME, (QString("")+msg).local8Bit().data()); \
    failaction;								\
  }
#endif
#define KLF_ASSERT_CONDITION_ELSE(expr, msg, failaction)	\
  KLF_ASSERT_CONDITION(expr, msg, failaction)			\
  else
#define KLF_ASSERT_NOT_NULL(ptr, msg, failaction)	\
  KLF_ASSERT_CONDITION((ptr) != NULL, msg, failaction)




#if defined(KLFBACKEND_QT4) && defined(QT_NO_DEBUG_OUTPUT)
// Qt fix: this line is needed in non-debug output mode (?)
inline QDebug& operator<<(QDebug& str, const QVariant& v) { return str; }
#endif





#endif