Blame src/terminal-debug.h

Packit d370c2
/*
Packit d370c2
 * Copyright (C) 2002 Red Hat, Inc.
Packit d370c2
 *
Packit d370c2
 * This program is free software: you can redistribute it and/or modify
Packit d370c2
 * it under the terms of the GNU General Public License as published by
Packit d370c2
 * the Free Software Foundation, either version 3 of the License, or
Packit d370c2
 * (at your option) any later version.
Packit d370c2
 *
Packit d370c2
 * This program is distributed in the hope that it will be useful,
Packit d370c2
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit d370c2
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit d370c2
 * GNU General Public License for more details.
Packit d370c2
 *
Packit d370c2
 * You should have received a copy of the GNU General Public License
Packit d370c2
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit d370c2
 */
Packit d370c2
Packit d370c2
/* The interfaces in this file are subject to change at any time. */
Packit d370c2
Packit d370c2
#ifndef ENABLE_DEBUG_H
Packit d370c2
#define ENABLE_DEBUG_H
Packit d370c2
Packit d370c2
#include <glib.h>
Packit d370c2
Packit d370c2
G_BEGIN_DECLS
Packit d370c2
Packit d370c2
typedef enum {
Packit d370c2
  TERMINAL_DEBUG_ACCELS        = 1 << 0,
Packit d370c2
  TERMINAL_DEBUG_CLIPBOARD     = 1 << 1,
Packit d370c2
  TERMINAL_DEBUG_ENCODINGS     = 1 << 2,
Packit d370c2
  TERMINAL_DEBUG_SERVER        = 1 << 3,
Packit d370c2
  TERMINAL_DEBUG_GEOMETRY      = 1 << 4,
Packit d370c2
  TERMINAL_DEBUG_MDI           = 1 << 5,
Packit d370c2
  TERMINAL_DEBUG_PROCESSES     = 1 << 6,
Packit d370c2
  TERMINAL_DEBUG_PROFILE       = 1 << 7,
Packit d370c2
  TERMINAL_DEBUG_SETTINGS_LIST = 1 << 8,
Packit Service 3b2fae
  TERMINAL_DEBUG_SEARCH        = 1 << 9
Packit d370c2
} TerminalDebugFlags;
Packit d370c2
Packit d370c2
void _terminal_debug_init(void);
Packit d370c2
Packit d370c2
extern TerminalDebugFlags _terminal_debug_flags;
Packit d370c2
static inline gboolean _terminal_debug_on (TerminalDebugFlags flags) G_GNUC_CONST G_GNUC_UNUSED;
Packit d370c2
Packit d370c2
static inline gboolean
Packit d370c2
_terminal_debug_on (TerminalDebugFlags flags)
Packit d370c2
{
Packit d370c2
  return (_terminal_debug_flags & flags) == flags;
Packit d370c2
}
Packit d370c2
Packit d370c2
#ifdef ENABLE_DEBUG
Packit d370c2
#define _TERMINAL_DEBUG_IF(flags) if (G_UNLIKELY (_terminal_debug_on (flags)))
Packit d370c2
#else
Packit d370c2
#define _TERMINAL_DEBUG_IF(flags) if (0)
Packit d370c2
#endif
Packit d370c2
Packit d370c2
#if defined(__GNUC__) && G_HAVE_GNUC_VARARGS
Packit d370c2
#define _terminal_debug_print(flags, fmt, ...) \
Packit d370c2
  G_STMT_START { _TERMINAL_DEBUG_IF(flags) g_printerr(fmt, ##__VA_ARGS__); } G_STMT_END
Packit d370c2
#else
Packit d370c2
#include <stdarg.h>
Packit d370c2
#include <glib/gstdio.h>
Packit d370c2
static void _terminal_debug_print (guint flags, const char *fmt, ...)
Packit d370c2
{
Packit d370c2
  if (_terminal_debug_on (flags)) {
Packit d370c2
    va_list  ap;
Packit d370c2
    va_start (ap, fmt);
Packit d370c2
    g_vfprintf (stderr, fmt, ap);
Packit d370c2
    va_end (ap);
Packit d370c2
  }
Packit d370c2
}
Packit d370c2
#endif
Packit d370c2
Packit d370c2
G_END_DECLS
Packit d370c2
Packit d370c2
#endif /* !ENABLE_DEBUG_H */