| 37 | } |
| 38 | |
| 39 | static void outputEscape() |
| 40 | { |
| 41 | printf( "// Automatically generated file. Do not modify.\n" |
| 42 | "#ifndef BITCOIN_UNIVALUE_UNIVALUE_ESCAPES_H\n" |
| 43 | "#define BITCOIN_UNIVALUE_UNIVALUE_ESCAPES_H\n" |
| 44 | "static const char *escapes[256] = {\n"); |
| 45 | |
| 46 | for (unsigned int i = 0; i < 256; i++) { |
| 47 | if (escapes[i].empty()) { |
| 48 | printf("\tnullptr,\n"); |
| 49 | } else { |
| 50 | printf("\t\""); |
| 51 | |
| 52 | unsigned int si; |
| 53 | for (si = 0; si < escapes[i].size(); si++) { |
| 54 | char ch = escapes[i][si]; |
| 55 | switch (ch) { |
| 56 | case '"': |
| 57 | printf("\\\""); |
| 58 | break; |
| 59 | case '\\': |
| 60 | printf("\\\\"); |
| 61 | break; |
| 62 | default: |
| 63 | printf("%c", escapes[i][si]); |
| 64 | break; |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | printf("\",\n"); |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | printf( "};\n" |
| 73 | "#endif // BITCOIN_UNIVALUE_UNIVALUE_ESCAPES_H\n"); |
| 74 | } |
| 75 | |
| 76 | int main (int argc, char *argv[]) |
| 77 | { |