[Teleus-cvs] teleus/src/util debugrecord.cpp,NONE,1.1 debugrecord.hpp,NONE,1.1 system.cpp,NONE,1.1 s
Status: Inactive
Brought to you by:
spiffgq
|
From: Daniel R. <sp...@us...> - 2004-05-25 23:12:43
|
Update of /cvsroot/teleus/teleus/src/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18170/src/util Added Files: debugrecord.cpp debugrecord.hpp system.cpp system.hpp Log Message: I can't believe I didn't add these classes to CVS yet. They aren't really useful, but they are needed by teleus.pro for compliation. Oops. --- NEW FILE: debugrecord.cpp --- /* * Teleus Space Combat Simulator * Copyright 2004 Daniel Royer * sp...@us... * http://teleus.sf.net * * This package is free software; you can redistribute it and/or * modify it under the terms of the Teleus Artistic License as * detailed on the Teleus website. * * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE. * * A copy of the Teleus Artistic License is provided along with * this source code package. You can also find a copy at or * http://teleus.sf.net/license.php * */ /* * $Revision: 1.1 $ * $Date: 2004/05/25 23:12:33 $ */ #include <cstdarg> #include "debugrecord.hpp" #include "debug.hpp" #define DEBUG_ON 0 namespace debugrecord { FILE *dbfptr; void keyDown (SDLKey sym){ #if DEBUG_ON fprintf (dbfptr, "Key down: %s\n", SDL_GetKeyName(sym)); #endif } void keyUp (SDLKey sym){ #if DEBUG_ON fprintf (dbfptr, "Key up: %s\n", SDL_GetKeyName(sym)); #endif } void printScalarFunc (const char* name, double val) { #if DEBUG_ON fprintf (dbfptr, "%s:\t %f\n", name, val); #endif } void printVecFunc (const char* name, const teleus::math::Vector3d& val) { #if DEBUG_ON fprintf (dbfptr, "%s:\t <%f, %f, %f> (Len = %f)\n", name, val.x, val.y, val.z, val.length()); #endif } void printQuatFunc (const char* name, const teleus::math::Vector4d& val) { #if DEBUG_ON fprintf (dbfptr, "%s:\t <%f, %f, %f, %f> (Len = %f)\n", name, val.w, val.x, val.y, val.z, val.length()); #endif } void printMatrixFunc (const char* name, const teleus::math::Matrix3d& val) { #if DEBUG_ON fprintf (dbfptr, "%s: (det = %f)\n" "\t[%f, %f, %f]\n" "\t[%f, %f, %f]\n" "\t[%f, %f, %f]\n", name, val.det(), val.f11, val.f12, val.f13, val.f21, val.f22, val.f23, val.f31, val.f32, val.f33); #endif } void printf (const char *fmt, ...) { #if DEBUG_ON assert (dbfptr, "Unable to write; file's not open"); va_list ap; if (fmt == NULL) return; va_start (ap, fmt); vfprintf (dbfptr, fmt, ap); va_end (ap); #endif } void initDebugRecord () { #if DEBUG_ON dbfptr = fopen ("debug_record.txt", "w+"); assert (dbfptr, "Unable to open debug_record.txt for writing"); #endif } void shutdownDebugRecord () { #if DEBUG_ON fclose (dbfptr); #endif } } // END NAMESPACE debugrecord --- NEW FILE: debugrecord.hpp --- /* * Teleus Space Combat Simulator * Copyright 2004 Daniel Royer * sp...@us... * http://teleus.sf.net * * This package is free software; you can redistribute it and/or * modify it under the terms of the Teleus Artistic License as * detailed on the Teleus website. * * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE. * * A copy of the Teleus Artistic License is provided along with * this source code package. You can also find a copy at or * http://teleus.sf.net/license.php * */ /* * $Revision: 1.1 $ * $Date: 2004/05/25 23:12:33 $ */ #ifndef TELEUS_DEBUG_RECORD_HEADER #define TELEUS_DEBUG_RECORD_HEADER 1 #include "math/vector.hpp" #include "math/matrix.hpp" #include <cstdio> #include <SDL/SDL.h> namespace debugrecord { void keyDown (SDLKey); void keyUp (SDLKey); void printScalarFunc (const char*, double); void printVecFunc (const char*, const teleus::math::Vector3d&); void printQuatFunc (const char*, const teleus::math::Vector4d&); void printMatrixFunc (const char*, const teleus::math::Matrix3d&); void printf (const char *fmt, ...); void initDebugRecord (); void shutdownDebugRecord (); extern FILE *dbfptr; } // END NAMESPACE debugrecord #if 0 #define printScalar(a) debugrecord::printScalarFunc(#a, a) #define printVec(a) debugrecord::printVecFunc(#a, a) #define printQuat(a) debugrecord::printQuatFunc(#a, a) #define printMatrix(a) debugrecord::printMatrixFunc(#a, a) #else #define printScalar(a) #define printVec(a) #define printQuat(a) #define printMatrix(a) #endif #endif --- NEW FILE: system.cpp --- /* * Teleus Space Combat Simulator * Copyright 2004 Daniel Royer * sp...@us... * http://teleus.sf.net * * This package is free software; you can redistribute it and/or * modify it under the terms of the Teleus Artistic License as * detailed on the Teleus website. * * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE. * * A copy of the Teleus Artistic License is provided along with * this source code package. You can also find a copy at or * http://teleus.sf.net/license.php * */ /* * $Revision: 1.1 $ * $Date: 2004/05/25 23:12:33 $ */ #include "system.hpp" namespace teleus { namespace util { } // END NAMESPACE util } // END NAMESPACE teleus --- NEW FILE: system.hpp --- /* * Teleus Space Combat Simulator * Copyright 2004 Daniel Royer * sp...@us... * http://teleus.sf.net * * This package is free software; you can redistribute it and/or * modify it under the terms of the Teleus Artistic License as * detailed on the Teleus website. * * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE. * * A copy of the Teleus Artistic License is provided along with * this source code package. You can also find a copy at or * http://teleus.sf.net/license.php * */ /* * $Revision: 1.1 $ * $Date: 2004/05/25 23:12:33 $ */ #ifndef TELEUS_SYSTEM_HEADER #define TELEUS_SYSTEM_HEADER namespace teleus { namespace util { extern const int WORD_SIZE; extern const int SIZE_CHAR_BITS; extern const int MIN_SIGNED_CHAR; extern const int MAX_SIGNED_CHAR; extern const int MAX_UNSIGNED_CHAR; extern const int MIN_SIGNED_SHORT; extern const int MAX_SIGNED_SHORT; extern const int MAX_UNSIGNED_SHORT; extern const int MIN_SIGNED_INT; extern const int MAX_SIGNED_INT; extern const int MAX_UNSIGNED_INT; extern const bool BYTE_ORDER_HOST; extern const bool BYTE_ORDER_NETWORK; extern const bool BYTE_ORDER_LITTLE_ENDIAN; extern const bool BYTE_ORDER_BIG_ENDIAN; } // END NAMESPACE util } // END NAMESPACE teleus #endif |