18 static bool initEscapes;
19 static std::string escapes[256];
21 static void initJsonEscape()
24 for (
int ch=0x00; ch<0x20; ++ch) {
26 snprintf(tmpbuf,
sizeof(tmpbuf),
"\\u%04x", ch);
27 escapes[ch] = std::string(tmpbuf);
30 escapes[(int)
'"'] =
"\\\"";
31 escapes[(int)
'\\'] =
"\\\\";
32 escapes[(int)
'\b'] =
"\\b";
33 escapes[(int)
'\f'] =
"\\f";
34 escapes[(int)
'\n'] =
"\\n";
35 escapes[(int)
'\r'] =
"\\r";
36 escapes[(int)
'\t'] =
"\\t";
37 escapes[(int)
'\x7f'] =
"\\u007f";
42 static void outputEscape()
44 printf(
"// Automatically generated file. Do not modify.\n" 45 "#ifndef RAVEN_UNIVALUE_UNIVALUE_ESCAPES_H\n" 46 "#define RAVEN_UNIVALUE_UNIVALUE_ESCAPES_H\n" 47 "static const char *escapes[256] = {\n");
49 for (
unsigned int i = 0; i < 256; i++) {
50 if (escapes[i].empty()) {
56 for (si = 0; si < escapes[i].size(); si++) {
57 char ch = escapes[i][si];
66 printf(
"%c", escapes[i][si]);
76 "#endif // RAVEN_UNIVALUE_UNIVALUE_ESCAPES_H\n");
79 int main (
int argc,
char *argv[])
int main(int argc, char *argv[])