Lines Matching refs:s
346 Source *s = cursource; in gettokens() local
350 ip = s->inp; in gettokens()
353 s->lineinc = 0; in gettokens()
354 if (ip >= s->inl) in gettokens()
356 s->inl = s->inb; in gettokens()
357 fillbuf(s); in gettokens()
358 ip = s->inp = s->inb; in gettokens()
361 if (ip >= s->inb + (3 * INS / 4)) in gettokens()
363 memmove(s->inb, ip, 4 + s->inl - ip); in gettokens()
364 s->inl = s->inb + (s->inl - ip); in gettokens()
365 ip = s->inp = s->inb; in gettokens()
430 s->inp = ip; in gettokens()
434 while (s->inp + 1 >= s->inl && fillbuf(s) != EOF); in gettokens()
436 if (s->inp[1] == '\r') in gettokens()
438 memmove(s->inp + 1, s->inp + 2, s->inl - s->inp + 2); in gettokens()
439 s->inl -= 1; in gettokens()
447 while (s->inp + 1 >= s->inl && fillbuf(s) != EOF); in gettokens()
449 if (s->inp[1] == '\n') in gettokens()
451 memmove(s->inp, s->inp + 1, s->inl - s->inp + 1); in gettokens()
452 s->inl -= 1; in gettokens()
455 *s->inp = '\n'; in gettokens()
463 if (trigraph(s)) in gettokens()
472 if (foldline(s)) in gettokens()
474 s->lineinc++; in gettokens()
486 s->inp = ip; in gettokens()
494 s->inp = ip; in gettokens()
507 s->lineinc++; in gettokens()
508 s->inp = ip + 1; in gettokens()
517 s->lineinc++; in gettokens()
538 s->lineinc = 0;; in gettokens()
554 trigraph(Source * s) in trigraph() argument
558 while (s->inp + 2 >= s->inl && fillbuf(s) != EOF); in trigraph()
560 if (s->inp[1] != '?') in trigraph()
563 switch (s->inp[2]) in trigraph()
595 *s->inp = c; in trigraph()
596 memmove(s->inp + 1, s->inp + 3, s->inl - s->inp + 2); in trigraph()
597 s->inl -= 2; in trigraph()
603 foldline(Source * s) in foldline() argument
608 while ((s->inp[n] == ' ') || (s->inp[n] == '\t')) in foldline()
611 if ((s->inp + n >= s->inl) && (fillbuf(s) == EOF)) in foldline()
616 while (s->inp + (n + 1) >= s->inl && fillbuf(s) != EOF); in foldline()
619 if (((s->inp[n] == '\r') && (s->inp[n+1] == '\n')) || in foldline()
620 ((s->inp[n] == '\n') && (s->inp[n+1] == '\r'))) in foldline()
623 if ((s->inp[n] == '\n') || (s->inp[n] == '\r')) in foldline()
625 memmove(s->inp, s->inp + n + 1, s->inl - s->inp + n + 2); in foldline()
626 s->inl -= n + 1; in foldline()
633 fillbuf(Source * s) in fillbuf() argument
637 if (s->fd < 0 || (n = read(s->fd, (char *) s->inl, INS / 8)) <= 0) in fillbuf()
639 s->inl += n; in fillbuf()
640 s->inl[0] = s->inl[1] = s->inl[2] = s->inl[3] = EOB; in fillbuf()
643 s->inl[0] = s->inl[1] = s->inl[2] = s->inl[3] = EOFC; in fillbuf()
657 Source *s = new(Source); in setsource() local
660 s->line = 1; in setsource()
661 s->lineinc = 0; in setsource()
662 s->fd = fd; in setsource()
663 s->filename = name; in setsource()
664 s->next = cursource; in setsource()
665 s->ifdepth = 0; in setsource()
666 s->pathdepth = path; in setsource()
667 s->wrap = wrap; in setsource()
669 cursource = s; in setsource()
671 if (s->wrap) in setsource()
678 s->inb = domalloc(len + 4); in setsource()
679 s->inp = s->inb; in setsource()
680 strncpy((char *) s->inp, str, len); in setsource()
684 s->inb = domalloc(INS + 4); in setsource()
685 s->inp = s->inb; in setsource()
688 s->inl = s->inp + len; in setsource()
689 s->inl[0] = s->inl[1] = EOB; in setsource()
691 return s; in setsource()
697 Source *s = cursource; in unsetsource() local
699 if (s->wrap) in unsetsource()
702 if (s->fd >= 0) in unsetsource()
704 close(s->fd); in unsetsource()
705 dofree(s->inb); in unsetsource()
707 cursource = s->next; in unsetsource()
708 dofree(s); in unsetsource()