Skip to content

Commit

Permalink
use c stdbool
Browse files Browse the repository at this point in the history
  • Loading branch information
laffer1 committed Dec 1, 2024
1 parent 84838b7 commit b060917
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions sys/dev/speaker/spkr.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,6 @@ rest(int centisecs)
* except possibly at physical block boundaries.
*/

#ifndef __bool_true_false_are_defined
typedef int bool;
#endif
#define TRUE 1
#define FALSE 0

#define dtoi(c) ((c) - '0')

static int octave; /* currently selected octave */
Expand Down Expand Up @@ -183,8 +177,8 @@ playinit(void)
whole = (100 * SECS_PER_MIN * WHOLE_NOTE) / DFLT_TEMPO;
fill = NORMAL;
value = DFLT_VALUE;
octtrack = FALSE;
octprefix = TRUE; /* act as though there was an initial O(n) */
octtrack = false;
octprefix = true; /* act as though there was an initial O(n) */
}

/*
Expand Down Expand Up @@ -281,7 +275,7 @@ playstring(char *cp, size_t slen)
pitch -= OCTAVE_NOTES;
}
}
octprefix = FALSE;
octprefix = false;
lastpitch = pitch;

/* ...which may in turn be followed by an override time value */
Expand Down Expand Up @@ -310,29 +304,29 @@ playstring(char *cp, size_t slen)
break;
case 'O':
if (cp[1] == 'N' || cp[1] == 'n') {
octprefix = octtrack = FALSE;
octprefix = octtrack = false;
++cp;
slen--;
} else if (cp[1] == 'L' || cp[1] == 'l') {
octtrack = TRUE;
octtrack = true;
++cp;
slen--;
} else {
GETNUM(cp, octave);
if (octave >= nitems(pitchtab) / OCTAVE_NOTES)
octave = DFLT_OCTAVE;
octprefix = TRUE;
octprefix = true;
}
break;
case '>':
if (octave < nitems(pitchtab) / OCTAVE_NOTES - 1)
octave++;
octprefix = TRUE;
octprefix = true;
break;
case '<':
if (octave > 0)
octave--;
octprefix = TRUE;
octprefix = true;
break;
case 'N':
GETNUM(cp, pitch);
Expand Down Expand Up @@ -397,7 +391,7 @@ playstring(char *cp, size_t slen)
* endtone(), and rest() functions defined above.
*/

static int spkr_active = FALSE; /* exclusion flag */
static bool spkr_active = false; /* exclusion flag */
static char *spkr_inbuf; /* incoming buf */

static int
Expand All @@ -419,7 +413,7 @@ spkropen(dev, flags, fmt, td)
#endif /* DEBUG */
playinit();
spkr_inbuf = malloc(DEV_BSIZE, M_SPKR, M_WAITOK);
spkr_active = TRUE;
spkr_active = true;
return(0);
}
}
Expand Down Expand Up @@ -467,7 +461,7 @@ spkrclose(dev, flags, fmt, td)
wakeup(&endtone);
wakeup(&endrest);
free(spkr_inbuf, M_SPKR);
spkr_active = FALSE;
spkr_active = false;
return(0);
}

Expand Down

0 comments on commit b060917

Please sign in to comment.