Unified Messaging Subsystem
[supertux.git] / src / lisp / writer.cpp
index ff70ce1..ee0633c 100644 (file)
@@ -21,8 +21,9 @@
 
 #include <iostream>
 
-#include "writer.h"
-#include "physfs/physfs_stream.h"
+#include "writer.hpp"
+#include "physfs/physfs_stream.hpp"
+#include "msg.hpp"
 
 namespace lisp
 {
@@ -44,7 +45,7 @@ Writer::Writer(std::ostream* newout)
 Writer::~Writer()
 {
   if(lists.size() > 0) {
-    std::cerr << "Warning: Not all sections closed in lispwriter!\n";
+    msg_warning("Not all sections closed in lispwriter");
   }
   if(out_owned)
     delete out;
@@ -70,13 +71,13 @@ void
 Writer::end_list(const std::string& listname)
 {
   if(lists.size() == 0) {
-    std::cerr << "Trying to close list '" << listname 
-              << "', which is not open.\n";
+    msg_warning("Trying to close list '" << listname 
+              << "', which is not open");
     return;
   }
   if(lists.back() != listname) {
-    std::cerr << "Warning: trying to close list '" << listname 
-              << "' while list '" << lists.back() << "' is open.\n";
+    msg_warning("trying to close list '" << listname 
+              << "' while list '" << lists.back() << "' is open");
     return;
   }
   lists.pop_back();
@@ -143,6 +144,17 @@ Writer::write_int_vector(const std::string& name,
 }
 
 void
+Writer::write_float_vector(const std::string& name,
+                           const std::vector<float>& value)
+{
+  indent();
+  *out << '(' << name;
+  for(std::vector<float>::const_iterator i = value.begin(); i != value.end(); ++i)
+    *out << " " << *i;
+  *out << ")\n";
+}
+
+void
 Writer::indent()
 {
   for(int i = 0; i<indent_depth; ++i)