Update to v094r37 release.

byuu says:

Changelog:
- synchronizes lots of nall changes
- changes displayed program title from tomoko to higan(*)
- browser dialog sort is case-insensitive
- .sys folders look at user-selected library path; no longer hard-coded

Tried to get rid of the file modes from the Windows browser dialog, but
it was being a bitch so I left it on for now.

- The storage locations and binary still use tomoko. I'm not really sure
  what to do here. The idea is there may be more than one "higan" UI in
  the future, but I don't want people to go around calling the entire
  program by the UI name. For official Windows releases, I can rename
  the binaries to "higan-{profile}.exe", and by putting the config files
  with the binary, they won't ever see the tomoko folder. Linux is of
  course trickier.

Note: Windows users will need to edit hiro/components.hpp and comment
out these lines:

 #define Hiro_Console
 #define Hiro_IconView
 #define Hiro_SourceView
 #define Hiro_TreeView

I forgot to do that, and too lazy to upload another WIP.
This commit is contained in:
Tim Allen
2015-07-14 19:32:43 +10:00
parent ecb35cac33
commit 092cac9073
81 changed files with 1670 additions and 1467 deletions

View File

@@ -1,17 +1,24 @@
#ifdef NALL_STRING_INTERNAL_HPP
/* CSS Markup Language (CML) v1.0 parser
* revision 0.01
* revision 0.02
*/
namespace nall { namespace {
struct CML {
CML(const string& filedata, const string& pathname);
CML(const string& filename);
auto output() -> string;
auto& setPath(const string& pathname) { settings.path = pathname; return *this; }
auto& setReader(const function<string (string)>& reader) { settings.reader = reader; return *this; }
auto parse(const string& filename) -> string;
auto parse(const string& filedata, const string& pathname) -> string;
private:
struct Settings {
string path;
function<string (string)> reader;
} settings;
struct State {
string output;
} state;
@@ -22,22 +29,25 @@ private:
};
vector<Variable> variables;
auto parse(const string& filedata, const string& pathname) -> bool;
auto parseDocument(const string& filedata, const string& pathname, unsigned depth) -> bool;
};
CML::CML(const string& filedata, const string& pathname) {
parse(filedata, pathname);
}
CML::CML(const string& filename) {
parse(string::read(filename), filename.pathname());
}
auto CML::output() -> string {
auto CML::parse(const string& filename) -> string {
if(!settings.path) settings.path = filename.pathname();
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) -> bool {
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, unsigned depth) -> bool {
if(depth >= 100) return false; //prevent infinite recursion
auto vendorAppend = [&](const string& name, const string& value) {
state.output.append(" -moz-", name, ": ", value, ";\n");
state.output.append(" -webkit-", name, ": ", value, ";\n");
@@ -47,15 +57,17 @@ auto CML::parse(const string& filedata, const string& pathname) -> bool {
lstring lines = block.rstrip().split("\n");
string name = lines.takeFirst();
if(ltrim(name, "include ")) {
if(name.beginsWith("include ")) {
name.ltrim("include ", 1L);
string filename{pathname, name};
parse(string::read(filename), filename.pathname());
string document = settings.reader ? settings.reader(filename) : string::read(filename);
parseDocument(document, filename.pathname(), depth + 1);
continue;
}
if(name == "variables") {
for(auto& line : lines) {
auto data = line.split<1>(":").strip();
auto data = line.split(":", 1L).strip();
variables.append({data(0), data(1)});
}
continue;
@@ -63,7 +75,7 @@ auto CML::parse(const string& filedata, const string& pathname) -> bool {
state.output.append(name, " {\n");
for(auto& line : lines) {
auto data = line.split<1>(":").strip();
auto data = line.split(":", 1L).strip();
auto name = data(0), value = data(1);
while(auto offset = value.find("var(")) {
bool found = false;