Use bool for booleans. - sam - An updated version of the sam text editor. | |
git clone git://vernunftzentrum.de/sam.git | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit c278f2b4d6f063d41632760c4e59addd653af041 | |
parent 520490c05a3d2049cd9df74efdacffd459fe66a5 | |
Author: Rob King <[email protected]> | |
Date: Mon, 3 Oct 2016 22:40:06 -0500 | |
Use bool for booleans. | |
Diffstat: | |
include/frame.h | 4 ++-- | |
libXg/gcs.c | 6 +++--- | |
libXg/gwin.c | 16 ++++++++-------- | |
libXg/menuhit.c | 6 +++--- | |
libXg/xtbinit.c | 14 +++++++------- | |
libframe/frdelete.c | 2 +- | |
libframe/frinit.c | 4 ++-- | |
libframe/frinsert.c | 2 +- | |
libframe/frutil.c | 4 ++-- | |
sam/address.c | 2 +- | |
sam/buffer.c | 10 +++++----- | |
sam/cmd.c | 6 +++--- | |
sam/file.c | 24 ++++++++++++------------ | |
sam/io.c | 6 +++--- | |
sam/mesg.c | 24 ++++++++++++------------ | |
sam/moveto.c | 2 +- | |
sam/multi.c | 4 ++-- | |
sam/parse.h | 20 ++++++++++---------- | |
sam/rasp.c | 4 ++-- | |
sam/regexp.c | 16 ++++++++-------- | |
sam/sam.c | 58 +++++++++++++++--------------- | |
sam/sam.h | 23 ++++++++++------------- | |
sam/shell.c | 6 +++--- | |
sam/xec.c | 113 ++++++++++++++++--------------- | |
samterm/flayer.c | 30 +++++++++++++++--------------- | |
samterm/flayer.h | 2 +- | |
samterm/main.c | 12 ++++++------ | |
samterm/mesg.c | 2 +- | |
samterm/samterm.h | 4 ++-- | |
29 files changed, 212 insertions(+), 214 deletions(-) | |
--- | |
diff --git a/include/frame.h b/include/frame.h | |
@@ -35,8 +35,8 @@ struct Frame | |
uint16_t nchars; /* # runes in frame */ | |
uint16_t nlines; /* # lines with text */ | |
uint16_t maxlines; /* total # lines in frame */ | |
- uint16_t lastlinefull; /* last line fills frame */ | |
- uint16_t modified; /* changed since frselect() */ | |
+ bool lastlinefull; /* last line fills frame */ | |
+ bool modified; /* changed since frselect() */ | |
}; | |
uint64_t frcharofpt(Frame*, Point); | |
diff --git a/libXg/gcs.c b/libXg/gcs.c | |
@@ -161,7 +161,7 @@ GC | |
_getgc(Bitmap *b, uint64_t gcvm, XGCValues *pgcv) | |
{ | |
static GC gc0, gcn; | |
- static int clipset = 0; | |
+ static bool clipset = false; | |
GC g; | |
XRectangle xr; | |
@@ -184,11 +184,11 @@ _getgc(Bitmap *b, uint64_t gcvm, XGCValues *pgcv) | |
xr.y -= b->r.min.y; | |
} | |
XSetClipRectangles(_dpy, g, 0, 0, &xr, 1, YXBanded); | |
- clipset = 1; | |
+ clipset = true; | |
}else if(clipset){ | |
pgcv->clip_mask = None; | |
XChangeGC(_dpy, g, GCClipMask, pgcv); | |
- clipset = 0; | |
+ clipset = false; | |
} | |
return g; | |
} | |
diff --git a/libXg/gwin.c b/libXg/gwin.c | |
@@ -13,7 +13,7 @@ | |
#define R3 | |
#define XtPointer caddr_t | |
#define XtOffsetOf(s_type,field) XtOffset(s_type*,field) | |
-#define XtExposeCompressMultiple TRUE | |
+#define XtExposeCompressMultiple true | |
#endif | |
#include "GwinP.h" | |
@@ -36,7 +36,7 @@ static XtResource resources[] = { | |
{XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), | |
Offset(foreground), XtRString, (XtPointer)XtDefaultForeground}, | |
{XtNscrollForwardR, XtCScrollForwardR, XtRBoolean, sizeof(Boolean), | |
- Offset(forwardr), XtRImmediate, (XtPointer)TRUE}, | |
+ Offset(forwardr), XtRImmediate, (XtPointer)true}, | |
{XtNreshaped, XtCReshaped, XtRFunction, sizeof(Reshapefunc), | |
Offset(reshaped), XtRFunction, (XtPointer) NULL}, | |
{XtNgotchar, XtCGotchar, XtRFunction, sizeof(Charfunc), | |
@@ -73,7 +73,7 @@ GwinClassRec gwinClassRec = { | |
/* widget_size */ sizeof(GwinRec), | |
/* class_initialize */ NULL, | |
/* class_part_initialize*/ NULL, | |
- /* class_inited */ FALSE, | |
+ /* class_inited */ false, | |
/* initialize */ NULL, | |
/* initialize_hook */ NULL, | |
/* realize */ Realize, | |
@@ -82,10 +82,10 @@ GwinClassRec gwinClassRec = { | |
/* resources */ resources, | |
/* num_resources */ XtNumber(resources), | |
/* xrm_class */ NULLQUARK, | |
- /* compress_motion */ TRUE, | |
+ /* compress_motion */ true, | |
/* compress_exposure */ XtExposeCompressMultiple, | |
- /* compress_enterleave*/ TRUE, | |
- /* visible_interest */ FALSE, | |
+ /* compress_enterleave*/ true, | |
+ /* visible_interest */ false, | |
/* destroy */ NULL, | |
/* resize */ Resize, | |
/* expose */ Redraw, | |
@@ -562,10 +562,10 @@ SendSel(Widget w, Atom *sel, Atom *target, Atom *rtype, X… | |
*ans = (XtPointer) XtNewString(s); | |
*anslen = strlen(*ans); | |
*ansfmt = 8; | |
- return TRUE; | |
+ return true; | |
} | |
- return FALSE; | |
+ return false; | |
} | |
static String | |
diff --git a/libXg/menuhit.c b/libXg/menuhit.c | |
@@ -131,7 +131,7 @@ int | |
menuhit(int but, Mouse *m, Menu *menu) | |
{ | |
int i, nitem, nitemdrawn, maxwid, lasti, off, noff, wid, screenitem; | |
- int scrolling; | |
+ bool scrolling; | |
Rectangle r, menur, sc, textr, scrollr; | |
Bitmap *b; | |
Point pt; | |
@@ -151,7 +151,7 @@ menuhit(int but, Mouse *m, Menu *menu) | |
menu->lasthit = 0; | |
screenitem = (Dy(screen.r)-10)/(fontheight()+Vspacing); | |
if(nitem>Maxunscroll || nitem>screenitem){ | |
- scrolling = 1; | |
+ scrolling = true; | |
nitemdrawn = Nscroll; | |
if(nitemdrawn > screenitem) | |
nitemdrawn = screenitem; | |
@@ -163,7 +163,7 @@ menuhit(int but, Mouse *m, Menu *menu) | |
off = nitem-nitemdrawn; | |
lasti = menu->lasthit-off; | |
}else{ | |
- scrolling = 0; | |
+ scrolling = false; | |
nitemdrawn = nitem; | |
wid = maxwid; | |
off = 0; | |
diff --git a/libXg/xtbinit.c b/libXg/xtbinit.c | |
@@ -77,7 +77,7 @@ int _cmap_installed; | |
static XtAppContext app; | |
#endif | |
static Widget widg; | |
-static int exposed = 0; | |
+static bool exposed = 0; | |
static Atom wm_take_focus; | |
static Mouse lastmouse; | |
@@ -88,7 +88,7 @@ typedef struct Ebuf { | |
} Ebuf; | |
typedef struct Esrc { | |
- int inuse; | |
+ bool inuse; | |
int size; | |
int count; | |
Ebuf *head; | |
@@ -159,7 +159,7 @@ xtbinit(Errfunc f, char *class, int *pargc, char **argv, ch… | |
if (!fallbacks) | |
fallbacks = _fallbacks; | |
n = 0; | |
- XtSetArg(args[n], XtNinput, TRUE); n++; | |
+ XtSetArg(args[n], XtNinput, true); n++; | |
char name[512] = {0}; | |
snprintf(name, sizeof(name) - 1, "samterm on %s", machine); | |
@@ -284,7 +284,7 @@ reshaped(int minx, int miny, int maxx, int maxy) | |
screen.r = Rect(minx, miny, maxx, maxy); | |
screen.clipr = screen.r; | |
if (screen.id) { | |
- exposed = 1; | |
+ exposed = true; | |
ereshaped(screen.r); | |
} | |
if(einitcalled){ | |
@@ -483,14 +483,14 @@ einit(uint64_t keys) | |
nsrc = 0; | |
if(keys&Emouse){ | |
Smouse = 0; | |
- esrc[Smouse].inuse = 1; | |
+ esrc[Smouse].inuse = true; | |
esrc[Smouse].size = sizeof(Mouse); | |
esrc[Smouse].count = 0; | |
nsrc = Smouse+1; | |
} | |
if(keys&Ekeyboard){ | |
Skeyboard = 1; | |
- esrc[Skeyboard].inuse = 1; | |
+ esrc[Skeyboard].inuse = true; | |
esrc[Skeyboard].size = sizeof(Keystroke); | |
esrc[Skeyboard].count = 0; | |
if(Skeyboard >= nsrc) | |
@@ -512,7 +512,7 @@ estart(uint64_t key, int fd, int n) | |
if((key & ~(1<<i)) == 0 && !esrc[i].inuse){ | |
if(nsrc <= i) | |
nsrc = i+1; | |
- esrc[i].inuse = 1; | |
+ esrc[i].inuse = true; | |
esrc[i].size = n; | |
esrc[i].count = 0; | |
XtAppAddInput(app, fd, (XtPointer)XtInputReadMask, | |
diff --git a/libframe/frdelete.c b/libframe/frdelete.c | |
@@ -28,7 +28,7 @@ frdelete(Frame *f, uint64_t p0, uint64_t p1) | |
nn0 = n0; | |
ppt0 = pt0; | |
_frfreebox(f, n0, n1-1); | |
- f->modified = 1; | |
+ f->modified = true; | |
/* | |
* Invariants: | |
diff --git a/libframe/frinit.c b/libframe/frinit.c | |
@@ -5,7 +5,7 @@ | |
#include <frame.h> | |
int tabwidth = 8; | |
-extern int expandtabs; | |
+extern bool expandtabs; | |
void | |
frinit(Frame *f, Rectangle r, XftFont *ft, Bitmap *b, uint64_t bg) | |
@@ -13,7 +13,7 @@ frinit(Frame *f, Rectangle r, XftFont *ft, Bitmap *b, uint64_… | |
int tabs = atoi(getenv("TABS") ? getenv("TABS") : ""); | |
if (tabs < 0){ | |
tabs = -tabs; | |
- expandtabs = 1; | |
+ expandtabs = true; | |
} | |
if (tabs > 0 && tabs <= 12) | |
diff --git a/libframe/frinsert.c b/libframe/frinsert.c | |
@@ -120,7 +120,7 @@ frinsert(Frame *f, wchar_t *sp, wchar_t *ep, uint64_t p0) | |
_frcklinewrap(f, &pt0, b = &f->box[n0]); /* for frselectf() */ | |
_frcklinewrap0(f, &ppt1, b); | |
} | |
- f->modified = 1; | |
+ f->modified = true; | |
/* | |
* ppt0 and ppt1 are start and end of insertion as they will appear when | |
* insertion is complete. pt0 is current location of insertion position | |
diff --git a/libframe/frutil.c b/libframe/frutil.c | |
@@ -98,7 +98,7 @@ _frclean(Frame *f, Point pt, int n0, int n1) /* look for m… | |
_frcklinewrap(f, &pt, b); | |
_fradvance(f, &pt, &f->box[nb]); | |
} | |
- f->lastlinefull = 0; | |
+ f->lastlinefull = false; | |
if(pt.y >= f->r.max.y) | |
- f->lastlinefull = 1; | |
+ f->lastlinefull = true; | |
} | |
diff --git a/sam/address.c b/sam/address.c | |
@@ -4,7 +4,7 @@ | |
Address addr; | |
String lastpat; | |
-int patset; | |
+bool patset; | |
File *menu; | |
File *matchfile(String*); | |
diff --git a/sam/buffer.c b/sam/buffer.c | |
@@ -58,7 +58,7 @@ Bread(Buffer *b, wchar_t *addr, int n, Posn p0) | |
b->cache.n = m; | |
b->c1 = minp; | |
b->c2 = minp+m; | |
- b->dirty = FALSE; | |
+ b->dirty = false; | |
} | |
} | |
memmove(addr, &b->cache.s[p0-b->c1], n*RUNESIZE); | |
@@ -76,7 +76,7 @@ Binsert(Buffer *b, String *s, Posn p0) | |
return; | |
if(incache(b, p0, p0) && b->cache.n+s->n<=STRSIZE){ | |
Strinsert(&b->cache, s, p0-b->c1); | |
- b->dirty = TRUE; | |
+ b->dirty = true; | |
if(b->cache.n > BLOCKSIZE*2){ | |
b->nrunes += s->n; | |
Bflush(b); | |
@@ -120,7 +120,7 @@ Binsert(Buffer *b, String *s, Posn p0) | |
b->c1 = minp; | |
b->c2 = minp+m; | |
Strinsert(&b->cache, s, p0-b->c1); | |
- b->dirty = TRUE; | |
+ b->dirty = true; | |
} | |
} | |
b->nrunes += s->n; | |
@@ -137,7 +137,7 @@ Bdelete(Buffer *b, Posn p1, Posn p2) | |
return; | |
if(incache(b, p1, p2)){ | |
Strdelete(&b->cache, p1-b->c1, p2-b->c1); | |
- b->dirty = TRUE; | |
+ b->dirty = true; | |
}else{ | |
Bflush(b); | |
Ddelete(b->disc, p1, p2); | |
@@ -153,7 +153,7 @@ Bflush(Buffer *b) | |
if(b->dirty){ | |
Dreplace(b->disc, b->c1, b->c2, b->cache.s, b->cache.n); | |
b->c2 = b->c1+b->cache.n; | |
- b->dirty = FALSE; | |
+ b->dirty = false; | |
if(b->nrunes != b->disc->nrunes) | |
panic("Bflush"); | |
} | |
diff --git a/sam/cmd.c b/sam/cmd.c | |
@@ -56,7 +56,7 @@ List cmdlist; | |
List addrlist; | |
List relist; | |
List stringlist; | |
-int eof; | |
+bool eof; | |
void | |
resetcmd(void) | |
@@ -130,7 +130,7 @@ getch(void) | |
if(eof) | |
return -1; | |
if(*linep==0 && inputline()<0){ | |
- eof = TRUE; | |
+ eof = true; | |
return -1; | |
} | |
return *linep++; | |
@@ -499,7 +499,7 @@ getregexp(int delim) | |
if(c!=delim && c) | |
ungetch(); | |
if(genstr.n > 0){ | |
- patset = TRUE; | |
+ patset = true; | |
Strduplstr(&lastpat, &genstr); | |
Straddc(&lastpat, '\0'); | |
} | |
diff --git a/sam/file.c b/sam/file.c | |
@@ -43,7 +43,7 @@ Fmark(File *f, Mod m) | |
f->markp = t->nrunes; | |
puthdr_M(t, p, f->dot.r, f->mark, f->mod, f->state); | |
f->ndot = f->dot; | |
- f->marked = TRUE; | |
+ f->marked = true; | |
f->mod = m; | |
f->hiposn = -1; | |
/* Safety first */ | |
@@ -130,8 +130,8 @@ Finsert(File *f, String *str, Posn p1) | |
Strinsert(&f->cache, str, f->cache.n); | |
} | |
if(f != cmd) | |
- quitok = FALSE; | |
- f->closeok = FALSE; | |
+ quitok = false; | |
+ f->closeok = false; | |
if(f->state == Clean) | |
state(f, Dirty); | |
f->hiposn = p1; | |
@@ -167,8 +167,8 @@ Fdelete(File *f, Posn p1, Posn p2) | |
} | |
f->cp2 = p2; | |
if(f!=cmd) | |
- quitok = FALSE; | |
- f->closeok = FALSE; | |
+ quitok = false; | |
+ f->closeok = false; | |
if(f->state==Clean) | |
state(f, Dirty); | |
f->hiposn = p2; | |
@@ -226,12 +226,12 @@ Fupdate(File *f, int mktrans, int toterm) | |
Buffer *u = undobuf; | |
int n, ni; | |
Posn p0, p1, p2, p, deltadot = 0, deltamark = 0, delta = 0; | |
- int changes = FALSE; | |
+ bool changes = false; | |
union Hdr buf; | |
wchar_t tmp[BLOCKSIZE+1]; /* +1 for NUL in 'f' case */ | |
if(f->state == Readerr) | |
- return FALSE; | |
+ return false; | |
if(lastfile && f!=lastfile) | |
Bclean(lastfile->transcript); /* save memory when multifile */ | |
lastfile = f; | |
@@ -267,7 +267,7 @@ Fupdate(File *f, int mktrans, int toterm) | |
} | |
f->nrunes -= p2-p1; | |
Bdelete(f->buf, p1, p2); | |
- changes = TRUE; | |
+ changes = true; | |
break; | |
case 'f': | |
@@ -284,7 +284,7 @@ Fupdate(File *f, int mktrans, int toterm) | |
} | |
Strduplstr(&f->name, &genstr); | |
sortname(f); | |
- changes = TRUE; | |
+ changes = true; | |
break; | |
case 'i': | |
@@ -299,7 +299,7 @@ Fupdate(File *f, int mktrans, int toterm) | |
delta += n; | |
if(!mktrans) | |
puthdr_cll(u, 'd', p1, p1+n); | |
- changes = TRUE; | |
+ changes = true; | |
f->nrunes += n; | |
while(n > 0){ | |
if(n > BLOCKSIZE) | |
@@ -347,7 +347,7 @@ Fupdate(File *f, int mktrans, int toterm) | |
} | |
Bdelete(u, (Posn)0, u->nrunes); | |
} | |
- return f==cmd? FALSE : changes; | |
+ return f==cmd? false : changes; | |
} | |
void | |
@@ -377,7 +377,7 @@ void | |
puthdr_M(Buffer *b, Posn p, Range dot, Range mk, Mod m, int16_t s1) | |
{ | |
Mark mark; | |
- static int first = 1; | |
+ static bool first = true; | |
if(!first && p<0) | |
panic("puthdr_M"); | |
diff --git a/sam/io.c b/sam/io.c | |
@@ -71,7 +71,7 @@ writef(File *f) | |
} | |
Posn | |
-readio(File *f, int *nulls, int setdate) | |
+readio(File *f, bool *nulls, bool setdate) | |
{ | |
size_t n = 0; | |
size_t nt = 0; | |
@@ -83,7 +83,7 @@ readio(File *f, int *nulls, int setdate) | |
wchar_t wbuf[BLOCKSIZE * MB_LEN_MAX + 1] = {0}; | |
mbstate_t ps = {0}; | |
- *nulls = FALSE; | |
+ *nulls = false; | |
n = read(io, buf, BLOCKSIZE); | |
while (n > 0){ | |
@@ -236,6 +236,6 @@ startup(char *machine, int Rflag, char **arg, char **end) | |
connectto(machine); | |
if(!Rflag) | |
bootterm(machine, arg, end); | |
- downloaded = 1; | |
+ downloaded = true; | |
outTs(Hversion, VERSION); | |
} | |
diff --git a/sam/mesg.c b/sam/mesg.c | |
@@ -10,8 +10,8 @@ uint8_t *outmsg = outdata; | |
Posn cmdpt; | |
Posn cmdptadv; | |
Buffer *snarfbuf; | |
-int waitack; | |
-int noflush; | |
+bool waitack; | |
+bool noflush; | |
int tversion; | |
int64_t inlong(void); | |
@@ -213,7 +213,7 @@ inmesg(Tmesg type) | |
Finsert(cmd, &cmdstr, 0L); | |
Strdelete(&cmdstr, 0L, (Posn)cmdstr.n); | |
} | |
- Fupdate(cmd, FALSE, TRUE); | |
+ Fupdate(cmd, false, true); | |
outT0(Hunlock); | |
break; | |
@@ -298,7 +298,7 @@ inmesg(Tmesg type) | |
str = tmpcstr((char*)inp); | |
i = str->n; | |
Finsert(f, str, p0); | |
- if(Fupdate(f, FALSE, FALSE)) | |
+ if(Fupdate(f, false, false)) | |
modnum++; | |
if(f==cmd && p0==f->nrunes-i && i>0 && str->s[i-1]=='\n'){ | |
freetmpstr(str); | |
@@ -317,7 +317,7 @@ inmesg(Tmesg type) | |
journaln(0, p0); | |
journaln(0, p1); | |
Fdelete(f, p0, p1); | |
- if(Fupdate(f, FALSE, FALSE)) | |
+ if(Fupdate(f, false, false)) | |
modnum++; | |
f->dot.r.p1 = f->dot.r.p2 = p0; | |
f->tdot = f->dot.r; /* terminal knows the value of dot already */ | |
@@ -334,7 +334,7 @@ inmesg(Tmesg type) | |
Bread(snarfbuf, genbuf, m, l); | |
Finsert(f, tmprstr(genbuf, m), p0); | |
} | |
- if(Fupdate(f, FALSE, TRUE)) | |
+ if(Fupdate(f, false, true)) | |
modnum++; | |
f->dot.r.p1 = p0; | |
f->dot.r.p2 = p0+snarfbuf->nrunes; | |
@@ -426,7 +426,7 @@ inmesg(Tmesg type) | |
if(genstr.s[genstr.n-1] != '\n') | |
Straddc(&genstr, '\n'); | |
Finsert(cmd, &genstr, cmd->nrunes); | |
- Fupdate(cmd, FALSE, TRUE); | |
+ Fupdate(cmd, false, true); | |
cmd->dot.r.p1 = cmd->dot.r.p2 = cmd->nrunes; | |
telldot(cmd); | |
termcommand(); | |
@@ -487,13 +487,13 @@ inmesg(Tmesg type) | |
break; | |
case Tack: | |
- waitack = 0; | |
+ waitack = false; | |
break; | |
case Texit: | |
exits(0); | |
} | |
- return TRUE; | |
+ return true; | |
} | |
void | |
@@ -733,9 +733,9 @@ outflush(void) | |
{ | |
if(outmsg == outdata) | |
return; | |
- noflush = 0; | |
+ noflush = false; | |
outT0(Hack); | |
- waitack = 1; | |
+ waitack = true; | |
do | |
if(rcv() == 0){ | |
rescue(); | |
@@ -743,5 +743,5 @@ outflush(void) | |
} | |
while(waitack); | |
outmsg = outdata; | |
- noflush = 1; | |
+ noflush = true; | |
} | |
diff --git a/sam/moveto.c b/sam/moveto.c | |
@@ -29,7 +29,7 @@ void | |
tellpat(void) | |
{ | |
outTS(Hsetpat, &lastpat); | |
- patset = FALSE; | |
+ patset = false; | |
} | |
#define CHARSHIFT 128 | |
diff --git a/sam/multi.c b/sam/multi.c | |
@@ -50,14 +50,14 @@ sortname(File *f) | |
int dupwarned; | |
w = whichmenu(f); | |
- dupwarned = FALSE; | |
+ dupwarned = false; | |
dellist(&file, w); | |
if(f == cmd) | |
i = 0; | |
else for(i=0; i<file.nused; i++){ | |
cmp = Strcmp(&f->name, &file.filepptr[i]->name); | |
if(cmp==0 && !dupwarned){ | |
- dupwarned = TRUE; | |
+ dupwarned = true; | |
warn_S(Wdupname, &f->name); | |
}else if(cmp<0 && (i>0 || cmd==0)) | |
break; | |
diff --git a/sam/parse.h b/sam/parse.h | |
@@ -45,7 +45,7 @@ extern struct cmdtab{ | |
uint8_t defaddr; /* default address */ | |
uint8_t count; /* takes a count e.g. s2/// */ | |
wchar_t *token; /* takes text terminated by one of these */ | |
- int (*fn)(File*, Cmd*); /* function to call with parse tree */ | |
+ bool (*fn)(File*, Cmd*); /* function to call with parse tree */ | |
}cmdtab[]; | |
enum Defaddr{ /* default addresses */ | |
@@ -54,15 +54,15 @@ enum Defaddr{ /* default addresses */ | |
aAll | |
}; | |
-int nl_cmd(File*, Cmd*), a_cmd(File*, Cmd*), b_cmd(File*, Cmd*); | |
-int c_cmd(File*, Cmd*), cd_cmd(File*, Cmd*), d_cmd(File*, Cmd*); | |
-int D_cmd(File*, Cmd*), e_cmd(File*, Cmd*); | |
-int f_cmd(File*, Cmd*), g_cmd(File*, Cmd*), i_cmd(File*, Cmd*); | |
-int k_cmd(File*, Cmd*), m_cmd(File*, Cmd*), n_cmd(File*, Cmd*); | |
-int p_cmd(File*, Cmd*), q_cmd(File*, Cmd*); | |
-int s_cmd(File*, Cmd*), u_cmd(File*, Cmd*), w_cmd(File*, Cmd*); | |
-int x_cmd(File*, Cmd*), X_cmd(File*, Cmd*), plan9_cmd(File*, Cmd*); | |
-int eq_cmd(File*, Cmd*); | |
+bool nl_cmd(File*, Cmd*), a_cmd(File*, Cmd*), b_cmd(File*, Cmd*); | |
+bool c_cmd(File*, Cmd*), cd_cmd(File*, Cmd*), d_cmd(File*, Cmd*); | |
+bool D_cmd(File*, Cmd*), e_cmd(File*, Cmd*); | |
+bool f_cmd(File*, Cmd*), g_cmd(File*, Cmd*), i_cmd(File*, Cmd*); | |
+bool k_cmd(File*, Cmd*), m_cmd(File*, Cmd*), n_cmd(File*, Cmd*); | |
+bool p_cmd(File*, Cmd*), q_cmd(File*, Cmd*); | |
+bool s_cmd(File*, Cmd*), u_cmd(File*, Cmd*), w_cmd(File*, Cmd*); | |
+bool x_cmd(File*, Cmd*), X_cmd(File*, Cmd*), plan9_cmd(File*, Cmd*); | |
+bool eq_cmd(File*, Cmd*); | |
String *getregexp(int); | |
diff --git a/sam/rasp.c b/sam/rasp.c | |
@@ -30,7 +30,7 @@ toterminal(File *f, int toterm) | |
else | |
p0 = 0; | |
grown = 0; | |
- noflush = 1; | |
+ noflush = true; | |
while(Bread(t, (wchar_t*)&hdr, sizeof(hdr)/RUNESIZE, p0) > 0){ | |
switch(hdr.g.cs.c){ | |
default: | |
@@ -121,7 +121,7 @@ toterminal(File *f, int toterm) | |
if(toterm) | |
outTs(Hcheck0, f->tag); | |
outflush(); | |
- noflush = 0; | |
+ noflush = false; | |
if(f == cmd){ | |
cmdpt += deltacmd+cmdptadv; | |
cmdptadv = 0; | |
diff --git a/sam/regexp.c b/sam/regexp.c | |
@@ -155,7 +155,7 @@ realcompile(wchar_t *s) | |
andp = andstack; | |
subidp = subidstack; | |
cursubid = 0; | |
- lastwasand = FALSE; | |
+ lastwasand = false; | |
/* Start with a low priority operator to prime parser */ | |
pushator(START-1); | |
while((token=lex()) != END){ | |
@@ -187,11 +187,11 @@ compile(String *s) | |
free(class[i]); | |
nclass = 0; | |
progp = program; | |
- backwards = FALSE; | |
+ backwards = false; | |
startinst = realcompile(s->s); | |
optimize(program); | |
oprogp = progp; | |
- backwards = TRUE; | |
+ backwards = true; | |
bstartinst = realcompile(s->s); | |
optimize(oprogp); | |
Strduplstr(&lastregexp, s); | |
@@ -210,7 +210,7 @@ operand(int t) | |
i->rclass = nclass-1; /* UGH */ | |
} | |
pushand(i, i); | |
- lastwasand = TRUE; | |
+ lastwasand = true; | |
} | |
void | |
@@ -227,9 +227,9 @@ operator(int t) | |
evaluntil(t); | |
if(t!=RBRA) | |
pushator(t); | |
- lastwasand = FALSE; | |
+ lastwasand = false; | |
if(t==STAR || t==QUEST || t==PLUS || t==RBRA) | |
- lastwasand = TRUE; /* these look like operands */ | |
+ lastwasand = true; /* these look like operands */ | |
} | |
void | |
@@ -474,10 +474,10 @@ bldcclass(void) | |
/* we have already seen the '[' */ | |
if(*exprp == '^'){ | |
classp[n++] = '\n'; /* don't match newline in negate case */ | |
- negateclass = TRUE; | |
+ negateclass = true; | |
exprp++; | |
}else | |
- negateclass = FALSE; | |
+ negateclass = false; | |
while((c1 = nextrec()) != ']'){ | |
if(c1 == '-'){ | |
Error: | |
diff --git a/sam/sam.c b/sam/sam.c | |
@@ -7,8 +7,8 @@ | |
wchar_t genbuf[BLOCKSIZE]; | |
int io; | |
-int panicking; | |
-int rescuing; | |
+bool panicking; | |
+bool rescuing; | |
Mod modnum; | |
String genstr; | |
String rhs; | |
@@ -21,14 +21,14 @@ File *flist; | |
File *cmd; | |
jmp_buf mainloop; | |
List tempfile; | |
-int quitok = TRUE; | |
-int downloaded; | |
-int expandtabs; | |
+bool quitok = true; | |
+bool downloaded; | |
+bool expandtabs; | |
bool dflag; | |
bool Rflag; | |
char *machine; | |
char *home; | |
-int bpipeok; | |
+bool bpipeok; | |
int termlocked; | |
char *samterm = "samterm"; | |
char *rsamname = "rsam"; | |
@@ -125,7 +125,7 @@ main(int argc, char *argv[]) | |
current(file.filepptr[0]); | |
setjmp(mainloop); | |
cmdloop(); | |
- trytoquit(); /* if we already q'ed, quitok will be TRUE */ | |
+ trytoquit(); /* if we already q'ed, quitok will be true */ | |
exits(0); | |
} | |
@@ -242,7 +242,7 @@ trytoclose(File *f) | |
if(f->deleted) | |
return; | |
if(f->state==Dirty && !f->closeok){ | |
- f->closeok = TRUE; | |
+ f->closeok = true; | |
if(f->name.s[0]){ | |
t = Strtoc(&f->name); | |
strncpy(buf, t, sizeof buf-1); | |
@@ -251,7 +251,7 @@ trytoclose(File *f) | |
strcpy(buf, "nameless file"); | |
error_s(Emodified, buf); | |
} | |
- f->deleted = TRUE; | |
+ f->deleted = true; | |
} | |
void | |
@@ -265,8 +265,8 @@ trytoquit(void) | |
for(c = 0; c<file.nused; c++){ | |
f = file.filepptr[c]; | |
if(f!=cmd && f->state==Dirty){ | |
- quitok = TRUE; | |
- eof = FALSE; | |
+ quitok = true; | |
+ eof = false; | |
error(Echanges); | |
} | |
} | |
@@ -286,14 +286,14 @@ load(File *f) | |
addr = saveaddr; | |
}else | |
f->state = Clean; | |
- Fupdate(f, TRUE, TRUE); | |
+ Fupdate(f, true, true); | |
} | |
void | |
cmdupdate(void) | |
{ | |
if(cmd && cmd->mod!=0){ | |
- Fupdate(cmd, FALSE, downloaded); | |
+ Fupdate(cmd, false, downloaded); | |
cmd->dot.r.p1 = cmd->dot.r.p2 = cmd->nrunes; | |
telldot(cmd); | |
} | |
@@ -324,7 +324,7 @@ update(void) | |
delete(f); | |
continue; | |
} | |
- if(f->mod==modnum && Fupdate(f, FALSE, downloaded)) | |
+ if(f->mod==modnum && Fupdate(f, false, downloaded)) | |
anymod++; | |
if(f->rasp) | |
telldot(f); | |
@@ -342,9 +342,9 @@ current(File *f) | |
void | |
edit(File *f, int cmd) | |
{ | |
- int empty = TRUE; | |
+ bool empty = true; | |
Posn p; | |
- int nulls; | |
+ bool nulls; | |
if(cmd == 'r') | |
Fdelete(f, addr.r.p1, addr.r.p2); | |
@@ -352,7 +352,7 @@ edit(File *f, int cmd) | |
Fdelete(f, (Posn)0, f->nrunes); | |
addr.r.p2 = f->nrunes; | |
}else if(f->nrunes!=0 || (f->name.s[0] && Strcmp(&genstr, &f->name)!=0)) | |
- empty = FALSE; | |
+ empty = false; | |
if((io = open(genc, O_RDONLY))<0) { | |
if (curfile && curfile->state == Unread) | |
curfile->state = Clean; | |
@@ -368,14 +368,14 @@ edit(File *f, int cmd) | |
if (quitok) | |
quitok = empty; | |
else | |
- quitok = FALSE; | |
- state(f, empty && !nulls? Clean : Dirty); | |
+ quitok = false; | |
+ state(f, empty && !nulls ? Clean : Dirty); | |
if(cmd == 'e') | |
filename(f); | |
} | |
int | |
-getname(File *f, String *s, int save) | |
+getname(File *f, String *s, bool save) | |
{ | |
int c, i; | |
@@ -405,7 +405,7 @@ getname(File *f, String *s, int save) | |
if(f && (save || f->name.s[0]==0)){ | |
Fsetname(f, &genstr); | |
if(Strcmp(&f->name, &genstr)){ | |
- quitok = f->closeok = FALSE; | |
+ quitok = (f->closeok = false); | |
f->qid = 0; | |
f->date = 0; | |
state(f, Dirty); /* if it's 'e', fix later */ | |
@@ -434,7 +434,7 @@ undostep(File *f) | |
Mark mark; | |
t = f->transcript; | |
- changes = Fupdate(f, TRUE, TRUE); | |
+ changes = Fupdate(f, true, true); | |
Bread(t, (wchar_t*)&mark, (sizeof mark)/RUNESIZE, f->markp); | |
Bdelete(t, f->markp, t->nrunes); | |
f->markp = mark.p; | |
@@ -444,7 +444,7 @@ undostep(File *f) | |
f->mod = mark.m; | |
f->closeok = mark.s1!=Dirty; | |
if(mark.s1==Dirty) | |
- quitok = FALSE; | |
+ quitok = false; | |
if(f->state==Clean && mark.s1==Clean && changes) | |
state(f, Dirty); | |
else | |
@@ -476,8 +476,8 @@ readcmd(String *s) | |
if(flist == 0) | |
(flist = Fopen())->state = Clean; | |
addr.r.p1 = 0, addr.r.p2 = flist->nrunes; | |
- retcode = plan9(flist, '<', s, FALSE); | |
- Fupdate(flist, FALSE, FALSE); | |
+ retcode = plan9(flist, '<', s, false); | |
+ Fupdate(flist, false, false); | |
flist->mod = 0; | |
if (flist->nrunes > BLOCKSIZE) | |
error(Etoolong); | |
@@ -516,7 +516,7 @@ cd(String *str) | |
--wd.n; | |
wd.s[wd.n-1]='/'; | |
} | |
- if(chdir(getname((File *)0, str, FALSE)? genc : home)) | |
+ if(chdir(getname((File *)0, str, false)? genc : home)) | |
syserror("chdir"); | |
settempfile(); | |
for(i=0; i<tempfile.nused; i++){ | |
@@ -606,7 +606,7 @@ tofile(String *s) | |
f = lookfile(&genstr, 1); | |
if (f == NULL) | |
- f = readflist(FALSE, FALSE); | |
+ f = readflist(false, false); | |
if (f == NULL) | |
error_s(Emenu, genc); | |
@@ -621,7 +621,7 @@ getfile(String *s) | |
if(loadflist(s) == 0) | |
Fsetname(f = newfile(), &genstr); | |
- else if((f=readflist(TRUE, FALSE)) == 0) | |
+ else if((f=readflist(true, false)) == 0) | |
error(Eblank); | |
return current(f); | |
} | |
@@ -639,7 +639,7 @@ closefiles(File *f, String *s) | |
error(Eblank); | |
if(loadflist(s) == 0) | |
error(Enewline); | |
- readflist(FALSE, TRUE); | |
+ readflist(false, true); | |
} | |
void | |
diff --git a/sam/sam.h b/sam/sam.h | |
@@ -13,9 +13,6 @@ | |
#define NBUFFILES 3+2*NDISC /* plan 9+undo+snarf+NDISC*(transcript+buf) */ | |
#define NSUBEXP 10 | |
-#define TRUE 1 | |
-#define FALSE 0 | |
- | |
#define INFINITY 0x7FFFFFFFL | |
#define INCR 25 | |
#define STRSIZE (2*BLOCKSIZE) | |
@@ -160,7 +157,7 @@ struct File | |
char state; /* Clean, Dirty, Unread, or Readerr*/ | |
char closeok; /* ok to close file? */ | |
char deleted; /* delete at completion of command */ | |
- char marked; /* file has been Fmarked at least once; once | |
+ bool marked; /* file has been Fmarked at least once; once | |
* set, this will never go off as undo doesn't | |
* revert to the dawn of time */ | |
int64_t dev; /* file system from which it was read */ | |
@@ -265,7 +262,7 @@ int execute(File*, Posn, Posn); | |
int filematch(File*, String*); | |
void filename(File*); | |
File *getfile(String*); | |
-int getname(File*, String*, int); | |
+int getname(File*, String*, bool); | |
int64_t getnum(void); | |
void hiccough(char*); | |
void inslist(List*, int, int64_t); | |
@@ -287,7 +284,7 @@ void print_ss(char*, String*, String*); | |
void print_s(char*, String*); | |
int rcv(void); | |
Range rdata(List*, Posn, Posn); | |
-Posn readio(File*, int*, int); | |
+Posn readio(File*, bool*, bool); | |
void rescue(void); | |
void resetcmd(void); | |
void resetsys(void); | |
@@ -350,8 +347,8 @@ extern char *shpath; | |
extern wchar_t genbuf[]; | |
extern char *genc; | |
extern int io; | |
-extern int patset; | |
-extern int quitok; | |
+extern bool patset; | |
+extern bool quitok; | |
extern Address addr; | |
extern Buffer *undobuf; | |
extern Buffer *snarfbuf; | |
@@ -370,13 +367,13 @@ extern String genstr; | |
extern String lastpat; | |
extern String lastregexp; | |
extern String plan9cmd; | |
-extern int downloaded; | |
-extern int eof; | |
-extern int bpipeok; | |
-extern int panicking; | |
+extern bool downloaded; | |
+extern bool eof; | |
+extern bool bpipeok; | |
+extern bool panicking; | |
extern wchar_t empty[]; | |
extern int termlocked; | |
-extern int noflush; | |
+extern bool noflush; | |
#include "mesg.h" | |
diff --git a/sam/shell.c b/sam/shell.c | |
@@ -101,7 +101,7 @@ plan9(File *f, int type, String *s, int nest) | |
if(pid == -1) | |
error(Efork); | |
if(type=='<' || type=='|'){ | |
- int nulls; | |
+ bool nulls; | |
if(downloaded && addr.r.p1 != addr.r.p2) | |
outTl(Hsnarflen, addr.r.p2-addr.r.p1); | |
snarf(f, addr.r.p1, addr.r.p2, snarfbuf, 0); | |
@@ -115,9 +115,9 @@ plan9(File *f, int type, String *s, int nest) | |
}else if(type=='>'){ | |
close(pipe1[0]); | |
io = pipe1[1]; | |
- bpipeok = 1; | |
+ bpipeok = true; | |
writeio(f); | |
- bpipeok = 0; | |
+ bpipeok = false; | |
closeio((Posn)-1); | |
} | |
retcode = waitfor(pid); | |
diff --git a/sam/xec.c b/sam/xec.c | |
@@ -5,8 +5,8 @@ | |
int Glooping; | |
int nest; | |
-int append(File*, Cmd*, Posn); | |
-int display(File*); | |
+bool append(File*, Cmd*, Posn); | |
+bool display(File*); | |
void looper(File*, Cmd*, int); | |
void filelooper(Cmd*, int); | |
void linelooper(File*, Cmd*); | |
@@ -69,13 +69,13 @@ cmdexec(File *f, Cmd *cp) | |
} | |
-int | |
+bool | |
a_cmd(File *f, Cmd *cp) | |
{ | |
return append(f, cp, addr.r.p2); | |
} | |
-int | |
+bool | |
b_cmd(File *f, Cmd *cp) | |
{ | |
f = cp->cmdc=='b'? tofile(cp->ctext) : getfile(cp->ctext); | |
@@ -83,10 +83,10 @@ b_cmd(File *f, Cmd *cp) | |
load(f); | |
else if(nest == 0) | |
filename(f); | |
- return TRUE; | |
+ return true; | |
} | |
-int | |
+bool | |
c_cmd(File *f, Cmd *cp) | |
{ | |
Fdelete(f, addr.r.p1, addr.r.p2); | |
@@ -94,39 +94,39 @@ c_cmd(File *f, Cmd *cp) | |
return append(f, cp, addr.r.p2); | |
} | |
-int | |
+bool | |
d_cmd(File *f, Cmd *cp) | |
{ | |
Fdelete(f, addr.r.p1, addr.r.p2); | |
f->ndot.r.p1 = f->ndot.r.p2 = addr.r.p1; | |
- return TRUE; | |
+ return true; | |
} | |
-int | |
+bool | |
D_cmd(File *f, Cmd *cp) | |
{ | |
closefiles(f, cp->ctext); | |
- return TRUE; | |
+ return true; | |
} | |
-int | |
+bool | |
e_cmd(File *f, Cmd *cp) | |
{ | |
if(getname(f, cp->ctext, cp->cmdc=='e')==0) | |
error(Enoname); | |
edit(f, cp->cmdc); | |
- return TRUE; | |
+ return true; | |
} | |
-int | |
+bool | |
f_cmd(File *f, Cmd *cp) | |
{ | |
- getname(f, cp->ctext, TRUE); | |
+ getname(f, cp->ctext, true); | |
filename(f); | |
- return TRUE; | |
+ return true; | |
} | |
-int | |
+bool | |
g_cmd(File *f, Cmd *cp) | |
{ | |
if(f!=addr.f)panic("g_cmd f!=addr.f"); | |
@@ -135,23 +135,23 @@ g_cmd(File *f, Cmd *cp) | |
f->dot = addr; | |
return cmdexec(f, cp->ccmd); | |
} | |
- return TRUE; | |
+ return true; | |
} | |
-int | |
+bool | |
i_cmd(File *f, Cmd *cp) | |
{ | |
return append(f, cp, addr.r.p1); | |
} | |
-int | |
+bool | |
k_cmd(File *f, Cmd *cp) | |
{ | |
f->mark = addr.r; | |
- return TRUE; | |
+ return true; | |
} | |
-int | |
+bool | |
m_cmd(File *f, Cmd *cp) | |
{ | |
Address addr2; | |
@@ -161,10 +161,10 @@ m_cmd(File *f, Cmd *cp) | |
move(f, addr2); | |
else | |
copy(f, addr2); | |
- return TRUE; | |
+ return true; | |
} | |
-int | |
+bool | |
n_cmd(File *f, Cmd *cp) | |
{ | |
int i; | |
@@ -175,31 +175,32 @@ n_cmd(File *f, Cmd *cp) | |
Strduplstr(&genstr, &f->name); | |
filename(f); | |
} | |
- return TRUE; | |
+ return true; | |
} | |
-int | |
+bool | |
p_cmd(File *f, Cmd *cp) | |
{ | |
return display(f); | |
} | |
-int | |
+bool | |
q_cmd(File *f, Cmd *cp) | |
{ | |
trytoquit(); | |
if(downloaded){ | |
outT0(Hexit); | |
- return TRUE; | |
+ return true; | |
} | |
- return FALSE; | |
+ return false; | |
} | |
-int | |
+bool | |
s_cmd(File *f, Cmd *cp) | |
{ | |
int i, j, c, n; | |
- Posn p1, op, didsub = 0, delta = 0; | |
+ Posn p1, op, delta = 0; | |
+ bool didsub = false; | |
n = cp->num; | |
op= -1; | |
@@ -246,81 +247,81 @@ s_cmd(File *f, Cmd *cp) | |
Finsert(f, &genstr, sel.p[0].p2); | |
delta+=genstr.n; | |
} | |
- didsub = 1; | |
+ didsub = true; | |
if(!cp->flag) | |
break; | |
} | |
if(!didsub && nest==0) | |
error(Enosub); | |
f->ndot.r.p1 = addr.r.p1, f->ndot.r.p2 = addr.r.p2+delta; | |
- return TRUE; | |
+ return true; | |
} | |
-int | |
+bool | |
u_cmd(File *f, Cmd *cp) | |
{ | |
int n; | |
n = cp->num; | |
while(n-- && undo()) | |
; | |
- return TRUE; | |
+ return true; | |
} | |
-int | |
+bool | |
w_cmd(File *f, Cmd *cp) | |
{ | |
- if(getname(f, cp->ctext, FALSE)==0) | |
+ if(getname(f, cp->ctext, false)==0) | |
error(Enoname); | |
writef(f); | |
- return TRUE; | |
+ return true; | |
} | |
-int | |
+bool | |
x_cmd(File *f, Cmd *cp) | |
{ | |
if(cp->re) | |
looper(f, cp, cp->cmdc=='x'); | |
else | |
linelooper(f, cp); | |
- return TRUE; | |
+ return true; | |
} | |
-int | |
+bool | |
X_cmd(File *f, Cmd *cp) | |
{ | |
filelooper(cp, cp->cmdc=='X'); | |
- return TRUE; | |
+ return true; | |
} | |
-int | |
+bool | |
plan9_cmd(File *f, Cmd *cp) | |
{ | |
plan9(f, cp->cmdc, cp->ctext, nest); | |
- return TRUE; | |
+ return true; | |
} | |
-int | |
+bool | |
eq_cmd(File *f, Cmd *cp) | |
{ | |
- int charsonly = FALSE; | |
+ int charsonly = false; | |
switch(cp->ctext->n){ | |
case 1: | |
- charsonly = FALSE; | |
+ charsonly = false; | |
break; | |
case 2: | |
if(cp->ctext->s[0]=='#'){ | |
- charsonly = TRUE; | |
+ charsonly = true; | |
break; | |
} | |
default: | |
error(Enewline); | |
} | |
printposn(f, charsonly); | |
- return TRUE; | |
+ return true; | |
} | |
-int | |
+bool | |
nl_cmd(File *f, Cmd *cp) | |
{ | |
if(cp->addr == 0){ | |
@@ -334,17 +335,17 @@ nl_cmd(File *f, Cmd *cp) | |
moveto(f, addr.r); | |
else | |
display(f); | |
- return TRUE; | |
+ return true; | |
} | |
-int | |
+bool | |
cd_cmd(File *f, Cmd *cp) | |
{ | |
cd(cp->ctext); | |
- return TRUE; | |
+ return true; | |
} | |
-int | |
+bool | |
append(File *f, Cmd *cp, Posn p) | |
{ | |
if(cp->ctext->n>0 && cp->ctext->s[cp->ctext->n-1]==0) | |
@@ -353,10 +354,10 @@ append(File *f, Cmd *cp, Posn p) | |
Finsert(f, cp->ctext, p); | |
f->ndot.r.p1 = p; | |
f->ndot.r.p2 = p+cp->ctext->n; | |
- return TRUE; | |
+ return true; | |
} | |
-int | |
+bool | |
display(File *f) | |
{ | |
Posn p1, p2; | |
@@ -382,7 +383,7 @@ display(File *f) | |
p1+=n; | |
} | |
f->dot = addr; | |
- return TRUE; | |
+ return true; | |
} | |
void | |
diff --git a/samterm/flayer.c b/samterm/flayer.c | |
@@ -234,25 +234,25 @@ fldelete(Flayer *l, int64_t p0, int64_t p1) | |
} | |
} | |
-int | |
+bool | |
flselect(Flayer *l) | |
{ | |
- int ret = 0; | |
+ bool ret = false; | |
if(l->visible!=All) | |
flupfront(l); | |
if(mouse.msec-l->click<Clicktime) | |
- ret = 1; | |
+ ret = true; | |
frselect(&l->f, &mouse); | |
if(l->f.p0==l->f.p1){ | |
- if(ret == 1 && l->f.p0+l->origin==l->p0){ | |
- ret = 1; | |
+ if(ret && l->f.p0+l->origin==l->p0){ | |
+ ret = true; | |
l->click = 0; | |
}else { | |
- ret = 0; | |
+ ret = false; | |
l->click = mouse.msec; | |
} | |
}else { | |
- ret = 0; | |
+ ret = false; | |
l->click = 0; | |
} | |
l->p0 = l->f.p0+l->origin, l->p1 = l->f.p1+l->origin; | |
@@ -386,18 +386,18 @@ flprepare(Flayer *l) | |
return 1; | |
} | |
-static int somevis, someinvis, justvis; | |
+static bool somevis, someinvis, justvis; | |
Vis | |
visibility(Flayer *l) | |
{ | |
- somevis = someinvis = 0; | |
- justvis = 1; | |
+ somevis = someinvis = false; | |
+ justvis = true; | |
flrefresh(l, l->entire, 0); | |
- justvis = 0; | |
- if(somevis==0) | |
+ justvis = false; | |
+ if(!somevis) | |
return None; | |
- if(someinvis==0) | |
+ if(!someinvis) | |
return All; | |
return Some; | |
} | |
@@ -412,7 +412,7 @@ flrefresh(Flayer *l, Rectangle r, int i) | |
if((t=llist[i++]) == l){ | |
if(!justvis) | |
bitblt2(&screen, r.min, l->f.b, r, S, 0, l->bg); | |
- somevis = 1; | |
+ somevis = true; | |
}else{ | |
if(!rectXrect(t->entire, r)) | |
goto Top; /* avoid stacking unnecessarily */ | |
@@ -441,6 +441,6 @@ flrefresh(Flayer *l, Rectangle r, int i) | |
r.max.y = t->entire.max.y; | |
} | |
/* remaining piece of r is blocked by t; forget about it */ | |
- someinvis = 1; | |
+ someinvis = true; | |
} | |
} | |
diff --git a/samterm/flayer.h b/samterm/flayer.h | |
@@ -41,7 +41,7 @@ int flprepare(Flayer*); | |
Rectangle flrect(Flayer*, Rectangle); | |
void flrefresh(Flayer*, Rectangle, int); | |
void flreshape(Rectangle); | |
-int flselect(Flayer*); | |
+bool flselect(Flayer*); | |
void flsetselect(Flayer*, int64_t, int64_t); | |
void flstart(Rectangle); | |
void flupfront(Flayer*); | |
diff --git a/samterm/main.c b/samterm/main.c | |
@@ -24,10 +24,10 @@ int64_t snarflen; | |
int64_t typestart = -1; | |
int64_t typeend = -1; | |
int64_t typeesc = -1; | |
-int64_t modified = 0; /* strange lookahead for menus */ | |
+bool modified = false; /* strange lookahead for menus */ | |
char lock = 1; | |
-char hasunlocked = 0; | |
-int expandtabs = 0; | |
+bool hasunlocked = false; | |
+bool expandtabs = false; | |
char *machine = "localhost"; | |
int nofifo = 0; | |
@@ -433,12 +433,12 @@ flushtyping(int clearesc) | |
if(clearesc) | |
typeesc = -1; | |
if(typestart == typeend) { | |
- modified = 0; | |
+ modified = false; | |
return; | |
} | |
t = which->user1; | |
if(t != &cmd) | |
- modified = 1; | |
+ modified = true; | |
rload(&t->rasp, typestart, typeend, &n); | |
scratch[n] = 0; | |
if(t==&cmd && typeend==t->rasp.nrunes && scratch[typeend-typestart-1]=='\n… | |
@@ -992,7 +992,7 @@ type(Flayer *l) /* what a bloody mess this is -- but it'… | |
if (typestart == typeend){ | |
typestart = -1; | |
typeend = -1; | |
- modified = 0; | |
+ modified = false; | |
} | |
} | |
} | |
diff --git a/samterm/mesg.c b/samterm/mesg.c | |
@@ -325,7 +325,7 @@ setlock(void) | |
void | |
clrlock(void) | |
{ | |
- hasunlocked = 1; | |
+ hasunlocked = true; | |
if(lock > 0) | |
lock--; | |
if(lock == 0) | |
diff --git a/samterm/samterm.h b/samterm/samterm.h | |
@@ -89,10 +89,10 @@ extern Text cmd; | |
extern wchar_t *scratch; | |
extern int64_t nscralloc; | |
extern char lock; | |
-extern char hasunlocked; | |
+extern bool hasunlocked; | |
extern int64_t snarflen; | |
extern Mouse mouse; | |
-extern int64_t modified; | |
+extern bool modified; | |
wchar_t *stgettext(Flayer*, int64_t, uint64_t*); | |
void *alloc(uint64_t n); |