/* ARGSUSED */ static int ctx_synopsis(MACRO_PROT_ARGS) { int nl; nl = MDOC_NEWLINE & m->flags; /* If we're not in the SYNOPSIS, go straight to in-line. */ if ( ! (MDOC_SYNOPSIS & m->flags)) return(in_line(m, tok, line, ppos, pos, buf)); /* If we're a nested call, same place. */ if ( ! nl) return(in_line(m, tok, line, ppos, pos, buf)); /* * XXX: this will open a block scope; however, if later we end * up formatting the block scope, then child nodes will inherit * the formatting. Be careful. */ if (MDOC_Nm == tok) return(blk_full(m, tok, line, ppos, pos, buf)); assert(MDOC_Vt == tok); return(blk_part_imp(m, tok, line, ppos, pos, buf)); }
static void ctx_synopsis(MACRO_PROT_ARGS) { if (~mdoc->flags & (MDOC_SYNOPSIS | MDOC_NEWLINE)) in_line(mdoc, tok, line, ppos, pos, buf); else if (tok == MDOC_Nm) blk_full(mdoc, tok, line, ppos, pos, buf); else { assert(tok == MDOC_Vt); blk_part_imp(mdoc, tok, line, ppos, pos, buf); } }
char *get_fd(const int fd, int *i) { char *dst; char *tmp; int j; j = 1; *i = 1; dst = ft_memalloc(sizeof(char) * BUFF_SIZE + 1); tmp = ft_memalloc(sizeof(char) * BUFF_SIZE + 1); while (j == 1 && *i > 0) { *i = read(fd, tmp, BUFF_SIZE); if (*i >= 0) { tmp[*i] = '\0'; dst = ft_strjoin(dst, tmp); } j = in_line(dst); } free(tmp); return (dst); }
preprocess() { int k; char c; if(ccode) { line = mline; ifline(); if(eof) return; } else { in_line(); return; } pptr = -1; while(ch != NEWLINE && ch) { if(white()) { keepch(' '); while(white()) gch(); } else if(ch == '"') { keepch(ch); gch(); while(ch != '"' || (*(lptr-1) == 92 && *(lptr-2) != 92)) { if(ch == NULL) { error("no quote"); break; } keepch(gch()); } gch(); keepch('"'); } else if(ch == 39) { keepch(39); gch(); while(ch != 39 || (*(lptr-1) == 92 && *(lptr-2) != 92)) { if(ch == NULL) { error("no apostrophe"); break; } keepch(gch()); } gch(); keepch(39); } else if(ch == '/' && nch == '*') { bump(2); while((ch == '*' && nch == '/') == 0) { if(ch) bump(1); else { ifline(); if(eof) break; } } bump(2); } else if(an(ch)) { k = 0; while(an(ch) && k < NAMEMAX) { msname[k++] = ch; gch(); } msname[k] = NULL; if(search(msname, macn, NAMESIZE+2, MACNEND, MACNBR, 0)) { k = getint(cptr+NAMESIZE, 2); while(c = macq[k++]) keepch(c); while(an(ch)) gch(); } else { k = 0; while(c = msname[k++]) keepch(c); } } else keepch(gch()); } if(pptr >= LINEMAX) error("line too long"); keepch(NULL); line = pline; bump(0); }