# SFBPrintf.h

Go to the documentation of this file.

    00001 /*                                             -*- mode:C++; fill-column:100 -*-
    00002   SFBPrintf.h - Crappy cheapo knockoff printf-like routines
    00003   Copyright (C) 2009 The Regents of the University of New Mexico
    00004
    00005   This library is free software; you can redistribute it and/or
    00006   modify it under the terms of the GNU Lesser General Public
    00007   License as published by the Free Software Foundation; either
    00008   version 2.1 of the License, or (at your option) any later version.
    00009
    00010   This library is distributed in the hope that it will be useful,
    00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013   Lesser General Public License for more details.
    00014
    00015   You should have received a copy of the GNU General Public License
    00016   along with this library; if not, write to the Free Software
    00017   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
    00018   USA
    00019
    00020   $Id$
    00021  */
    00022
    00029 #ifndef SFBPRINTF_H
    00030 #define SFBPRINTF_H
    00031
    00032 #include "SFBTypes.h"
    00033 #include <stdarg.h>
    00034
    00035 enum LoggingLevels {
    00036   LOGLEVEL_NONE,
    00037   LOGLEVEL_QUIET,
    00038   LOGLEVEL_NORMAL,
    00039   LOGLEVEL_VERBOSE,
    00040   LOGLEVEL_DEBUG
    00041 };
    00049 extern void setLogLevel(int n) ;
    00050
    00054 extern int getLogLevel() ;
    00055
    00059 extern void setLogFace(u8 face) ;
    00060
    00064 extern u8 getLogFace() ;
    00065
    00070 extern void pprintf(const char * format, ...) ;
    00071
    00072 extern void facePrintf(u8 face, const char * format, ...) ;
    00073 extern void vfacePrintf(u8 face, const char * format, va_list & ap) ;
    00074
    00117 extern u32 packetScanf(u8 * packet, const char * format, ...) ;
    00118
    00119 extern u32 vPacketScanf(u8 * packet, const char * format, va_list & ap) ;
    00120
    00121 extern void vfaceLogf(int includeTimestamp, int level, u8 face, const char * format, va_list & ap) ;
    00122
    00123 /* The 'log*' functions output a timestamp first */
    00124 extern void logf(int level, const char * format, ...) ;
    00125
    00130 extern void logNormal(const char * format, ...) ;
    00131
    00136 extern void logVerbose(const char * format, ...) ;
    00137
    00142 extern void logDebug(const char * format, ...) ;
    00143
    00148 extern void logQuiet(const char * format, ...) ;
    00149
    00150 /* The 'msg*' functions print only what you say */
    00151 extern void msgf(int level, const char * format, ...) ;
    00152
    00157 extern void msgNormal(const char * format, ...) ;
    00162 extern void msgVerbose(const char * format, ...) ;
    00167 extern void msgDebug(const char * format, ...) ;
    00172 extern void msgQuiet(const char * format, ...) ;
    00173
    00200 typedef void (*CustomPrintfHandler)(u8 face, void * arg, bool alt, int width, bool zerofill);
    00201
    00228 typedef bool (*CustomPacketScanfHandler)(u8 * packet, void * arg, bool alt, int width);
    00229
    00230 #endif /* SFBPRINTF_H */