*/
enum ulas_ppdirs {
- ULAS_PPDIR_NONE = 0,
+ ULAS_PPDIR_NONE = 1,
ULAS_PPDIR_DEF,
ULAS_PPDIR_MACRO,
ULAS_PPDIR_ENDMACRO,
// reads the next line
// returns 0 if no more data can be read
-// 1 if data was read
+// > 0 if data was read (enum ulas_ppdirs id)
// -1 on error
// it also places the processed line into pp->line.buf
// note that this is overwritten by every call!
}
found:
- if (found_dir) {
+ if (found_dir != ULAS_PPDIR_NONE) {
switch (found_dir) {
case ULAS_PPDIR_DEF: {
// next token is a name
fwrite(line, 1, n, dst);
}
- return 0;
+ return ULAS_PPDIR_NONE;
}
int ulas_preprocnext(struct ulas_preproc *pp, FILE *dst, FILE *src, char *buf,
int rc = 1;
if (fgets(buf, n, src) != NULL) {
ulas.line++;
- if (ulas_preprocline(pp, dst, src, buf, strlen(buf)) == -1) {
- rc = -1;
- }
+ rc = ulas_preprocline(pp, dst, src, buf, strlen(buf));
} else {
rc = 0;
}