⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cccp.i

📁 linux下基于c++的处理器仿真平台。具有处理器流水线
💻 I
📖 第 1 页 / 共 5 页
字号:
      output_file[s - spec] = 0;    }    else {      deps_target = 0;      output_file = spec;    }    deps_file = output_file;  }  if (print_deps) {    deps_allocated_size = 200;    deps_buffer = (char *) xmalloc (deps_allocated_size);    deps_buffer[0] = 0;    deps_size = 0;    deps_column = 0;    if (deps_target) {      deps_output (deps_target, 0);      deps_output (":", 0);    } else if (*in_fname == 0)      deps_output ("-: ", 0);    else {      int len;      char *p = in_fname;      char *p1 = p;      while (*p1) {	if (*p1 == '/')	  p = p1 + 1;	p1++;      }      len = strlen (p);      if (p[len - 2] == '.' && p[len - 1] == 'c')	deps_output (p, len - 2);      else if (p[len - 2] == '.' && p[len - 1] == 'C')	deps_output (p, len - 2);      else if (p[len - 3] == '.'	       && p[len - 2] == 'c'	       && p[len - 1] == 'c')	deps_output (p, len - 3);      else if (p[len - 2] == '.' && p[len - 1] == 's')	deps_output (p, len - 2);      else if (p[len - 2] == '.' && p[len - 1] == 'S')	deps_output (p, len - 2);      else if (p[len - 2] == '.' && p[len - 1] == 'm')	deps_output (p, len - 2);      else	deps_output (p, 0);      deps_output (".o : ", 0);      deps_output (in_fname, 0);      deps_output (" ", 0);    }  }  file_size_and_mode (f, &st_mode, &st_size);  fp->nominal_fname = fp->fname = in_fname;  fp->lineno = 1;  fp->system_header_p = 0;  if (! (((st_mode)&(0170000)) == (0100000))) {    int size;    int bsize;    int cnt;    U_CHAR *bufp;    bsize = 2000;    size = 0;    fp->buf = (U_CHAR *) xmalloc (bsize + 2);    bufp = fp->buf;    for (;;) {      cnt = read (f, bufp, bsize - size);      if (cnt < 0) goto perror;	      if (cnt == 0) break;	      size += cnt;      bufp += cnt;      if (bsize == size) {	        bsize *= 2;        fp->buf = (U_CHAR *) xrealloc (fp->buf, bsize + 2);	bufp = fp->buf + size;	      }    }    fp->length = size;  } else {    long i;    fp->length = 0;    fp->buf = (U_CHAR *) xmalloc (st_size + 2);    while (st_size > 0) {      i = read (f, fp->buf + fp->length, st_size);      if (i <= 0) {        if (i == 0) break;	goto perror;      }      fp->length += i;      st_size -= i;    }  }  fp->bufp = fp->buf;  fp->if_stack = if_stack;  if ((fp->length > 0 && fp->buf[fp->length - 1] != '\n')      || (fp->length > 1 && fp->buf[fp->length - 2] == '\\')) {    fp->buf[fp->length++] = '\n';    missing_newline = 1;  }  fp->buf[fp->length] = '\0';  if (!no_trigraphs)    trigraph_pcp (fp);  if (!out_fname || !strcmp (out_fname, ""))    out_fname = "stdout";  else if (! freopen (out_fname, "w", (&_iob[1])))    pfatal_with_name (out_fname);  output_line_command (fp, &outbuf, 0, same_file);  for (i = 1; i < argc; i++)    if (pend_includes[i]) {      int fd = open (pend_includes[i], 0, 0666);      if (fd < 0) {	perror_with_name (pend_includes[i]);	return 33	;      }      finclude (fd, pend_includes[i], &outbuf, 0, ((char *)0));    }  rescan (&outbuf, 0);  if (pedantic && missing_newline)    pedwarn ("file does not end in newline");  if (dump_macros == dump_only)    dump_all_macros ();  else if (! inhibit_output) {    write_output ();  }  if (print_deps) {    if (errors == 0) {      if (deps_file && ! (deps_stream = fopen (deps_file, "a")))	pfatal_with_name (deps_file);      fputs (deps_buffer, deps_stream);      		(--(  deps_stream)->_cnt < 0 ? 			_flsbuf((int) ('\n'), (  deps_stream)) : 			(int) (*(  deps_stream)->_ptr++ = (unsigned char) ('\n')));      if (deps_file) {	if (((deps_stream)->_flag & 0040) || fclose (deps_stream) != 0)	  fatal ("I/O error on output");      }    }  }  if ((((&_iob[1]))->_flag & 0040) || fclose ((&_iob[1])) != 0)    fatal ("I/O error on output");  if (errors)    exit (33	);  exit (0	); perror:  pfatal_with_name (in_fname);  return 0;}static voidpath_include (path)     char *path;{  char *p;  p = path;  if (*p)    while (1) {      char *q = p;      char *name;      struct file_name_list *dirtmp;      while (*q != 0 && *q != ':') q++;      if (p == q) {	name = (char *) xmalloc (2);	name[0] = '.';	name[1] = 0;      } else {	name = (char *) xmalloc (q - p + 1);	bcopy (p, name, q - p);	name[q - p] = 0;      }      dirtmp = (struct file_name_list *)	xmalloc (sizeof (struct file_name_list));      dirtmp->next = 0;		      dirtmp->control_macro = 0;      dirtmp->fname = name;      append_include_chain (dirtmp, dirtmp);      p = q;      if (*p == 0)	break;      p++;    }}static voidtrigraph_pcp (buf)     FILE_BUF *buf;{  register U_CHAR c, *fptr, *bptr, *sptr;  int len;  fptr = bptr = sptr = buf->buf;  while ((sptr = (U_CHAR *) index (sptr, '?')) != 0L) {    if (*++sptr != '?')      continue;    switch (*++sptr) {      case '=':      c = '#';      break;    case '(':      c = '[';      break;    case '/':      c = '\\';      break;    case ')':      c = ']';      break;    case '\'':      c = '^';      break;    case '<':      c = '{';      break;    case '!':      c = '|';      break;    case '>':      c = '}';      break;    case '-':      c  = '~';      break;    case '?':      sptr--;      continue;    default:      continue;    }    len = sptr - fptr - 2;    if (bptr != fptr && len > 0)      bcopy (fptr, bptr, len);	    bptr += len;    *bptr++ = c;    fptr = ++sptr;  }  len = buf->length - (fptr - buf->buf);  if (bptr != fptr && len > 0)    bcopy (fptr, bptr, len);  buf->length -= fptr - bptr;  buf->buf[buf->length] = '\0';  if (warn_trigraphs && fptr != bptr)    warning ("%d trigraph(s) encountered", (fptr - bptr) / 2);}static voidnewline_fix (bp)     U_CHAR *bp;{  register U_CHAR *p = bp;  register int count = 0;  while (1) {    if (p[0] == '\\') {      if (p[1] == '\n')	p += 2, count++;      else if (p[1] == '\r' && p[2] == '\n')	p += 3, count++;      else	break;    } else      break;  }  if (count == 0 || (*p != '/' && *p != '*'))    return;  while (*p == '*' || *p == '/')    *bp++ = *p++;  while (count-- > 0) {    *bp++ = '\\';    *bp++ = '\n';  }}static voidname_newline_fix (bp)     U_CHAR *bp;{  register U_CHAR *p = bp;  register int count = 0;  while (1) {    if (p[0] == '\\') {      if (p[1] == '\n')	p += 2, count++;      else if (p[1] == '\r' && p[2] == '\n')	p += 3, count++;      else	break;    } else      break;  }  if (count == 0 || !is_idchar[*p])    return;  while (is_idchar[*p])    *bp++ = *p++;  while (count-- > 0) {    *bp++ = '\\';    *bp++ = '\n';  }}static char *get_lintcmd (ibp, limit, argstart, arglen, cmdlen)     register U_CHAR *ibp;     register U_CHAR *limit;     U_CHAR **argstart;		     int *arglen, *cmdlen;	{  long linsize;  register U_CHAR *numptr;	  *arglen = 0;  do { while (is_hor_space[*ibp]) ibp++; } while (0);  if (ibp >= limit) return 0L;  linsize = limit - ibp;  if ((linsize >= 10) && !strncmp (ibp, "NOTREACHED", 10)) {    *cmdlen = 10;    return "NOTREACHED";  }  if ((linsize >= 8) && !strncmp (ibp, "ARGSUSED", 8)) {    *cmdlen = 8;    return "ARGSUSED";  }  if ((linsize >= 11) && !strncmp (ibp, "LINTLIBRARY", 11)) {    *cmdlen = 11;    return "LINTLIBRARY";  }  if ((linsize >= 7) && !strncmp (ibp, "VARARGS", 7)) {    *cmdlen = 7;    ibp += 7; linsize -= 7;    if ((linsize == 0) || ! (((*(__lc_ctype->core.iswctype)) == 0L) 		? (int) (__lc_ctype->_mask[*ibp] & (0x010)) 		: (*(__lc_ctype->core.iswctype)) (*ibp,0x010,__lc_ctype))) return "VARARGS";    for (numptr = *argstart = ibp; (numptr < limit) && (((*(__lc_ctype->core.iswctype)) == 0L) 		? (int) (__lc_ctype->_mask[*numptr] & (0x010)) 		: (*(__lc_ctype->core.iswctype)) (*numptr,0x010,__lc_ctype));	 numptr++);    *arglen = numptr - *argstart;    return "VARARGS";  }  return 0L;}static voidrescan (op, output_marks)     FILE_BUF *op;     int output_marks;{  register U_CHAR c;  register int ident_length = 0;  register int hash = 0;  FILE_BUF *ip;  register U_CHAR *ibp;  register U_CHAR *limit;  register U_CHAR *obp;  int redo_char = 0;  int concatenated = 0;  int start_line;  int multiline_string_line = 0;  U_CHAR *beg_of_line;  if (no_output && instack[indepth].fname != 0)    skip_if_group (&instack[indepth], 1);  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);  beg_of_line = ibp;  if (*limit != 0)    abort ();  while (1) {    c = *ibp++;    *obp++ = c;    switch (c) {    case '\\':      if (ibp >= limit)	break;      if (*ibp == '\n') {	++ibp;	++ip->lineno;	--obp;			break;      }      if (ident_length > 0)	goto specialchar;      *obp++ = *ibp++;      break;    case '#':      if (assertions_flag) {	do { while (is_hor_space[*ibp]) ibp++; } while (0);	while (is_idchar[*ibp])	  *obp++ = *ibp++;	do { while (is_hor_space[*ibp]) ibp++; } while (0);	if (*ibp == '(') {	  ip->bufp = ibp;	  skip_paren_group (ip);	  bcopy (ibp, obp, ip->bufp - ibp);	  obp += ip->bufp - ibp;	  ibp = ip->bufp;	}      }      if (ip->macro != 0)	goto randomchar;      if (ip->fname == 0 && beg_of_line == ip->buf)	goto randomchar;      if (ident_length)	goto specialchar;      if (beg_of_line == 0)	goto randomchar;      {	U_CHAR *bp;	bp = beg_of_line;	if (!traditional)	  while (1) {	    if (is_hor_space[*bp])	      bp++;	    else if (*bp == '\\' && bp[1] == '\n')	      bp += 2;	    else if (*bp == '/' && bp[1] == '*') {	      bp += 2;	      while (!(*bp == '*' && bp[1] == '/'))		bp++;	      bp += 2;	    }	    else if (cplusplus_comments && *bp == '/' && bp[1] == '/') {	      bp += 2;	      while (*bp++ != '\n') ;	    }	    else break;	  }	if (bp + 1 != ibp)	  goto randomchar;      }      --obp;		      ip->bufp = ibp;      op->bufp = obp;      if (! handle_directive (ip, op)) {	if (no_output && instack[indepth].fname) {	  skip_if_group (&instack[indepth], 1);	  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);	  beg_of_line = ibp;	  break;	}	++obp;			goto randomchar;      }      if (no_output && instack[indepth].fname)	skip_if_group (&instack[indepth], 1);      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);      beg_of_line = ibp;      break;    case '\"':			    case '\'':      if (ident_length)	goto specialchar;      start_line = ip->lineno;      while (1) {	if (ibp >= limit) {	  if (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);	    continue;	  }	  if (!traditional) {	    error_with_line (line_for_error (start_line),			     "unterminated string or character constant");	    error_with_line (multiline_string_line,			     "possible real start of unterminated constant");	    multiline_string_line = 0;	  }	  break;	}	*obp++ = *ibp;	switch (*ibp++) {	case '\n':	  ++ip->lineno;	  ++op->lineno;	  if (traditional) {	    beg_of_line = ibp;	    goto while2end;	  }	  if (pedantic || c == '\'') {	    error_with_line (line_for_error (start_line),			     "unterminated string or character constant");	    goto while2end;	  }	  if (multiline_string_line == 0)	    multiline_string_line = ip->lineno - 1;	  break;	case '\\':	  if (ibp >= limit)	    break;	  if (*ibp == '\n') {	    --obp;	    ++ibp;	    ++ip->lineno;	  } else {	    while (*ibp == '\\' && ibp[1] == '\n') {	      ibp += 2;	      ++ip->lineno;	    }	    *obp++ = *ibp++;	  }	  break;	case '\"':	case '\'':	  if (ibp[-1] == c)	    goto while2end;	  break;	}      }    while2end:      break;    case '/':      if (*ibp == '\\' && ibp[1] == '\n')	newline_fix (ibp);      if (*ibp != '*'	  && !(cplusplus_comments && *ibp == '/'))	goto randomchar;      if (ip->macro != 0)	goto randomchar;      if (ident_length)	goto specialchar;      if (*ibp == '/') {	start_line = ip->lineno;	--ibp;				--obp;	if (! put_out_comments)	  *obp++ = ' ';	else {	  *obp++ = '/';	  *obp++ = '/';	}	{

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -