#include <sys/mman.h>
+#include "Code.hpp"
#include "ConvertUTF.h"
#include "Driver.hpp"
#include "Error.hpp"
}
/* }}} */
/* JavaScript *ify {{{ */
-void CYStringify(std::ostringstream &str, const char *data, size_t size) {
- unsigned quot(0), apos(0);
- for (const char *value(data), *end(data + size); value != end; ++value)
- if (*value == '"')
- ++quot;
- else if (*value == '\'')
- ++apos;
-
- bool single(quot > apos);
+void CYStringify(std::ostringstream &str, const char *data, size_t size, bool c) {
+ bool single;
+ if (c)
+ single = false;
+ else {
+ unsigned quot(0), apos(0);
+ for (const char *value(data), *end(data + size); value != end; ++value)
+ if (*value == '"')
+ ++quot;
+ else if (*value == '\'')
+ ++apos;
+
+ single = quot > apos;
+ }
str << (single ? '\'' : '"');
return $pool.strdup(str.str().c_str());
}
+CYUTF8String CYPoolCode(CYPool &pool, CYUTF8String code) {
+ CYStream stream(code.data, code.data + code.size);
+ return CYPoolCode(pool, stream);
+}
+
CYPool &CYGetGlobalPool() {
static CYPool pool;
return pool;