mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-13 05:14:16 +02:00
Update to v106r81 release.
byuu says: First 32 instructions implemented in the TLCS900H disassembler. Only 992 to go! I removed the use of anonymous namespaces in nall. It was something I rarely used, because it rarely did what I wanted. I updated all nested namespaces to use C++17-style namespace Foo::Bar {} syntax instead of classic C++-style namespace Foo { namespace Bar {}}. I updated ruby::Video::acquire() to return a struct, so we can use C++17 structured bindings. Long term, I want to get away from all functions that take references for output only. Even though C++ botched structured bindings by not allowing you to bind to existing variables, it's even worse to have function calls that take arguments by reference and then write to them. From the caller side, you can't tell the value is being written, nor that the value passed in doesn't matter, which is terrible.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
namespace nall { namespace Eval {
|
||||
namespace nall::Eval {
|
||||
|
||||
inline auto evaluateExpression(Node* node) -> string {
|
||||
#define p(n) evaluateExpression(node->link[n])
|
||||
@@ -143,4 +143,4 @@ inline auto real(const string& expression) -> maybe<long double> {
|
||||
}
|
||||
}
|
||||
|
||||
}}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
namespace nall { namespace Eval {
|
||||
namespace nall::Eval {
|
||||
|
||||
inline auto isLiteral(const char*& s) -> bool {
|
||||
char n = s[0];
|
||||
@@ -96,4 +96,4 @@ inline auto literal(const char*& s) -> string {
|
||||
throw "invalid literal";
|
||||
}
|
||||
|
||||
}}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
namespace nall { namespace Eval {
|
||||
namespace nall::Eval {
|
||||
|
||||
struct Node {
|
||||
enum class Type : uint {
|
||||
@@ -34,4 +34,4 @@ struct Node {
|
||||
~Node() { for(auto& node : link) delete node; }
|
||||
};
|
||||
|
||||
}}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
namespace nall { namespace Eval {
|
||||
namespace nall::Eval {
|
||||
|
||||
inline auto whitespace(char n) -> bool {
|
||||
return n == ' ' || n == '\t' || n == '\r' || n == '\n';
|
||||
@@ -161,4 +161,4 @@ inline auto parse(const string& expression) -> Node* {
|
||||
return result;
|
||||
}
|
||||
|
||||
}}
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
//BML v1.0 parser
|
||||
//revision 0.04
|
||||
|
||||
namespace nall { namespace BML {
|
||||
namespace nall::BML {
|
||||
|
||||
//metadata is used to store nesting level
|
||||
|
||||
@@ -186,4 +186,4 @@ inline auto serialize(const Markup::Node& node, string_view spacing = {}, uint d
|
||||
return result;
|
||||
}
|
||||
|
||||
}}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
namespace nall { namespace Markup {
|
||||
namespace nall::Markup {
|
||||
|
||||
auto ManagedNode::_evaluate(string query) const -> bool {
|
||||
if(!query) return true;
|
||||
@@ -134,4 +134,4 @@ auto ManagedNode::_create(const string& path) -> Node {
|
||||
return _children.right();
|
||||
}
|
||||
|
||||
}}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
namespace nall { namespace Markup {
|
||||
namespace nall::Markup {
|
||||
|
||||
struct Node;
|
||||
struct ManagedNode;
|
||||
@@ -136,4 +136,4 @@ protected:
|
||||
SharedNode shared;
|
||||
};
|
||||
|
||||
}}
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
//XML v1.0 subset parser
|
||||
//revision 0.04
|
||||
|
||||
namespace nall { namespace XML {
|
||||
namespace nall::XML {
|
||||
|
||||
//metadata:
|
||||
// 0 = element
|
||||
@@ -214,4 +214,4 @@ inline auto unserialize(const string& markup) -> Markup::SharedNode {
|
||||
return node;
|
||||
}
|
||||
|
||||
}}
|
||||
}
|
||||
|
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <nall/location.hpp>
|
||||
|
||||
namespace nall { namespace {
|
||||
namespace nall {
|
||||
|
||||
struct CML {
|
||||
auto& setPath(const string& pathname) { settings.path = pathname; return *this; }
|
||||
@@ -34,20 +34,20 @@ private:
|
||||
auto parseDocument(const string& filedata, const string& pathname, uint depth) -> bool;
|
||||
};
|
||||
|
||||
auto CML::parse(const string& filename) -> string {
|
||||
inline auto CML::parse(const string& filename) -> string {
|
||||
if(!settings.path) settings.path = Location::path(filename);
|
||||
string document = settings.reader ? settings.reader(filename) : string::read(filename);
|
||||
parseDocument(document, settings.path, 0);
|
||||
return state.output;
|
||||
}
|
||||
|
||||
auto CML::parse(const string& filedata, const string& pathname) -> string {
|
||||
inline auto CML::parse(const string& filedata, const string& pathname) -> string {
|
||||
settings.path = pathname;
|
||||
parseDocument(filedata, settings.path, 0);
|
||||
return state.output;
|
||||
}
|
||||
|
||||
auto CML::parseDocument(const string& filedata, const string& pathname, uint depth) -> bool {
|
||||
inline auto CML::parseDocument(const string& filedata, const string& pathname, uint depth) -> bool {
|
||||
if(depth >= 100) return false; //prevent infinite recursion
|
||||
|
||||
auto vendorAppend = [&](const string& name, const string& value) {
|
||||
@@ -102,4 +102,4 @@ auto CML::parseDocument(const string& filedata, const string& pathname, uint dep
|
||||
return true;
|
||||
}
|
||||
|
||||
}}
|
||||
}
|
||||
|
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <nall/location.hpp>
|
||||
|
||||
namespace nall { namespace {
|
||||
namespace nall {
|
||||
|
||||
struct DML {
|
||||
auto& setAllowHTML(bool allowHTML) { settings.allowHTML = allowHTML; return *this; }
|
||||
@@ -40,20 +40,20 @@ private:
|
||||
auto markup(const string& text) -> string;
|
||||
};
|
||||
|
||||
auto DML::parse(const string& filedata, const string& pathname) -> string {
|
||||
inline auto DML::parse(const string& filedata, const string& pathname) -> string {
|
||||
settings.path = pathname;
|
||||
parseDocument(filedata, settings.path, 0);
|
||||
return state.output;
|
||||
}
|
||||
|
||||
auto DML::parse(const string& filename) -> string {
|
||||
inline auto DML::parse(const string& filename) -> string {
|
||||
if(!settings.path) settings.path = Location::path(filename);
|
||||
string document = settings.reader ? settings.reader(filename) : string::read(filename);
|
||||
parseDocument(document, settings.path, 0);
|
||||
return state.output;
|
||||
}
|
||||
|
||||
auto DML::parseDocument(const string& filedata, const string& pathname, uint depth) -> bool {
|
||||
inline auto DML::parseDocument(const string& filedata, const string& pathname, uint depth) -> bool {
|
||||
if(depth >= 100) return false; //attempt to prevent infinite recursion with reasonable limit
|
||||
|
||||
auto blocks = filedata.split("\n\n");
|
||||
@@ -62,7 +62,7 @@ auto DML::parseDocument(const string& filedata, const string& pathname, uint dep
|
||||
return true;
|
||||
}
|
||||
|
||||
auto DML::parseBlock(string& block, const string& pathname, uint depth) -> bool {
|
||||
inline auto DML::parseBlock(string& block, const string& pathname, uint depth) -> bool {
|
||||
if(!block.stripRight()) return true;
|
||||
auto lines = block.split("\n");
|
||||
|
||||
@@ -182,7 +182,7 @@ auto DML::parseBlock(string& block, const string& pathname, uint depth) -> bool
|
||||
return true;
|
||||
}
|
||||
|
||||
auto DML::count(const string& text, char value) -> uint {
|
||||
inline auto DML::count(const string& text, char value) -> uint {
|
||||
for(uint n = 0; n < text.size(); n++) {
|
||||
if(text[n] != value) {
|
||||
if(text[n] == ' ') return n;
|
||||
@@ -192,7 +192,7 @@ auto DML::count(const string& text, char value) -> uint {
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto DML::escape(const string& text) -> string {
|
||||
inline auto DML::escape(const string& text) -> string {
|
||||
string output;
|
||||
for(auto c : text) {
|
||||
if(c == '&') { output.append("&"); continue; }
|
||||
@@ -204,7 +204,7 @@ auto DML::escape(const string& text) -> string {
|
||||
return output;
|
||||
}
|
||||
|
||||
auto DML::markup(const string& s) -> string {
|
||||
inline auto DML::markup(const string& s) -> string {
|
||||
string t;
|
||||
|
||||
boolean strong;
|
||||
@@ -266,4 +266,4 @@ auto DML::markup(const string& s) -> string {
|
||||
return t;
|
||||
}
|
||||
|
||||
}}
|
||||
}
|
||||
|
Reference in New Issue
Block a user