* Return value: * 1 = success * 0 = failure */
| 109 | * 0 = failure |
| 110 | */ |
| 111 | int |
| 112 | glyphrep_to_custom_map_entries( |
| 113 | const char *op, |
| 114 | int *glyphptr) |
| 115 | { |
| 116 | to_custom_symbol_find = zero_find; |
| 117 | char buf[BUFSZ], *c_glyphid, *c_unicode, *c_colorval, *cp; |
| 118 | int reslt = 0; |
| 119 | long rgb = 0L; |
| 120 | boolean slash = FALSE, colon = FALSE; |
| 121 | |
| 122 | if (!glyphid_cache) |
| 123 | reslt = 1; /* for debugger use only; no cache available */ |
| 124 | nhUse(reslt); |
| 125 | |
| 126 | Snprintf(buf, sizeof buf, "%s", op); |
| 127 | c_unicode = c_colorval = (char *) 0; |
| 128 | c_glyphid = cp = buf; |
| 129 | while (*cp) { |
| 130 | if (*cp == ':' || *cp == '/') { |
| 131 | if (*cp == ':') { |
| 132 | colon = TRUE; |
| 133 | *cp = '\0'; |
| 134 | } |
| 135 | if (*cp == '/') { |
| 136 | slash = TRUE; |
| 137 | *cp = '\0'; |
| 138 | } |
| 139 | } |
| 140 | cp++; |
| 141 | if (colon) { |
| 142 | c_unicode = cp; |
| 143 | colon = FALSE; |
| 144 | } |
| 145 | if (slash) { |
| 146 | c_colorval = cp; |
| 147 | slash = FALSE; |
| 148 | } |
| 149 | } |
| 150 | /* some sanity checks */ |
| 151 | if (c_glyphid && *c_glyphid == ' ') |
| 152 | c_glyphid++; |
| 153 | if (c_colorval && *c_colorval == ' ') |
| 154 | c_colorval++; |
| 155 | if (c_unicode && *c_unicode == ' ') { |
| 156 | while (*c_unicode == ' ') { |
| 157 | c_unicode++; |
| 158 | } |
| 159 | } |
| 160 | if (c_unicode && !*c_unicode) |
| 161 | c_unicode = 0; |
| 162 | |
| 163 | if ((c_colorval && (rgb = rgbstr_to_int32(c_colorval)) != -1L) |
| 164 | || !c_colorval) { |
| 165 | /* if the color 0 is an actual color, as opposed to just "not set" |
| 166 | we set a marker bit outside the 24-bit range to indicate a |
| 167 | valid color value 0. That allows valid color 0, but allows a |
| 168 | simple checking for 0 to detect "not set". The window port that |
no test coverage detected