logo

libbulletml

Library of Bullet Markup Language (forked from https://shinh.skr.jp/libbulletml/index_en.html )git clone https://hacktivis.me/git/libbulletml.git
commit: e3f20fb09dcd4452471db7762145b34fadab4c1e
parent 0349c28270a9888ceba0643ee1a9f5cd04a1045e
Author: Marcel Unbehaun <frostworks@gmx.de>
Date:   Fri, 22 Mar 2024 19:52:41 +0100

Apply 0.0.6-7.debian:patches/fixes.patch

Diffstat:

Msrc/bulletmlparser-tinyxml.cpp6+++---
Msrc/bulletmlparser-tinyxml.h5++---
Msrc/bulletmlparser-xerces.cpp9++++-----
Msrc/bulletmlparser-xerces.h6+-----
Msrc/bulletmlparser-ygg.cpp7++++---
Msrc/bulletmlparser-ygg.h3+--
Msrc/bulletmlparser.h7+++----
Msrc/bulletmlrunnerimpl.cpp14++++----------
Msrc/bulletmlrunnerimpl.h2+-
Msrc/calc.yy4++--
10 files changed, 25 insertions(+), 38 deletions(-)

diff --git a/src/bulletmlparser-tinyxml.cpp b/src/bulletmlparser-tinyxml.cpp @@ -5,8 +5,8 @@ #include <string> -BulletMLParserTinyXML::BulletMLParserTinyXML(const std::string& filename) - : xmlFile_(filename), curNode_(0) +BulletMLParserTinyXML::BulletMLParserTinyXML(const char* filename) + : curNode_(0) { setName(filename); } @@ -71,7 +71,7 @@ void BulletMLParserTinyXML::parseImpl(TiXmlDocument& doc) { } void BulletMLParserTinyXML::parse() { - TiXmlDocument doc(xmlFile_.c_str()); + TiXmlDocument doc(name_); doc.LoadFile(); parseImpl(doc); } diff --git a/src/bulletmlparser-tinyxml.h b/src/bulletmlparser-tinyxml.h @@ -16,12 +16,12 @@ class BulletMLNode; class BulletMLParserTinyXML : public BulletMLParser { public: - DECLSPEC BulletMLParserTinyXML(const std::string& filename); + DECLSPEC BulletMLParserTinyXML(const char* filename); DECLSPEC virtual ~BulletMLParserTinyXML(); DECLSPEC virtual void parse(); -protected: +private: void parseImpl(TiXmlDocument& doc); protected: @@ -29,7 +29,6 @@ protected: void translateNode(TiXmlNode* node); private: - std::string xmlFile_; BulletMLNode* curNode_; }; diff --git a/src/bulletmlparser-xerces.cpp b/src/bulletmlparser-xerces.cpp @@ -19,9 +19,9 @@ public: BulletMLParserXercesSAXHandler(BulletMLParserXerces* parser); virtual void characters(const XMLCh* const chars, - const unsigned int length); + const unsigned int length); virtual void startElement(const XMLCh* const name, - AttributeList& attributes); + AttributeList& attributes); virtual void endElement(const XMLCh* const name); virtual void error(const SAXParseException& e) { @@ -94,8 +94,7 @@ void BulletMLParserXercesSAXHandler::endElement(const XMLCh* const) { curNode_ = curNode_->getParent(); } -BulletMLParserXerces::BulletMLParserXerces(const std::string& filename) - : xmlFile_(filename) +BulletMLParserXerces::BulletMLParserXerces(const char* filename) { setName(filename); } @@ -117,7 +116,7 @@ void BulletMLParserXerces::parse() { parser->setDocumentHandler(&handler); parser->setErrorHandler(&handler); - parser->parse(xmlFile_.c_str()); + parser->parse(name_); parser.reset(0); } diff --git a/src/bulletmlparser-xerces.h b/src/bulletmlparser-xerces.h @@ -8,18 +8,14 @@ #ifdef USE_XERCES -#include <string> - class BulletMLParserXerces : public BulletMLParser { public: - explicit BulletMLParserXerces(const std::string& filename); + explicit BulletMLParserXerces(const char* filename); virtual ~BulletMLParserXerces(); virtual void parse(); private: - std::string xmlFile_; - friend class BulletMLParserXercesSAXHandler; }; diff --git a/src/bulletmlparser-ygg.cpp b/src/bulletmlparser-ygg.cpp @@ -63,8 +63,8 @@ void BulletMLParserYggdrasil::catch_text(yggdrasil::ygg_node text) { curNode_->setValue(trimString(text.get_text())); } -BulletMLParserYggdrasil::BulletMLParserYggdrasil(const std::string& filename) - : xmlFile_(filename), curNode_(0) +BulletMLParserYggdrasil::BulletMLParserYggdrasil(const char* filename) + : curNode_(0) { setName(filename); } @@ -72,7 +72,8 @@ BulletMLParserYggdrasil::BulletMLParserYggdrasil(const std::string& filename) BulletMLParserYggdrasil::~BulletMLParserYggdrasil() {} void BulletMLParserYggdrasil::parse() { - sox_file(xmlFile_).read(this); + std::string f(name_); + sox_file(f).read(this); } std::string BulletMLParserYggdrasil::trimString(const std::string& str) { diff --git a/src/bulletmlparser-ygg.h b/src/bulletmlparser-ygg.h @@ -24,7 +24,7 @@ public: void catch_text(yggdrasil::ygg_node text); public: - DECLSPEC explicit BulletMLParserYggdrasil(const std::string& filename); + DECLSPEC explicit BulletMLParserYggdrasil(const char* filename); DECLSPEC virtual ~BulletMLParserYggdrasil(); DECLSPEC virtual void parse(); @@ -33,7 +33,6 @@ protected: std::string trimString(const std::string& str); private: - std::string xmlFile_; class BulletMLNode* curNode_; }; diff --git a/src/bulletmlparser.h b/src/bulletmlparser.h @@ -70,11 +70,10 @@ protected: bool isHorizontal_; protected: - /// 一時的な導入 - void setName(const std::string& name) { name_ = name; } - std::string name_; + void setName(const char* name) { name_ = name; } + const char* name_; public: - DECLSPEC const std::string& getName() const { return name_; } + DECLSPEC const char* getName() const { return name_; } }; diff --git a/src/bulletmlrunnerimpl.cpp b/src/bulletmlrunnerimpl.cpp @@ -25,8 +25,7 @@ BulletMLRunnerImpl::commandMap_[BulletMLNode::nameSize] = { &BulletMLRunnerImpl::runVanish }; -double BulletMLRunnerImpl::getDirection(BulletMLNode* dirNode, - bool prevChange) { +double BulletMLRunnerImpl::getDirection(BulletMLNode* dirNode) { double dir; bool isDefault = true; @@ -64,7 +63,7 @@ double BulletMLRunnerImpl::getDirection(BulletMLNode* dirNode, while (dir > 360) dir -= 360; while (dir < 0) dir += 360; - if (prevChange) prevDir_ = dir; + prevDir_ = dir; return dir; } @@ -119,12 +118,7 @@ BulletMLRunnerImpl::BulletMLRunnerImpl(BulletMLState* state, act_ = node_[0]; } -BulletMLRunnerImpl::~BulletMLRunnerImpl() { - while (!repeatStack_.empty()) { - delete repeatStack_.top(); - repeatStack_.pop(); - } -} +BulletMLRunnerImpl::~BulletMLRunnerImpl() {} double BulletMLRunnerImpl::getNumberContents(const BulletMLNode* node) { assert(node); @@ -404,7 +398,7 @@ void BulletMLRunnerImpl::runChangeDirection() { BulletMLNode::Type type = dirNode->getType(); double dir; - if (type != BulletMLNode::sequence) dir = getDirection(dirNode, false); + if (type != BulletMLNode::sequence) dir = getDirection(dirNode); else dir = getNumberContents(dirNode); calcChangeDirection(dir, term, type == BulletMLNode::sequence); diff --git a/src/bulletmlrunnerimpl.h b/src/bulletmlrunnerimpl.h @@ -136,7 +136,7 @@ private: double getNumberContents(const BulletMLNode* node); std::vector<double>* getParameters(); double getSpeed(BulletMLNode* spdNode); - double getDirection(BulletMLNode* dirNode, bool prevChange = true); + double getDirection(BulletMLNode* dirNode); private: private: diff --git a/src/calc.yy b/src/calc.yy @@ -19,7 +19,7 @@ typedef double NumType; #include "formula.h" #include "formula-variables.h" -int yyerror(char* s); +int yyerror(const char* s); int yylex(); const char* yyinStr; @@ -151,7 +151,7 @@ int yylex () return c; } -int yyerror(char* s) { +int yyerror(const char* s) { printf("yyerror: %s\n", s); return 0; }