fg_traits.hxx -> sg_traits.hxx

fg_zlib.hxx -> sg_zlib.hxx
This commit is contained in:
curt
2001-03-24 13:12:26 +00:00
parent 124629e1d9
commit 65fa6f2f00
8 changed files with 142 additions and 102 deletions

View File

@@ -22,7 +22,7 @@ METAR_DIRS = metar
EXTRA_DIST = version.h.in
include_HEADERS = \
compiler.h constants.h fg_traits.hxx fg_zlib.h inlines.h version.h
compiler.h constants.h inlines.h sg_traits.hxx sg_zlib.h version.h
SUBDIRS = \
bucket \

View File

@@ -42,7 +42,7 @@
# include <iostream>
#else
# include <iostream.h>
# include <simgear/fg_traits.hxx>
# include <simgear/sg_traits.hxx>
#endif
#include <simgear/debug/debug_types.h>
@@ -92,13 +92,24 @@ public:
/** Is logging enabled? */
bool enabled() { return logging_enabled; }
/** Set the logging level of subsequent messages. */
/**
* Set the logging level of subsequent messages.
* @param c debug class
* @param p priority
*/
void set_log_state( sgDebugClass c, sgDebugPriority p );
/** Set the global logging level. */
/**
* Set the global logging level.
* @param c debug class
* @param p priority
*/
static void set_log_level( sgDebugClass c, sgDebugPriority p );
/** Set the stream buffer */
/**
* Set the stream buffer
* @param sb stream buffer
*/
void set_sb( streambuf* sb );
protected:
@@ -181,19 +192,32 @@ struct logstream_base
class logstream : private logstream_base, public ostream
{
public:
/** The default is to send messages to cerr. */
/**
* The default is to send messages to cerr.
* @param out output stream
*/
logstream( ostream& out )
// : logstream_base(out.rdbuf()),
: logstream_base(),
ostream(&lbuf) { lbuf.set_sb(out.rdbuf());}
/** Set the output stream */
/**
* Set the output stream
* @param out output stream
*/
void set_output( ostream& out ) { lbuf.set_sb( out.rdbuf() ); }
/** Set the global log class and priority level. */
/**
* Set the global log class and priority level.
* @param c debug class
* @param p priority
*/
void setLogLevels( sgDebugClass c, sgDebugPriority p );
/** Output operator to capture the debug level and priority of a message. */
/**
* Output operator to capture the debug level and priority of a message.
* @param l log level
*/
inline ostream& operator<< ( const loglevel& l );
};
@@ -219,7 +243,10 @@ sglog()
/** \def SG_LOG(C,P,M)
* Log a message = M of class = C and priority = P
* Log a message.
* @param C debug class
* @param P priority
* @param M message
*/
#ifdef FG_NDEBUG
# define SG_LOG(C,P,M)

View File

@@ -50,6 +50,9 @@
/** Ephemeris class
*
* Written by Durk Talsma <d.talsma@direct.a2000.nl> and Curtis Olson
* <curt@flightgear.org>
*
* Introduction
*

View File

@@ -1,87 +0,0 @@
/**************************************************************************
* fg_zlib.h -- a zlib wrapper to replace zlib calls with normal uncompressed
* calls for systems that have problems building zlib.
*
* Written by Curtis Olson, started April 1998.
*
* Copyright (C) 1998 Curtis L. Olson - curt@me.umn.edu
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* $Id$
**************************************************************************/
#ifndef _FG_ZLIB_H
#define _FG_ZLIB_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef AVOID_USING_ZLIB
#include <stdio.h>
#define fgFile FILE *
/* fgFile fgopen(char *filename, const char *flags) */
#define fgopen(P, F) (fopen((P), (F)))
/* int fgseek(fgFile *file, long offset, int whence) */
#define fgseek(F, O, W) (fseek((F), (O), (W)))
/* fgread(fgFile file, void *buf, int size); */
#define fgread(F, B, S) (fread((B), (S), 1, (F)))
/* int fggets(fgFile fd, char *buffer, int len) */
#define fggets(F, B, L) (fgets((B), (L), (F)))
/* int fgclose(fgFile fd) */
#define fgclose(F) (fclose((F)))
#else
#ifdef HAVE_ZLIB
#include <zlib.h>
#else
#include <simgear/zlib/zlib.h>
#endif
#define fgFile gzFile
/* fgFile fgopen(char *filename, const char *flags) */
#define fgopen(P, F) (gzopen((P), (F)))
/* int fgseek(fgFile *file, long offset, int whence) */
#define fgseek(F, O, W) (gzseek((F), (O), (W)))
/* fgread(fgFile file, void *buf, int size); */
#define fgread(F, B, S) (gzread((F), (B), (S)))
/* int fggets(fgFile fd, char *buffer, int len) */
#define fggets(F, B, L) (gzgets((F), (B), (L)))
/* int fgclose(fgFile fd) */
#define fgclose(F) (gzclose((F)))
#endif /* #ifdef AVOID_USING_ZLIB #else #endif */
#endif /* _FG_ZLIB_H */

