symbols tweaks
Mostly formatting but a couple of minor code changes too.
This commit is contained in:
+2
-2
@@ -3475,8 +3475,8 @@ read_wizkit(void)
|
|||||||
|
|
||||||
/* ---------- BEGIN SYMSET FILE HANDLING ----------- */
|
/* ---------- BEGIN SYMSET FILE HANDLING ----------- */
|
||||||
|
|
||||||
extern const char *known_handling[]; /* symbols.c */
|
extern const char *const known_handling[]; /* symbols.c */
|
||||||
extern const char *known_restrictions[]; /* symbols.c */
|
extern const char *const known_restrictions[]; /* symbols.c */
|
||||||
|
|
||||||
static
|
static
|
||||||
FILE *
|
FILE *
|
||||||
|
|||||||
+14
-7
@@ -3455,12 +3455,16 @@ optfn_suppress_alert(int optidx, int req, boolean negated,
|
|||||||
return optn_ok;
|
return optn_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern const char *known_handling[]; /* symbols.c */
|
extern const char *const known_handling[]; /* symbols.c */
|
||||||
extern const char *known_restrictions[]; /* symbols.c */
|
extern const char *const known_restrictions[]; /* symbols.c */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
optfn_symset(int optidx UNUSED, int req, boolean negated UNUSED, char *opts,
|
optfn_symset(
|
||||||
char *op)
|
int optidx UNUSED,
|
||||||
|
int req,
|
||||||
|
boolean negated UNUSED,
|
||||||
|
char *opts,
|
||||||
|
char *op)
|
||||||
{
|
{
|
||||||
if (req == do_init) {
|
if (req == do_init) {
|
||||||
return optn_ok;
|
return optn_ok;
|
||||||
@@ -3478,7 +3482,8 @@ optfn_symset(int optidx UNUSED, int req, boolean negated UNUSED, char *opts,
|
|||||||
if (g.symset[PRIMARYSET].handling) {
|
if (g.symset[PRIMARYSET].handling) {
|
||||||
#ifndef ENHANCED_SYMBOLS
|
#ifndef ENHANCED_SYMBOLS
|
||||||
if (g.symset[PRIMARYSET].handling == H_UTF8) {
|
if (g.symset[PRIMARYSET].handling == H_UTF8) {
|
||||||
config_error_add("Unavailable symset handler \"%s\" for %s",
|
config_error_add(
|
||||||
|
"Unavailable symset handler \"%s\" for %s",
|
||||||
known_handling[H_UTF8], op);
|
known_handling[H_UTF8], op);
|
||||||
load_symset("default", PRIMARYSET);
|
load_symset("default", PRIMARYSET);
|
||||||
}
|
}
|
||||||
@@ -3495,7 +3500,8 @@ optfn_symset(int optidx UNUSED, int req, boolean negated UNUSED, char *opts,
|
|||||||
if (!opts)
|
if (!opts)
|
||||||
return optn_err;
|
return optn_err;
|
||||||
Sprintf(opts, "%s",
|
Sprintf(opts, "%s",
|
||||||
g.symset[PRIMARYSET].name ? g.symset[PRIMARYSET].name : "default");
|
g.symset[PRIMARYSET].name ? g.symset[PRIMARYSET].name
|
||||||
|
: "default");
|
||||||
if (g.currentgraphics == PRIMARYSET && g.symset[PRIMARYSET].name)
|
if (g.currentgraphics == PRIMARYSET && g.symset[PRIMARYSET].name)
|
||||||
Strcat(opts, ", active");
|
Strcat(opts, ", active");
|
||||||
if (g.symset[PRIMARYSET].handling) {
|
if (g.symset[PRIMARYSET].handling) {
|
||||||
@@ -3508,7 +3514,8 @@ optfn_symset(int optidx UNUSED, int req, boolean negated UNUSED, char *opts,
|
|||||||
if (!opts)
|
if (!opts)
|
||||||
return optn_err;
|
return optn_err;
|
||||||
Sprintf(opts, "%s",
|
Sprintf(opts, "%s",
|
||||||
g.symset[PRIMARYSET].name ? g.symset[PRIMARYSET].name : "default");
|
g.symset[PRIMARYSET].name ? g.symset[PRIMARYSET].name
|
||||||
|
: "default");
|
||||||
return optn_ok;
|
return optn_ok;
|
||||||
}
|
}
|
||||||
if (req == do_handler) {
|
if (req == do_handler) {
|
||||||
|
|||||||
+39
-24
@@ -7,7 +7,9 @@
|
|||||||
|
|
||||||
static void savedsym_add(const char *, const char *, int);
|
static void savedsym_add(const char *, const char *, int);
|
||||||
static struct _savedsym *savedsym_find(const char *, int);
|
static struct _savedsym *savedsym_find(const char *, int);
|
||||||
void purge_custom_entries(enum graphics_sets which_set);
|
#ifdef ENHANCED_SYMBOLS
|
||||||
|
static void purge_custom_entries(enum graphics_sets which_set);
|
||||||
|
#endif
|
||||||
|
|
||||||
extern const uchar def_r_oc_syms[MAXOCLASSES]; /* drawing.c */
|
extern const uchar def_r_oc_syms[MAXOCLASSES]; /* drawing.c */
|
||||||
|
|
||||||
@@ -27,10 +29,10 @@ void (*ibmgraphics_mode_callback)(void) = 0;
|
|||||||
#endif
|
#endif
|
||||||
#ifdef ENHANCED_SYMBOLS
|
#ifdef ENHANCED_SYMBOLS
|
||||||
void (*utf8graphics_mode_callback)(void) = 0; /* set in tty_start_screen and
|
void (*utf8graphics_mode_callback)(void) = 0; /* set in tty_start_screen and
|
||||||
found in unixtty, windtty, etc */
|
* found in unixtty,windtty,&c */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Explanations of the functions found below:
|
* Explanations of the functions found below:
|
||||||
*
|
*
|
||||||
* init_symbols()
|
* init_symbols()
|
||||||
@@ -136,10 +138,10 @@ get_othersym(int idx, int which_set)
|
|||||||
|
|
||||||
if (which_set == ROGUESET)
|
if (which_set == ROGUESET)
|
||||||
sym = g.ov_rogue_syms[oidx] ? g.ov_rogue_syms[oidx]
|
sym = g.ov_rogue_syms[oidx] ? g.ov_rogue_syms[oidx]
|
||||||
: g.rogue_syms[oidx];
|
: g.rogue_syms[oidx];
|
||||||
else
|
else
|
||||||
sym = g.ov_primary_syms[oidx] ? g.ov_primary_syms[oidx]
|
sym = g.ov_primary_syms[oidx] ? g.ov_primary_syms[oidx]
|
||||||
: g.primary_syms[oidx];
|
: g.primary_syms[oidx];
|
||||||
if (!sym) {
|
if (!sym) {
|
||||||
switch(idx) {
|
switch(idx) {
|
||||||
case SYM_NOTHING:
|
case SYM_NOTHING:
|
||||||
@@ -194,7 +196,8 @@ init_rogue_symbols(void)
|
|||||||
|
|
||||||
for (i = 0; i < MAXPCHARS; i++)
|
for (i = 0; i < MAXPCHARS; i++)
|
||||||
g.rogue_syms[i + SYM_OFF_P] = defsyms[i].sym;
|
g.rogue_syms[i + SYM_OFF_P] = defsyms[i].sym;
|
||||||
g.rogue_syms[S_vodoor] = g.rogue_syms[S_hodoor] = g.rogue_syms[S_ndoor] = '+';
|
g.rogue_syms[S_vodoor] = g.rogue_syms[S_hodoor]
|
||||||
|
= g.rogue_syms[S_ndoor] = '+';
|
||||||
g.rogue_syms[S_upstair] = g.rogue_syms[S_dnstair] = '%';
|
g.rogue_syms[S_upstair] = g.rogue_syms[S_dnstair] = '%';
|
||||||
|
|
||||||
for (i = 0; i < MAXOCLASSES; i++)
|
for (i = 0; i < MAXOCLASSES; i++)
|
||||||
@@ -257,7 +260,7 @@ switch_symbols(int nondefault)
|
|||||||
if (nondefault) {
|
if (nondefault) {
|
||||||
for (i = 0; i < SYM_MAX; i++)
|
for (i = 0; i < SYM_MAX; i++)
|
||||||
g.showsyms[i] = g.ov_primary_syms[i] ? g.ov_primary_syms[i]
|
g.showsyms[i] = g.ov_primary_syms[i] ? g.ov_primary_syms[i]
|
||||||
: g.primary_syms[i];
|
: g.primary_syms[i];
|
||||||
#ifdef PC9800
|
#ifdef PC9800
|
||||||
if (SYMHANDLING(H_IBM) && ibmgraphics_mode_callback)
|
if (SYMHANDLING(H_IBM) && ibmgraphics_mode_callback)
|
||||||
(*ibmgraphics_mode_callback)();
|
(*ibmgraphics_mode_callback)();
|
||||||
@@ -339,26 +342,31 @@ clear_symsetentry(int which_set, boolean name_too)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean symset_is_compatible(enum symset_handling_types handling, unsigned long wincap2)
|
/* called from windmain.c */
|
||||||
|
boolean
|
||||||
|
symset_is_compatible(
|
||||||
|
enum symset_handling_types handling,
|
||||||
|
unsigned long wincap2)
|
||||||
{
|
{
|
||||||
#ifdef ENHANCED_SYMBOLS
|
#ifdef ENHANCED_SYMBOLS
|
||||||
if ((handling == H_UTF8) &&
|
#define WC2_utf8_bits (WC2_U_UTF8STR | WC2_U_24BITCOLOR)
|
||||||
(((wincap2 & WC2_U_UTF8STR) == 0)
|
if (handling == H_UTF8 && ((wincap2 & WC2_utf8_bits) != WC2_utf8_bits))
|
||||||
|| ((wincap2 & WC2_U_24BITCOLOR) == 0)))
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
#undef WC2_bits
|
||||||
#else
|
#else
|
||||||
nhUse(handling);
|
nhUse(handling);
|
||||||
nhUse(wincap2);
|
nhUse(wincap2);
|
||||||
#endif
|
#endif
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
|
/*
|
||||||
* If you are adding code somewhere to be able to recognize
|
* If you are adding code somewhere to be able to recognize
|
||||||
* particular types of symset "handling", define a
|
* particular types of symset "handling", define a
|
||||||
* H_XXX macro in include/sym.h and add the name
|
* H_XXX macro in include/sym.h and add the name
|
||||||
* to this array at the matching offset.
|
* to this array at the matching offset.
|
||||||
*/
|
*/
|
||||||
const char *known_handling[] = {
|
const char *const known_handling[] = {
|
||||||
"UNKNOWN", /* H_UNK */
|
"UNKNOWN", /* H_UNK */
|
||||||
"IBM", /* H_IBM */
|
"IBM", /* H_IBM */
|
||||||
"DEC", /* H_DEC */
|
"DEC", /* H_DEC */
|
||||||
@@ -381,7 +389,7 @@ const char *known_handling[] = {
|
|||||||
* under the case 5 sections of the same SYM_CONTROL idx switches.
|
* under the case 5 sections of the same SYM_CONTROL idx switches.
|
||||||
* - add the field to clear_symsetentry()
|
* - add the field to clear_symsetentry()
|
||||||
*/
|
*/
|
||||||
const char *known_restrictions[] = {
|
const char *const known_restrictions[] = {
|
||||||
"primary", "rogue", (const char *) 0,
|
"primary", "rogue", (const char *) 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1057,7 +1065,8 @@ struct customization_detail *find_matching_symset_customization(
|
|||||||
const char *customization_name, int custtype,
|
const char *customization_name, int custtype,
|
||||||
enum graphics_sets which_set);
|
enum graphics_sets which_set);
|
||||||
struct customization_detail *find_display_urep_customization(
|
struct customization_detail *find_display_urep_customization(
|
||||||
const char *customization_name, int glyphidx, enum graphics_sets which_set);
|
const char *customization_name, int glyphidx,
|
||||||
|
enum graphics_sets which_set);
|
||||||
extern glyph_map glyphmap[MAX_GLYPH];
|
extern glyph_map glyphmap[MAX_GLYPH];
|
||||||
static void shuffle_customizations(void);
|
static void shuffle_customizations(void);
|
||||||
|
|
||||||
@@ -1114,10 +1123,12 @@ shuffle_customizations(void)
|
|||||||
/* Current structure already appears in tmp_u */
|
/* Current structure already appears in tmp_u */
|
||||||
struct unicode_representation *other = tmp_u[duplicate[idx]];
|
struct unicode_representation *other = tmp_u[duplicate[idx]];
|
||||||
|
|
||||||
tmp_u[i] = (struct unicode_representation *) alloc(sizeof *tmp_u[i]);
|
tmp_u[i] = (struct unicode_representation *)
|
||||||
|
alloc(sizeof *tmp_u[i]);
|
||||||
*tmp_u[i] = *other;
|
*tmp_u[i] = *other;
|
||||||
if (other->utf8str != NULL) {
|
if (other->utf8str != NULL) {
|
||||||
tmp_u[i]->utf8str = (uint8 *) dupstr((const char *) other->utf8str);
|
tmp_u[i]->utf8str = (uint8 *)
|
||||||
|
dupstr((const char *) other->utf8str);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tmp_u[i] = obj_glyphs[idx].u;
|
tmp_u[i] = obj_glyphs[idx].u;
|
||||||
@@ -1139,9 +1150,10 @@ shuffle_customizations(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct customization_detail *
|
struct customization_detail *
|
||||||
find_matching_symset_customization(const char *customization_name,
|
find_matching_symset_customization(
|
||||||
int custtype,
|
const char *customization_name,
|
||||||
enum graphics_sets which_set)
|
int custtype,
|
||||||
|
enum graphics_sets which_set)
|
||||||
{
|
{
|
||||||
struct symset_customization *gdc = &g.sym_customizations[which_set];
|
struct symset_customization *gdc = &g.sym_customizations[which_set];
|
||||||
if ((gdc->custtype == custtype)
|
if ((gdc->custtype == custtype)
|
||||||
@@ -1150,11 +1162,12 @@ find_matching_symset_customization(const char *customization_name,
|
|||||||
return (struct customization_detail *) 0;
|
return (struct customization_detail *) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
purge_custom_entries(enum graphics_sets which_set)
|
purge_custom_entries(enum graphics_sets which_set)
|
||||||
{
|
{
|
||||||
struct symset_customization *gdc = &g.sym_customizations[which_set];
|
struct symset_customization *gdc = &g.sym_customizations[which_set];
|
||||||
struct customization_detail *details = gdc->details, *next;
|
struct customization_detail *details = gdc->details, *next;
|
||||||
|
|
||||||
while (details) {
|
while (details) {
|
||||||
next = details->next;
|
next = details->next;
|
||||||
if (gdc->custtype == custom_ureps) {
|
if (gdc->custtype == custom_ureps) {
|
||||||
@@ -1179,12 +1192,14 @@ purge_custom_entries(enum graphics_sets which_set)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct customization_detail *
|
struct customization_detail *
|
||||||
find_display_sym_customization(const char *customization_name,
|
find_display_sym_customization(
|
||||||
const struct symparse *symparse,
|
const char *customization_name,
|
||||||
enum graphics_sets which_set)
|
const struct symparse *symparse,
|
||||||
|
enum graphics_sets which_set)
|
||||||
{
|
{
|
||||||
struct symset_customization *gdc = &g.sym_customizations[which_set];
|
struct symset_customization *gdc = &g.sym_customizations[which_set];
|
||||||
struct customization_detail *symdetails;
|
struct customization_detail *symdetails;
|
||||||
|
|
||||||
if ((gdc->custtype == custom_symbols)
|
if ((gdc->custtype == custom_symbols)
|
||||||
&& (strcmp(customization_name, gdc->customization_name) == 0)) {
|
&& (strcmp(customization_name, gdc->customization_name) == 0)) {
|
||||||
symdetails = gdc->details;
|
symdetails = gdc->details;
|
||||||
|
|||||||
+6
-3
@@ -10,7 +10,7 @@ extern const struct symparse loadsyms[];
|
|||||||
extern struct enum_dump monsdump[];
|
extern struct enum_dump monsdump[];
|
||||||
extern struct enum_dump objdump[];
|
extern struct enum_dump objdump[];
|
||||||
extern glyph_map glyphmap[MAX_GLYPH];
|
extern glyph_map glyphmap[MAX_GLYPH];
|
||||||
extern const char *known_handling[]; /* symbols.c */
|
extern const char *const known_handling[]; /* symbols.c */
|
||||||
|
|
||||||
#ifdef ENHANCED_SYMBOLS
|
#ifdef ENHANCED_SYMBOLS
|
||||||
|
|
||||||
@@ -65,7 +65,8 @@ to_custom_symset_entry_callback(int glyph, struct find_struct *findwhat)
|
|||||||
(findwhat->color != 0L) ? findwhat->color : 0L);
|
(findwhat->color != 0L) ? findwhat->color : 0L);
|
||||||
#endif
|
#endif
|
||||||
add_custom_urep_entry(known_handling[H_UTF8], glyph,
|
add_custom_urep_entry(known_handling[H_UTF8], glyph,
|
||||||
uval, utf8str, findwhat->color, g.symset_which_set);
|
uval, utf8str, findwhat->color,
|
||||||
|
g.symset_which_set);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1053,8 +1054,9 @@ test_glyphnames(void)
|
|||||||
static void
|
static void
|
||||||
just_find_callback(int glyph UNUSED, struct find_struct *findwhat UNUSED)
|
just_find_callback(int glyph UNUSED, struct find_struct *findwhat UNUSED)
|
||||||
{
|
{
|
||||||
/* nothing */
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
find_glyphs(const char *id)
|
find_glyphs(const char *id)
|
||||||
{
|
{
|
||||||
@@ -1086,6 +1088,7 @@ to_unicode_callback(int glyph UNUSED, struct find_struct *findwhat)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
glyphs_to_unicode(const char *id, const char *unicode_val, long clr)
|
glyphs_to_unicode(const char *id, const char *unicode_val, long clr)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user