| 50 | /* staticfn void purge_custom_entries(enum graphics_sets which_set); */ |
| 51 | |
| 52 | staticfn void |
| 53 | to_custom_symset_entry_callback( |
| 54 | int glyph, |
| 55 | struct find_struct *findwhat) |
| 56 | { |
| 57 | int idx = gs.symset_which_set; |
| 58 | #ifdef ENHANCED_SYMBOLS |
| 59 | uint8 utf8str[6] = { 0, 0, 0, 0, 0, 0 }; |
| 60 | int uval = 0; |
| 61 | #endif |
| 62 | |
| 63 | if (findwhat->extraval) |
| 64 | *findwhat->extraval = glyph; |
| 65 | |
| 66 | assert(idx >= 0 && idx < NUM_GRAPHICS); |
| 67 | #ifdef ENHANCED_SYMBOLS |
| 68 | if (findwhat->unicode_val) |
| 69 | uval = unicode_val(findwhat->unicode_val); |
| 70 | if (uval && unicodeval_to_utf8str(uval, utf8str, sizeof utf8str)) { |
| 71 | /* presently the customizations are affiliated with a particular |
| 72 | * symset but if we don't have any symset context, ignore it for now |
| 73 | * in order to avoid a segfault. |
| 74 | * FIXME: |
| 75 | * One future idea might be to store the U+ entries under "UTF8" |
| 76 | * and apply those customizations to any current symset if it has |
| 77 | * a UTF8 handler. Similar approach for unaffiliated glyph/symbols |
| 78 | * non-UTF color customizations |
| 79 | */ |
| 80 | if (gs.symset[idx].name) { |
| 81 | add_custom_urep_entry(gs.symset[idx].name, glyph, uval, |
| 82 | utf8str, gs.symset_which_set); |
| 83 | } else { |
| 84 | static int glyphnag = 0; |
| 85 | |
| 86 | if (!glyphnag++) |
| 87 | config_error_add("Unimplemented customization feature," |
| 88 | " ignoring for now"); |
| 89 | } |
| 90 | } |
| 91 | #endif |
| 92 | if (findwhat->color) { |
| 93 | if (gs.symset[idx].name) { |
| 94 | add_custom_nhcolor_entry(gs.symset[idx].name, glyph, |
| 95 | findwhat->color, gs.symset_which_set); |
| 96 | } else { |
| 97 | static int colornag = 0; |
| 98 | |
| 99 | if (!colornag++) |
| 100 | config_error_add("Unimplemented customization feature," |
| 101 | " ignoring for now"); |
| 102 | } |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | /* |
| 107 | * Return value: |
nothing calls this directly
no test coverage detected