17
18
19
20
21
22
23
24
25
26
27
28
29
30
..
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
...
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
enum e { ok, badname, nofile };
enum kind { css, sass, scss, bad };
typedef enum { false, true } bool;
#define corebufsz 1024
char corebuf[corebufsz];
................................................................................
size_t rsz = bufptr-extbuf;
extbuf = realloc(extbuf, run);
bufptr = extbuf + rsz + sz;
return bufptr - sz;
}
}
}
// this point should never be reached
mkptr: {
void* ret = bufptr;
bufptr += sz;
return ret;
}
}
................................................................................
*namecur = 0;
printf("found import to %s;\n", namebuf);
namecur = namebuf;
}
++cur; goto read_start;
read_string:
if (*cur == 0) goto read_done; //unterminated string!?
if (*cur++ == strqt) goto read_start;
goto read_string;
read_ml_comment:
if (*cur == 0) goto read_done; //unterminated comment!
if (*cur == '*' && cur[1] == '/') {
cur += 2;
goto read_start;
}
++cur; goto read_ml_comment;
skip_line:
|
|
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
..
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
...
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <assert.h>
enum e { ok, badname, nofile };
enum kind { css, sass, scss, bad };
typedef enum { false, true } bool;
#define corebufsz 1024
char corebuf[corebufsz];
................................................................................
size_t rsz = bufptr-extbuf;
extbuf = realloc(extbuf, run);
bufptr = extbuf + rsz + sz;
return bufptr - sz;
}
}
}
assert(false); /* this point should never be reached */
mkptr: {
void* ret = bufptr;
bufptr += sz;
return ret;
}
}
................................................................................
*namecur = 0;
printf("found import to %s;\n", namebuf);
namecur = namebuf;
}
++cur; goto read_start;
read_string:
if (*cur == 0) goto read_done; /* unterminated string!? */
if (*cur++ == strqt) goto read_start;
goto read_string;
read_ml_comment:
if (*cur == 0) goto read_done; /* unterminated comment! */
if (*cur == '*' && cur[1] == '/') {
cur += 2;
goto read_start;
}
++cur; goto read_ml_comment;
skip_line:
|