X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fscripting%2Fserialize.cpp;h=ff3c859bcd3de8b08ce9f4085177ad11e0a4e255;hb=0b73428a8a9e9563cb196e4b13167de3ec5f6b02;hp=d9dda42c2480b798992b024ede537dea896ce1ce;hpb=65a0b6f7ec1123cff959e13e1a4919dc70fe4e85;p=supertux.git diff --git a/src/scripting/serialize.cpp b/src/scripting/serialize.cpp index d9dda42c2..ff3c859bc 100644 --- a/src/scripting/serialize.cpp +++ b/src/scripting/serialize.cpp @@ -1,12 +1,10 @@ -// $Id$ -// // SuperTux // Copyright (C) 2006 Matthias Braun // -// 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 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 3 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 @@ -14,31 +12,26 @@ // 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 +// along with this program. If not, see . -#include "serialize.hpp" +#include "scripting/serialize.hpp" + +#include -#include -#include -#include "lisp/lisp.hpp" -#include "lisp/list_iterator.hpp" -#include "lisp/parser.hpp" #include "lisp/writer.hpp" -#include "squirrel_error.hpp" +#include "lisp/list_iterator.hpp" +#include "scripting/squirrel_error.hpp" -namespace Scripting -{ +namespace scripting { -void load_squirrel_table(HSQUIRRELVM vm, SQInteger table_idx, const lisp::Lisp* lisp) +void load_squirrel_table(HSQUIRRELVM vm, SQInteger table_idx, const Reader& lisp) { using namespace lisp; if(table_idx < 0) table_idx -= 2; - lisp::ListIterator iter(lisp); + lisp::ListIterator iter(&lisp); while(iter.next() && iter.lisp() != NULL) { const std::string& token = iter.item(); sq_pushstring(vm, token.c_str(), token.size()); @@ -47,7 +40,7 @@ void load_squirrel_table(HSQUIRRELVM vm, SQInteger table_idx, const lisp::Lisp* switch(value->get_type()) { case Lisp::TYPE_CONS: sq_newtable(vm); - load_squirrel_table(vm, sq_gettop(vm), iter.lisp()); + load_squirrel_table(vm, sq_gettop(vm), *iter.lisp()); break; case Lisp::TYPE_INTEGER: sq_pushinteger(vm, value->get_int()); @@ -71,11 +64,11 @@ void load_squirrel_table(HSQUIRRELVM vm, SQInteger table_idx, const lisp::Lisp* } if(SQ_FAILED(sq_createslot(vm, table_idx))) - throw Scripting::SquirrelError(vm, "Couldn't create new index"); + throw scripting::SquirrelError(vm, "Couldn't create new index"); } } -void save_squirrel_table(HSQUIRRELVM vm, SQInteger table_idx, lisp::Writer& writer) +void save_squirrel_table(HSQUIRRELVM vm, SQInteger table_idx, Writer& writer) { // offset because of sq_pushnull if(table_idx < 0) @@ -135,4 +128,6 @@ void save_squirrel_table(HSQUIRRELVM vm, SQInteger table_idx, lisp::Writer& writ sq_pop(vm, 1); } -} +} // namespace scripting + +/* EOF */