/* Partially preprocesses the contents of infile to outfile. */ void partialpreprocess(struct ppproc *ppp, void *infile, void *outfile) { beginfile(ppp); seterrorline(1); while (readline(ppp, infile) && writeline(ppp, outfile)) advanceline(ppp->line); seterrorline(0); endfile(ppp); }
/* Partially preprocesses the contents of infile to outfile. */ void preprocess_file(CparsePP *pp, void *infile, void *outfile) { begin_pp(pp); seterrorline(1); while (readline(pp, infile) && writeline(pp, outfile)) advanceline(pp->line); seterrorline(0); end_pp(pp); }
char* preprocess_buf(CparsePP *pp, const char *inbuf) { // TODO: implement more dynamic allocation char* outbuf = malloc(4098); begin_pp(pp); seterrorline(1); while (readline_buf(pp, inbuf) && writeline_buf(pp, outbuf)) advanceline(pp->line); seterrorline(0); end_pp(pp); return outbuf; }