| 89 | } |
| 90 | |
| 91 | static void create_map2(void) |
| 92 | { |
| 93 | unsigned int i, j, n; |
| 94 | |
| 95 | n = sizeof(html_charset) / sizeof(html_charset[0]); |
| 96 | |
| 97 | for (i = 0; i < n; i++) { |
| 98 | const char *ptr = html_charset[i].entity; |
| 99 | if (ptr == NULL) |
| 100 | continue; |
| 101 | for (j = 0; j < i; j++) { |
| 102 | if (html_charset[j].entity == NULL) |
| 103 | continue; |
| 104 | if (strcmp(ptr, html_charset[j].entity) == 0) { |
| 105 | html_charset[j].entity = NULL; |
| 106 | break; |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | printf("#ifndef __HTML_CHARSET_INCLUDE_H__\n"); |
| 112 | printf("#define __HTML_CHARSET_INCLUDE_H__\n"); |
| 113 | printf("\n"); |
| 114 | |
| 115 | printf("static const char *html_charmap[] = {\n"); |
| 116 | for (i = 0; i < 65535; i++) { |
| 117 | if (i > 0) { |
| 118 | if (i % 8 == 0) |
| 119 | printf(",\n\t"); |
| 120 | else |
| 121 | printf(", "); |
| 122 | } else |
| 123 | printf("\t"); |
| 124 | for (j = 0; j < n; j++) { |
| 125 | if (html_charset[j].entity && html_charset[j].id == i) |
| 126 | break; |
| 127 | } |
| 128 | if (j < n) |
| 129 | printf("\"%s\"", html_charset[j].entity); |
| 130 | else |
| 131 | printf("NULL"); |
| 132 | } |
| 133 | printf("\n};\n"); |
| 134 | |
| 135 | printf("\ntypedef struct {\n" |
| 136 | "\tunsigned short ch;\n" |
| 137 | "\tconst char *txt;\n" |
| 138 | "\tsize_t len;\n" |
| 139 | "} HTML_SPEC;\n" |
| 140 | "\n" |
| 141 | "static const HTML_SPEC html_tab[] = {\n" |
| 142 | ); |
| 143 | for (i = 0; i < n; i++) { |
| 144 | if (html_charset[i].entity == NULL) |
| 145 | continue; |
| 146 | printf("\t{ %u, \"%s\", sizeof(\"%s\") - 1 },\n", |
| 147 | html_charset[i].id, html_charset[i].entity, html_charset[i].entity); |
| 148 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…