📄 cccp.i
字号:
U_CHAR *before_bp = ibp+2; while (ibp < limit) { if (*ibp++ == '\n') { ibp--; if (put_out_comments) { bcopy (before_bp, obp, ibp - before_bp); obp += ibp - before_bp; } break; } } break; } } start_line = ip->lineno; ++ibp; if (lint) { U_CHAR *argbp; int cmdlen, arglen; char *lintcmd = get_lintcmd (ibp, limit, &argbp, &arglen, &cmdlen); if (lintcmd != 0L) { obp[-1] = '\n'; bcopy ("#pragma lint ", obp, 13); obp += 13; bcopy (lintcmd, obp, cmdlen); obp += cmdlen; if (arglen != 0) { *(obp++) = ' '; bcopy (argbp, obp, arglen); obp += arglen; } output_line_command (ip, op, 0, same_file); *(obp++) = ' '; *(obp++) = '/'; } } if (! put_out_comments) { if (traditional) obp--; else obp[-1] = ' '; } else *obp++ = '*'; { U_CHAR *before_bp = ibp; while (ibp < limit) { switch (*ibp++) { case '/': if (warn_comments && ibp < limit && *ibp == '*') warning("`/*' within comment"); break; case '*': if (*ibp == '\\' && ibp[1] == '\n') newline_fix (ibp); if (ibp >= limit || *ibp == '/') goto comment_end; break; case '\n': ++ip->lineno; if (!put_out_comments) *obp++ = '\n'; ++op->lineno; } } comment_end: if (ibp >= limit) error_with_line (line_for_error (start_line), "unterminated comment"); else { ibp++; if (put_out_comments) { bcopy (before_bp, obp, ibp - before_bp); obp += ibp - before_bp; } } } break; case '$': if (!dollars_in_ident) goto randomchar; goto letter; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (ident_length == 0) { while (ibp < limit) { while (ibp < limit && ibp[0] == '\\' && ibp[1] == '\n') { ++ip->lineno; ibp += 2; } c = *ibp++; if (!(((*(__lc_ctype->core.iswctype)) == 0L) ? (int) (__lc_ctype->_mask[c] & (0x002)) : (*(__lc_ctype->core.iswctype)) (c,0x002,__lc_ctype)) && (c != '.' || *ibp == '.') && c != '_') { --ibp; break; } *obp++ = c; if (c == 'e' || c == 'E') { while (ibp < limit && ibp[0] == '\\' && ibp[1] == '\n') { ++ip->lineno; ibp += 2; } if (ibp < limit && (*ibp == '+' || *ibp == '-')) { *obp++ = *ibp++; if (traditional) break; } } } break; } case '_': case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': letter: ident_length++; hash = ((hash << 2) + c); break; case '\n': if (ip->macro != 0) { if (*ibp == '-') { if (! concatenated) { ident_length = 0; hash = 0; } ibp++; if (!output_marks) { obp--; } else { *obp++ = '-'; } } else if (is_space[*ibp]) { if (ident_length > 0) goto specialchar; if (!output_marks) { obp[-1] = *ibp++; if (obp[-1] == '\n') op->lineno++; } else { *obp++ = *ibp++; } } else abort (); break; } if (ident_length > 0) goto specialchar; beg_of_line = ibp; ++ip->lineno; ++op->lineno; if (ip->lineno != op->lineno) { op->bufp = obp; output_line_command (ip, op, 1, same_file); (((op)->length - ((op)->bufp - (op)->buf) <= ( ip->length - (ip->bufp - ip->buf))) ? grow_outbuf ((op), ( ip->length - (ip->bufp - ip->buf))) : 0); obp = op->bufp; } break; case 0: if (ibp <= limit) goto randomchar; if (ip->macro != 0) { obp--; ibp--; if (traditional && ident_length && ! is_idchar[*instack[indepth - 1].bufp]) { redo_char = 1; goto randomchar; } do { ip->macro->type = T_MACRO; if (ip->free_ptr) free (ip->free_ptr); --indepth; } while (0); do { ip = &instack[indepth]; ibp = ip->bufp; limit = ip->buf + ip->length; op->bufp = obp; (((op)->length - ((op)->bufp - (op)->buf) <= ( limit - ibp)) ? grow_outbuf ((op), ( limit - ibp)) : 0); beg_of_line = 0; obp = op->bufp; } while (0); break; } if (ident_length == 0) { obp--; ibp--; op->bufp = obp; ip->bufp = ibp; goto ending; }specialchar: ibp--; obp--; redo_char = 1; default:randomchar: if (ident_length > 0) { register HASHNODE *hp; if (!pcp_outfile || pcp_inside_if) {startagain: for (hp = hashtab[(hash & 0x7fffffff) % 1403]; hp != 0L; hp = hp->next) { if (hp->length == ident_length) { int obufp_before_macroname; int op_lineno_before_macroname; register int i = ident_length; register U_CHAR *p = hp->name; register U_CHAR *q = obp - i; int disabled; if (! redo_char) q--; do { if (*p++ != *q++) goto hashcollision; } while (--i); if (! redo_char) { ibp--; obp--; } obufp_before_macroname = (obp - op->buf) - ident_length; op_lineno_before_macroname = op->lineno; if (hp->type == T_PCSTRING) { pcstring_used (hp); break; } disabled = hp->type == T_DISABLED; if (disabled) { if (output_marks) { (((op)->length - ((op)->bufp - (op)->buf) <= ( limit - ibp + 2)) ? grow_outbuf ((op), ( limit - ibp + 2)) : 0); *obp++ = '\n'; *obp++ = '-'; } break; } if ((hp->type == T_MACRO || hp->type == T_DISABLED) && hp->value.defn->nargs >= 0) { U_CHAR *old_ibp = ibp; U_CHAR *old_obp = obp; int old_iln = ip->lineno; int old_oln = op->lineno; while (1) { if (ibp == limit && ip->macro != 0) { do { ip->macro->type = T_MACRO; if (ip->free_ptr) free (ip->free_ptr); --indepth; } while (0); do { ip = &instack[indepth]; ibp = ip->bufp; limit = ip->buf + ip->length; op->bufp = obp; (((op)->length - ((op)->bufp - (op)->buf) <= ( limit - ibp)) ? grow_outbuf ((op), ( limit - ibp)) : 0); beg_of_line = 0; obp = op->bufp; } while (0); old_ibp = ibp; old_obp = obp; old_iln = ip->lineno; old_oln = op->lineno; } else if (*ibp == '/' && ibp+1 != limit && ibp[1] == '*') { if (put_out_comments) { *obp++ = '/'; *obp++ = '*'; } else if (! traditional) { *obp++ = ' '; } ibp += 2; while (ibp + 1 != limit && !(ibp[0] == '*' && ibp[1] == '/')) { if (*ibp == '\n') { ++ip->lineno; ++op->lineno; } if (put_out_comments) *obp++ = *ibp++; else ibp++; } ibp += 2; if (put_out_comments) { *obp++ = '*'; *obp++ = '/'; } } else if (is_space[*ibp]) { *obp++ = *ibp++; if (ibp[-1] == '\n') { if (ip->macro == 0) { ++ip->lineno; ++op->lineno; } else if (!output_marks) { obp--; if (*ibp == '-') ibp++; else { if (*ibp == '\n') ++op->lineno; *obp++ = *ibp++; } } else { *obp++ = *ibp++; } } } else break; } if (*ibp != '(') { ibp = old_ibp; obp = old_obp; ip->lineno = old_iln; op->lineno = old_oln; break; } } obp = op->buf + obufp_before_macroname; op->lineno = op_lineno_before_macroname; ip->bufp = ibp; op->bufp = obp; macroexpand (hp, op); obp = op->bufp; do { ip = &instack[indepth]; ibp = ip->bufp; limit = ip->buf + ip->length; op->bufp = obp; (((op)->length - ((op)->bufp - (op)->buf) <= ( limit - ibp)) ? grow_outbuf ((op), ( limit - ibp)) : 0); beg_of_line = 0; obp = op->bufp; } while (0); break; }hashcollision: ; } } ident_length = hash = 0; redo_char = 0; concatenated = 0; } } } ending: if (if_stack != ip->if_stack) { char *str; switch (if_stack->type) { case T_IF: str = "if"; break; case T_IFDEF: str = "ifdef"; break; case T_IFNDEF: str = "ifndef"; break; case T_ELSE: str = "else"; break; case T_ELIF: str = "elif"; break; } error_with_line (line_for_error (if_stack->lineno), "unterminated `#%s' conditional", str); } if_stack = ip->if_stack;}static FILE_BUFexpand_to_temp_buffer (buf, limit, output_marks, assertions) U_CHAR *buf, *limit; int output_marks, assertions;{ register FILE_BUF *ip; FILE_BUF obuf; int length = limit - buf; U_CHAR *buf1; int odepth = indepth; int save_assertions_flag = assertions_flag; assertions_flag = assertions; if (length < 0) abort (); buf1 = (U_CHAR *) alloca (length + 1); { register U_CHAR *p1 = buf; register U_CHAR *p2 = buf1; while (p1 != limit) *p2++ = *p1++; } buf1[length] = 0; obuf.length = length * 2 + 100; obuf.bufp = obuf.buf = (U_CHAR *) xmalloc (obuf.length); obuf.fname = 0; obuf.macro = 0; obuf.free_ptr = 0; if (indepth >= (200 - 1)) { error_with_line (line_for_error (instack[indepth].lineno), "macro or `#include' recursion too deep"); {return obuf;}; }; ++indepth; ip = &instack[indepth]; ip->fname = 0; ip->nominal_fname = 0; ip->system_header_p = 0; ip->macro = 0; ip->free_ptr = 0; ip->length = length; ip->buf = ip->bufp = buf1; ip->if_stack = if_stack; ip->lineno = obuf.lineno = 1; rescan (&obuf, output_marks); --indepth; if (indepth != odepth) abort (); obuf.length = obuf.bufp - obuf.buf; assertions_flag = save_assertions_flag; return obuf;}static inthandle_directive (ip, op) FILE_BUF *ip, *op;{ register U_CHAR *bp, *cp; register struct directive *kt; register int ident_length; U_CHAR *resume_p; int copy_command = 0; U_CHAR *ident, *after_ident; bp = ip->bufp; directive_start = bp - 1; while (1) { if (is_hor_space[*bp]) { if ((*bp == '\f' || *bp == '\v') && pedantic) pedwarn ("%s in preprocessing directive", *bp == '\f' ? "formfeed" : "vertical tab"); bp++; } else if (*bp == '/' && bp[1] == '*') { ip->bufp = bp; skip_to_end_of_comment (ip, &ip->lineno, 0); bp = ip->bufp; } else if (*bp == '\\' && bp[1] == '\n') { bp += 2; ip->lineno++; } else break; } cp = bp; while (1) { if (is_idchar[*cp]) cp++; else { if (*cp == '\\' && cp[1] == '\n') name_newline_fix (cp); if (is_idchar[*cp]) cp++; else break; } } ident_length = cp - bp; ident = bp; after_ident = cp; if (ident_length == 0 && *after_ident == '\n') { ip->bufp = after_ident; return 1; } if (ident_length == 0 || !is_idstart[*ident]) { U_CHAR *p = ident; while (is_idchar[*p]) { if (*p < '0' || *p > '9') break; p++; } if (p != ident && !is_idchar[*p]) { static struct directive line_directive_table[] = { { 4, do_line, "line", T_LINE}, }; if (pedantic) pedwarn ("`#' followed by integer"); after_ident = ident; kt = line_directive_table; goto old_linenum; } if (p == ident) { while (*p == '#' || is_hor_space[*p]) p++; if (*p == '\n') { if (pedantic && !lang_asm) warning ("invalid preprocessor directive"); return 0; } } if (!lang_asm) error ("invalid preprocessor directive name"); return 0; } for (kt = directive_table; kt->length > 0; kt++) { if (kt->length == ident_length && !strncmp (kt->name, ident, ident_length)) { register U_CHAR *buf; register U_CHAR *limit; int unterminated; int junk; int *already_output = 0; int keep_comments; old_linenum: limit = ip->buf + ip->length; unterminated = 0; keep_comments = traditional && kt->traditional_comments; if (kt->type == T_IMPORT && !(objc || lookup ("__NeXT__", -1, -1))) break; buf = bp = after_ident; while (bp < limit) { register U_CHAR c = *bp++; switch (c) { case '\\': if (bp < limit) { if (*bp == '\n') { ip->lineno++; copy_command = 1; } bp++; } break; case '\'': case '\"': bp = skip_quoted_string (bp - 1, limit, ip->lineno, &ip->lineno, ©_command, &unterminated); if (unterminated) { if (traditional) { ip->bufp = bp; goto endloop1; } ip->bufp = bp; return 1; } break; case '<': if (!kt->angle_brackets) break; while (*bp && *bp != '>') bp++;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -