Skip to content

Commit

Permalink
Kludge peek() and poke() to not sign extend on machines with signed c…
Browse files Browse the repository at this point in the history
…hars,

so a 0xff character will not sign extend and become an EOF.  This breaks
a test in mun\CC\83oz.t (which tripped the 0xff becomes EOF bug) so that
test needed to be rewritten.

Inline comment handling is still broken!  It only checks for a > to end
a html comment, not the correct --> sequence!
  • Loading branch information
david parsons committed Jul 16, 2016
1 parent d37ccb7 commit 0d71ce7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions generate.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,22 @@ pushc(char c, MMIOT *f)

/* look <i> characters ahead of the cursor.
*/
static inline int
static inline unsigned int
peek(MMIOT *f, int i)
{

i += (f->isp-1);

return (i >= 0) && (i < S(f->in)) ? T(f->in)[i] : EOF;
return (i >= 0) && (i < S(f->in)) ? (unsigned char)T(f->in)[i] : EOF;
}


/* pull a byte from the input buffer
*/
static inline int
static inline unsigned int
pull(MMIOT *f)
{
return ( f->isp < S(f->in) ) ? T(f->in)[f->isp++] : EOF;
return ( f->isp < S(f->in) ) ? (unsigned char)T(f->in)[f->isp++] : EOF;
}


Expand Down

0 comments on commit 0d71ce7

Please sign in to comment.