From 3dcebcf56c6dd3a3707291e757af485bb55df7a6 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sun, 14 Apr 2002 15:57:07 +0000 Subject: [PATCH] Added Util.h, which contains only an ASSERT macro for now --- src/Makefile.am | 9 +++++---- src/Makefile.in | 9 +++++---- src/Resource.cc | 21 ++++++++++----------- src/Screen.cc | 1 - src/Util.h | 32 ++++++++++++++++++++++++++++++++ src/Workspace.cc | 3 ++- src/openbox.cc | 5 +++-- 7 files changed, 57 insertions(+), 23 deletions(-) create mode 100644 src/Util.h diff --git a/src/Makefile.am b/src/Makefile.am index 5bfdc813..3fb5cb5e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -39,8 +39,6 @@ distclean-local: # local dependencies -Geometry.o: Geometry.cc Geometry.h -Resource.o: Resource.cc Resource.h BaseDisplay.o: BaseDisplay.cc i18n.h BaseDisplay.h LinkedList.h \ Timer.h Basemenu.o: Basemenu.cc i18n.h openbox.h BaseDisplay.h \ @@ -55,6 +53,7 @@ Configmenu.o: Configmenu.cc i18n.h Configmenu.h Basemenu.h \ LinkedList.h Screen.h BaseDisplay.h Timer.h Iconmenu.h Netizen.h \ Rootmenu.h Workspace.h Workspacemenu.h openbox.h Image.h \ Window.h Windowmenu.h Slit.h Toolbar.h Resource.h Geometry.h +Geometry.o: Geometry.cc Geometry.h Icon.o: Iconmenu.cc i18n.h openbox.h BaseDisplay.h LinkedList.h \ Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \ Screen.h Configmenu.h Netizen.h Rootmenu.h Workspace.h \ @@ -66,6 +65,7 @@ Netizen.o: Netizen.cc Netizen.h BaseDisplay.h LinkedList.h Timer.h \ Screen.h Configmenu.h Basemenu.h openbox.h Image.h Window.h \ Iconmenu.h Windowmenu.h Slit.h Rootmenu.h Workspace.h \ Workspacemenu.h Resource.h Geometry.h +Resource.o: Resource.cc Resource.h Util.h Rootmenu.o: Rootmenu.cc openbox.h BaseDisplay.h LinkedList.h \ Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \ Rootmenu.h Screen.h Configmenu.h Netizen.h Workspace.h \ @@ -95,7 +95,7 @@ Workspace.o: Workspace.cc i18n.h openbox.h BaseDisplay.h \ LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \ Windowmenu.h Slit.h Clientmenu.h Workspace.h Screen.h \ Configmenu.h Netizen.h Rootmenu.h Workspacemenu.h Toolbar.h Resource.h \ - Geometry.h Geometry.h + Geometry.h Geometry.h Util.h Workspacemenu.o: Workspacemenu.cc i18n.h openbox.h BaseDisplay.h \ LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \ Windowmenu.h Slit.h Screen.h Configmenu.h Netizen.h Rootmenu.h \ @@ -103,7 +103,8 @@ Workspacemenu.o: Workspacemenu.cc i18n.h openbox.h BaseDisplay.h \ openbox.o: openbox.cc i18n.h openbox.h BaseDisplay.h \ LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \ Windowmenu.h Slit.h Clientmenu.h Workspace.h Rootmenu.h \ - Screen.h Configmenu.h Netizen.h Workspacemenu.h Toolbar.h Resource.h Geometry.h + Screen.h Configmenu.h Netizen.h Workspacemenu.h Toolbar.h Resource.h \ + Geometry.h Util.h bsd-snprintf.o: bsd-snprintf.c bsd-snprintf.h i18n.o: i18n.cc i18n.h main.o: main.cc ../version.h i18n.h openbox.h BaseDisplay.h \ diff --git a/src/Makefile.in b/src/Makefile.in index 4f50404d..47cb910a 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -390,8 +390,6 @@ distclean-local: # local dependencies -Geometry.o: Geometry.cc Geometry.h -Resource.o: Resource.cc Resource.h BaseDisplay.o: BaseDisplay.cc i18n.h BaseDisplay.h LinkedList.h \ Timer.h Basemenu.o: Basemenu.cc i18n.h openbox.h BaseDisplay.h \ @@ -406,6 +404,7 @@ Configmenu.o: Configmenu.cc i18n.h Configmenu.h Basemenu.h \ LinkedList.h Screen.h BaseDisplay.h Timer.h Iconmenu.h Netizen.h \ Rootmenu.h Workspace.h Workspacemenu.h openbox.h Image.h \ Window.h Windowmenu.h Slit.h Toolbar.h Resource.h Geometry.h +Geometry.o: Geometry.cc Geometry.h Icon.o: Iconmenu.cc i18n.h openbox.h BaseDisplay.h LinkedList.h \ Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \ Screen.h Configmenu.h Netizen.h Rootmenu.h Workspace.h \ @@ -417,6 +416,7 @@ Netizen.o: Netizen.cc Netizen.h BaseDisplay.h LinkedList.h Timer.h \ Screen.h Configmenu.h Basemenu.h openbox.h Image.h Window.h \ Iconmenu.h Windowmenu.h Slit.h Rootmenu.h Workspace.h \ Workspacemenu.h Resource.h Geometry.h +Resource.o: Resource.cc Resource.h Util.h Rootmenu.o: Rootmenu.cc openbox.h BaseDisplay.h LinkedList.h \ Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \ Rootmenu.h Screen.h Configmenu.h Netizen.h Workspace.h \ @@ -446,7 +446,7 @@ Workspace.o: Workspace.cc i18n.h openbox.h BaseDisplay.h \ LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \ Windowmenu.h Slit.h Clientmenu.h Workspace.h Screen.h \ Configmenu.h Netizen.h Rootmenu.h Workspacemenu.h Toolbar.h Resource.h \ - Geometry.h Geometry.h + Geometry.h Geometry.h Util.h Workspacemenu.o: Workspacemenu.cc i18n.h openbox.h BaseDisplay.h \ LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \ Windowmenu.h Slit.h Screen.h Configmenu.h Netizen.h Rootmenu.h \ @@ -454,7 +454,8 @@ Workspacemenu.o: Workspacemenu.cc i18n.h openbox.h BaseDisplay.h \ openbox.o: openbox.cc i18n.h openbox.h BaseDisplay.h \ LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \ Windowmenu.h Slit.h Clientmenu.h Workspace.h Rootmenu.h \ - Screen.h Configmenu.h Netizen.h Workspacemenu.h Toolbar.h Resource.h Geometry.h + Screen.h Configmenu.h Netizen.h Workspacemenu.h Toolbar.h Resource.h \ + Geometry.h Util.h bsd-snprintf.o: bsd-snprintf.c bsd-snprintf.h i18n.o: i18n.cc i18n.h main.o: main.cc ../version.h i18n.h openbox.h BaseDisplay.h \ diff --git a/src/Resource.cc b/src/Resource.cc index 1f6f8438..42dd2301 100644 --- a/src/Resource.cc +++ b/src/Resource.cc @@ -20,6 +20,7 @@ // DEALINGS IN THE SOFTWARE. #include "Resource.h" +#include "Util.h" #ifdef HAVE_CONFIG_H # include "../config.h" @@ -33,8 +34,6 @@ # include #endif // HAVE_STDIO_H -#include - bool obResource::m_initialized = false; obResource::obResource(const std::string &file) { @@ -72,7 +71,7 @@ void obResource::setAutoSave(bool autosave) { } void obResource::save() { - assert(m_database != NULL); + ASSERT(m_database != NULL); XrmPutFileDatabase(m_database, m_file.c_str()); m_modified = false; } @@ -87,7 +86,7 @@ bool obResource::load() { } void obResource::setValue(const std::string &rname, bool value) { - assert(m_database != NULL); + ASSERT(m_database != NULL); const char *val = (value ? "True" : "False"); std::string rc_string = rname + ": " + val; @@ -103,7 +102,7 @@ void obResource::setValue(const std::string &rname, int value) { } void obResource::setValue(const std::string &rname, long value) { - assert(m_database != NULL); + ASSERT(m_database != NULL); char val[11]; sprintf(val, "%ld", value); @@ -116,7 +115,7 @@ void obResource::setValue(const std::string &rname, long value) { } void obResource::setValue(const std::string &rname, const char *value) { - assert(m_database != NULL); + ASSERT(m_database != NULL); std::string rc_string = rname + ": " + value; XrmPutLineResource(&m_database, rc_string.c_str()); @@ -127,7 +126,7 @@ void obResource::setValue(const std::string &rname, const char *value) { } void obResource::setValue(const std::string &rname, const std::string &value) { - assert(m_database != NULL); + ASSERT(m_database != NULL); std::string rc_string = rname + ": " + value; XrmPutLineResource(&m_database, rc_string.c_str()); @@ -139,8 +138,8 @@ void obResource::setValue(const std::string &rname, const std::string &value) { bool obResource::getValue(const std::string &rname, const std::string &rclass, bool &value) const { - assert(rclass.c_str() != NULL); - assert(m_database != NULL); + ASSERT(rclass.c_str() != NULL); + ASSERT(m_database != NULL); char *rettype; XrmValue retvalue; @@ -157,7 +156,7 @@ bool obResource::getValue(const std::string &rname, const std::string &rclass, bool obResource::getValue(const std::string &rname, const std::string &rclass, long &value) const { - assert(m_database != NULL); + ASSERT(m_database != NULL); char *rettype; XrmValue retvalue; @@ -173,7 +172,7 @@ bool obResource::getValue(const std::string &rname, const std::string &rclass, bool obResource::getValue(const std::string &rname, const std::string &rclass, std::string &value) const { - assert(m_database != NULL); + ASSERT(m_database != NULL); char *rettype; XrmValue retvalue; diff --git a/src/Screen.cc b/src/Screen.cc index 65264e36..368a6e8f 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -32,7 +32,6 @@ #include #include -#include #include "i18n.h" #include "openbox.h" diff --git a/src/Util.h b/src/Util.h new file mode 100644 index 00000000..03b352e1 --- /dev/null +++ b/src/Util.h @@ -0,0 +1,32 @@ +// Util.h for Openbox +// Copyright (c) 2002 - 2002 Ben Jansens (ben@orodu.net) +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +#ifndef __Util_hh +#define __Util_hh + +#ifdef DEBUG +# include +# define ASSERT(x) assert(x) +#else // !DEBUG +# define ASSERT(x) +#endif // DEBUG + +#endif // __Util_hh diff --git a/src/Workspace.cc b/src/Workspace.cc index 6dcd1974..0e7edcab 100644 --- a/src/Workspace.cc +++ b/src/Workspace.cc @@ -43,6 +43,7 @@ #include "Workspace.h" #include "Windowmenu.h" #include "Geometry.h" +#include "Util.h" #ifdef HAVE_STDIO_H # include @@ -458,7 +459,7 @@ inline Point *Workspace::rowSmartPlacement(const Size &win_size, } void Workspace::placeWindow(OpenboxWindow *win) { - assert(win != NULL); + ASSERT(win != NULL); Bool placed = False; diff --git a/src/openbox.cc b/src/openbox.cc index 194a737c..e657fbd3 100644 --- a/src/openbox.cc +++ b/src/openbox.cc @@ -55,6 +55,7 @@ #include "Window.h" #include "Workspace.h" #include "Workspacemenu.h" +#include "Util.h" #include #include @@ -1209,9 +1210,9 @@ void Openbox::load_rc(void) { void Openbox::load_rc(BScreen *screen) { - assert (screen != NULL); + ASSERT (screen != NULL); const int screen_number = screen->getScreenNumber(); - assert (screen_number >= 0); + ASSERT (screen_number >= 0); if (!config.load()) return; -- 2.39.2