nomenclature: glyphids
glyphids shall be known as glyphnames henceforth glyphid_cache shall be known as glyphname_hashtable
This commit is contained in:
+3
-3
@@ -6170,10 +6170,10 @@ U+224B and the color represented by R-G-B value 0-0-160:
|
|||||||
OPTIONS=glyph:G_pool/U+224B/0-0-160
|
OPTIONS=glyph:G_pool/U+224B/0-0-160
|
||||||
.ft
|
.ft
|
||||||
.ED
|
.ED
|
||||||
The list of acceptable glyphid's can be produced by
|
The list of acceptable glyphnames can be produced by
|
||||||
\fBnethack \-\-dumpglyphids\fP.
|
\fBnethack \-\-dumpglyphnames\fP.
|
||||||
Individual NetHack glyphs can be specified using the G_ prefix,
|
Individual NetHack glyphs can be specified using the G_ prefix,
|
||||||
or you can use an S_ symbol for a glyphid and store the custom
|
or you can use an S_ symbol for a glyphname and store the custom
|
||||||
representation for all NetHack glyphs that would map to that
|
representation for all NetHack glyphs that would map to that
|
||||||
particular symbol.
|
particular symbol.
|
||||||
.pg
|
.pg
|
||||||
|
|||||||
+3
-3
@@ -6769,12 +6769,12 @@ U+224B and the color represented by R-G-B value 0-0-160:\\
|
|||||||
OPTIONS=glyph:G_pool/U+224B/0-0-160
|
OPTIONS=glyph:G_pool/U+224B/0-0-160
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
The list of acceptable glyphid's can be produced by
|
The list of acceptable glyphnames can be produced by
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
nethack --glyphids
|
nethack --dumpglyphnames
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
Individual NetHack glyphs can be specified using the G\textunderscore prefix,
|
Individual NetHack glyphs can be specified using the G\textunderscore prefix,
|
||||||
or you can use an S\textunderscore symbol for a glyphid and store the custom
|
or you can use an S\textunderscore symbol for a glyphname and store the custom
|
||||||
representation for all NetHack glyphs that would map to that
|
representation for all NetHack glyphs that would map to that
|
||||||
particular symbol.
|
particular symbol.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -344,7 +344,7 @@ struct instance_globals_d {
|
|||||||
/* new */
|
/* new */
|
||||||
boolean deferred_showpaths;
|
boolean deferred_showpaths;
|
||||||
char *deferred_showpaths_dir;
|
char *deferred_showpaths_dir;
|
||||||
boolean disable_glyphid_cache_prefill;
|
boolean disable_glyphname_hashtable_prefill;
|
||||||
|
|
||||||
boolean havestate;
|
boolean havestate;
|
||||||
};
|
};
|
||||||
|
|||||||
+6
-6
@@ -1183,16 +1183,16 @@ int set_map_customcolor(glyph_map *gm, uint32 nhcolor) NONNULLARG1;
|
|||||||
extern int unicode_val(const char *);
|
extern int unicode_val(const char *);
|
||||||
extern int glyphrep(const char *) NONNULLARG1;
|
extern int glyphrep(const char *) NONNULLARG1;
|
||||||
extern int match_glyph(char *) NONNULLARG1;
|
extern int match_glyph(char *) NONNULLARG1;
|
||||||
extern void dump_all_glyphids(FILE *fp) NONNULLARG1;
|
extern void dump_all_glyphnames(FILE *fp) NONNULLARG1;
|
||||||
extern void wizcustom_glyphids(winid win);
|
extern void wizcustom_glyphnames(winid win);
|
||||||
extern void fill_glyphid_cache(void);
|
extern void populate_glyphname_hashtable(void);
|
||||||
extern void free_glyphid_cache(void);
|
extern void empty_glyphname_hashtable(void);
|
||||||
extern boolean glyphid_cache_status(void);
|
extern boolean glyphname_hashtable_loaded(void);
|
||||||
extern void apply_customizations(enum graphics_sets which_set,
|
extern void apply_customizations(enum graphics_sets which_set,
|
||||||
enum do_customizations docustomize);
|
enum do_customizations docustomize);
|
||||||
extern void purge_custom_entries(enum graphics_sets which_set);
|
extern void purge_custom_entries(enum graphics_sets which_set);
|
||||||
extern void purge_all_custom_entries(void);
|
extern void purge_all_custom_entries(void);
|
||||||
extern void dump_glyphids(void);
|
extern void dump_glyphnames(void);
|
||||||
extern void clear_all_glyphmap_colors(void);
|
extern void clear_all_glyphmap_colors(void);
|
||||||
extern void reset_customcolors(void);
|
extern void reset_customcolors(void);
|
||||||
extern int glyph_to_cmap(int);
|
extern int glyph_to_cmap(int);
|
||||||
|
|||||||
+2
-2
@@ -313,7 +313,7 @@ static const struct instance_globals_d g_init_d = {
|
|||||||
FALSE, /* decor_levitate_override */
|
FALSE, /* decor_levitate_override */
|
||||||
FALSE, /* deferred_showpaths */
|
FALSE, /* deferred_showpaths */
|
||||||
NULL, /* deferred_showpaths_dir */
|
NULL, /* deferred_showpaths_dir */
|
||||||
FALSE, /* disable_glyphid_cache_prefill */
|
FALSE, /* disable_glyphname_hashtable_prefill */
|
||||||
TRUE, /* havestate*/
|
TRUE, /* havestate*/
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1186,7 +1186,7 @@ decl_globals_init(void)
|
|||||||
gu.urole = urole_init_data;
|
gu.urole = urole_init_data;
|
||||||
gu.urace = urace_init_data;
|
gu.urace = urace_init_data;
|
||||||
#ifdef DISABLE_GLYPHID_CACHE_PREFILL
|
#ifdef DISABLE_GLYPHID_CACHE_PREFILL
|
||||||
gd.disable_glyphid_cache_prefill = TRUE;
|
gd.disable_glyphname_hashtable_prefill = TRUE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -40,7 +40,7 @@ static const struct early_opt earlyopts[] = {
|
|||||||
#ifndef NODUMPENUMS
|
#ifndef NODUMPENUMS
|
||||||
{ ARG_DUMPENUMS, "dumpenums", 9, FALSE },
|
{ ARG_DUMPENUMS, "dumpenums", 9, FALSE },
|
||||||
#endif
|
#endif
|
||||||
{ ARG_DUMPGLYPHIDS, "dumpglyphids", 12, FALSE },
|
{ ARG_DUMPGLYPHIDS, "dumpglyphnames", 12, FALSE },
|
||||||
{ ARG_DUMPMONGEN, "dumpmongen", 10, FALSE },
|
{ ARG_DUMPMONGEN, "dumpmongen", 10, FALSE },
|
||||||
{ ARG_DUMPWEIGHTS, "dumpweights", 11, FALSE },
|
{ ARG_DUMPWEIGHTS, "dumpweights", 11, FALSE },
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@@ -530,7 +530,7 @@ argcheck(int argc, char *argv[], enum earlyarg e_arg)
|
|||||||
return 2;
|
return 2;
|
||||||
#endif
|
#endif
|
||||||
case ARG_DUMPGLYPHIDS:
|
case ARG_DUMPGLYPHIDS:
|
||||||
dump_glyphids();
|
dump_glyphnames();
|
||||||
return 2;
|
return 2;
|
||||||
case ARG_DUMPMONGEN:
|
case ARG_DUMPMONGEN:
|
||||||
dump_mongen();
|
dump_mongen();
|
||||||
@@ -803,9 +803,9 @@ dump_enums(void)
|
|||||||
#endif /* NODUMPENUMS */
|
#endif /* NODUMPENUMS */
|
||||||
|
|
||||||
void
|
void
|
||||||
dump_glyphids(void)
|
dump_glyphnames(void)
|
||||||
{
|
{
|
||||||
dump_all_glyphids(stdout);
|
dump_all_glyphnames(stdout);
|
||||||
}
|
}
|
||||||
#endif /* !NODUMPENUMS */
|
#endif /* !NODUMPENUMS */
|
||||||
|
|
||||||
|
|||||||
+84
-84
@@ -11,7 +11,7 @@ extern struct enum_dump objdump[];
|
|||||||
|
|
||||||
#define Fprintf (void) fprintf
|
#define Fprintf (void) fprintf
|
||||||
|
|
||||||
enum reserved_activities { res_nothing, res_dump_glyphids, res_fill_cache };
|
enum reserved_activities { res_nothing, res_dump_glyphnames, res_fill_hashtable };
|
||||||
enum things_to_find { find_nothing, find_pm, find_oc, find_cmap, find_glyph };
|
enum things_to_find { find_nothing, find_pm, find_oc, find_cmap, find_glyph };
|
||||||
struct find_struct {
|
struct find_struct {
|
||||||
enum things_to_find findtype;
|
enum things_to_find findtype;
|
||||||
@@ -26,20 +26,20 @@ struct find_struct {
|
|||||||
genericptr_t reserved;
|
genericptr_t reserved;
|
||||||
};
|
};
|
||||||
static const struct find_struct zero_find = { 0 };
|
static const struct find_struct zero_find = { 0 };
|
||||||
struct glyphid_cache_t {
|
struct glyphname_hashtable_entry_t {
|
||||||
int glyphnum;
|
int glyphnum;
|
||||||
char *id;
|
char *id;
|
||||||
};
|
};
|
||||||
static struct glyphid_cache_t *glyphid_cache;
|
static struct glyphname_hashtable_entry_t *glyphname_hashtable_ptr;
|
||||||
static unsigned glyphid_cache_lsize;
|
static unsigned glyphname_hashtable_lsize;
|
||||||
static size_t glyphid_cache_size;
|
static size_t glyphname_hashtable_size;
|
||||||
static struct find_struct glyphcache_find, to_custom_symbol_find;
|
static struct find_struct glyphname_hashtable_find, to_custom_symbol_find;
|
||||||
static const long nonzero_black = CLR_BLACK | NH_BASIC_COLOR;
|
static const long nonzero_black = CLR_BLACK | NH_BASIC_COLOR;
|
||||||
|
|
||||||
staticfn void init_glyph_cache(void);
|
staticfn void init_glyphname_hashtable(void);
|
||||||
staticfn void add_glyph_to_cache(int glyphnum, const char *id);
|
staticfn void add_glyph_to_glyphname_hashtable(int glyphnum, const char *id);
|
||||||
staticfn int find_glyph_in_cache(const char *id);
|
staticfn int find_glyph_in_cache(const char *id);
|
||||||
staticfn char *find_glyphid_in_cache_by_glyphnum(int glyphnum);
|
staticfn char *find_glyphname_in_hashtable_by_glyphnum(int glyphnum);
|
||||||
staticfn uint32 glyph_hash(const char *id);
|
staticfn uint32 glyph_hash(const char *id);
|
||||||
staticfn void to_custom_symset_entry_callback(int glyph,
|
staticfn void to_custom_symset_entry_callback(int glyph,
|
||||||
struct find_struct *findwhat);
|
struct find_struct *findwhat);
|
||||||
@@ -114,18 +114,18 @@ glyphrep_to_custom_map_entries(
|
|||||||
int *glyphptr)
|
int *glyphptr)
|
||||||
{
|
{
|
||||||
to_custom_symbol_find = zero_find;
|
to_custom_symbol_find = zero_find;
|
||||||
char buf[BUFSZ], *c_glyphid, *c_unicode, *c_colorval, *cp;
|
char buf[BUFSZ], *c_glyphname, *c_unicode, *c_colorval, *cp;
|
||||||
int reslt = 0;
|
int reslt = 0;
|
||||||
long rgb = 0L;
|
long rgb = 0L;
|
||||||
boolean slash = FALSE, colon = FALSE;
|
boolean slash = FALSE, colon = FALSE;
|
||||||
|
|
||||||
if (!glyphid_cache)
|
if (!glyphname_hashtable_ptr)
|
||||||
reslt = 1; /* for debugger use only; no cache available */
|
reslt = 1; /* for debugger use only; no cache available */
|
||||||
nhUse(reslt);
|
nhUse(reslt);
|
||||||
|
|
||||||
Snprintf(buf, sizeof buf, "%s", op);
|
Snprintf(buf, sizeof buf, "%s", op);
|
||||||
c_unicode = c_colorval = (char *) 0;
|
c_unicode = c_colorval = (char *) 0;
|
||||||
c_glyphid = cp = buf;
|
c_glyphname = cp = buf;
|
||||||
while (*cp) {
|
while (*cp) {
|
||||||
if (*cp == ':' || *cp == '/') {
|
if (*cp == ':' || *cp == '/') {
|
||||||
if (*cp == ':') {
|
if (*cp == ':') {
|
||||||
@@ -148,8 +148,8 @@ glyphrep_to_custom_map_entries(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* some sanity checks */
|
/* some sanity checks */
|
||||||
if (c_glyphid && *c_glyphid == ' ')
|
if (c_glyphname && *c_glyphname == ' ')
|
||||||
c_glyphid++;
|
c_glyphname++;
|
||||||
if (c_colorval && *c_colorval == ' ')
|
if (c_colorval && *c_colorval == ' ')
|
||||||
c_colorval++;
|
c_colorval++;
|
||||||
if (c_unicode && *c_unicode == ' ') {
|
if (c_unicode && *c_unicode == ' ') {
|
||||||
@@ -176,7 +176,7 @@ glyphrep_to_custom_map_entries(
|
|||||||
to_custom_symbol_find.unicode_val = c_unicode;
|
to_custom_symbol_find.unicode_val = c_unicode;
|
||||||
to_custom_symbol_find.extraval = glyphptr;
|
to_custom_symbol_find.extraval = glyphptr;
|
||||||
to_custom_symbol_find.callback = to_custom_symset_entry_callback;
|
to_custom_symbol_find.callback = to_custom_symset_entry_callback;
|
||||||
reslt = glyph_find_core(c_glyphid, &to_custom_symbol_find);
|
reslt = glyph_find_core(c_glyphname, &to_custom_symbol_find);
|
||||||
return reslt;
|
return reslt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,22 +300,22 @@ glyph_find_core(
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
fill_glyphid_cache(void)
|
populate_glyphname_hashtable(void)
|
||||||
{
|
{
|
||||||
int reslt = 0;
|
int reslt = 0;
|
||||||
|
|
||||||
if (!glyphid_cache) {
|
if (!glyphname_hashtable_ptr) {
|
||||||
init_glyph_cache();
|
init_glyphname_hashtable();
|
||||||
}
|
}
|
||||||
if (glyphid_cache) {
|
if (glyphname_hashtable_ptr) {
|
||||||
glyphcache_find = zero_find;
|
glyphname_hashtable_find = zero_find;
|
||||||
glyphcache_find.findtype = find_nothing;
|
glyphname_hashtable_find.findtype = find_nothing;
|
||||||
glyphcache_find.reserved = (genericptr_t) glyphid_cache;
|
glyphname_hashtable_find.reserved = (genericptr_t) glyphname_hashtable_ptr;
|
||||||
glyphcache_find.restype = res_fill_cache;
|
glyphname_hashtable_find.restype = res_fill_hashtable;
|
||||||
reslt = parse_id((char *) 0, &glyphcache_find);
|
reslt = parse_id((char *) 0, &glyphname_hashtable_find);
|
||||||
if (!reslt) {
|
if (!reslt) {
|
||||||
free_glyphid_cache();
|
empty_glyphname_hashtable();
|
||||||
glyphid_cache = (struct glyphid_cache_t *) 0;
|
glyphname_hashtable_ptr = (struct glyphname_hashtable_entry_t *) 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -331,101 +331,101 @@ fill_glyphid_cache(void)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
staticfn void
|
staticfn void
|
||||||
init_glyph_cache(void)
|
init_glyphname_hashtable(void)
|
||||||
{
|
{
|
||||||
size_t glyph;
|
size_t glyph;
|
||||||
|
|
||||||
/* Cache size of power of 2 not less than 2*MAX_GLYPH */
|
/* Cache size of power of 2 not less than 2*MAX_GLYPH */
|
||||||
glyphid_cache_lsize = 0;
|
glyphname_hashtable_lsize = 0;
|
||||||
glyphid_cache_size = 1;
|
glyphname_hashtable_size = 1;
|
||||||
while (glyphid_cache_size < 2*MAX_GLYPH) {
|
while (glyphname_hashtable_size < 2*MAX_GLYPH) {
|
||||||
++glyphid_cache_lsize;
|
++glyphname_hashtable_lsize;
|
||||||
glyphid_cache_size <<= 1;
|
glyphname_hashtable_size <<= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
glyphid_cache = (struct glyphid_cache_t *) alloc(
|
glyphname_hashtable_ptr = (struct glyphname_hashtable_entry_t *) alloc(
|
||||||
glyphid_cache_size * sizeof (struct glyphid_cache_t));
|
glyphname_hashtable_size * sizeof (struct glyphname_hashtable_entry_t));
|
||||||
for (glyph = 0; glyph < glyphid_cache_size; ++glyph) {
|
for (glyph = 0; glyph < glyphname_hashtable_size; ++glyph) {
|
||||||
glyphid_cache[glyph].glyphnum = 0;
|
glyphname_hashtable_ptr[glyph].glyphnum = 0;
|
||||||
glyphid_cache[glyph].id = (char *) 0;
|
glyphname_hashtable_ptr[glyph].id = (char *) 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
free_glyphid_cache(void)
|
empty_glyphname_hashtable(void)
|
||||||
{
|
{
|
||||||
size_t idx;
|
size_t idx;
|
||||||
|
|
||||||
if (!glyphid_cache)
|
if (!glyphname_hashtable_ptr)
|
||||||
return;
|
return;
|
||||||
for (idx = 0; idx < glyphid_cache_size; ++idx) {
|
for (idx = 0; idx < glyphname_hashtable_size; ++idx) {
|
||||||
if (glyphid_cache[idx].id) {
|
if (glyphname_hashtable_ptr[idx].id) {
|
||||||
free(glyphid_cache[idx].id);
|
free(glyphname_hashtable_ptr[idx].id);
|
||||||
glyphid_cache[idx].id = (char *) 0;
|
glyphname_hashtable_ptr[idx].id = (char *) 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(glyphid_cache);
|
free(glyphname_hashtable_ptr);
|
||||||
glyphid_cache = (struct glyphid_cache_t *) 0;
|
glyphname_hashtable_ptr = (struct glyphname_hashtable_entry_t *) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
staticfn void
|
staticfn void
|
||||||
add_glyph_to_cache(int glyphnum, const char *id)
|
add_glyph_to_glyphname_hashtable(int glyphnum, const char *id)
|
||||||
{
|
{
|
||||||
uint32 hash = glyph_hash(id);
|
uint32 hash = glyph_hash(id);
|
||||||
size_t hash1 = (size_t) (hash & (glyphid_cache_size - 1));
|
size_t hash1 = (size_t) (hash & (glyphname_hashtable_size - 1));
|
||||||
size_t hash2 = (size_t)
|
size_t hash2 = (size_t)
|
||||||
(((hash >> glyphid_cache_lsize) & (glyphid_cache_size - 1)) | 1);
|
(((hash >> glyphname_hashtable_lsize) & (glyphname_hashtable_size - 1)) | 1);
|
||||||
size_t i = hash1;
|
size_t i = hash1;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (glyphid_cache[i].id == NULL) {
|
if (glyphname_hashtable_ptr[i].id == NULL) {
|
||||||
/* Empty bucket found */
|
/* Empty bucket found */
|
||||||
glyphid_cache[i].id = dupstr(id);
|
glyphname_hashtable_ptr[i].id = dupstr(id);
|
||||||
glyphid_cache[i].glyphnum = glyphnum;
|
glyphname_hashtable_ptr[i].glyphnum = glyphnum;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* For speed, assume that no ID occurs twice */
|
/* For speed, assume that no ID occurs twice */
|
||||||
i = (i + hash2) & (glyphid_cache_size - 1);
|
i = (i + hash2) & (glyphname_hashtable_size - 1);
|
||||||
} while (i != hash1);
|
} while (i != hash1);
|
||||||
/* This should never happen */
|
/* This should never happen */
|
||||||
panic("glyphid_cache full");
|
panic("glyphname_hashtable_ptr full");
|
||||||
}
|
}
|
||||||
|
|
||||||
staticfn int
|
staticfn int
|
||||||
find_glyph_in_cache(const char *id)
|
find_glyph_in_cache(const char *id)
|
||||||
{
|
{
|
||||||
uint32 hash = glyph_hash(id);
|
uint32 hash = glyph_hash(id);
|
||||||
size_t hash1 = (size_t) (hash & (glyphid_cache_size - 1));
|
size_t hash1 = (size_t) (hash & (glyphname_hashtable_size - 1));
|
||||||
size_t hash2 = (size_t)
|
size_t hash2 = (size_t)
|
||||||
(((hash >> glyphid_cache_lsize) & (glyphid_cache_size - 1)) | 1);
|
(((hash >> glyphname_hashtable_lsize) & (glyphname_hashtable_size - 1)) | 1);
|
||||||
size_t i = hash1;
|
size_t i = hash1;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (glyphid_cache[i].id == NULL) {
|
if (glyphname_hashtable_ptr[i].id == NULL) {
|
||||||
/* Empty bucket found */
|
/* Empty bucket found */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (strcmpi(id, glyphid_cache[i].id) == 0) {
|
if (strcmpi(id, glyphname_hashtable_ptr[i].id) == 0) {
|
||||||
/* Match found */
|
/* Match found */
|
||||||
return glyphid_cache[i].glyphnum;
|
return glyphname_hashtable_ptr[i].glyphnum;
|
||||||
}
|
}
|
||||||
i = (i + hash2) & (glyphid_cache_size - 1);
|
i = (i + hash2) & (glyphname_hashtable_size - 1);
|
||||||
} while (i != hash1);
|
} while (i != hash1);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
staticfn char *
|
staticfn char *
|
||||||
find_glyphid_in_cache_by_glyphnum(int glyphnum)
|
find_glyphname_in_hashtable_by_glyphnum(int glyphnum)
|
||||||
{
|
{
|
||||||
size_t idx;
|
size_t idx;
|
||||||
|
|
||||||
if (!glyphid_cache)
|
if (!glyphname_hashtable_ptr)
|
||||||
return (char *) 0;
|
return (char *) 0;
|
||||||
for (idx = 0; idx < glyphid_cache_size; ++idx) {
|
for (idx = 0; idx < glyphname_hashtable_size; ++idx) {
|
||||||
if (glyphid_cache[idx].glyphnum == glyphnum
|
if (glyphname_hashtable_ptr[idx].glyphnum == glyphnum
|
||||||
&& glyphid_cache[idx].id != 0) {
|
&& glyphname_hashtable_ptr[idx].id != 0) {
|
||||||
/* Match found */
|
/* Match found */
|
||||||
return glyphid_cache[idx].id;
|
return glyphname_hashtable_ptr[idx].id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (char *) 0;
|
return (char *) 0;
|
||||||
@@ -449,9 +449,9 @@ glyph_hash(const char *id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
glyphid_cache_status(void)
|
glyphname_hashtable_loaded(void)
|
||||||
{
|
{
|
||||||
return (glyphid_cache != 0);
|
return (glyphname_hashtable_ptr != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -471,7 +471,7 @@ glyphrep(const char *op)
|
|||||||
{
|
{
|
||||||
int reslt = 0, glyph = NO_GLYPH;
|
int reslt = 0, glyph = NO_GLYPH;
|
||||||
|
|
||||||
if (!glyphid_cache)
|
if (!glyphname_hashtable_ptr)
|
||||||
reslt = 1; /* for debugger use only; no cache available */
|
reslt = 1; /* for debugger use only; no cache available */
|
||||||
nhUse(reslt);
|
nhUse(reslt);
|
||||||
reslt = glyphrep_to_custom_map_entries(op, &glyph);
|
reslt = glyphrep_to_custom_map_entries(op, &glyph);
|
||||||
@@ -794,26 +794,26 @@ purge_custom_entries(enum graphics_sets which_set)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dump_all_glyphids(FILE *fp)
|
dump_all_glyphnames(FILE *fp)
|
||||||
{
|
{
|
||||||
struct find_struct dump_glyphid_find = zero_find;
|
struct find_struct dump_glyphname_find = zero_find;
|
||||||
|
|
||||||
dump_glyphid_find.findtype = find_nothing;
|
dump_glyphname_find.findtype = find_nothing;
|
||||||
dump_glyphid_find.reserved = (genericptr_t) fp;
|
dump_glyphname_find.reserved = (genericptr_t) fp;
|
||||||
dump_glyphid_find.restype = res_dump_glyphids;
|
dump_glyphname_find.restype = res_dump_glyphnames;
|
||||||
(void) parse_id((char *) 0, &dump_glyphid_find);
|
(void) parse_id((char *) 0, &dump_glyphname_find);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wizcustom_glyphids(winid win)
|
wizcustom_glyphnames(winid win)
|
||||||
{
|
{
|
||||||
int glyphnum;
|
int glyphnum;
|
||||||
char *id;
|
char *id;
|
||||||
|
|
||||||
if (!glyphid_cache)
|
if (!glyphname_hashtable_ptr)
|
||||||
return;
|
return;
|
||||||
for (glyphnum = 0; glyphnum < MAX_GLYPH; ++glyphnum) {
|
for (glyphnum = 0; glyphnum < MAX_GLYPH; ++glyphnum) {
|
||||||
id = find_glyphid_in_cache_by_glyphnum(glyphnum);
|
id = find_glyphname_in_hashtable_by_glyphnum(glyphnum);
|
||||||
if (id) {
|
if (id) {
|
||||||
wizcustom_callback(win, glyphnum, id);
|
wizcustom_callback(win, glyphnum, id);
|
||||||
}
|
}
|
||||||
@@ -834,7 +834,7 @@ parse_id(
|
|||||||
char buf[4][QBUFSZ];
|
char buf[4][QBUFSZ];
|
||||||
|
|
||||||
if (findwhat->findtype == find_nothing && findwhat->restype) {
|
if (findwhat->findtype == find_nothing && findwhat->restype) {
|
||||||
if (findwhat->restype == res_dump_glyphids) {
|
if (findwhat->restype == res_dump_glyphnames) {
|
||||||
if (findwhat->reserved) {
|
if (findwhat->reserved) {
|
||||||
fp = (FILE *) findwhat->reserved;
|
fp = (FILE *) findwhat->reserved;
|
||||||
dump_ids = TRUE;
|
dump_ids = TRUE;
|
||||||
@@ -842,9 +842,9 @@ parse_id(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (findwhat->restype == res_fill_cache) {
|
if (findwhat->restype == res_fill_hashtable) {
|
||||||
if (findwhat->reserved
|
if (findwhat->reserved
|
||||||
&& findwhat->reserved == (genericptr_t) glyphid_cache) {
|
&& findwhat->reserved == (genericptr_t) glyphname_hashtable_ptr) {
|
||||||
filling_cache = TRUE;
|
filling_cache = TRUE;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -855,7 +855,7 @@ parse_id(
|
|||||||
is_G = (id && id[0] == 'G' && id[1] == '_');
|
is_G = (id && id[0] == 'G' && id[1] == '_');
|
||||||
is_S = (id && id[0] == 'S' && id[1] == '_');
|
is_S = (id && id[0] == 'S' && id[1] == '_');
|
||||||
|
|
||||||
if ((is_G && !glyphid_cache) || filling_cache || dump_ids || is_S) {
|
if ((is_G && !glyphname_hashtable_ptr) || filling_cache || dump_ids || is_S) {
|
||||||
while (loadsyms[i].range) {
|
while (loadsyms[i].range) {
|
||||||
if (!pm_offset && loadsyms[i].range == SYM_MON)
|
if (!pm_offset && loadsyms[i].range == SYM_MON)
|
||||||
pm_offset = i;
|
pm_offset = i;
|
||||||
@@ -873,7 +873,7 @@ parse_id(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (is_G || filling_cache || dump_ids) {
|
if (is_G || filling_cache || dump_ids) {
|
||||||
if (!filling_cache && id && glyphid_cache) {
|
if (!filling_cache && id && glyphname_hashtable_ptr) {
|
||||||
int val = find_glyph_in_cache(id);
|
int val = find_glyph_in_cache(id);
|
||||||
if (val >= 0) {
|
if (val >= 0) {
|
||||||
findwhat->findtype = find_glyph;
|
findwhat->findtype = find_glyph;
|
||||||
@@ -1112,7 +1112,7 @@ parse_id(
|
|||||||
if (dump_ids) {
|
if (dump_ids) {
|
||||||
Fprintf(fp, "(%04d) %s\n", glyph, buf[0]);
|
Fprintf(fp, "(%04d) %s\n", glyph, buf[0]);
|
||||||
} else if (filling_cache) {
|
} else if (filling_cache) {
|
||||||
add_glyph_to_cache(glyph, buf[0]);
|
add_glyph_to_glyphname_hashtable(glyph, buf[0]);
|
||||||
} else if (id) {
|
} else if (id) {
|
||||||
if (!strcmpi(id, buf[0])) {
|
if (!strcmpi(id, buf[0])) {
|
||||||
findwhat->findtype = find_glyph;
|
findwhat->findtype = find_glyph;
|
||||||
@@ -1123,7 +1123,7 @@ parse_id(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} /* not glyphid_cache */
|
} /* not glyphname_hashtable_ptr */
|
||||||
} else if (is_S) {
|
} else if (is_S) {
|
||||||
/* cmap entries */
|
/* cmap entries */
|
||||||
for (i = 0; i < cmap_count; ++i) {
|
for (i = 0; i < cmap_count; ++i) {
|
||||||
|
|||||||
+9
-9
@@ -4224,11 +4224,11 @@ optfn_symset(
|
|||||||
if (req == do_handler) {
|
if (req == do_handler) {
|
||||||
int reslt;
|
int reslt;
|
||||||
|
|
||||||
if (!glyphid_cache_status())
|
if (!glyphname_hashtable_loaded())
|
||||||
fill_glyphid_cache();
|
populate_glyphname_hashtable();
|
||||||
reslt = handler_symset(optidx);
|
reslt = handler_symset(optidx);
|
||||||
if (glyphid_cache_status())
|
if (glyphname_hashtable_loaded())
|
||||||
free_glyphid_cache();
|
empty_glyphname_hashtable();
|
||||||
/* apply_customizations(gc.currentgraphics,
|
/* apply_customizations(gc.currentgraphics,
|
||||||
(do_custom_colors | do_custom_symbols)); */
|
(do_custom_colors | do_custom_symbols)); */
|
||||||
return reslt;
|
return reslt;
|
||||||
@@ -7152,9 +7152,9 @@ initoptions_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* make any symbol parsing quicker, but only if
|
/* make any symbol parsing quicker, but only if
|
||||||
* gd.disable_glyphid_cache_prefill is not set to TRUE */
|
* gd.disable_glyphname_hashtable_prefill is not set to TRUE */
|
||||||
if (!glyphid_cache_status() && !gd.disable_glyphid_cache_prefill)
|
if (!glyphname_hashtable_loaded() && !gd.disable_glyphname_hashtable_prefill)
|
||||||
fill_glyphid_cache();
|
populate_glyphname_hashtable();
|
||||||
|
|
||||||
/* set up the command parsing */
|
/* set up the command parsing */
|
||||||
reset_commands(TRUE); /* init */
|
reset_commands(TRUE); /* init */
|
||||||
@@ -7377,8 +7377,8 @@ initoptions_finish(void)
|
|||||||
iflags.wc_ascii_map = FALSE, iflags.wc_tiled_map = TRUE;
|
iflags.wc_ascii_map = FALSE, iflags.wc_tiled_map = TRUE;
|
||||||
|
|
||||||
#ifdef ENHANCED_SYMBOLS
|
#ifdef ENHANCED_SYMBOLS
|
||||||
if (glyphid_cache_status())
|
if (glyphname_hashtable_loaded())
|
||||||
free_glyphid_cache();
|
empty_glyphname_hashtable();
|
||||||
apply_customizations(gc.currentgraphics,
|
apply_customizations(gc.currentgraphics,
|
||||||
do_custom_symbols | do_custom_colors);
|
do_custom_symbols | do_custom_colors);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+2
-2
@@ -1175,8 +1175,8 @@ freedynamicdata(void)
|
|||||||
if (options_set_window_colors_flag)
|
if (options_set_window_colors_flag)
|
||||||
options_free_window_colors();
|
options_free_window_colors();
|
||||||
|
|
||||||
if (glyphid_cache_status())
|
if (glyphname_hashtable_loaded())
|
||||||
free_glyphid_cache();
|
empty_glyphname_hashtable();
|
||||||
|
|
||||||
if (tnhfp) {
|
if (tnhfp) {
|
||||||
close_nhfile(tnhfp);
|
close_nhfile(tnhfp);
|
||||||
|
|||||||
+4
-4
@@ -1069,12 +1069,12 @@ do_symset(boolean rogueflag)
|
|||||||
if (gs.symset[which_set].name) {
|
if (gs.symset[which_set].name) {
|
||||||
/* non-default symbols */
|
/* non-default symbols */
|
||||||
int ok;
|
int ok;
|
||||||
if (!glyphid_cache_status()) {
|
if (!glyphname_hashtable_loaded()) {
|
||||||
fill_glyphid_cache();
|
populate_glyphname_hashtable();
|
||||||
}
|
}
|
||||||
ok = read_sym_file(which_set);
|
ok = read_sym_file(which_set);
|
||||||
if (glyphid_cache_status()) {
|
if (glyphname_hashtable_loaded()) {
|
||||||
free_glyphid_cache();
|
empty_glyphname_hashtable();
|
||||||
}
|
}
|
||||||
if (ok) {
|
if (ok) {
|
||||||
ready_to_switch = TRUE;
|
ready_to_switch = TRUE;
|
||||||
|
|||||||
+5
-5
@@ -1945,8 +1945,8 @@ wiz_custom(void)
|
|||||||
#endif
|
#endif
|
||||||
menu_item *pick_list = (menu_item *) 0;
|
menu_item *pick_list = (menu_item *) 0;
|
||||||
|
|
||||||
if (!glyphid_cache_status())
|
if (!glyphname_hashtable_loaded())
|
||||||
fill_glyphid_cache();
|
populate_glyphname_hashtable();
|
||||||
|
|
||||||
win = create_nhwindow(NHW_MENU);
|
win = create_nhwindow(NHW_MENU);
|
||||||
start_menu(win, MENU_BEHAVE_STANDARD);
|
start_menu(win, MENU_BEHAVE_STANDARD);
|
||||||
@@ -1964,7 +1964,7 @@ wiz_custom(void)
|
|||||||
known_handling[gs.symset[PRIMARYSET].handling]);
|
known_handling[gs.symset[PRIMARYSET].handling]);
|
||||||
}
|
}
|
||||||
Sprintf(buf, "%s", bufa);
|
Sprintf(buf, "%s", bufa);
|
||||||
wizcustom_glyphids(win);
|
wizcustom_glyphnames(win);
|
||||||
end_menu(win, bufa);
|
end_menu(win, bufa);
|
||||||
n = select_menu(win, PICK_NONE, &pick_list);
|
n = select_menu(win, PICK_NONE, &pick_list);
|
||||||
destroy_nhwindow(win);
|
destroy_nhwindow(win);
|
||||||
@@ -1975,8 +1975,8 @@ wiz_custom(void)
|
|||||||
#endif
|
#endif
|
||||||
if (n >= 1)
|
if (n >= 1)
|
||||||
free((genericptr_t) pick_list);
|
free((genericptr_t) pick_list);
|
||||||
if (glyphid_cache_status())
|
if (glyphname_hashtable_loaded())
|
||||||
free_glyphid_cache();
|
empty_glyphname_hashtable();
|
||||||
docrt();
|
docrt();
|
||||||
} else
|
} else
|
||||||
pline(unavailcmd, ecname_from_fn(wiz_custom));
|
pline(unavailcmd, ecname_from_fn(wiz_custom));
|
||||||
|
|||||||
Reference in New Issue
Block a user