[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r2868 - in branches/pingus_sdl/src: . lisp
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r2868 - in branches/pingus_sdl/src: . lisp |
Date: |
Sun, 12 Aug 2007 21:07:55 +0200 |
Author: grumbel
Date: 2007-08-12 21:07:54 +0200 (Sun, 12 Aug 2007)
New Revision: 2868
Removed:
branches/pingus_sdl/src/lisp/properties.cpp
branches/pingus_sdl/src/lisp/properties.hpp
branches/pingus_sdl/src/lisp/writer.cpp
branches/pingus_sdl/src/lisp/writer.hpp
Modified:
branches/pingus_sdl/src/SConscript
branches/pingus_sdl/src/sexpr_file_writer.hpp
Log:
- some unused files removed
- added indention for enum in sexpr_file_writer.hpp
Modified: branches/pingus_sdl/src/SConscript
===================================================================
--- branches/pingus_sdl/src/SConscript 2007-08-12 19:04:09 UTC (rev 2867)
+++ branches/pingus_sdl/src/SConscript 2007-08-12 19:07:54 UTC (rev 2868)
@@ -171,8 +171,6 @@
'lisp/lexer.cpp',
'lisp/lisp.cpp',
'lisp/parser.cpp',
-'lisp/properties.cpp',
-'lisp/writer.cpp',
'input/axes/button_axis.cpp',
'input/axes/inverted_axis.cpp',
Deleted: branches/pingus_sdl/src/lisp/properties.cpp
===================================================================
--- branches/pingus_sdl/src/lisp/properties.cpp 2007-08-12 19:04:09 UTC (rev
2867)
+++ branches/pingus_sdl/src/lisp/properties.cpp 2007-08-12 19:07:54 UTC (rev
2868)
@@ -1,51 +0,0 @@
-#include <config.h>
-
-#include "lisp.hpp"
-#include "properties.hpp"
-
-namespace lisp
-{
-
-Properties::Properties(const Lisp* lisp)
-{
- if (lisp)
- {
- if(lisp->get_type() != Lisp::TYPE_LIST)
- throw std::runtime_error("Lisp is not a list");
-
- for(size_t i = 0; i < lisp->get_list_size(); ++i) {
- const boost::shared_ptr<Lisp> child = lisp->get_list_elem(i);
- if(i == 0 && child->get_type() == Lisp::TYPE_SYMBOL)
- continue;
- if(child->get_type() != Lisp::TYPE_LIST)
- throw std::runtime_error("child of properties lisp is not a list");
- if(child->get_list_size() > 1)
- {
- const boost::shared_ptr<Lisp> name = child->get_list_elem(0);
- if(name->get_type() != Lisp::TYPE_SYMBOL)
- throw std::runtime_error("property has no symbol as name");
- properties.insert(std::make_pair(
- std::string(name->get_symbol()),
ListEntry(child)));
- }
- }
- }
-}
-
-Properties::~Properties()
-{
-}
-
-void
-Properties::print_unused_warnings(const std::string& context) const
-{
- for(PropertyMap::const_iterator i = properties.begin();
- i != properties.end(); ++i) {
- if(i->second.used)
- continue;
-
- std::cout << "Warning: property '" << i->first << "' not used (in "
- << context << ")\n";
- }
-}
-
-}
Deleted: branches/pingus_sdl/src/lisp/properties.hpp
===================================================================
--- branches/pingus_sdl/src/lisp/properties.hpp 2007-08-12 19:04:09 UTC (rev
2867)
+++ branches/pingus_sdl/src/lisp/properties.hpp 2007-08-12 19:07:54 UTC (rev
2868)
@@ -1,85 +0,0 @@
-#ifndef __PROPERTIES_HPP__
-#define __PROPERTIES_HPP__
-
-#include <vector>
-#include "getters.hpp"
-#include "property_iterator.hpp"
-
-namespace lisp
-{
-
-class Properties
-{
-public:
- Properties(const lisp::Lisp* lisp);
- ~Properties();
-
- /**
- * fetches the value of a property. returns true if the property was defined
- * and could be converted into the target type, false otherwise.
- * You have to define get() or property_get() functions to support new
- * datatypes. See getters.hpp for details
- */
- template<typename T>
- bool get(const std::string& name, T& val)
- {
- PropertyMap::iterator i = properties.find(name);
- if(i == properties.end())
- return false;
- if(property_get(i->second.lisp, val) == false)
- return false;
- i->second.used = true;
- return true;
- }
-
- /**
- * Ignore a property so that it doesn't give a warning, usefull for
- * example if some tags are only used by the editor but not by the
- * game.
- */
- void ignore(const std::string& name)
- {
- PropertyMap::iterator i = properties.find(name);
- if(i != properties.end())
- i->second.used = true;
- }
-
- /**
- * returns an iterator over all properties with a certain name
- */
- template<typename T>
- bool get_iter(const std::string& name, PropertyIterator<T>& iter)
- {
- PropertyMap::iterator beg = properties.lower_bound(name);
- if(beg == properties.end() || beg->first != name) {
- iter = PropertyIterator<T>(properties.end(), properties.end());
- return false;
- }
- PropertyMap::iterator end = properties.upper_bound(name);
-
- iter = PropertyIterator<T>(beg, end);
- return true;
- }
-
- /**
- * returns an iterator over all properties
- */
- PropertyIterator<const Lisp*> get_iter()
- {
- return PropertyIterator<const Lisp*>(properties.begin(), properties.end());
- }
-
- /**
- * Prints a warning for properties that have not been accessed. This
typically
- * indicates typos that the user should know about
- */
- void print_unused_warnings(const std::string& context) const;
-
-private:
- PropertyMap properties;
-};
-
-}
-
-#endif
-
Deleted: branches/pingus_sdl/src/lisp/writer.cpp
===================================================================
--- branches/pingus_sdl/src/lisp/writer.cpp 2007-08-12 19:04:09 UTC (rev
2867)
+++ branches/pingus_sdl/src/lisp/writer.cpp 2007-08-12 19:07:54 UTC (rev
2868)
@@ -1,152 +0,0 @@
-// $Id: writer.cpp 2575 2005-06-07 15:59:27Z matzebraun $
-//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2004 Matthias Braun <address@hidden
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program 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 General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <config.h>
-
-#include <iostream>
-
-#include "writer.hpp"
-#include "physfs/physfs_stream.hpp"
-
-namespace lisp
-{
-
-Writer::Writer(const std::string& filename)
-{
- out = new OFileStream(filename);
- out_owned = true;
- indent_depth = 0;
-}
-
-Writer::Writer(std::ostream* newout)
-{
- out = newout;
- out_owned = false;
- indent_depth = 0;
-}
-
-Writer::~Writer()
-{
- if(lists.size() > 0) {
- std::cerr << "Warning: Not all sections closed in lispwriter!\n";
- }
- if(out_owned)
- delete out;
-}
-
-void
-Writer::write_comment(const std::string& comment)
-{
- *out << "; " << comment << "\n";
-}
-
-void
-Writer::start_list(const std::string& listname)
-{
- indent();
- *out << '(' << listname << '\n';
- indent_depth += 2;
-
- lists.push_back(listname);
-}
-
-void
-Writer::end_list(const std::string& listname)
-{
- if(lists.size() == 0) {
- std::cerr << "Trying to close list '" << listname
- << "', which is not open.\n";
- return;
- }
- if(lists.back() != listname) {
- std::cerr << "Warning: trying to close list '" << listname
- << "' while list '" << lists.back() << "' is open.\n";
- return;
- }
- lists.pop_back();
-
- indent_depth -= 2;
- indent();
- *out << ")\n";
-}
-
-void
-Writer::write_int(const std::string& name, int value)
-{
- indent();
- *out << '(' << name << ' ' << value << ")\n";
-}
-
-void
-Writer::write_float(const std::string& name, float value)
-{
- indent();
- *out << '(' << name << ' ' << value << ")\n";
-}
-
-void
-Writer::write_string(const std::string& name, const std::string& value,
- bool translatable)
-{
- indent();
- *out << '(' << name;
- if(translatable) {
- *out << " (_ \"" << value << "\"))\n";
- } else {
- *out << " \"" << value << "\")\n";
- }
-}
-
-void
-Writer::write_bool(const std::string& name, bool value)
-{
- indent();
- *out << '(' << name << ' ' << (value ? "#t" : "#f") << ")\n";
-}
-
-void
-Writer::write_int_vector(const std::string& name,
- const std::vector<int>& value)
-{
- indent();
- *out << '(' << name;
- for(std::vector<int>::const_iterator i = value.begin(); i != value.end();
++i)
- *out << " " << *i;
- *out << ")\n";
-}
-
-void
-Writer::write_int_vector(const std::string& name,
- const std::vector<unsigned int>& value)
-{
- indent();
- *out << '(' << name;
- for(std::vector<unsigned int>::const_iterator i = value.begin(); i !=
value.end(); ++i)
- *out << " " << *i;
- *out << ")\n";
-}
-
-void
-Writer::indent()
-{
- for(int i = 0; i<indent_depth; ++i)
- *out << ' ';
-}
-
-} // end of namespace lisp
Deleted: branches/pingus_sdl/src/lisp/writer.hpp
===================================================================
--- branches/pingus_sdl/src/lisp/writer.hpp 2007-08-12 19:04:09 UTC (rev
2867)
+++ branches/pingus_sdl/src/lisp/writer.hpp 2007-08-12 19:07:54 UTC (rev
2868)
@@ -1,64 +0,0 @@
-// $Id: writer.h 2575 2005-06-07 15:59:27Z matzebraun $
-//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2004 Matthias Braun <address@hidden
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program 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 General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef SUPERTUX_LISPWRITER_H
-#define SUPERTUX_LISPWRITER_H
-
-#include <iostream>
-#include <string>
-#include <vector>
-
-namespace lisp
-{
-
- class Writer
- {
- public:
- Writer(const std::string& filename);
- Writer(std::ostream* out);
- ~Writer();
-
- void write_comment(const std::string& comment);
-
- void start_list(const std::string& listname);
-
- void write_int(const std::string& name, int value);
- void write_float(const std::string& name, float value);
- void write_string(const std::string& name, const std::string& value,
- bool translatable = false);
- void write_bool(const std::string& name, bool value);
- void write_int_vector(const std::string& name, const std::vector<int>&
value);
- void write_int_vector(const std::string& name, const std::vector<unsigned
int>& value);
- // add more write-functions when needed...
-
- void end_list(const std::string& listname);
-
- private:
- void indent();
-
- std::ostream* out;
- bool out_owned;
- int indent_depth;
- std::vector<std::string> lists;
- };
-
-} //namespace lisp
-
-#endif //SUPERTUX_LISPWRITER_H
-
Modified: branches/pingus_sdl/src/sexpr_file_writer.hpp
===================================================================
--- branches/pingus_sdl/src/sexpr_file_writer.hpp 2007-08-12 19:04:09 UTC
(rev 2867)
+++ branches/pingus_sdl/src/sexpr_file_writer.hpp 2007-08-12 19:07:54 UTC
(rev 2868)
@@ -53,7 +53,7 @@
template<class E, class F>
void write_enum(const char* name, E value, F enum2string)
{
- (*out) << "(" << name << " \"" << enum2string(value) << "\")\n";
+ (*out) << indent() << "(" << name << " \"" << enum2string(value) <<
"\")\n";
}
private:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r2868 - in branches/pingus_sdl/src: . lisp,
grumbel at BerliOS <=