1*5e7646d2SAndroid Build Coastguard Worker /* 2*5e7646d2SAndroid Build Coastguard Worker * Internal debugging macros for CUPS. 3*5e7646d2SAndroid Build Coastguard Worker * 4*5e7646d2SAndroid Build Coastguard Worker * Copyright © 2007-2018 by Apple Inc. 5*5e7646d2SAndroid Build Coastguard Worker * Copyright © 1997-2005 by Easy Software Products. 6*5e7646d2SAndroid Build Coastguard Worker * 7*5e7646d2SAndroid Build Coastguard Worker * Licensed under Apache License v2.0. See the file "LICENSE" for more 8*5e7646d2SAndroid Build Coastguard Worker * information. 9*5e7646d2SAndroid Build Coastguard Worker */ 10*5e7646d2SAndroid Build Coastguard Worker 11*5e7646d2SAndroid Build Coastguard Worker #ifndef _CUPS_DEBUG_INTERNAL_H_ 12*5e7646d2SAndroid Build Coastguard Worker # define _CUPS_DEBUG_INTERNAL_H_ 13*5e7646d2SAndroid Build Coastguard Worker 14*5e7646d2SAndroid Build Coastguard Worker 15*5e7646d2SAndroid Build Coastguard Worker /* 16*5e7646d2SAndroid Build Coastguard Worker * Include necessary headers... 17*5e7646d2SAndroid Build Coastguard Worker */ 18*5e7646d2SAndroid Build Coastguard Worker 19*5e7646d2SAndroid Build Coastguard Worker # include "debug-private.h" 20*5e7646d2SAndroid Build Coastguard Worker 21*5e7646d2SAndroid Build Coastguard Worker 22*5e7646d2SAndroid Build Coastguard Worker /* 23*5e7646d2SAndroid Build Coastguard Worker * C++ magic... 24*5e7646d2SAndroid Build Coastguard Worker */ 25*5e7646d2SAndroid Build Coastguard Worker 26*5e7646d2SAndroid Build Coastguard Worker # ifdef __cplusplus 27*5e7646d2SAndroid Build Coastguard Worker extern "C" { 28*5e7646d2SAndroid Build Coastguard Worker # endif /* __cplusplus */ 29*5e7646d2SAndroid Build Coastguard Worker 30*5e7646d2SAndroid Build Coastguard Worker 31*5e7646d2SAndroid Build Coastguard Worker /* 32*5e7646d2SAndroid Build Coastguard Worker * The debug macros are used if you compile with DEBUG defined. 33*5e7646d2SAndroid Build Coastguard Worker * 34*5e7646d2SAndroid Build Coastguard Worker * Usage: 35*5e7646d2SAndroid Build Coastguard Worker * 36*5e7646d2SAndroid Build Coastguard Worker * DEBUG_puts("string") 37*5e7646d2SAndroid Build Coastguard Worker * DEBUG_printf(("format string", arg, arg, ...)); 38*5e7646d2SAndroid Build Coastguard Worker * 39*5e7646d2SAndroid Build Coastguard Worker * Note the extra parenthesis around the DEBUG_printf macro... 40*5e7646d2SAndroid Build Coastguard Worker * 41*5e7646d2SAndroid Build Coastguard Worker * Newlines are not required on the end of messages, as both add one when 42*5e7646d2SAndroid Build Coastguard Worker * writing the output. 43*5e7646d2SAndroid Build Coastguard Worker * 44*5e7646d2SAndroid Build Coastguard Worker * If the first character is a digit, then it represents the "log level" of the 45*5e7646d2SAndroid Build Coastguard Worker * message from 0 to 9. The default level is 1. The following defines the 46*5e7646d2SAndroid Build Coastguard Worker * current levels we use: 47*5e7646d2SAndroid Build Coastguard Worker * 48*5e7646d2SAndroid Build Coastguard Worker * 0 = public APIs, other than value accessor functions 49*5e7646d2SAndroid Build Coastguard Worker * 1 = return values for public APIs 50*5e7646d2SAndroid Build Coastguard Worker * 2 = public value accessor APIs, progress for public APIs 51*5e7646d2SAndroid Build Coastguard Worker * 3 = return values for value accessor APIs 52*5e7646d2SAndroid Build Coastguard Worker * 4 = private APIs, progress for value accessor APIs 53*5e7646d2SAndroid Build Coastguard Worker * 5 = return values for private APIs 54*5e7646d2SAndroid Build Coastguard Worker * 6 = progress for private APIs 55*5e7646d2SAndroid Build Coastguard Worker * 7 = static functions 56*5e7646d2SAndroid Build Coastguard Worker * 8 = return values for static functions 57*5e7646d2SAndroid Build Coastguard Worker * 9 = progress for static functions 58*5e7646d2SAndroid Build Coastguard Worker */ 59*5e7646d2SAndroid Build Coastguard Worker 60*5e7646d2SAndroid Build Coastguard Worker # ifdef DEBUG 61*5e7646d2SAndroid Build Coastguard Worker # define DEBUG_puts(x) _cups_debug_puts(x) 62*5e7646d2SAndroid Build Coastguard Worker # define DEBUG_printf(x) _cups_debug_printf x 63*5e7646d2SAndroid Build Coastguard Worker # else 64*5e7646d2SAndroid Build Coastguard Worker # define DEBUG_puts(x) 65*5e7646d2SAndroid Build Coastguard Worker # define DEBUG_printf(x) 66*5e7646d2SAndroid Build Coastguard Worker # endif /* DEBUG */ 67*5e7646d2SAndroid Build Coastguard Worker 68*5e7646d2SAndroid Build Coastguard Worker 69*5e7646d2SAndroid Build Coastguard Worker /* 70*5e7646d2SAndroid Build Coastguard Worker * Prototypes... 71*5e7646d2SAndroid Build Coastguard Worker */ 72*5e7646d2SAndroid Build Coastguard Worker 73*5e7646d2SAndroid Build Coastguard Worker # ifdef DEBUG 74*5e7646d2SAndroid Build Coastguard Worker extern int _cups_debug_fd _CUPS_INTERNAL; 75*5e7646d2SAndroid Build Coastguard Worker extern int _cups_debug_level _CUPS_INTERNAL; 76*5e7646d2SAndroid Build Coastguard Worker extern void _cups_debug_printf(const char *format, ...) _CUPS_FORMAT(1,2) _CUPS_INTERNAL; 77*5e7646d2SAndroid Build Coastguard Worker extern void _cups_debug_puts(const char *s) _CUPS_INTERNAL; 78*5e7646d2SAndroid Build Coastguard Worker # endif /* DEBUG */ 79*5e7646d2SAndroid Build Coastguard Worker 80*5e7646d2SAndroid Build Coastguard Worker # ifdef __cplusplus 81*5e7646d2SAndroid Build Coastguard Worker } 82*5e7646d2SAndroid Build Coastguard Worker # endif /* __cplusplus */ 83*5e7646d2SAndroid Build Coastguard Worker 84*5e7646d2SAndroid Build Coastguard Worker #endif /* !_CUPS_DEBUG_INTERNAL_H_ */ 85