define macros for print levels and avoid direct use of fmt::printf

pull/3/head
Li Linfeng 2019-08-29 10:29:36 +08:00
parent 56d2b8765a
commit 9c371c891c
45 changed files with 159 additions and 151 deletions

View File

@ -620,18 +620,18 @@ M3DScene* Read3DSFile(ifstream& in)
unsigned short chunkType = readUshort(in);
if (chunkType != M3DCHUNK_MAGIC)
{
DPRINTF(0, "Read3DSFile: Wrong magic number in header\n");
DPRINTF(LOG_LEVEL_ERROR, "Read3DSFile: Wrong magic number in header\n");
return nullptr;
}
int32_t chunkSize = readInt(in);
if (in.bad())
{
DPRINTF(0, "Read3DSFile: Error reading 3DS file.\n");
DPRINTF(LOG_LEVEL_ERROR, "Read3DSFile: Error reading 3DS file.\n");
return nullptr;
}
DPRINTF(1, "3DS file, %d bytes\n", chunkSize);
DPRINTF(LOG_LEVEL_INFO, "3DS file, %d bytes\n", chunkSize);
auto* scene = new M3DScene();
int contentSize = chunkSize - 6;
@ -647,7 +647,7 @@ M3DScene* Read3DSFile(const fs::path& filename)
ifstream in(filename.string(), ios::in | ios::binary);
if (!in.good())
{
DPRINTF(0, "Read3DSFile: Error opening %s\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "Read3DSFile: Error opening %s\n", filename);
return nullptr;
}

View File

@ -217,7 +217,7 @@ AsterismList* ReadAsterismList(istream& in, const StarDatabase& stardb)
{
if (tokenizer.getTokenType() != Tokenizer::TokenString)
{
DPRINTF(0, "Error parsing asterism file.\n");
DPRINTF(LOG_LEVEL_ERROR, "Error parsing asterism file.\n");
for_each(asterisms->begin(), asterisms->end(), deleteFunc<Asterism*>());
delete asterisms;
return nullptr;
@ -229,7 +229,7 @@ AsterismList* ReadAsterismList(istream& in, const StarDatabase& stardb)
Value* chainsValue = parser.readValue();
if (chainsValue == nullptr || chainsValue->getType() != Value::ArrayType)
{
DPRINTF(0, "Error parsing asterism %s\n", name.c_str());
DPRINTF(LOG_LEVEL_ERROR, "Error parsing asterism %s\n", name.c_str());
for_each(asterisms->begin(), asterisms->end(), deleteFunc<Asterism*>());
delete ast;
delete asterisms;
@ -258,7 +258,7 @@ AsterismList* ReadAsterismList(istream& in, const StarDatabase& stardb)
star = stardb.find(ReplaceGreekLetterAbbr(i->getString()));
if (star != nullptr)
new_chain->push_back(star->getPosition());
else DPRINTF(0, "Error loading star \"%s\" for asterism \"%s\".\n", name.c_str(), i->getString().c_str());
else DPRINTF(LOG_LEVEL_ERROR, "Error loading star \"%s\" for asterism \"%s\".\n", name.c_str(), i->getString().c_str());
}
}

View File

@ -93,19 +93,19 @@ bool UserCategory::hasChild(const std::string &n) const
void UserCategory::cleanup()
{
DPRINTF(1, "UserCategory::cleanup()\n");
DPRINTF(1, " Objects: %i\n", m_objlist.size());
DPRINTF(1, " Categories: %i\n", m_catlist.size());
DPRINTF(LOG_LEVEL_INFO, "UserCategory::cleanup()\n");
DPRINTF(LOG_LEVEL_INFO, " Objects: %i\n", m_objlist.size());
DPRINTF(LOG_LEVEL_INFO, " Categories: %i\n", m_catlist.size());
while(!m_objlist.empty())
{
auto it = m_objlist.begin();
DPRINTF(1, "Removing object: %s\n", it->getName());
DPRINTF(LOG_LEVEL_INFO, "Removing object: %s\n", it->getName());
removeObject(*it);
}
while(!m_catlist.empty())
{
auto it = m_catlist.begin();
DPRINTF(1, "Removing category: %s\n", (*it)->name());
DPRINTF(LOG_LEVEL_INFO, "Removing category: %s\n", (*it)->name());
deleteChild(*it);
}
}
@ -135,7 +135,7 @@ UserCategory *UserCategory::find(const std::string &s)
{
if (m_allcats.count(s) == 0)
return nullptr;
DPRINTF(1, "UserCategory::find(%s): exists\n", s.c_str());
DPRINTF(LOG_LEVEL_INFO, "UserCategory::find(%s): exists\n", s.c_str());
return m_allcats.find(s)->second;
}

View File

@ -88,7 +88,7 @@ Image* LoadDDSImage(const fs::path& filename)
ifstream in(filename.string(), ios::in | ios::binary);
if (!in.good())
{
DPRINTF(0, "Error opening DDS texture file %s.\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "Error opening DDS texture file %s.\n", filename);
return nullptr;
}
@ -97,7 +97,7 @@ Image* LoadDDSImage(const fs::path& filename)
if (header[0] != 'D' || header[1] != 'D' ||
header[2] != 'S' || header[3] != ' ')
{
DPRINTF(0, "DDS texture file %s has bad header.\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "DDS texture file %s has bad header.\n", filename);
return nullptr;
}
@ -176,7 +176,7 @@ Image* LoadDDSImage(const fs::path& filename)
if (format == -1)
{
DPRINTF(0, "Unsupported format for DDS texture file %s.\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "Unsupported format for DDS texture file %s.\n", filename);
return nullptr;
}
@ -200,7 +200,7 @@ Image* LoadDDSImage(const fs::path& filename)
in.read(reinterpret_cast<char*>(img->getPixels()), img->getSize());
if (!in.eof() && !in.good())
{
DPRINTF(0, "Failed reading data from DDS texture file %s.\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "Failed reading data from DDS texture file %s.\n", filename);
delete img;
return nullptr;
}

View File

@ -14,7 +14,7 @@
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <fmt/printf.h>
#include <celutil/debug.h>
#include <celmath/mathlib.h>
#include <celutil/util.h>
#include <celutil/bytes.h>
@ -231,7 +231,7 @@ bool DSODatabase::load(istream& in, const fs::path& resourcePath)
if (tokenizer.getTokenType() != Tokenizer::TokenName)
{
DPRINTF(0, "Error parsing deep sky catalog file.\n");
DPRINTF(LOG_LEVEL_ERROR, "Error parsing deep sky catalog file.\n");
return false;
}
objType = tokenizer.getNameValue();
@ -252,7 +252,7 @@ bool DSODatabase::load(istream& in, const fs::path& resourcePath)
if (tokenizer.nextToken() != Tokenizer::TokenString)
{
DPRINTF(0, "Error parsing deep sky catalog file: bad name.\n");
DPRINTF(LOG_LEVEL_ERROR, "Error parsing deep sky catalog file: bad name.\n");
return false;
}
objName = tokenizer.getStringValue();
@ -261,7 +261,7 @@ bool DSODatabase::load(istream& in, const fs::path& resourcePath)
if (objParamsValue == nullptr ||
objParamsValue->getType() != Value::HashType)
{
DPRINTF(0, "Error parsing deep sky catalog entry %s\n", objName.c_str());
DPRINTF(LOG_LEVEL_ERROR, "Error parsing deep sky catalog entry %s\n", objName.c_str());
return false;
}
@ -339,7 +339,7 @@ bool DSODatabase::load(istream& in, const fs::path& resourcePath)
}
else
{
DPRINTF(1, "Bad Deep Sky Object definition--will continue parsing file.\n");
DPRINTF(LOG_LEVEL_WARNING, "Bad Deep Sky Object definition--will continue parsing file.\n");
delete objParamsValue;
return false;
}
@ -374,7 +374,7 @@ void DSODatabase::finish()
void DSODatabase::buildOctree()
{
DPRINTF(1, "Sorting DSOs into octree . . .\n");
DPRINTF(LOG_LEVEL_INFO, "Sorting DSOs into octree . . .\n");
float absMag = astro::appToAbsMag(DSO_OCTREE_MAGNITUDE, DSO_OCTREE_ROOT_SIZE * (float) sqrt(3.0));
// TODO: investigate using a different center--it's possible that more
@ -386,7 +386,7 @@ void DSODatabase::buildOctree()
root->insertObject(DSOs[i], DSO_OCTREE_ROOT_SIZE);
}
DPRINTF(1, "Spatially sorting DSOs for improved locality of reference . . .\n");
DPRINTF(LOG_LEVEL_INFO, "Spatially sorting DSOs for improved locality of reference . . .\n");
DeepSkyObject** sortedDSOs = new DeepSkyObject*[nDSOs];
DeepSkyObject** firstDSO = sortedDSOs;
@ -394,8 +394,8 @@ void DSODatabase::buildOctree()
// are storing pointers to objects and not the objects themselves:
root->rebuildAndSort(octreeRoot, firstDSO);
DPRINTF(1, "%d DSOs total\n", (int) (firstDSO - sortedDSOs));
DPRINTF(1, "Octree has %d nodes and %d DSOs.\n",
DPRINTF(LOG_LEVEL_INFO, "%d DSOs total\n", (int) (firstDSO - sortedDSOs));
DPRINTF(LOG_LEVEL_INFO, "Octree has %d nodes and %d DSOs.\n",
1 + octreeRoot->countChildren(), octreeRoot->countObjects());
//cout<<"DSOs: "<< octreeRoot->countObjects()<<" Nodes:"
// <<octreeRoot->countChildren() <<endl;
@ -431,7 +431,7 @@ void DSODatabase::buildIndexes()
// This should only be called once for the database
// assert(catalogNumberIndexes[0] == nullptr);
DPRINTF(1, "Building catalog number indexes . . .\n");
DPRINTF(LOG_LEVEL_INFO, "Building catalog number indexes . . .\n");
catalogNumberIndex = new DeepSkyObject*[nDSOs];
for (int i = 0; i < nDSOs; ++i)

View File

@ -23,7 +23,7 @@
#include <cstring>
#include <fstream>
#include <algorithm>
#include <fmt/printf.h>
#include <celutil/debug.h>
#include <cassert>
using namespace Eigen;

View File

@ -22,7 +22,7 @@
#include <fstream>
#include <algorithm>
#include <cassert>
#include <fmt/printf.h>
#include <celutil/debug.h>
using namespace Eigen;
using namespace std;

View File

@ -25,7 +25,7 @@ extern "C" {
#include <celutil/util.h>
#include <celutil/filetype.h>
#include <GL/glew.h>
#include <fmt/printf.h>
#include <celutil/debug.h>
#include "image.h"
@ -331,7 +331,7 @@ Image* LoadImageFromFile(const fs::path& filename)
img = LoadDDSImage(filename);
break;
default:
fmt::printf(_("%s: unrecognized or unsupported image file type.\n"), filename.string());
DPRINTF(LOG_LEVEL_ERROR, "%s: unrecognized or unsupported image file type.\n", filename.string());
break;
}

View File

@ -35,7 +35,7 @@
#include <fstream>
#include <cassert>
#include <utility>
#include <fmt/printf.h>
#include <celutil/debug.h>
#include <memory>
@ -246,7 +246,7 @@ Model* LoadCelestiaMesh(const fs::path& filename)
ifstream meshFile(filename.string(), ios::in);
if (!meshFile.good())
{
DPRINTF(0, "Error opening mesh file: %s\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "Error opening mesh file: %s\n", filename);
return nullptr;
}
@ -255,13 +255,13 @@ Model* LoadCelestiaMesh(const fs::path& filename)
if (tokenizer.nextToken() != Tokenizer::TokenName)
{
DPRINTF(0, "Mesh file %s is invalid.\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "Mesh file %s is invalid.\n", filename);
return nullptr;
}
if (tokenizer.getStringValue() != "SphereDisplacementMesh")
{
DPRINTF(0, "%s: Unrecognized mesh type %s.\n",
DPRINTF(LOG_LEVEL_ERROR, "%s: Unrecognized mesh type %s.\n",
filename, tokenizer.getStringValue());
return nullptr;
}
@ -269,13 +269,13 @@ Model* LoadCelestiaMesh(const fs::path& filename)
Value* meshDefValue = parser.readValue();
if (meshDefValue == nullptr)
{
DPRINTF(0, "%s: Bad mesh file.\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "%s: Bad mesh file.\n", filename);
return nullptr;
}
if (meshDefValue->getType() != Value::HashType)
{
DPRINTF(0, "%s: Bad mesh file.\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "%s: Bad mesh file.\n", filename);
delete meshDefValue;
return nullptr;
}

View File

@ -13,7 +13,7 @@ void NameDatabase::add(const uint32_t catalogNumber, const std::string& name, bo
#ifdef DEBUG
uint32_t tmp;
if ((tmp = getCatalogNumberByName(name)) != InvalidCatalogNumber)
DPRINTF(2,"Duplicated name '%s' on object with catalog numbers: %d and %d\n", name.c_str(), tmp, catalogNumber);
DPRINTF(LOG_LEVEL_INFO,"Duplicated name '%s' on object with catalog numbers: %d and %d\n", name.c_str(), tmp, catalogNumber);
#endif
// Add the new name
//nameIndex.insert(NameIndex::value_type(name, catalogNumber));

View File

@ -12,7 +12,7 @@
#include <celutil/utf8.h>
#include <GL/glew.h>
#include <Eigen/Core>
#include <fmt/printf.h>
#include <celutil/debug.h>
#include "vecgl.h"
#include "overlay.h"
#include "render.h"

View File

@ -254,7 +254,7 @@ CreateSampledTrajectory(Hash* trajData, const fs::path& path)
trajData->getBoolean("DoublePrecision", useDoublePrecision);
TrajectoryPrecision precision = useDoublePrecision ? TrajectoryPrecisionDouble : TrajectoryPrecisionSingle;
DPRINTF(1, "Attempting to load sampled trajectory from source '%s'\n", sourceName.c_str());
DPRINTF(LOG_LEVEL_INFO, "Attempting to load sampled trajectory from source '%s'\n", sourceName.c_str());
ResourceHandle orbitHandle = GetTrajectoryManager()->getHandle(TrajectoryInfo(sourceName, path, interpolation, precision));
Orbit* orbit = GetTrajectoryManager()->find(orbitHandle);
if (orbit == nullptr)
@ -704,7 +704,7 @@ CreateOrbit(const Selection& centralObject,
return orbit;
}
clog << "Bad spice orbit\n";
DPRINTF(0, "Could not load SPICE orbit\n");
DPRINTF(LOG_LEVEL_ERROR, "Could not load SPICE orbit\n");
}
}
#endif
@ -743,7 +743,7 @@ CreateOrbit(const Selection& centralObject,
string sampOrbitFile;
if (planetData->getString("SampledOrbit", sampOrbitFile))
{
DPRINTF(1, "Attempting to load sampled orbit file '%s'\n",
DPRINTF(LOG_LEVEL_INFO, "Attempting to load sampled orbit file '%s'\n",
sampOrbitFile.c_str());
ResourceHandle orbitHandle =
GetTrajectoryManager()->getHandle(TrajectoryInfo(sampOrbitFile,
@ -1089,7 +1089,7 @@ CreateRotationModel(Hash* planetData,
return rotationModel;
}
clog << "Bad spice rotation model\n";
DPRINTF(0, "Could not load SPICE rotation model\n");
DPRINTF(LOG_LEVEL_ERROR, "Could not load SPICE rotation model\n");
}
}
#endif
@ -1112,7 +1112,7 @@ CreateRotationModel(Hash* planetData,
string sampOrientationFile;
if (planetData->getString("SampledOrientation", sampOrientationFile))
{
DPRINTF(1, "Attempting to load orientation file '%s'\n",
DPRINTF(LOG_LEVEL_INFO, "Attempting to load orientation file '%s'\n",
sampOrientationFile.c_str());
ResourceHandle orientationHandle =
GetRotationModelManager()->getHandle(RotationModelInfo(sampOrientationFile, path));
@ -1406,14 +1406,14 @@ getAxis(Hash* vectorData)
string axisLabel;
if (!vectorData->getString("Axis", axisLabel))
{
DPRINTF(0, "Bad two-vector frame: missing axis label for vector.\n");
DPRINTF(LOG_LEVEL_ERROR, "Bad two-vector frame: missing axis label for vector.\n");
return 0;
}
int axis = parseAxisLabel(axisLabel);
if (axis == 0)
{
DPRINTF(0, "Bad two-vector frame: vector has invalid axis label.\n");
DPRINTF(LOG_LEVEL_ERROR, "Bad two-vector frame: vector has invalid axis label.\n");
}
// Permute axis labels to match non-standard Celestia coordinate

View File

@ -18,7 +18,7 @@
#include <Eigen/Core>
#include <Eigen/Geometry>
#include <cmath>
#include <fmt/printf.h>
#include <celutil/debug.h>
using namespace Eigen;
using namespace celmath;

View File

@ -44,7 +44,7 @@ fs::path RotationModelInfo::resolve(const fs::path& baseDir)
RotationModel* RotationModelInfo::load(const fs::path& filename)
{
DPRINTF(1, "Loading rotation model: %s\n", filename);
DPRINTF(LOG_LEVEL_INFO, "Loading rotation model: %s\n", filename);
return LoadSampledOrientation(filename);
}

View File

@ -8,7 +8,7 @@
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
#include <fmt/printf.h>
#include <celutil/debug.h>
#include <cassert>
#include "astro.h"
#include "selection.h"

View File

@ -17,7 +17,7 @@
#include <fstream>
#include <sstream>
#include <iomanip>
#include <fmt/printf.h>
#include <celutil/debug.h>
#include <cassert>
#include <Eigen/Geometry>

View File

@ -16,7 +16,7 @@
#include <celmath/mathlib.h>
#include <celutil/util.h>
#include <limits>
#include <fmt/printf.h>
#include <celutil/debug.h>
#include "astro.h"
#include "parser.h"
#include "texmanager.h"

View File

@ -11,7 +11,7 @@
#include <celmath/mathlib.h>
#include <celengine/selection.h>
#include <cassert>
#include <fmt/printf.h>
#include <celutil/debug.h>
#include <config.h>
#include "astro.h"
#include "star.h"

View File

@ -11,7 +11,7 @@
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <fmt/printf.h>
#include <celutil/debug.h>
#include <cassert>
#include <algorithm>
#include <celmath/mathlib.h>
@ -690,7 +690,7 @@ bool StarDatabase::loadBinary(istream& in)
if (in.bad())
return false;
DPRINTF(0, "StarDatabase::read: nStars = %d\n", nStarsInFile);
DPRINTF(LOG_LEVEL_ERROR, "StarDatabase::read: nStars = %d\n", nStarsInFile);
fmt::fprintf(clog, _("%d stars in binary database\n"), nStars);
// Create the temporary list of stars sorted by catalog number; this
@ -1294,7 +1294,7 @@ bool StarDatabase::load(istream& in, const fs::path& resourcePath)
if (starDataValue->getType() != Value::HashType)
{
DPRINTF(0, "Bad star definition.\n");
DPRINTF(LOG_LEVEL_ERROR, "Bad star definition.\n");
delete starDataValue;
return false;
}
@ -1358,7 +1358,7 @@ bool StarDatabase::load(istream& in, const fs::path& resourcePath)
{
if (isNewStar)
delete star;
DPRINTF(1, "Bad star definition--will continue parsing file.\n");
DPRINTF(LOG_LEVEL_INFO, "Bad star definition--will continue parsing file.\n");
}
}
@ -1371,7 +1371,7 @@ void StarDatabase::buildOctree()
// This should only be called once for the database
// ASSERT(octreeRoot == nullptr);
DPRINTF(1, "Sorting stars into octree . . .\n");
DPRINTF(LOG_LEVEL_INFO, "Sorting stars into octree . . .\n");
float absMag = astro::appToAbsMag(STAR_OCTREE_MAGNITUDE,
STAR_OCTREE_ROOT_SIZE * (float) sqrt(3.0));
DynamicStarOctree* root = new DynamicStarOctree(Vector3f(1000.0f, 1000.0f, 1000.0f),
@ -1381,14 +1381,14 @@ void StarDatabase::buildOctree()
root->insertObject(unsortedStars[i], STAR_OCTREE_ROOT_SIZE);
}
DPRINTF(1, "Spatially sorting stars for improved locality of reference . . .\n");
DPRINTF(LOG_LEVEL_INFO, "Spatially sorting stars for improved locality of reference . . .\n");
Star* sortedStars = new Star[nStars];
Star* firstStar = sortedStars;
root->rebuildAndSort(octreeRoot, firstStar);
// ASSERT((int) (firstStar - sortedStars) == nStars);
DPRINTF(1, "%d stars total\n", (int) (firstStar - sortedStars));
DPRINTF(1, "Octree has %d nodes and %d stars.\n",
DPRINTF(LOG_LEVEL_INFO, "%d stars total\n", (int) (firstStar - sortedStars));
DPRINTF(LOG_LEVEL_INFO, "Octree has %d nodes and %d stars.\n",
1 + octreeRoot->countChildren(), octreeRoot->countObjects());
#ifdef PROFILE_OCTREE
vector<OctreeLevelStatistics> stats;
@ -1420,7 +1420,7 @@ void StarDatabase::buildIndexes()
// This should only be called once for the database
// assert(catalogNumberIndexes[0] == nullptr);
DPRINTF(1, "Building catalog number indexes . . .\n");
DPRINTF(LOG_LEVEL_INFO, "Building catalog number indexes . . .\n");
catalogNumberIndex = new Star*[nStars];
for (int i = 0; i < nStars; ++i)

View File

@ -8,7 +8,7 @@
// of the License, or (at your option) any later version.
#include <cstring>
#include <fmt/printf.h>
#include <celutil/debug.h>
#include <cassert>
#include <config.h>
#include "stellarclass.h"

View File

@ -129,13 +129,13 @@ Texture* TextureInfo::load(const fs::path& name)
if (bumpHeight == 0.0f)
{
DPRINTF(0, "Loading texture: %s\n", name.c_str());
DPRINTF(LOG_LEVEL_ERROR, "Loading texture: %s\n", name.c_str());
// cout << "Loading texture: " << name << '\n';
return LoadTextureFromFile(name, addressMode, mipMode);
}
DPRINTF(0, "Loading bump map: %s\n", name.c_str());
DPRINTF(LOG_LEVEL_ERROR, "Loading bump map: %s\n", name.c_str());
// cout << "Loading texture: " << name << '\n';
return LoadHeightMapFromFile(name, bumpHeight, addressMode);

View File

@ -25,7 +25,7 @@ extern "C" {
#include <celutil/util.h>
#include <Eigen/Core>
#include <GL/glew.h>
#include <fmt/printf.h>
#include <celutil/debug.h>
#include "texture.h"
#include "virtualtex.h"

View File

@ -15,7 +15,7 @@
#include <iostream>
#include <fstream>
#include <cassert>
#include <fmt/printf.h>
#include <celutil/debug.h>
using namespace std;
@ -64,7 +64,7 @@ Orbit* TrajectoryInfo::load(const fs::path& filename)
fs::path strippedFilename = filename.string().substr(0, uniquifyingSuffixStart);
ContentType filetype = DetermineFileType(strippedFilename);
DPRINTF(1, "Loading trajectory: %s\n", strippedFilename);
DPRINTF(LOG_LEVEL_INFO, "Loading trajectory: %s\n", strippedFilename);
Orbit* sampTrajectory = nullptr;

View File

@ -14,7 +14,7 @@
#include <fstream>
#include <string>
#include <utility>
#include <fmt/printf.h>
#include <celutil/debug.h>
#include <GL/glew.h>
#include <celutil/debug.h>
#include <celcompat/filesystem.h>
@ -313,7 +313,7 @@ static VirtualTexture* CreateVirtualTexture(Hash* texParams,
string imageDirectory;
if (!texParams->getString("ImageDirectory", imageDirectory))
{
DPRINTF(0, "ImageDirectory missing in virtual texture.\n");
DPRINTF(LOG_LEVEL_ERROR, "ImageDirectory missing in virtual texture.\n");
return nullptr;
}
@ -321,14 +321,14 @@ static VirtualTexture* CreateVirtualTexture(Hash* texParams,
if (!texParams->getNumber("BaseSplit", baseSplit) ||
baseSplit < 0.0 || baseSplit != floor(baseSplit))
{
DPRINTF(0, "BaseSplit in virtual texture missing or has bad value\n");
DPRINTF(LOG_LEVEL_ERROR, "BaseSplit in virtual texture missing or has bad value\n");
return nullptr;
}
double tileSize = 0.0;
if (!texParams->getNumber("TileSize", tileSize))
{
DPRINTF(0, "TileSize is missing from virtual texture\n");
DPRINTF(LOG_LEVEL_ERROR, "TileSize is missing from virtual texture\n");
return nullptr;
}
@ -336,7 +336,7 @@ static VirtualTexture* CreateVirtualTexture(Hash* texParams,
tileSize < 64.0 ||
!isPow2((int) tileSize))
{
DPRINTF(0, "Virtual texture tile size must be a power of two >= 64\n");
DPRINTF(LOG_LEVEL_ERROR, "Virtual texture tile size must be a power of two >= 64\n");
return nullptr;
}
@ -375,7 +375,7 @@ static VirtualTexture* LoadVirtualTexture(istream& in, const fs::path& path)
Value* texParamsValue = parser.readValue();
if (texParamsValue == nullptr || texParamsValue->getType() != Value::HashType)
{
DPRINTF(0, "Error parsing virtual texture\n");
DPRINTF(LOG_LEVEL_ERROR, "Error parsing virtual texture\n");
delete texParamsValue;
return nullptr;
}
@ -395,7 +395,7 @@ VirtualTexture* LoadVirtualTexture(const fs::path& filename)
if (!in.good())
{
//DPRINTF(0, "Error opening virtual texture file: %s\n", filename.c_str());
//DPRINTF(LOG_LEVEL_ERROR, "Error opening virtual texture file: %s\n", filename.c_str());
return nullptr;
}

View File

@ -16,7 +16,7 @@
#include <cassert>
#include <vector>
#include <fstream>
#include <fmt/printf.h>
#include <celutil/debug.h>
using namespace Eigen;
using namespace std;

View File

@ -297,7 +297,7 @@ double EllipticalOrbit::eccentricAnomaly(double M) const
// much faster converging iteration.
Solution sol = solve_iteration_fixed(SolveKeplerFunc2(eccentricity, M), M, 6);
// Debugging
// fmt::printf("ecc: %f, error: %f mas\n",
// DPRINTF(LOG_LEVEL_INFO, "ecc: %f, error: %f mas\n",
// eccentricity, radToDeg(sol.second) * 3600000);
return sol.first;
}

View File

@ -25,7 +25,7 @@
#include <fstream>
#include <limits>
#include <iomanip>
#include <fmt/printf.h>
#include <celutil/debug.h>
using namespace Eigen;
using namespace std;

View File

@ -9,7 +9,7 @@
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
#include <fmt/printf.h>
#include <celutil/debug.h>
#include "scriptobject.h"

View File

@ -49,7 +49,7 @@
#include <cassert>
#include <ctime>
#include <set>
#include <fmt/printf.h>
#include <celutil/debug.h>
#include <celutil/color.h>
#include <celengine/vecgl.h>
@ -438,8 +438,7 @@ void showSelectionInfo(const Selection& sel)
AngleAxisf aa(orientation);
fmt::printf(_("%s\nOrientation: [%f, %f, %f], %.1f\n"),
sel.getName(), aa.axis().x(), aa.axis().y(), aa.axis().z(), radToDeg(aa.angle()));
DPRINTF(LOG_LEVEL_VERBOSE, "%s\nOrientation: [%f, %f, %f], %.1f\n", sel.getName(), aa.axis().x(), aa.axis().y(), aa.axis().z(), radToDeg(aa.angle()));
}
@ -4006,7 +4005,7 @@ template <class OBJDB> class CatalogLoader
if (catalogFile.good())
{
if (!objDB->load(catalogFile, filepath.parent_path()))
DPRINTF(0, "Error reading %s catalog file: %s\n", typeDesc.c_str(), filepath.string());
DPRINTF(LOG_LEVEL_ERROR, "Error reading %s catalog file: %s\n", typeDesc.c_str(), filepath.string());
}
}
};
@ -4253,7 +4252,7 @@ bool CelestiaCore::initRenderer()
context->init(config->ignoreGLExtensions);
// Choose the render path, starting with the least desirable
context->setRenderPath(GLContext::GLPath_GLSL);
//fmt::printf(_("render path: %i\n"), context->getRenderPath());
//DPRINTF(LOG_LEVEL_VERBOSE, "render path: %i\n", context->getRenderPath());
#endif
Renderer::DetailOptions detailOptions;

View File

@ -21,7 +21,7 @@
#include "execution.h"
#include <celengine/timeline.h>
#include <celengine/timelinephase.h>
#include <fmt/printf.h>
#include <celutil/debug.h>
#include "imagecapture.h"
#include "url.h"

View File

@ -1,5 +1,5 @@
#include <fmt/printf.h>
#include <celutil/debug.h>
#include "celx.h"
#include "celx_internal.h"
#include "celx_category.h"

View File

@ -9,7 +9,7 @@
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
#include <fmt/printf.h>
#include <celutil/debug.h>
#include <celtxf/texturefont.h>
#include <celengine/category.h>
#include <celengine/texture.h>

View File

@ -1,5 +1,5 @@
#include <fmt/printf.h>
#include <celutil/debug.h>
#include "celx_misc.h"
#include "celx_internal.h"
#include "cmdparser.h"

View File

@ -966,7 +966,7 @@ int parseConstellations(CommandConstellations* cmd, string s, int act)
}
else
{
DPRINTF(0, "Command Parser: error parsing render flags\n");
DPRINTF(LOG_LEVEL_ERROR, "Command Parser: error parsing render flags\n");
return 0;
}
}
@ -1006,7 +1006,7 @@ int parseConstellationColor(CommandConstellationColor* cmd, string s, Eigen::Vec
}
else
{
DPRINTF(0, "Command Parser: error parsing render flags\n");
DPRINTF(LOG_LEVEL_ERROR, "Command Parser: error parsing render flags\n");
return 0;
}
}

View File

@ -36,7 +36,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
ifstream configFile(filename.string());
if (!configFile.good())
{
DPRINTF(0, "Error opening config file '%s'.\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "Error opening config file '%s'.\n", filename);
return config;
}
@ -45,14 +45,14 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
if (tokenizer.nextToken() != Tokenizer::TokenName)
{
DPRINTF(0, "%s:%d 'Configuration' expected.\n", filename,
DPRINTF(LOG_LEVEL_ERROR, "%s:%d 'Configuration' expected.\n", filename,
tokenizer.getLineNumber());
return config;
}
if (tokenizer.getStringValue() != "Configuration")
{
DPRINTF(0, "%s:%d 'Configuration' expected.\n", filename,
DPRINTF(LOG_LEVEL_ERROR, "%s:%d 'Configuration' expected.\n", filename,
tokenizer.getLineNumber());
return config;
}
@ -60,7 +60,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
Value* configParamsValue = parser.readValue();
if (configParamsValue == nullptr || configParamsValue->getType() != Value::HashType)
{
DPRINTF(0, "%s: Bad configuration file.\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "%s: Bad configuration file.\n", filename);
return config;
}
@ -132,7 +132,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
{
if (solarSystemsVal->getType() != Value::ArrayType)
{
DPRINTF(0, "%s: SolarSystemCatalogs must be an array.\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "%s: SolarSystemCatalogs must be an array.\n", filename);
}
else
{
@ -148,7 +148,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
}
else
{
DPRINTF(0, "%s: Solar system catalog name must be a string.\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "%s: Solar system catalog name must be a string.\n", filename);
}
}
}
@ -159,7 +159,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
{
if (starCatalogsVal->getType() != Value::ArrayType)
{
DPRINTF(0, "%s: StarCatalogs must be an array.\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "%s: StarCatalogs must be an array.\n", filename);
}
else
{
@ -176,7 +176,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
}
else
{
DPRINTF(0, "%s: Star catalog name must be a string.\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "%s: Star catalog name must be a string.\n", filename);
}
}
}
@ -187,7 +187,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
{
if (dsoCatalogsVal->getType() != Value::ArrayType)
{
DPRINTF(0, "%s: DeepSkyCatalogs must be an array.\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "%s: DeepSkyCatalogs must be an array.\n", filename);
}
else
{
@ -204,7 +204,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
}
else
{
DPRINTF(0, "%s: DeepSky catalog name must be a string.\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "%s: DeepSky catalog name must be a string.\n", filename);
}
}
}
@ -226,7 +226,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
}
else
{
DPRINTF(0, "%s: Extras directory name must be a string.\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "%s: Extras directory name must be a string.\n", filename);
}
}
}
@ -236,7 +236,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
}
else
{
DPRINTF(0, "%s: ExtrasDirectories must be an array or string.\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "%s: ExtrasDirectories must be an array or string.\n", filename);
}
}
@ -245,7 +245,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
{
if (ignoreExtVal->getType() != Value::ArrayType)
{
DPRINTF(0, "%s: IgnoreGLExtensions must be an array.\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "%s: IgnoreGLExtensions must be an array.\n", filename);
}
else
{
@ -259,7 +259,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
}
else
{
DPRINTF(0, "%s: extension name must be a string.\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "%s: extension name must be a string.\n", filename);
}
}
}
@ -270,7 +270,7 @@ CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *con
{
if (starTexValue->getType() != Value::HashType)
{
DPRINTF(0, "%s: StarTextures must be a property list.\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "%s: StarTextures must be a property list.\n", filename);
}
else
{

View File

@ -28,7 +28,7 @@ DestinationList* ReadDestinationList(istream& in)
{
if (tokenizer.getTokenType() != Tokenizer::TokenBeginGroup)
{
DPRINTF(0, "Error parsing destinations file.\n");
DPRINTF(LOG_LEVEL_ERROR, "Error parsing destinations file.\n");
for_each(destinations->begin(), destinations->end(), deleteFunc<Destination*>());
delete destinations;
return nullptr;
@ -38,7 +38,7 @@ DestinationList* ReadDestinationList(istream& in)
Value* destValue = parser.readValue();
if (destValue == nullptr || destValue->getType() != Value::HashType)
{
DPRINTF(0, "Error parsing destination.\n");
DPRINTF(LOG_LEVEL_ERROR, "Error parsing destination.\n");
for_each(destinations->begin(), destinations->end(), deleteFunc<Destination*>());
delete destinations;
if (destValue != nullptr)
@ -51,7 +51,7 @@ DestinationList* ReadDestinationList(istream& in)
if (!destParams->getString("Name", dest->name))
{
DPRINTF(1, "Skipping unnamed destination\n");
DPRINTF(LOG_LEVEL_INFO, "Skipping unnamed destination\n");
delete dest;
}
else

View File

@ -30,7 +30,7 @@ FavoritesList* ReadFavoritesList(istream& in)
{
if (tokenizer.getTokenType() != Tokenizer::TokenString)
{
DPRINTF(0, "Error parsing favorites file.\n");
DPRINTF(LOG_LEVEL_ERROR, "Error parsing favorites file.\n");
for_each(favorites->begin(), favorites->end(), deleteFunc<FavoritesEntry*>());
delete favorites;
return nullptr;
@ -42,7 +42,7 @@ FavoritesList* ReadFavoritesList(istream& in)
Value* favParamsValue = parser.readValue();
if (favParamsValue == nullptr || favParamsValue->getType() != Value::HashType)
{
DPRINTF(0, "Error parsing favorites entry %s\n", fav->name.c_str());
DPRINTF(LOG_LEVEL_ERROR, "Error parsing favorites entry %s\n", fav->name.c_str());
for_each(favorites->begin(), favorites->end(), deleteFunc<FavoritesEntry*>());
delete favorites;
if (favParamsValue != nullptr)

View File

@ -44,7 +44,7 @@ bool CaptureGLBufferToJPEG(const fs::path& filename,
#endif
if (out == nullptr)
{
DPRINTF(0, "Can't open screen capture file '%s'\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "Can't open screen capture file '%s'\n", filename);
delete[] pixels;
return false;
}
@ -116,7 +116,7 @@ bool CaptureGLBufferToPNG(const fs::path& filename,
#endif
if (out == nullptr)
{
DPRINTF(0, "Can't open screen capture file '%s'\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "Can't open screen capture file '%s'\n", filename);
delete[] pixels;
return false;
}
@ -133,7 +133,7 @@ bool CaptureGLBufferToPNG(const fs::path& filename,
if (png_ptr == nullptr)
{
DPRINTF(0, "Screen capture: error allocating png_ptr\n");
DPRINTF(LOG_LEVEL_ERROR, "Screen capture: error allocating png_ptr\n");
fclose(out);
delete[] pixels;
delete[] row_pointers;
@ -143,7 +143,7 @@ bool CaptureGLBufferToPNG(const fs::path& filename,
info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == nullptr)
{
DPRINTF(0, "Screen capture: error allocating info_ptr\n");
DPRINTF(LOG_LEVEL_ERROR, "Screen capture: error allocating info_ptr\n");
fclose(out);
delete[] pixels;
delete[] row_pointers;
@ -153,7 +153,7 @@ bool CaptureGLBufferToPNG(const fs::path& filename,
if (setjmp(png_jmpbuf(png_ptr)))
{
DPRINTF(0, "Error writing PNG file '%s'\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "Error writing PNG file '%s'\n", filename);
fclose(out);
delete[] pixels;
delete[] row_pointers;

View File

@ -69,7 +69,7 @@
#include <celutil/util.h>
#include <GL/glew.h>
#include <string>
#include <fmt/printf.h>
#include <celutil/debug.h>
#include <theora/theora.h>
using namespace std;
@ -160,7 +160,7 @@ bool OggTheoraCapture::start(const std::string& filename,
outfile = fopen(filename.c_str(), "wb");
if (!outfile)
{
DPRINTF(0, _("Error in creating ogg file %s for capture.\n"), filename.c_str());
DPRINTF(LOG_LEVEL_ERROR, _("Error in creating ogg file %s for capture.\n"), filename.c_str());
return false;
}
/* Set up Ogg output stream */
@ -309,13 +309,14 @@ bool OggTheoraCapture::start(const std::string& filename,
yuv.uv_height=video_y/2;
yuv.uv_stride=video_x/2;
fmt::printf(_("OggTheoraCapture::start() - Theora video: %s %.2f(%d/%d) fps quality %d %dx%d offset (%dx%d)\n"),
filename.c_str(),
(double)video_hzn/(double)video_hzd,
video_hzn,video_hzd,
video_q,
video_x,video_y,
frame_x_offset,frame_y_offset);
DPRINTF(LOG_LEVEL_VERBOSE,
_("OggTheoraCapture::start() - Theora video: %s %.2f(%d/%d) fps quality %d %dx%d offset (%dx%d)\n"),
filename.c_str(),
(double)video_hzn/(double)video_hzd,
video_hzn,video_hzd,
video_q,
video_x,video_y,
frame_x_offset,frame_y_offset);
capturing = true;
return true;
@ -409,7 +410,7 @@ bool OggTheoraCapture::captureFrame()
}
video_frame_count += 1;
//if ((video_frame_count % 10) == 0)
// fmt::printf("Writing frame %d\n", video_frame_count);
// DPRINTF(LOG_LEVEL_VERBOSE, "Writing frame %d\n", video_frame_count);
unsigned char *temp = yuvframe[0];
yuvframe[0] = yuvframe[1];
yuvframe[1] = temp;
@ -424,7 +425,7 @@ void OggTheoraCapture::cleanup()
if(outfile)
{
fmt::printf(_("OggTheoraCapture::cleanup() - wrote %d frames\n"), video_frame_count);
DPRINTF(LOG_LEVEL_VERBOSE, _("OggTheoraCapture::cleanup() - wrote %d frames\n"), video_frame_count);
if (video_frame_count > 0)
{
yuv.y= yuvframe[1];

View File

@ -20,7 +20,7 @@
#include <sstream>
#include <iomanip>
#include <utility>
#include <fmt/printf.h>
#include <celutil/debug.h>
#include "celestiacore.h"
#include "celutil/util.h"
#include "celengine/astro.h"

View File

@ -12,7 +12,7 @@
#include <celutil/bytes.h>
#include <cassert>
#include <cmath>
#include <fmt/printf.h>
#include <celutil/debug.h>
using namespace cmod;

View File

@ -222,7 +222,7 @@ bool TextureFont::buildTexture()
glGenTextures(1, (GLuint*) &texName);
if (texName == 0)
{
DPRINTF(0, "Failed to allocate texture object for font.\n");
DPRINTF(LOG_LEVEL_ERROR, "Failed to allocate texture object for font.\n");
return false;
}
@ -258,7 +258,7 @@ void TextureFont::rebuildGlyphLookupTable()
// If there was already a lookup table, delete it.
delete[] glyphLookup;
DPRINTF(1, "texturefont: allocating glyph lookup table with %d entries.\n",
DPRINTF(LOG_LEVEL_INFO, "texturefont: allocating glyph lookup table with %d entries.\n",
maxID + 1);
glyphLookup = new const Glyph*[maxID + 1];
for (int i = 0; i <= maxID; i++)
@ -322,7 +322,7 @@ TextureFont* TextureFont::load(istream& in)
in.read(header, sizeof header);
if (!in.good() || strncmp(header, "\377txf", 4) != 0)
{
DPRINTF(0, "Stream is not a texture font!.\n");
DPRINTF(LOG_LEVEL_ERROR, "Stream is not a texture font!.\n");
return nullptr;
}
@ -330,7 +330,7 @@ TextureFont* TextureFont::load(istream& in)
in.read(reinterpret_cast<char*>(&endiannessTest), sizeof endiannessTest);
if (!in.good())
{
DPRINTF(0, "Error reading endianness bytes in txf header.\n");
DPRINTF(LOG_LEVEL_ERROR, "Error reading endianness bytes in txf header.\n");
return nullptr;
}
@ -341,7 +341,7 @@ TextureFont* TextureFont::load(istream& in)
byteSwap = false;
else
{
DPRINTF(0, "Stream is not a texture font!.\n");
DPRINTF(LOG_LEVEL_ERROR, "Stream is not a texture font!.\n");
return nullptr;
}
@ -354,11 +354,11 @@ TextureFont* TextureFont::load(istream& in)
if (!in)
{
DPRINTF(0, "Texture font stream is incomplete");
DPRINTF(LOG_LEVEL_ERROR, "Texture font stream is incomplete");
return nullptr;
}
DPRINTF(1, "Font contains %d glyphs.\n", nGlyphs);
DPRINTF(LOG_LEVEL_INFO, "Font contains %d glyphs.\n", nGlyphs);
auto* font = new TextureFont();
assert(font != nullptr);
@ -385,7 +385,7 @@ TextureFont* TextureFont::load(istream& in)
if (!in)
{
DPRINTF(0, "Error reading glyph %ud from texture font stream.\n", i);
DPRINTF(LOG_LEVEL_ERROR, "Error reading glyph %ud from texture font stream.\n", i);
delete font;
return nullptr;
}
@ -410,12 +410,12 @@ TextureFont* TextureFont::load(istream& in)
{
auto* fontImage = new unsigned char[texWidth * texHeight];
DPRINTF(1, "Reading %d x %d 8-bit font image.\n", texWidth, texHeight);
DPRINTF(LOG_LEVEL_INFO, "Reading %d x %d 8-bit font image.\n", texWidth, texHeight);
in.read(reinterpret_cast<char*>(fontImage), texWidth * texHeight);
if (in.gcount() != (signed)(texWidth * texHeight))
{
DPRINTF(0, "Missing bitmap data in font stream.\n");
DPRINTF(LOG_LEVEL_ERROR, "Missing bitmap data in font stream.\n");
delete font;
delete[] fontImage;
return nullptr;
@ -429,12 +429,12 @@ TextureFont* TextureFont::load(istream& in)
auto* fontBits = new unsigned char[rowBytes * texHeight];
auto* fontImage = new unsigned char[texWidth * texHeight];
DPRINTF(1, "Reading %d x %d 1-bit font image.\n", texWidth, texHeight);
DPRINTF(LOG_LEVEL_INFO, "Reading %d x %d 1-bit font image.\n", texWidth, texHeight);
in.read(reinterpret_cast<char*>(fontBits), rowBytes * texHeight);
if (in.gcount() != (signed)(rowBytes * texHeight))
{
DPRINTF(0, "Missing bitmap data in font stream.\n");
DPRINTF(LOG_LEVEL_ERROR, "Missing bitmap data in font stream.\n");
delete font;
delete[] fontImage;
delete[] fontBits;
@ -468,7 +468,7 @@ TextureFont* LoadTextureFont(const fs::path& filename)
ifstream in(localeFilename.string(), ios::in | ios::binary);
if (!in.good())
{
DPRINTF(0, "Could not open font file %s\n", filename);
DPRINTF(LOG_LEVEL_ERROR, "Could not open font file %s\n", filename);
return nullptr;
}

View File

@ -13,7 +13,7 @@
// of the License, or (at your option) any later version.
#include <cmath>
#include <fmt/printf.h>
#include <debug.h>
#include <iostream>
#include "bigfix.h"
@ -255,11 +255,12 @@ int BigFix::sign() const
// For debugging
void BigFix::dump()
{
fmt::printf("%08x %08x %08x %08x",
(uint32_t) (hi >> 32),
(uint32_t) (hi & 0xffffffff),
(uint32_t) (lo >> 32),
(uint32_t) (lo & 0xffffffff));
DPRINTF(LOG_LEVEL_INFO,
"%08x %08x %08x %08x",
(uint32_t) (hi >> 32),
(uint32_t) (hi & 0xffffffff),
(uint32_t) (lo >> 32),
(uint32_t) (lo & 0xffffffff));
}
@ -277,10 +278,10 @@ int main(int argc, char* argv[])
if (sscanf(argv[2], "%lf", &b) != 1)
return 1;
fmt::printf(" sum:\n%f\n%f\n", a + b, (double) (BigFix(a) + BigFix(b)));
fmt::printf(" diff:\n%f\n%f\n", a - b, (double) (BigFix(a) - BigFix(b)));
fmt::printf("product:\n%f\n%f\n", a * b, (double) (BigFix(a) * BigFix(b)));
fmt::printf(" lt: %u %u\n", a < b, BigFix(a) < BigFix(b));
DPRINTF(LOG_LEVEL_INFO, " sum:\n%f\n%f\n", a + b, (double) (BigFix(a) + BigFix(b)));
DPRINTF(LOG_LEVEL_INFO, " diff:\n%f\n%f\n", a - b, (double) (BigFix(a) - BigFix(b)));
DPRINTF(LOG_LEVEL_INFO, "product:\n%f\n%f\n", a * b, (double) (BigFix(a) * BigFix(b)));
DPRINTF(LOG_LEVEL_INFO, " lt: %u %u\n", a < b, BigFix(a) < BigFix(b));
return 0;
}

View File

@ -20,6 +20,13 @@
#undef DPRINTF // OSX has DPRINTF
#endif // DPRINTF
// verbosity choices
#define LOG_LEVEL_ERROR 0
#define LOG_LEVEL_WARNING 1
#define LOG_LEVEL_INFO 2
#define LOG_LEVEL_VERBOSE 3
#define LOG_LEVEL_DEBUG 4
#if !defined(_DEBUG) && !defined(DEBUG)
#define DPRINTF(level, format, ...)
#else

View File

@ -9,7 +9,7 @@
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
#include <fmt/printf.h>
#include <celutil/debug.h>
#include "util.h"
#ifdef _WIN32
#include <shlobj.h>