mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-16 19:15:10 +00:00
(uxnasm) Read characters into char buffers
This commit is contained in:
parent
832ba26e30
commit
0ae8812680
1 changed files with 11 additions and 14 deletions
19
src/uxnasm.c
19
src/uxnasm.c
|
@ -278,10 +278,9 @@ writehex(char *w)
|
|||
static int
|
||||
tokenize(FILE *f)
|
||||
{
|
||||
unsigned int buf;
|
||||
char c;
|
||||
char *cptr = token;
|
||||
while(fread(&buf, 1, 1, f)) {
|
||||
char c = (char)buf;
|
||||
while(fread(&c, 1, 1, f)) {
|
||||
if(c < 0x21) {
|
||||
*cptr++ = 0x00;
|
||||
if(c == 0x0a)
|
||||
|
@ -315,15 +314,13 @@ doinclude(char *filename)
|
|||
static int
|
||||
walkcomment(char *w, FILE *f)
|
||||
{
|
||||
int i = 1;
|
||||
unsigned int buf;
|
||||
if(slen(w) != 1)
|
||||
return 0;
|
||||
while(fread(&buf, 1, 1, f)) {
|
||||
char c = (char)buf;
|
||||
int depth = 1;
|
||||
char c;
|
||||
if(slen(w) == 1)
|
||||
while(fread(&c, 1, 1, f)) {
|
||||
if(c == '(')
|
||||
i++;
|
||||
else if(c == ')' && --i < 1)
|
||||
depth++;
|
||||
else if(c == ')' && --depth < 1)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue