From 7cc269cfe4a110737e695c1691274505e5f6c5a6 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Thu, 9 Apr 2026 00:29:17 +0100 Subject: [PATCH 1/3] =?UTF-8?q?More=20int=E2=86=92bool.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- joe/b.c | 20 ++++++++++---------- joe/b.h | 2 +- joe/bw.c | 16 ++++++++-------- joe/bw.h | 6 +++--- joe/macro.c | 2 +- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/joe/b.c b/joe/b.c index d62aad9e..f1907ab8 100644 --- a/joe/b.c +++ b/joe/b.c @@ -2521,7 +2521,7 @@ B *bread(int fi, off_t max, int binary) * * Returns new variable length string. */ -char *parsens(const char *s, off_t *skip, off_t *amnt, int *binary) +char *parsens(const char *s, off_t *skip, off_t *amnt, bool *binary) { char *n = vsncpy(NULL, 0, sz(s)); ptrdiff_t x, y; @@ -2626,13 +2626,13 @@ static off_t euclid(off_t a, off_t b) } /* return column of first nonblank character, but don't count comments */ -int found_space; -int found_tab; +static bool found_space; +static bool found_tab; static off_t pisindentg(P *p) { - int i_spc = 0; - int i_tab = 0; + bool i_spc = 0; + bool i_tab = 0; P *q = pdup(p, "pisindentg"); off_t col; int ch; @@ -2724,9 +2724,9 @@ B *bload(const char *s) FILE *fi = 0; B *b = 0; off_t skip, amnt; - int binary; + bool binary; char *n; - int nowrite = 0; + bool nowrite = 0; P *p; int x; time_t mod_time = 0; @@ -3184,11 +3184,11 @@ bool break_symlinks; /* Set to break symbolic links and hard links on writes */ int bsave(P *p, const char *as, off_t size, int flag) { struct stat sbuf; - int have_stat = 0; + bool have_stat = 0; FILE *f; off_t skip, amnt; - int binary; - int norm = 0; + bool binary; + bool norm = 0; char *s = parsens(as, &skip, &amnt, &binary); if (amnt < size) diff --git a/joe/b.h b/joe/b.h index 2464d790..f63b32a6 100644 --- a/joe/b.h +++ b/joe/b.h @@ -292,7 +292,7 @@ B *borphan(void); int bsave(P *p, const char *s, off_t size,int flag); int bsavefd(P *p, int fd, off_t size); -char *parsens(const char *s, off_t *skip, off_t *amnt, int *binary); +char *parsens(const char *s, off_t *skip, off_t *amnt, bool *binary); char *canonical(char *s, int flags); #define CANFLAG_NORESTART 1 /* Support path restart feature */ diff --git a/joe/bw.c b/joe/bw.c index 701a654a..9f511d72 100644 --- a/joe/bw.c +++ b/joe/bw.c @@ -253,7 +253,7 @@ static HIGHLIGHT_STATE get_highlight_state(BW *w, P *p, off_t line) * the first line was split */ -void bwins(BW *w, off_t l, off_t n, int flg) +void bwins(BW *w, off_t l, off_t n, bool flg) { /* If highlighting is enabled... */ if (w->o.highlight && w->o.syntax) { @@ -288,7 +288,7 @@ void bwins(BW *w, off_t l, off_t n, int flg) /* Scroll current windows after a delete */ -void bwdel(BW *w, off_t l, off_t n, int flg) +void bwdel(BW *w, off_t l, off_t n, bool flg) { /* If highlighting is enabled... */ if (w->o.highlight && w->o.syntax) { @@ -430,7 +430,7 @@ static void end_osc8(const struct state_debug_data *oldstate, int opt) /* Update a single line */ -static int lgen(SCRN *t, ptrdiff_t y, int (*screen)[COMPOSE], int *attr, ptrdiff_t x, ptrdiff_t w, P *p, off_t scr, off_t from, off_t to,HIGHLIGHT_STATE st,BW *bw) +static bool lgen(SCRN *t, ptrdiff_t y, int (*screen)[COMPOSE], int *attr, ptrdiff_t x, ptrdiff_t w, P *p, off_t scr, off_t from, off_t to,HIGHLIGHT_STATE st,BW *bw) /* Screen line address */ @@ -442,7 +442,7 @@ static int lgen(SCRN *t, ptrdiff_t y, int (*screen)[COMPOSE], int *attr, ptrdiff int ansi = bw->o.ansi; ptrdiff_t ox = x; int tach; - int done = 1; + bool done = 1; off_t col = 0; off_t byte = p->byte; char *bp; /* Buffer pointer, 0 if not set */ @@ -867,10 +867,10 @@ void bwgenh(BW *w) ptrdiff_t bot = w->h + w->y; ptrdiff_t y; SCRN *t = w->t->t; - int flg = 0; + bool flg = 0; off_t from; off_t to; - int dosquare = 0; + bool dosquare = 0; from = to = 0; @@ -976,7 +976,7 @@ void bwgenh(BW *w) prm(q); } -void bwgen(BW *w, int linums, int linchg) +void bwgen(BW *w, bool linums, bool linchg) { int (*screen)[COMPOSE]; int *attr; @@ -984,7 +984,7 @@ void bwgen(BW *w, int linums, int linchg) P *q; ptrdiff_t bot = w->h + w->y; ptrdiff_t y; - int dosquare = 0; + bool dosquare = 0; off_t from, to; off_t fromline, toline; SCRN *t = w->t->t; diff --git a/joe/bw.h b/joe/bw.h index e6f9ed7a..510ce77f 100644 --- a/joe/bw.h +++ b/joe/bw.h @@ -48,9 +48,9 @@ extern int vwsmask; /* Attribute mask for visible whitespace */ void bwfllw(W *w); void bwfllwt(W *w); void bwfllwh(W *w); -void bwins(BW *w, off_t l, off_t n, int flg); -void bwdel(BW *w, off_t l, off_t n, int flg); -void bwgen(BW *w, int linums, int linchg); +void bwins(BW *w, off_t l, off_t n, bool flg); +void bwdel(BW *w, off_t l, off_t n, bool flg); +void bwgen(BW *w, bool linums, bool linchg); void bwgenh(BW *w); BW *bwmk(W *window, B *b, int prompt); void bwmove(BW *w, ptrdiff_t x, ptrdiff_t y); diff --git a/joe/macro.c b/joe/macro.c index 37cbf29d..a8c5bd77 100644 --- a/joe/macro.c +++ b/joe/macro.c @@ -331,7 +331,7 @@ int uquery(W *w, int k) return ret; } -static int/*bool*/ paste_undo = 1; /* true if not pasting */ +static bool paste_undo = 1; /* true if not pasting */ /* Macro execution */ From c6a7c50a09f4875f537412ba87a4cd97dd5c4e5c Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Fri, 10 Apr 2026 15:26:20 +0100 Subject: [PATCH 2/3] Replace (charmap).type with is_unicode; convert to bool. --- joe/b.c | 14 +++++++------- joe/bw.c | 6 +++--- joe/cclass.c | 2 +- joe/charmap.c | 18 +++++++++--------- joe/charmap.h | 2 +- joe/help.c | 4 ++-- joe/main.c | 2 +- joe/mouse.c | 6 +++--- joe/options.c | 6 +++--- joe/regex.c | 22 +++++++++++----------- joe/scrn.c | 18 +++++++++--------- joe/syntax.c | 2 +- joe/tty.c | 2 +- joe/tw.c | 2 +- joe/ublock.c | 2 +- joe/uedit.c | 12 ++++++------ joe/ufile.c | 2 +- joe/uisrch.c | 6 +++--- joe/unicode.c | 4 ++-- joe/usearch.c | 6 +++--- joe/utf8.c | 2 +- joe/vt.c | 2 +- 22 files changed, 71 insertions(+), 71 deletions(-) diff --git a/joe/b.c b/joe/b.c index f1907ab8..074e7a97 100644 --- a/joe/b.c +++ b/joe/b.c @@ -799,7 +799,7 @@ char *ansi_string(int code) /* return current character and move p to the next character. column will be updated if it was valid. */ int pgetc(P *p) { - if (p->b->o.charmap->type) { + if (p->b->o.charmap->is_unicode) { bool val; int valattr; int c; /* , oc; */ @@ -1006,7 +1006,7 @@ int prgetc(P *p) off_t startbyte, startcol; bool val = 0; - if (!p->b->o.charmap->type || pisbol(p)) + if (!p->b->o.charmap->is_unicode || pisbol(p)) return prgetb(p); /* Save p for later column calculation */ @@ -1109,7 +1109,7 @@ P *p_goto_indent(P *p, int c) /* move p to the end of line */ P *p_goto_eol(P *p) { - if (p->b->o.crlf || p->b->o.charmap->type || p->b->o.ansi) + if (p->b->o.crlf || p->b->o.charmap->is_unicode || p->b->o.ansi) while (!piseol(p)) pgetc(p); else @@ -1219,7 +1219,7 @@ P *pline(P *p, off_t line) P *pcol(P *p, off_t goalcol) { p_goto_bol(p); - if(p->b->o.charmap->type || p->b->o.ansi) { + if(p->b->o.charmap->is_unicode || p->b->o.ansi) { do { int c; off_t wid; @@ -1291,7 +1291,7 @@ P *pcolwse(P *p, off_t goalcol) P *pcoli(P *p, off_t goalcol) { p_goto_bol(p); - if (p->b->o.charmap->type || p->b->o.ansi) { + if (p->b->o.charmap->is_unicode || p->b->o.ansi) { while (p->col < goalcol) { int c; c = brc(p); @@ -2271,7 +2271,7 @@ P *binsc(P *p, int c) if ((c & ANSI_BIT) && p->b->o.ansi) { char *s = ansi_string(c); return binsm(p, s, zlen(s)); - } else if (c>127 && p->b->o.charmap->type) { + } else if (c>127 && p->b->o.charmap->is_unicode) { char buf[8]; ptrdiff_t len = utf8_encode(buf,c); return binsm(p,buf,len); @@ -3328,7 +3328,7 @@ int brc(P *p) int brch(P *p) { - if (p->b->o.charmap->type) { + if (p->b->o.charmap->is_unicode) { P *q = pdup(p, "brch"); int c = pgetc(q); prm(q); diff --git a/joe/bw.c b/joe/bw.c index 9f511d72..701e3e2b 100644 --- a/joe/bw.c +++ b/joe/bw.c @@ -561,7 +561,7 @@ static bool lgen(SCRN *t, ptrdiff_t y, int (*screen)[COMPOSE], int *attr, ptrdif goto eobl; else { int wid = 1; - if (p->b->o.charmap->type) { + if (p->b->o.charmap->is_unicode) { c = utf8_decode(&utf8_sm,bc); if (c>=0) /* Normal decoded character */ @@ -722,7 +722,7 @@ static bool lgen(SCRN *t, ptrdiff_t y, int (*screen)[COMPOSE], int *attr, ptrdif } else { int wid = -1; int utf8_char; - if (p->b->o.charmap->type) { /* UTF-8 */ + if (p->b->o.charmap->is_unicode) { /* UTF-8 */ utf8_char = utf8_decode(&utf8_sm,bc); @@ -1432,7 +1432,7 @@ void init_visiblews(void) vspace = vtab = vrtn = 0; /* If we're Unicode, just take the best */ - if (locale_map->type) { + if (locale_map->is_unicode) { vspace = spaces[0]; vtab = tabs[0]; vrtn = rtns[0]; diff --git a/joe/cclass.c b/joe/cclass.c index 0536a5ab..37e7d4ac 100644 --- a/joe/cclass.c +++ b/joe/cclass.c @@ -1461,7 +1461,7 @@ struct Cclass *cclass_remap(struct Cclass *m, struct charmap *map) { if (!map) return 0; - if (!map->type) { + if (!map->is_unicode) { struct Cclass_list *l; ptrdiff_t x; int low, high; diff --git a/joe/charmap.c b/joe/charmap.c index 93583d72..c0cc4bef 100644 --- a/joe/charmap.c +++ b/joe/charmap.c @@ -1111,7 +1111,7 @@ static struct charmap *process_builtin(const struct builtin_charmap *builtin) struct charmap *map; map = (struct charmap *)joe_malloc(SIZEOF(struct charmap)); map->name = zdup(builtin->name); - map->type = 0; + map->is_unicode = 0; map->is_punct = byte_ispunct; map->is_print = byte_isprint; map->is_space = byte_isspace; @@ -1205,7 +1205,7 @@ static void load_builtins(void) /* install UTF-8 map (ties into i18n module) */ map = (struct charmap *)joe_malloc(SIZEOF(struct charmap)); map->name = "utf-8"; - map->type = 1; + map->is_unicode = 1; map->is_punct = joe_iswpunct; map->is_print = joe_iswprint; map->is_space = joe_iswspace; @@ -1220,7 +1220,7 @@ static void load_builtins(void) /* install UTF-16 map (ties into i18n module) */ map = (struct charmap *)joe_malloc(SIZEOF(struct charmap)); map->name = "utf-16"; - map->type = 1; + map->is_unicode = 1; map->is_punct = joe_iswpunct; map->is_print = joe_iswprint; map->is_space = joe_iswspace; @@ -1235,7 +1235,7 @@ static void load_builtins(void) /* install UTF-16R map (ties into i18n module) */ map = (struct charmap *)joe_malloc(SIZEOF(struct charmap)); map->name = "utf-16r"; - map->type = 1; + map->is_unicode = 1; map->is_punct = joe_iswpunct; map->is_print = joe_iswprint; map->is_space = joe_iswspace; @@ -1688,9 +1688,9 @@ void my_iconv(char *dest, ptrdiff_t destsiz, struct charmap *dest_map, return; } - if (src_map->type) { + if (src_map->is_unicode) { /* src is UTF-8 */ - if (dest_map->type) { + if (dest_map->is_unicode) { /* UTF-8 to UTF-8? */ zlcpy (dest, destsiz, src); } else { @@ -1713,7 +1713,7 @@ void my_iconv(char *dest, ptrdiff_t destsiz, struct charmap *dest_map, } } else { /* src is not UTF-8 */ - if (!dest_map->type) { + if (!dest_map->is_unicode) { /* Non UTF-8 to non-UTF-8 */ --destsiz; while (*src && destsiz) { @@ -1753,7 +1753,7 @@ void my_iconv1(char *dest, ptrdiff_t destsiz, struct charmap *dest_map, const int *src) { /* src is UTF-8 */ - if (dest_map->type) { + if (dest_map->is_unicode) { /* Unicode to UTF-8? */ Ztoutf8(dest, destsiz, src); } else { @@ -1807,7 +1807,7 @@ struct charmap *guess_map(const char *buf, ptrdiff_t len) if (flag && c >= 0) { /* There are characters above 128, and there are no utf-8 errors */ - if (locale_map->type || !guess_utf8) + if (locale_map->is_unicode || !guess_utf8) return locale_map; else return utf8_map; diff --git a/joe/charmap.h b/joe/charmap.h index 882d6eda..9a7cd6e4 100644 --- a/joe/charmap.h +++ b/joe/charmap.h @@ -19,7 +19,7 @@ struct charmap { struct charmap *next; /* Linked list of loaded character maps */ const char *name; /* Name of this one */ - int type; /* 0=byte, 1=UTF-8 */ + bool is_unicode; /* 0=byte, 1=UTF-8 */ /* Character predicate functions */ diff --git a/joe/help.c b/joe/help.c index 61061bc5..3974a96b 100644 --- a/joe/help.c +++ b/joe/help.c @@ -165,7 +165,7 @@ void help_display(Screen *t) c = *(const unsigned char *)str++; --len; } - width += joe_wcwidth((help_is_utf8 ? 1 : !!locale_map->type), c); + width += joe_wcwidth((help_is_utf8 ? 1 : !!locale_map->is_unicode), c); } } str = start; @@ -265,7 +265,7 @@ void help_display(Screen *t) t->t, t->t->scrn + x + y * t->w, t->t->attr + x + y * t->w, x, y, c, atr); - x += (joe_wcwidth((help_is_utf8 ? 1 : !!locale_map->type), c) - 1); + x += (joe_wcwidth((help_is_utf8 ? 1 : !!locale_map->is_unicode), c) - 1); } } atr = BG_COLOR(bg_help); diff --git a/joe/main.c b/joe/main.c index d313d203..9065815a 100644 --- a/joe/main.c +++ b/joe/main.c @@ -742,7 +742,7 @@ int main(int argc, char **real_argv, const char * const *envv) xmsg = stagen(NULL, (BW *)(lastw(maint)->object), joe_gettext(xmsg), ' '); msgnw(((BASE *)lastw(maint)->object)->parent, xmsg); } else { - joe_snprintf_3(msgbuf,JOE_MSGBUFSIZE,joe_gettext(_("\\i** Joe's Own Editor v%s ** (%s) ** Copyright %s 2015 **\\i")),VERSION,locale_map->name,(locale_map->type ? "©" : "(C)")); + joe_snprintf_3(msgbuf,JOE_MSGBUFSIZE,joe_gettext(_("\\i** Joe's Own Editor v%s ** (%s) ** Copyright %s 2015 **\\i")),VERSION,locale_map->name,(locale_map->is_unicode ? "©" : "(C)")); msgnw(((BASE *)lastw(maint)->object)->parent, msgbuf); } diff --git a/joe/mouse.c b/joe/mouse.c index c831171a..1b637906 100644 --- a/joe/mouse.c +++ b/joe/mouse.c @@ -327,8 +327,8 @@ static void select_done(struct charmap *map) /* Copy text into buffer */ while (q->byte < markk->byte && (!square || (piscol(q) >= left && piscol(q) < right))) { c = pgetc(q); - if (map->type) - if (locale_map->type) { + if (map->is_unicode) + if (locale_map->is_unicode) { /* UTF-8 char to UTF-8 terminal */ len = utf8_encode(buf,c); ttputs64(buf, len); @@ -341,7 +341,7 @@ static void select_done(struct charmap *map) ttputs64(buf, 1); } else - if (locale_map->type) { + if (locale_map->is_unicode) { /* Non-UTF-8 to UTF-8 terminal */ c = to_uni(map, c); if (c == -1) diff --git a/joe/options.c b/joe/options.c index e5a2a9e7..2ccc0e41 100644 --- a/joe/options.c +++ b/joe/options.c @@ -204,7 +204,7 @@ void lazy_opts(B *b, OPTIONS *o) b->o.hex_saved = 0; /* Hex not allowed with UTF-8 */ - if (b->o.charmap->type) { + if (b->o.charmap->is_unicode) { b->o.charmap = find_charmap("c"); b->o.hex_saved |= HEX_RESTORE_UTF8; } @@ -1216,7 +1216,7 @@ static int doencoding(W *w, char *s, void *obj, int *notify) map = find_charmap(s); - if (map && map->type && check_for_hex(bw)) { + if (map && map->is_unicode && check_for_hex(bw)) { msgnw(bw->parent, joe_gettext(_("UTF-8 encoding not allowed with hexadecimal windows"))); if (notify) *notify = 1; @@ -1317,7 +1317,7 @@ static int olddoopt(BW *bw, int y, int flg, int *notify) if (bw->o.hex && !oldval) { bw->o.hex = 1; bw->o.hex_saved = 0; - if (bw->b->o.charmap->type) { + if (bw->b->o.charmap->is_unicode) { /* Switch out of UTF-8 mode */ doencoding(bw->parent, vsncpy(NULL, 0, sc("C")), NULL, NULL); bw->o.hex_saved |= HEX_RESTORE_UTF8; diff --git a/joe/regex.c b/joe/regex.c index ab0b2d41..f0fd573c 100644 --- a/joe/regex.c +++ b/joe/regex.c @@ -357,7 +357,7 @@ static int do_parse_conventional(struct regcomp *g, int prec, int fold) struct Cclass *cat; int first, last; - first = escape(g->cmap->type, &g->ptr, &g->l, &cat); + first = escape(g->cmap->is_unicode, &g->ptr, &g->l, &cat); if (first == -256) { cclass_union(m, cclass_remap(cat, g->cmap)); @@ -365,7 +365,7 @@ static int do_parse_conventional(struct regcomp *g, int prec, int fold) if (g->l >= 2 && g->ptr[0] == '-' && g->ptr[1] != ']') { ++g->ptr; --g->l; - last = escape(g->cmap->type, &g->ptr, &g->l, &cat); + last = escape(g->cmap->is_unicode, &g->ptr, &g->l, &cat); } else { last = first; } @@ -385,7 +385,7 @@ static int do_parse_conventional(struct regcomp *g, int prec, int fold) cclass_inv(m); } else { struct Cclass *cat; - int ch = escape(g->cmap->type, &g->ptr, &g->l, &cat); + int ch = escape(g->cmap->is_unicode, &g->ptr, &g->l, &cat); if (ch == -256) { no = mk_node(g, -'[', -1, -1); if (cat) @@ -393,7 +393,7 @@ static int do_parse_conventional(struct regcomp *g, int prec, int fold) cclass_union(g->nodes[no].cclass, cat); } else { if (fold) { - if (g->cmap->type) { /* Unicode folding... */ + if (g->cmap->is_unicode) { /* Unicode folding... */ int idx = rmap_lookup(rtree_fold, ch, 0); if (idx < FOLDMAGIC) no = mk_node(g, ch + idx, -1, -1); @@ -579,7 +579,7 @@ static int do_parse(struct regcomp *g, int prec, int fold) struct Cclass *cat; int first, last; - first = escape(g->cmap->type, &g->ptr, &g->l, &cat); + first = escape(g->cmap->is_unicode, &g->ptr, &g->l, &cat); if (first == -256) { cclass_union(m, cclass_remap(cat, g->cmap)); @@ -587,7 +587,7 @@ static int do_parse(struct regcomp *g, int prec, int fold) if (g->l >= 2 && g->ptr[0] == '-' && g->ptr[1] != ']') { ++g->ptr; --g->l; - last = escape(g->cmap->type, &g->ptr, &g->l, &cat); + last = escape(g->cmap->is_unicode, &g->ptr, &g->l, &cat); } else { last = first; } @@ -609,13 +609,13 @@ static int do_parse(struct regcomp *g, int prec, int fold) cclass_inv(m); } else { struct Cclass *cat; - int ch = escape(g->cmap->type, &g->ptr, &g->l, &cat); + int ch = escape(g->cmap->is_unicode, &g->ptr, &g->l, &cat); if (ch == -256) { no = mk_node(g, -'[', -1, -1); cclass_union(g->nodes[no].cclass, cclass_remap(cat, g->cmap)); } else { if (fold) { - if (g->cmap->type) { /* Unicode folding... */ + if (g->cmap->is_unicode) { /* Unicode folding... */ int idx = rmap_lookup(rtree_fold, ch, 0); if (idx < FOLDMAGIC) no = mk_node(g, ch + idx, -1, -1); @@ -827,9 +827,9 @@ static int extract(struct regcomp *g, int no, int fold) } } else if ((g->nodes[no].type >= 0) && ( (g->nodes[no].type < 128 || - !g->cmap->type || + !g->cmap->is_unicode || !fold))) { - if (g->cmap->type) { /* UTF-8 */ + if (g->cmap->is_unicode) { /* UTF-8 */ char buf[8]; ptrdiff_t x; utf8_encode(buf, g->nodes[no].type); @@ -1300,7 +1300,7 @@ int joe_regexec(struct regcomp *g, P *p, int nmatch, Regmatch_t *matches, int fo d = c; byte = p->byte; if (fold) { /* Case folding */ - if (g->cmap->type) { /* Unicode folding */ + if (g->cmap->is_unicode) { /* Unicode folding */ if (repl1) { c = repl1; repl1 = 0; diff --git a/joe/scrn.c b/joe/scrn.c index 1adaf8e4..d430c690 100644 --- a/joe/scrn.c +++ b/joe/scrn.c @@ -327,8 +327,8 @@ void outatr(struct charmap *map,SCRN *t,int (*scrn)[COMPOSE],int *attrf,ptrdiff_ { if (c < 0) c += 256; - if(map->type) - if(locale_map->type) { + if(map->is_unicode) + if(locale_map->is_unicode) { if (cclass_lookup(cclass_combining, c)) { /* It's a combining character */ if (!outatr_state) /* No start character? */ outatr_state = 2; /* Ignore it... */ @@ -408,7 +408,7 @@ void outatr(struct charmap *map,SCRN *t,int (*scrn)[COMPOSE],int *attrf,ptrdiff_ t->x++; } else - if (!locale_map->type) { + if (!locale_map->is_unicode) { /* Non UTF-8 char to non UTF-8 terminal */ /* Byte-byte Translate? */ @@ -2172,7 +2172,7 @@ void genfield(SCRN *t,int (*scrn)[COMPOSE],int *attr,ptrdiff_t x,ptrdiff_t y,ptr my_atr = (my_atr & ~BG_MASK) | (fmtatr & BG_MASK); my_atr |= fmtatr & AT_MASK; } - if (locale_map->type) { + if (locale_map->is_unicode) { /* UTF-8 mode: decode character and determine its width */ c = utf8_decode(&sm,TO_CHAR_OK(c)); if (c >= 0) @@ -2232,7 +2232,7 @@ void genfield(SCRN *t,int (*scrn)[COMPOSE],int *attr,ptrdiff_t x,ptrdiff_t y,ptr ptrdiff_t txtwidth(const char *s,ptrdiff_t len) { - if (locale_map->type) { + if (locale_map->is_unicode) { ptrdiff_t col=0; struct utf8_sm sm; utf8_init(&sm); @@ -2250,7 +2250,7 @@ ptrdiff_t txtwidth(const char *s,ptrdiff_t len) off_t txtwidth1(struct charmap *map,off_t tabwidth,const char *s,ptrdiff_t len) { - if (map->type) { + if (map->is_unicode) { off_t col=0; struct utf8_sm sm; utf8_init(&sm); @@ -2355,7 +2355,7 @@ void genfmt(SCRN *t, ptrdiff_t x, ptrdiff_t y, ptrdiff_t ofst, const char *s, in } } else { ptrdiff_t wid = -1; - if (locale_map->type) { + if (locale_map->is_unicode) { /* UTF-8 mode: decode character and determine its width */ c = utf8_decode(&sm,TO_CHAR_OK(c)); if (c >= 0) { @@ -2427,7 +2427,7 @@ ptrdiff_t fmtlen(const char *s) } } else { ptrdiff_t wid = 0; - if(locale_map->type) { + if(locale_map->is_unicode) { c = utf8_decode(&sm,TO_CHAR_OK(c)); if (c>=0) wid = joe_wcwidth(1,c); @@ -2478,7 +2478,7 @@ ptrdiff_t fmtpos(const char *s, ptrdiff_t goal) } } else { ptrdiff_t wid = 0; - if(locale_map->type) { + if(locale_map->is_unicode) { c = utf8_decode(&sm,TO_CHAR_OK(c)); if (c>=0) wid = joe_wcwidth(1,c); diff --git a/joe/syntax.c b/joe/syntax.c index 8391f52d..795616fe 100644 --- a/joe/syntax.c +++ b/joe/syntax.c @@ -245,7 +245,7 @@ HIGHLIGHT_STATE parse(struct high_syntax *syntax,P *line,HIGHLIGHT_STATE h_state ptrdiff_t x; /* If it isn't already, convert character to unicode */ - if (!charmap->type) + if (!charmap->is_unicode) c = to_uni(charmap, c); /* Create or expand attribute array if necessary */ diff --git a/joe/tty.c b/joe/tty.c index 8083a0db..7f0a686f 100644 --- a/joe/tty.c +++ b/joe/tty.c @@ -717,7 +717,7 @@ static struct utf8_sm main_utf8_sm; int ttgetch(void) { - if (locale_map->type) { + if (locale_map->is_unicode) { int utf8_char; do { char c = ttgetc(); diff --git a/joe/tw.c b/joe/tw.c index ca861d5c..55f5e903 100644 --- a/joe/tw.c +++ b/joe/tw.c @@ -553,7 +553,7 @@ char *stagen(char *stalin, BW *bw, const char *s, char fill) break; case 'w': if (!piseof(bw->cursor)) { - joe_snprintf_1(buf, SIZEOF(buf), "%d", joe_wcwidth(bw->o.charmap->type, brch(bw->cursor))); + joe_snprintf_1(buf, SIZEOF(buf), "%d", joe_wcwidth(bw->o.charmap->is_unicode, brch(bw->cursor))); stalin = vsncpy(sv(stalin), sz(buf)); } break; diff --git a/joe/ublock.c b/joe/ublock.c index e9c9074b..c20dc58f 100644 --- a/joe/ublock.c +++ b/joe/ublock.c @@ -1558,7 +1558,7 @@ char *blkget(BW *bw) int ch = pgetc(q); char bf[8]; ptrdiff_t len, x; - if (!q->b->o.charmap->type) + if (!q->b->o.charmap->is_unicode) ch = to_uni(q->b->o.charmap, ch); len = utf8_encode(bf, ch); for (x = 0; x != len; ++x) { diff --git a/joe/uedit.c b/joe/uedit.c index 4d0c37a2..8f2456c3 100644 --- a/joe/uedit.c +++ b/joe/uedit.c @@ -1002,7 +1002,7 @@ int utomatch(W *w, int k) } /* We don't know the word, so start a search */ - if (bw->b->o.charmap->type) { + if (bw->b->o.charmap->is_unicode) { Ztoutf8(utf8_buf, SIZEOF(utf8_buf), buf); } else { Ztoz(utf8_buf, SIZEOF(utf8_buf), buf); @@ -1813,7 +1813,7 @@ static int utypebw_raw(BW *bw, int k, int no_decode) /* Send data to shell window */ if ((bw->b->pid && !bw->b->vt && piseof(bw->cursor)) || ( bw->b->pid && bw->b->vt && bw->cursor->byte == bw->b->vt->vtcur->byte)) { - if (locale_map->type) { + if (locale_map->is_unicode) { char buf[8]; ptrdiff_t len = utf8_encode(buf, k); joe_write(bw->b->out, buf, len); @@ -1834,7 +1834,7 @@ static int utypebw_raw(BW *bw, int k, int no_decode) char buf[8]; ptrdiff_t x; ptrdiff_t len; - if (map->type) { + if (map->is_unicode) { len = utf8_encode(buf, k); } else { if (!no_decode) @@ -1919,7 +1919,7 @@ static int utypebw_raw(BW *bw, int k, int no_decode) } if (!no_decode) { - if(!map->type) { + if(!map->is_unicode) { /* Convert to byte code */ k = from_uni(map, k); } @@ -2033,7 +2033,7 @@ static int doquote(W *w, int c, void *object, int *notify) else return 0; } else if (c == 'x' || c == 'X') { - if (bw->b->o.charmap->type) { + if (bw->b->o.charmap->is_unicode) { if (!wmkpw(bw->parent, joe_gettext(_("Unicode (ISO-10646) character in hex (%{abort} to abort): ")), &unicodehist, dounicode, NULL, NULL, NULL, NULL, NULL, locale_map, 0)) return 0; @@ -2465,7 +2465,7 @@ static int dotxt(W *w, char *s, void *object, int *notify) ptrdiff_t len = sLEN(s); while (len) { int c; - if (bw->b->o.charmap->type) + if (bw->b->o.charmap->is_unicode) c = utf8_decode_fwrd(&t, &len); else { c = *(const unsigned char *)t++; diff --git a/joe/ufile.c b/joe/ufile.c index 709607c6..81b4f69e 100644 --- a/joe/ufile.c +++ b/joe/ufile.c @@ -275,7 +275,7 @@ const char *no_key = _("|no|nN"); int yncheck(const char *key_set, int c) { const char *set = joe_gettext(key_set); - if (locale_map->type) { + if (locale_map->is_unicode) { /* set is utf-8 */ while (*set) { if (c == utf8_decode_fwrd(&set, NULL)) diff --git a/joe/uisrch.c b/joe/uisrch.c index ebef55f7..d8f1c058 100644 --- a/joe/uisrch.c +++ b/joe/uisrch.c @@ -200,7 +200,7 @@ static int itype(W *w, int c, void *obj, int *notify) in: - if (bw->b->o.charmap->type) { + if (bw->b->o.charmap->is_unicode) { buf_len = utf8_encode(buf, c); } else { buf[0] = TO_CHAR_OK(from_uni(bw->b->o.charmap, c)); @@ -218,7 +218,7 @@ static int itype(W *w, int c, void *obj, int *notify) isrch->prompt = vstrunc(isrch->prompt, isrch->ofst); - if (locale_map->type && !bw->b->o.charmap->type) { + if (locale_map->is_unicode && !bw->b->o.charmap->is_unicode) { /* Translate bytes to utf-8 */ char buf[16]; int x; @@ -227,7 +227,7 @@ static int itype(W *w, int c, void *obj, int *notify) utf8_encode(buf, tc); isrch->prompt = vsncpy(sv(isrch->prompt),sz(buf)); } - } else if (!locale_map->type && bw->b->o.charmap->type) { + } else if (!locale_map->is_unicode && bw->b->o.charmap->is_unicode) { /* Translate utf-8 to bytes */ const char *p = isrch->pattern; ptrdiff_t len = sLEN(isrch->pattern); diff --git a/joe/unicode.c b/joe/unicode.c index 2134fd04..ff6ac812 100644 --- a/joe/unicode.c +++ b/joe/unicode.c @@ -517,7 +517,7 @@ int joe_wcwidth(int wide,int ucs) /* If terminal is not UTF-8 or file is not UTF-8: width is 1 */ /* FIXME */ - if (!locale_map->type || !wide) + if (!locale_map->is_unicode || !wide) return 1; /* Negative characters are characters in range 128 - 255 converted from signed char to int */ @@ -560,7 +560,7 @@ int joe_wcwidth(int wide,int ucs) ptrdiff_t joe_wcswidth(struct charmap *map,const char *s, ptrdiff_t len) { - if (!map->type) { + if (!map->is_unicode) { return len; } else { int width = 0; diff --git a/joe/usearch.c b/joe/usearch.c index 48440f12..1e36263f 100644 --- a/joe/usearch.c +++ b/joe/usearch.c @@ -64,7 +64,7 @@ static char **get_word_list(B *b,off_t ignore) c = pgetc(p); if (idx) { if (joe_isalnum_(b->o.charmap, c)) { - if (b->o.charmap->type) { + if (b->o.charmap->is_unicode) { if (idx < MAX_WORD_SIZE - 8) { idx += utf8_encode(buf+idx, c); } @@ -85,7 +85,7 @@ static char **get_word_list(B *b,off_t ignore) } else { start=p->byte-1; if (joe_isalpha_(b->o.charmap, c)) { - if (b->o.charmap->type) { + if (b->o.charmap->is_unicode) { idx += utf8_encode(buf+idx, c); } else { buf[idx++] = TO_CHAR_OK(c); @@ -594,7 +594,7 @@ static P *insert(SRCH *srch, P *p, const char *s, ptrdiff_t len, B **entire, B * } else { const char *a = s + x; ptrdiff_t l = len - x; - int ch = escape(p->b->o.charmap->type, &a, &l, NULL); + int ch = escape(p->b->o.charmap->is_unicode, &a, &l, NULL); if (ch != -256) { switch (case_flag) { case 1: { diff --git a/joe/utf8.c b/joe/utf8.c index 0aeffc85..a6097ef7 100644 --- a/joe/utf8.c +++ b/joe/utf8.c @@ -204,7 +204,7 @@ int utf8_decode_fwrd(const char **p,ptrdiff_t *plen) int fwrd_c(struct charmap *map, const char **s, ptrdiff_t *len) { - if (map->type) + if (map->is_unicode) return utf8_decode_fwrd(s, len); else { int c = *(const unsigned char *)*s; diff --git a/joe/vt.c b/joe/vt.c index e2f2a223..7864432a 100644 --- a/joe/vt.c +++ b/joe/vt.c @@ -655,7 +655,7 @@ MACRO *vt_data(VT *vt, char **indat, ptrdiff_t *insiz) } case 0x9F: { /* Same as ESC _ */ break; } default: { /* Type regular character */ - if (locale_map->type) { + if (locale_map->is_unicode) { int ch = utf8_decode(&vt->utf8_sm, c); if (ch >= 0) { vt_type(vt, ch); From cf43ef01e2ba6cdbe55d19e07962b0b1b84259a7 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sat, 11 Apr 2026 03:42:22 +0100 Subject: [PATCH 3/3] =?UTF-8?q?More=20int=E2=86=92bool.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- joe/cmd.c | 4 ++-- joe/cmd.h | 4 ++-- joe/colors.c | 30 +++++++++++++++--------------- joe/macro.c | 9 +++++---- joe/main.c | 10 +++++----- joe/mouse.c | 10 ++++++---- joe/scrn.c | 2 +- joe/scrn.h | 4 ++-- joe/syntax.c | 4 ++-- joe/uerror.c | 2 +- joe/uisrch.c | 22 +++++++++++----------- joe/umath.c | 8 ++++---- joe/undo.c | 8 ++++---- joe/undo.h | 4 ++-- joe/vt.c | 2 +- joe/w.c | 2 +- 16 files changed, 64 insertions(+), 61 deletions(-) diff --git a/joe/cmd.c b/joe/cmd.c index bc7e8907..ff429771 100644 --- a/joe/cmd.c +++ b/joe/cmd.c @@ -293,7 +293,7 @@ static int file_changed(W *w,int c,void *object,int *notify) /* Try to lock: start dialog if we can't. Returns 0 if we couldn't lock */ -int try_lock(BW *bw,B *b) +bool try_lock(BW *bw,B *b) { /* First time we modify the file */ /* If we're a plain file, acquire lock */ @@ -329,7 +329,7 @@ int try_lock(BW *bw,B *b) #define CHECK_INTERVAL 15 bool nomodcheck; -int modify_logic(BW *bw,B *b) +bool modify_logic(BW *bw,B *b) { if (last_time > b->check_time + CHECK_INTERVAL) { b->check_time = last_time; diff --git a/joe/cmd.h b/joe/cmd.h index 8e2d3daa..e6a8c3c9 100644 --- a/joe/cmd.h +++ b/joe/cmd.h @@ -46,8 +46,8 @@ void do_auto_scroll(void); extern B *cmdhist; /* Command history buffer */ -int try_lock(BW *bw,B *b); -int modify_logic(BW *bw,B *b); +bool try_lock(BW *bw,B *b); +bool modify_logic(BW *bw,B *b); int uexecmd(W *w, int k); diff --git a/joe/colors.c b/joe/colors.c index 642ff520..b1cd469f 100644 --- a/joe/colors.c +++ b/joe/colors.c @@ -28,27 +28,27 @@ struct color_builtin_specs { const char *name; /* Name in config */ int *attribute; /* Destination of attribute */ int *mask; /* Destination of attribute mask */ - int invert; /* Whether to invert input in config file (e.g. status) */ + bool invert; /* Whether to invert input in config file (e.g. status) */ int default_attr; /* Default attribute value */ int default_mask; /* Default attribute mask */ int *default_ptr; /* Pointer to default attribute, e.g. to use bg_text */ }; static const struct color_builtin_specs color_builtins[] = { - { "text", &bg_text, NULL, 0, 0, 0, 0 }, /* Must come first, so others can use as default */ - { "linum", &bg_linum, NULL, 0, 0, 0, &bg_text }, - { "curlin", &bg_curlin, &curlinmask, 0, 0, -1, &bg_text }, - { "curlinum", &bg_curlinum, NULL, 0, 0, 0, &bg_linum }, - { "selection", &selectatr, &selectmask, 0, INVERSE, ~INVERSE, NULL }, - { "help", &bg_help, NULL, 0, 0, 0, &bg_text }, - { "status", &bg_stalin, NULL, 1, 0, 0, &bg_text }, - { "menu", &bg_menu, NULL, 0, 0, 0, &bg_text }, - { "menusel", &bg_menusel, &bg_menumask, 0, INVERSE, ~INVERSE, NULL }, - { "prompt", &bg_prompt, NULL, 0, 0, 0, &bg_text }, - { "message", &bg_msg, NULL, 0, 0, 0, &bg_text }, - { "cursor", &bg_cursor, NULL, 0, INVERSE, ~INVERSE, NULL }, - { "visiblews", &vwsatr, &vwsmask, 0, DIM, ~(DIM | FG_MASK), &bg_text }, - { NULL, NULL, NULL, 0, 0, 0, NULL } + { "text", &bg_text, NULL, false, 0, 0, 0 }, /* Must come first, so others can use as default */ + { "linum", &bg_linum, NULL, false, 0, 0, &bg_text }, + { "curlin", &bg_curlin, &curlinmask, false, 0, -1, &bg_text }, + { "curlinum", &bg_curlinum, NULL, false, 0, 0, &bg_linum }, + { "selection", &selectatr, &selectmask, false, INVERSE, ~INVERSE, NULL }, + { "help", &bg_help, NULL, false, 0, 0, &bg_text }, + { "status", &bg_stalin, NULL, true, 0, 0, &bg_text }, + { "menu", &bg_menu, NULL, false, 0, 0, &bg_text }, + { "menusel", &bg_menusel, &bg_menumask, false, INVERSE, ~INVERSE, NULL }, + { "prompt", &bg_prompt, NULL, false, 0, 0, &bg_text }, + { "message", &bg_msg, NULL, false, 0, 0, &bg_text }, + { "cursor", &bg_cursor, NULL, false, INVERSE, ~INVERSE, NULL }, + { "visiblews", &vwsatr, &vwsmask, false, DIM, ~(DIM | FG_MASK), &bg_text }, + { NULL, NULL, NULL, false, 0, 0, NULL } }; /* Terminal -> color scheme mapping from joe_state file */ diff --git a/joe/macro.c b/joe/macro.c index a8c5bd77..dcb59a2b 100644 --- a/joe/macro.c +++ b/joe/macro.c @@ -303,7 +303,7 @@ static void record(MACRO *m, int k) } static int ifdepth=0; /* JM: Nesting level of if cmds */ -static int ifflag=1; /* JM: Truth flag for if */ +static bool ifflag=1; /* JM: Truth flag for if */ static int iffail=0; /* JM: Depth where ifflag became 0 */ /* Suspend macro record/play to allow for user input. @@ -345,7 +345,7 @@ static int argset = 0; /* Set if 'arg' is set */ static int exsimple(MACRO *m, int myarg, int u, int k) { const CMD *cmd = m->cmd; - int flg = 0; /* set if we should not try to merge minor changes into single undo record */ + bool flg = 0; /* set if we should not try to merge minor changes into single undo record */ int ret = 0; /* Find command to execute if repeat argument is negative */ @@ -388,7 +388,7 @@ int current_arg_set = 0; int exmacro(MACRO *m, int u, int k) { int larg; - int negarg = 0; + bool negarg = 0; int oid=0, oifl=0, oifa=0; int ret = 0; int main_ret = 0; @@ -778,7 +778,8 @@ int uelsif(W *w, int k) msgnw(w,joe_gettext(_("Elsif without if"))); return -1; } else if(ifflag) { - ifflag=iffail=0; /* don't let the next else/elsif get run */ + ifflag = false; + iffail = 0; /* don't let the next else/elsif get run */ } else if(ifdepth == iffail) { ifflag=1; /* so the script can type the condition :) */ if(wmkpw(w,joe_gettext(_("Else if: ")),NULL,doif,NULL,NULL,math_cmplt,NULL,NULL,locale_map,0)) return 0; diff --git a/joe/main.c b/joe/main.c index 9065815a..0a8e635b 100644 --- a/joe/main.c +++ b/joe/main.c @@ -73,8 +73,8 @@ void edupd(int flg) staupd = 0; } -static int ahead = 0; /* Low means typehead possible while JOE is starting, before TTY mode changed */ -static int ungot = 0; +static bool ahead = 0; /* Low means typehead possible while JOE is starting, before TTY mode changed */ +static bool ungot = 0; static int ungotc = 0; void nungetc(int c) @@ -322,11 +322,10 @@ int main(int argc, char **real_argv, const char * const *envv) char *rundir; #endif SCRN *n; - int opened = 0; - int omid; + bool opened = 0; + bool filesonly = 0; int backopt; int c; - int filesonly; joe_iswinit(); joe_locale(); @@ -707,6 +706,7 @@ int main(int argc, char **real_argv, const char * const *envv) if (opened) { + bool omid; wshowall(maint); omid = opt_mid; opt_mid = 1; diff --git a/joe/mouse.c b/joe/mouse.c index 1b637906..d659b9cc 100644 --- a/joe/mouse.c +++ b/joe/mouse.c @@ -575,8 +575,8 @@ static int tomousestay(void) static off_t anchor; /* byte where mouse was originally pressed */ static off_t anchorn; /* near side of the anchored word */ -static int marked; /* mark was set by defmdrag? */ -static int reversed; /* mouse was dragged above the anchor? */ +static bool marked; /* mark was set by defmdrag? */ +static bool reversed; /* mouse was dragged above the anchor? */ /* Select text */ @@ -653,8 +653,10 @@ int udefmdrag(W *xx, int k) auto_rate = new_rate; } - if (!marked) - marked++, umarkb(bw->parent, 0); + if (!marked) { + marked = false; + umarkb(bw->parent, 0); + } if (tomousestay()) return -1; selecting = 1; diff --git a/joe/scrn.c b/joe/scrn.c index d430c690..cfaee14d 100644 --- a/joe/scrn.c +++ b/joe/scrn.c @@ -575,7 +575,7 @@ SCRN *nopen(CAP *cap) { SCRN *t = (SCRN *) joe_malloc(SIZEOF(SCRN)); ptrdiff_t x, y, co, li; - int ansiish; + bool ansiish; ttopen(); diff --git a/joe/scrn.h b/joe/scrn.h index 476766a5..f6a90a44 100644 --- a/joe/scrn.h +++ b/joe/scrn.h @@ -19,8 +19,8 @@ struct scrn { ptrdiff_t li; /* Height of screen */ ptrdiff_t co; /* Width of screen */ short *scrn; /* Buffer */ - int scroll; - int insdel; + bool scroll; + bool insdel; int *updtab; /* Lines which need to be updated */ HIGHLIGHT_STATE *syntax; int *compose; diff --git a/joe/syntax.c b/joe/syntax.c index 795616fe..aea828f0 100644 --- a/joe/syntax.c +++ b/joe/syntax.c @@ -851,8 +851,8 @@ static struct high_state *load_dfa(struct high_syntax *syntax) struct high_state *state=0; /* Current state */ struct high_state *first=0; /* First state */ int line = 0; - int this_one = 0; - int inside_subr = 0; + bool this_one = 0; + bool inside_subr = 0; /* Find the syntax file */ fullpath = open_config_file(&f, "syntax/", syntax->name, ".jsf"); diff --git a/joe/uerror.c b/joe/uerror.c index 5a47c66b..064b5369 100644 --- a/joe/uerror.c +++ b/joe/uerror.c @@ -174,7 +174,7 @@ static void parsedir(const char *s, char **rtn_dir) static void parseone(struct charmap *map,const char *s,char **rtn_name,off_t *rtn_line) { - int flg; + bool flg; int c; char *name = NULL; off_t line = -1; diff --git a/joe/uisrch.c b/joe/uisrch.c index d8f1c058..f15d9123 100644 --- a/joe/uisrch.c +++ b/joe/uisrch.c @@ -14,7 +14,7 @@ struct irec { ptrdiff_t what; /* 0 repeat, >0 append n chars */ off_t start; /* Cursor search position */ off_t disp; /* Original cursor position */ - int wrap_flag; /* Wrap flag */ + bool wrap_flag; /* Wrap flag */ }; struct isrch { @@ -22,8 +22,8 @@ struct isrch { char *pattern; /* Search pattern string */ char *prompt; /* Prompt (usually same as pattern unless utf-8/byte conversion) */ ptrdiff_t ofst; /* Offset in pattern past prompt */ - int dir; /* 0=fwrd, 1=bkwd */ - int quote; /* Set to quote next char */ + bool backwards; /* 0=fwrd, 1=bkwd */ + bool quote; /* Set to quote next char */ }; struct isrch *lastisrch = NULL; /* Previous search */ @@ -76,7 +76,7 @@ static void iappend(BW *bw, struct isrch *isrch, char *s, ptrdiff_t len) i->start = bw->cursor->byte; if (!globalsrch) - srch = mksrch(NULL,NULL,opt_icase,isrch->dir,-1,0,0,0,0); + srch = mksrch(NULL,NULL,opt_icase,isrch->backwards,-1,0,0,0,0); else { srch = globalsrch; globalsrch = 0; @@ -94,7 +94,7 @@ static void iappend(BW *bw, struct isrch *isrch, char *s, ptrdiff_t len) i->wrap_flag = srch->wrap_flag; setpat(srch, vsncpy(NULL, 0, isrch->pattern, sLen(isrch->pattern))); - srch->backwards = isrch->dir; + srch->backwards = isrch->backwards; if (dopfnext(bw, srch, NULL)) { if(joe_beep) @@ -136,9 +136,9 @@ static int itype(W *w, int c, void *obj, int *notify) } else if (c == 'S' - '@' || c == '\\' - '@' || c == 'L' - '@' || c == 'R' - '@') { /* Repeat */ if (c == 'R' - '@') { - isrch->dir = 1; + isrch->backwards = 1; } else { - isrch->dir = 0; + isrch->backwards = 0; } if (qempty(IREC, link, &isrch->irecs)) { if (lastpat && lastpat[0]) { @@ -151,7 +151,7 @@ static int itype(W *w, int c, void *obj, int *notify) i->what = 0; if (!globalsrch) - srch = mksrch(NULL,NULL,opt_icase,isrch->dir,-1,0,0,0,0); + srch = mksrch(NULL,NULL,opt_icase,isrch->backwards,-1,0,0,0,0); else { srch = globalsrch; globalsrch = 0; @@ -169,7 +169,7 @@ static int itype(W *w, int c, void *obj, int *notify) i->wrap_flag = srch->wrap_flag; setpat(srch, vsncpy(NULL, 0, isrch->pattern, sLen(isrch->pattern))); - srch->backwards = isrch->dir; + srch->backwards = isrch->backwards; if (dopfnext(bw, srch, NULL)) { if(joe_beep) @@ -251,13 +251,13 @@ static int itype(W *w, int c, void *obj, int *notify) } } -static int doisrch(BW *bw, int dir) +static int doisrch(BW *bw, int backwards) { /* Create a struct isrch */ struct isrch *isrch = (struct isrch *) joe_malloc(SIZEOF(struct isrch)); izque(IREC, link, &isrch->irecs); isrch->pattern = vsncpy(NULL, 0, NULL, 0); - isrch->dir = dir; + isrch->backwards = backwards; isrch->quote = 0; isrch->prompt = vsncpy(NULL, 0, sz(joe_gettext(_("I-find: ")))); isrch->ofst = sLen(isrch->prompt); diff --git a/joe/umath.c b/joe/umath.c index 0a750e66..4c2a2160 100644 --- a/joe/umath.c +++ b/joe/umath.c @@ -32,8 +32,8 @@ static char get_lcl_comma(void) const char *merr; int mode_display; /* 0 = decimal, 1 = engineering, 2 = hex, 3 = octal, 4 = binary */ -int mode_ins; /* Set if ins or insf appeared in command */ -int mode_commas; /* Set if insf was used, so include underscores */ +bool mode_ins; /* Set if ins or insf appeared in command */ +bool mode_commas; /* Set if insf was used, so include underscores */ static BW *calc_bw; @@ -50,7 +50,7 @@ static void fperr(int unused) struct var { char *name; double (*func)(double n); - int set; + bool set; double val; struct var *next; } *vars = NULL; @@ -1551,7 +1551,7 @@ static char *eng(char *d, ptrdiff_t d_len, const char *s) static int doumath(W *w, char *s, void *object, int *notify); -static void format_result(char *out, double result, int base, int commas) +static void format_result(char *out, double result, int base, bool commas) { char comma_char = get_lcl_comma(); char buf[128]; diff --git a/joe/undo.c b/joe/undo.c index 45f87dfa..7f2b4cbc 100644 --- a/joe/undo.c +++ b/joe/undo.c @@ -16,13 +16,13 @@ int undo_keep = 1000; /* Number of undo records to keep */ static UNDO undos = { {&undos, &undos} }; static UNDO frdos = { {&frdos, &frdos} }; -int inundo = 0; -int inredo = 0; /* Turns off recording of undo records */ +bool inundo = 0; +bool inredo = 0; /* Turns off recording of undo records */ UNDOREC yanked = { {&yanked, &yanked} }; int nyanked = 0; -int inyank = 0; -int justkilled = 0; +bool inyank = 0; +bool justkilled = 0; UNDOREC frrecs = { {&frrecs, &frrecs} }; diff --git a/joe/undo.h b/joe/undo.h index 2c4039e7..f59deb65 100644 --- a/joe/undo.h +++ b/joe/undo.h @@ -28,8 +28,8 @@ struct undo { UNDOREC *last; /* treated as a single undo record. */ }; -extern int inundo; /* Set if inserts/deletes are part of an undo operation */ -extern int justkilled; /* Last edit was a delete, so store data in yank buffer */ +extern bool inundo; /* Set if inserts/deletes are part of an undo operation */ +extern bool justkilled; /* Last edit was a delete, so store data in yank buffer */ UNDO *undomk(B *b); void undorm(UNDO *undo); diff --git a/joe/vt.c b/joe/vt.c index 7864432a..744309af 100644 --- a/joe/vt.c +++ b/joe/vt.c @@ -22,7 +22,7 @@ VT *mkvt(B *b, P *top, ptrdiff_t height, ptrdiff_t width) void vt_resize(VT *vt, P *top, ptrdiff_t height, ptrdiff_t width) { - int flag = 0; + bool flag = 0; if (vt->regn_bot == vt->height) flag = 1; vt->height = height; diff --git a/joe/w.c b/joe/w.c index 8d50d19c..1f318eb8 100644 --- a/joe/w.c +++ b/joe/w.c @@ -266,7 +266,7 @@ void wfit(Screen *t) W *pw; /* Main window of previous family */ ptrdiff_t req; /* Amount this family needs */ ptrdiff_t adj; /* Amount family needs to be adjusted */ - int flg = 0; /* Set if cursor window was placed on screen */ + bool flg = 0; /* Set if cursor window was placed on screen */ int ret; dostaupd = 1;