mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
Give makerd a cwd argument, and upgrade cpptoml
This commit is contained in:
@@ -4,8 +4,8 @@
|
|||||||
* @date May 2013
|
* @date May 2013
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _CPPTOML_H_
|
#ifndef CPPTOML_H
|
||||||
#define _CPPTOML_H_
|
#define CPPTOML_H
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@@ -84,11 +84,12 @@ class option
|
|||||||
return &value_;
|
return &value_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const T& value_or(const T& alternative) const
|
template <class U>
|
||||||
|
T value_or(U&& alternative) const
|
||||||
{
|
{
|
||||||
if (!empty_)
|
if (!empty_)
|
||||||
return value_;
|
return value_;
|
||||||
return alternative;
|
return static_cast<T>(std::forward<U>(alternative));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -2874,8 +2875,14 @@ class parser
|
|||||||
std::string::iterator find_end_of_date(std::string::iterator it,
|
std::string::iterator find_end_of_date(std::string::iterator it,
|
||||||
std::string::iterator end)
|
std::string::iterator end)
|
||||||
{
|
{
|
||||||
return std::find_if(it, end, [](char c) {
|
auto end_of_date = std::find_if(it, end, [](char c) {
|
||||||
return !is_number(c) && c != 'T' && c != ' ' && c != 'Z' && c != ':'
|
return !is_number(c) && c != '-';
|
||||||
|
});
|
||||||
|
if (end_of_date != end && *end_of_date == ' ' && end_of_date + 1 != end
|
||||||
|
&& is_number(end_of_date[1]))
|
||||||
|
end_of_date++;
|
||||||
|
return std::find_if(end_of_date, end, [](char c) {
|
||||||
|
return !is_number(c) && c != 'T' && c != 'Z' && c != ':'
|
||||||
&& c != '-' && c != '+' && c != '.';
|
&& c != '-' && c != '+' && c != '.';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -3097,8 +3104,11 @@ class parser
|
|||||||
throw_parse_exception("Unterminated inline table");
|
throw_parse_exception("Unterminated inline table");
|
||||||
|
|
||||||
consume_whitespace(it, end);
|
consume_whitespace(it, end);
|
||||||
parse_key_value(it, end, tbl.get());
|
if (it != end && *it != '}')
|
||||||
consume_whitespace(it, end);
|
{
|
||||||
|
parse_key_value(it, end, tbl.get());
|
||||||
|
consume_whitespace(it, end);
|
||||||
|
}
|
||||||
} while (*it == ',');
|
} while (*it == ',');
|
||||||
|
|
||||||
if (it == end || *it != '}')
|
if (it == end || *it != '}')
|
||||||
@@ -3435,7 +3445,7 @@ class toml_writer
|
|||||||
{
|
{
|
||||||
res += "\\\\";
|
res += "\\\\";
|
||||||
}
|
}
|
||||||
else if ((const uint32_t)*it <= 0x001f)
|
else if (static_cast<uint32_t>(*it) <= UINT32_C(0x001f))
|
||||||
{
|
{
|
||||||
res += "\\u";
|
res += "\\u";
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
@@ -3655,4 +3665,5 @@ inline std::ostream& operator<<(std::ostream& stream, const array& a)
|
|||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
} // namespace cpptoml
|
} // namespace cpptoml
|
||||||
#endif
|
#endif // CPPTOML_H
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,23 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
#include "cpptoml.h"
|
#include "cpptoml.h"
|
||||||
#include "initrd/headers.h"
|
#include "initrd/headers.h"
|
||||||
#include "entry.h"
|
#include "entry.h"
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
if (argc != 3) {
|
if (argc < 3 && argc > 4) {
|
||||||
std::cerr << "Usage: " << argv[0] << " <manifest> <output>" << std::endl;
|
std::cerr << "Usage: " << argv[0] << " <manifest> <output> [sourceroot]" << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argc == 4 && chdir(argv[3]) != 0) {
|
||||||
|
std::cerr
|
||||||
|
<< "Failed to change to " << argv[3] << ": "
|
||||||
|
<< std::strerror(errno) << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user