Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions joe/b.c
Original file line number Diff line number Diff line change
Expand Up @@ -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; */
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -2534,7 +2534,7 @@ int hack_check(const char *name)
*
* 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;
Expand Down Expand Up @@ -2639,13 +2639,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;
Expand Down Expand Up @@ -2737,9 +2737,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;
Expand Down Expand Up @@ -3197,11 +3197,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)
Expand Down Expand Up @@ -3341,7 +3341,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);
Expand Down
2 changes: 1 addition & 1 deletion joe/b.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
22 changes: 11 additions & 11 deletions joe/bw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -431,7 +431,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 */
Expand All @@ -443,7 +443,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 */
Expand Down Expand Up @@ -562,7 +562,7 @@ static int lgen(SCRN *t, ptrdiff_t y, int (*screen)[COMPOSE], int *attr, ptrdiff
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 */
Expand Down Expand Up @@ -723,7 +723,7 @@ static int lgen(SCRN *t, ptrdiff_t y, int (*screen)[COMPOSE], int *attr, ptrdiff
} 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);

Expand Down Expand Up @@ -868,10 +868,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;

Expand Down Expand Up @@ -977,15 +977,15 @@ 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;
P *p = NULL;
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;
Expand Down Expand Up @@ -1433,7 +1433,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];
Expand Down
6 changes: 3 additions & 3 deletions joe/bw.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion joe/cclass.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
18 changes: 9 additions & 9 deletions joe/charmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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 {
Expand All @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion joe/charmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down
4 changes: 2 additions & 2 deletions joe/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions joe/cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
30 changes: 15 additions & 15 deletions joe/colors.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Loading
Loading