View File

@@ -30,7 +30,7 @@
#include STL_STRING
#include <simgear/fg_zlib.h>
// depricated - #include <simgear/sg_zlib.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/fgstream.hxx>

View File

@@ -92,7 +92,7 @@ SG_USING_STD(streamoff);
# define ios_badbit ios::badbit
# define ios_failbit ios::failbit
# include <simgear/fg_traits.hxx>
# include <simgear/sg_traits.hxx>
#endif // SG_HAVE_STD_INCLUDES

View File

@@ -1,5 +1,10 @@
#ifndef _FG_TRAITS_HXX
#define _FG_TRAITS_HXX
/** \file sg_traits.hxx
* Provides a char_traits declaration for systems without it.
* \internal
*/
#ifndef _SG_TRAITS_HXX
#define _SG_TRAITS_HXX
#include <simgear/compiler.h>
@@ -20,4 +25,4 @@ struct char_traits<char>
};
#endif // SG_HAVE_TRAITS
#endif // _FG_TRAITS_HXX
#endif // _SG_TRAITS_HXX

92
simgear/sg_zlib.h Normal file
View File

@@ -0,0 +1,92 @@
/**
* \file sg_zlib.h
* A file IO wrapper system that can select at compile time if the system
* should use zlib calls or normal uncompressed calls for systems that have
* problems building zlib.
* Define AVOID_USING_ZLIB to use standard uncompressed calls.
*/
/*
* Written by Curtis Olson, started April 1998.
*
* Copyright (C) 1998 Curtis L. Olson - curt@me.umn.edu
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* $Id$
**************************************************************************/
#ifndef _SG_ZLIB_H
#define _SG_ZLIB_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef AVOID_USING_ZLIB
#include <stdio.h>
#define sgFile FILE *
/* sgFile sgopen(char *filename, const char *flags) */
#define sgopen(P, F) (fopen((P), (F)))
/* int sgseek(sgFile *file, long offset, int whence) */
#define sgseek(F, O, W) (fseek((F), (O), (W)))
/* sgread(sgFile file, void *buf, int size); */
#define sgread(F, B, S) (fread((B), (S), 1, (F)))
/* int sggets(sgFile fd, char *buffer, int len) */
#define sggets(F, B, L) (sgets((B), (L), (F)))
/* int sgclose(sgFile fd) */
#define sgclose(F) (fclose((F)))
#else
#ifdef HAVE_ZLIB
#include <zlib.h>
#else
#include <simgear/zlib/zlib.h>
#endif
#define sgFile gzFile
/* sgFile sgopen(char *filename, const char *flags) */
#define sgopen(P, F) (gzopen((P), (F)))
/* int sgseek(sgFile *file, long offset, int whence) */
#define sgseek(F, O, W) (gzseek((F), (O), (W)))
/* sgread(sgFile file, void *buf, int size); */
#define sgread(F, B, S) (gzread((F), (B), (S)))
/* int sggets(sgFile fd, char *buffer, int len) */
#define sggets(F, B, L) (gzgets((F), (B), (L)))
/* int sgclose(sgFile fd) */
#define sgclose(F) (gzclose((F)))
#endif /* #ifdef AVOID_USING_ZLIB #else #endif */
#endif /* _SG_ZLIB_H */