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

📄 stab.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
📖 第 1 页 / 共 2 页
字号:
	    field = &stab[dimtab[i]];	    printf("%s:", field->sname);	    gentype(field);	    if (field->sclass > FIELD) {		printf(",%d,%d;", field->offset, field->sclass - FIELD);	    } else {		printf(",%d,%d;", field->offset,		    tsize(field->stype, field->dimoff, field->sizoff));	    }	    ++i;	}	putchar(';');	break;    case ENUMTY:	printf("%d=e", id);	i = index;	while (dimtab[i] != -1) {	    field = &stab[dimtab[i]];	    printf("%s:%d,", field->sname, field->offset);	    i++;	}	putchar(';');	break;    default:	cerror("couldn't find basic type %d for %s\n", t, name);	break;    }}/* * Generate offset and size info. */private geninfo(p)register struct symtab *p;{    int stabtype;    if (p == nil) {	printf("\",0x%x,0,0,0\n", N_LSYM);    } else {	switch (p->sclass) {	    case EXTERN:	    case EXTDEF:		if (ISFTN(p->stype)) {		    printf("\",0x%x,0,%d,_%s\n", N_FUN, bsize(p), p->sname);		} else {		    printf("\",0x%x,0,%d,0\n", N_GSYM, bsize(p));		}		break;	    case STATIC:		stabtype = stabLCSYM ? N_LCSYM : N_STSYM;		if (ISFTN(p->stype)) {		    printf("\",0x%x,0,%d,_%s\n", N_FUN, bsize(p), p->sname);		} else if (p->slevel > 1) {		    printf("\",0x%x,0,%d,L%d\n", stabtype, bsize(p), p->offset);		} else {		    printf("\",0x%x,0,%d,_%s\n", stabtype, bsize(p), p->sname);		}		break;	    case REGISTER:		printf("\",0x%x,0,%d,%d\n", N_RSYM, bsize(p), p->offset);		break;	    case PARAM:		printf("\",0x%x,0,%d,%d\n", N_PSYM, bsize(p), bytes(argoff));		break;	    default:		printf("\",0x%x,0,%d,%d\n", N_LSYM, bsize(p), bytes(p->offset));		break;	}    }}/* * Generate information for a newly-defined structure. */outstruct(szindex, paramindex)int szindex, paramindex;{    register Typeid typeid;    register struct symtab *p;    register int i, t, strindex;    if (oldway) {	/* do nothing */;    } else if (gdebug) {	i = dimtab[szindex + 3];	p = &stab[i];	if (p->sname != nil) {	    strindex = dimtab[p->sizoff + 1];	    typeid = typelookup(p->stype, NILINDEX, FORWARD, i);	    if (typeid == nil) {		t = 0;	    } else {		t = typeid->tnum;		reentertype(typeid, p->stype, NILINDEX, strindex, NILINDEX);	    }	    printf("\t.stabs\t\"%s:T", p->sname);	    genstruct(p->stype, t, strindex, p->sname, bsize(p));	    geninfo(p);	}    }}pstab(name, type)char *name;int type;{    register int i;    register char c;    if (!gdebug) {	return;    } else if (oldway) {	old_pstab(name, type);	return;    }    /* locctr(PROG);  /* .stabs must appear in .text for c2 */#ifdef ASSTRINGS    if ( name[0] == '\0')	printf("\t.stabn\t");    else#ifndef FLEXNAMES	printf("\t.stabs\t\"%.8s\",", name);#else	printf("\t.stabs\t\"%s\",", name);#endif#else    printf("    .stab   ");    for(i=0; i<8; i++) 	if (c = name[i]) printf("'%c,", c);	else printf("0,");#endif    printf("0%o,", type);}#ifdef STABDOTpstabdot(type, value)int type;int value;{    if ( ! gdebug) {	return;    } else if (oldway) {	old_pstabdot(type, value);	return;    }    /* locctr(PROG);  /* .stabs must appear in .text for c2 */    printf("\t.stabd\t");    printf("0%o,0,0%o\n",type, value);}#endifextern char NULLNAME[8];extern int  labelno;extern int  fdefflag;psline(){    static int lastlineno;    register char *cp, *cq;    register int i;        if (!gdebug) {	return;    } else if (oldway) {	old_psline();	return;    }    cq = ititle;    cp = ftitle;    while ( *cq ) if ( *cp++ != *cq++ ) goto neq;    if ( *cp == '\0' ) goto eq;    neq:    for (i=0; i<100; i++)	ititle[i] = '\0';    cp = ftitle;    cq = ititle;    while ( *cp )  	*cq++ = *cp++;    *cq = '\0';    *--cq = '\0';#ifndef FLEXNAMES    for ( cp = ititle+1; *(cp-1); cp += 8 ) {	pstab(cp, N_SOL);	if (gdebug) printf("0,0,LL%d\n", labelno);    }#else    pstab(ititle+1, N_SOL);    if (gdebug) printf("0,0,LL%d\n", labelno);#endif    *cq = '"';    printf("LL%d:\n", labelno++);eq: if (lineno == lastlineno) return;    lastlineno = lineno;    if (fdefflag) {#ifdef STABDOT	pstabdot(N_SLINE, lineno);#else	pstab(NULLNAME, N_SLINE);	printf("0,%d,LL%d\n", lineno, labelno);	printf("LL%d:\n", labelno++);#endif    }}    plcstab(level)int level;{    if (!gdebug) {	return;    } else if (oldway) {	old_plcstab(level);	return;    }#ifdef STABDOT    pstabdot(N_LBRAC, level);#else    pstab(NULLNAME, N_LBRAC);    printf("0,%d,LL%d\n", level, labelno);    printf("LL%d:\n", labelno++);#endif}    prcstab(level)int level;{    if (!gdebug) {	return;    } else if (oldway) {	old_prcstab(level);	return;    }#ifdef STABDOT    pstabdot(N_RBRAC, level);#else    pstab(NULLNAME, N_RBRAC);    printf("0,%d,LL%d\n", level, labelno);    printf("LL%d:\n", labelno++);#endif}    pfstab(sname) char *sname;{    register struct symtab *p;    if (gdebug) {	if (oldway) {	    old_pfstab(sname);	} else {	    p = &stab[lookup(sname, 0)];	    printf("\t.stabs\t\"%s:", p->sname);	    putchar((p->sclass == STATIC) ? 'f' : 'F');	    gentype(p);	    geninfo(p);	}    }}/* * Old way of doing things. */private old_fixarg(p)struct symtab *p; {	if (gdebug) {		old_pstab(p->sname, N_PSYM);		if (gdebug) printf("0,%d,%d\n", p->stype, argoff/SZCHAR);		old_poffs(p);	}}private old_outstab(p)struct symtab *p; {	register TWORD ptype;	register char *pname;	register char pclass;	register int poffset;	if (!gdebug) return;	ptype = p->stype;	pname = p->sname;	pclass = p->sclass;	poffset = p->offset;	if (ISFTN(ptype)) {		return;	}		switch (pclass) {		case AUTO:		old_pstab(pname, N_LSYM);		printf("0,%d,%d\n", ptype, (-poffset)/SZCHAR);		old_poffs(p);		return;		case EXTDEF:	case EXTERN:		old_pstab(pname, N_GSYM);		printf("0,%d,0\n", ptype);		old_poffs(p);		return;				case STATIC:#ifdef LCOMM		/* stabLCSYM is 1 during nidcl so we can get stab type right */		old_pstab(pname, stabLCSYM ? N_LCSYM : N_STSYM);#else		old_pstab(pname, N_STSYM);#endif		if (p->slevel > 1) {			printf("0,%d,L%d\n", ptype, poffset);		} else {			printf("0,%d,%s\n", ptype, exname(pname));		}		old_poffs(p);		return;		case REGISTER:		old_pstab(pname, N_RSYM);		printf("0,%d,%d\n", ptype, poffset);		old_poffs(p);		return;		case MOS:	case MOU:		old_pstab(pname, N_SSYM);		printf("0,%d,%d\n", ptype, poffset/SZCHAR);		old_poffs(p);		return;		case PARAM:		/* parameter stab entries are processed in dclargs() */		return;		default:#ifndef FLEXNAMES		if (ddebug) printf("	No .stab for %.8s\n", pname);#else		if (ddebug) printf("	No .stab for %s\n", pname);#endif			}}private old_pstab(name, type)char *name;int type; {	register int i;	register char c;	if (!gdebug) return;	/* locctr(PROG);  /* .stabs must appear in .text for c2 */#ifdef ASSTRINGS	if ( name[0] == '\0')		printf("\t.stabn\t");	else#ifndef FLEXNAMES		printf("\t.stabs\t\"%.8s\", ", name);#else		printf("\t.stabs\t\"%s\", ", name);#endif#else	printf("	.stab	");	for(i=0; i<8; i++) 		if (c = name[i]) printf("'%c,", c);		else printf("0,");#endif	printf("0%o,", type);}#ifdef STABDOTprivate old_pstabdot(type, value)	int	type;	int	value;{	if ( ! gdebug) return;	/* locctr(PROG);  /* .stabs must appear in .text for c2 */	printf("\t.stabd\t");	printf("0%o,0,0%o\n",type, value);}#endifprivate old_poffs(p)register struct symtab *p; {	int s;	if (!gdebug) return;	if ((s = dimtab[p->sizoff]/SZCHAR) > 1) {		old_pstab(p->sname, N_LENG);		printf("1,0,%d\n", s);	}}private old_psline() {	static int lastlineno;	register char *cp, *cq;	register int i;		if (!gdebug) return;	cq = ititle;	cp = ftitle;	while ( *cq ) if ( *cp++ != *cq++ ) goto neq;	if ( *cp == '\0' ) goto eq;	neq:	for (i=0; i<100; i++)		ititle[i] = '\0';	cp = ftitle;	cq = ititle;	while ( *cp )  		*cq++ = *cp++;	*cq = '\0';	*--cq = '\0';#ifndef FLEXNAMES	for ( cp = ititle+1; *(cp-1); cp += 8 ) {		old_pstab(cp, N_SOL);		if (gdebug) printf("0,0,LL%d\n", labelno);		}#else	old_pstab(ititle+1, N_SOL);	if (gdebug) printf("0,0,LL%d\n", labelno);#endif	*cq = '"';	printf("LL%d:\n", labelno++);eq:	if (lineno == lastlineno) return;	lastlineno = lineno;	if (fdefflag) {#ifdef STABDOT		old_pstabdot(N_SLINE, lineno);#else		old_pstab(NULLNAME, N_SLINE);		printf("0,%d,LL%d\n", lineno, labelno);		printf("LL%d:\n", labelno++);#endif		}	}	private old_plcstab(level) {	if (!gdebug) return;#ifdef STABDOT	old_pstabdot(N_LBRAC, level);#else	old_pstab(NULLNAME, N_LBRAC);	printf("0,%d,LL%d\n", level, labelno);	printf("LL%d:\n", labelno++);#endif	}	private old_prcstab(level) {	if (!gdebug) return;#ifdef STABDOT	pstabdot(N_RBRAC, level);#else	pstab(NULLNAME, N_RBRAC);	printf("0,%d,LL%d\n", level, labelno);	printf("LL%d:\n", labelno++);#endif	}	private old_pfstab(sname) char *sname; {	if (!gdebug) return;	pstab(sname, N_FUN);#ifndef FLEXNAMES	printf("0,%d,_%.7s\n", lineno, sname);#else	printf("0,%d,_%s\n", lineno, sname);#endif}

⌨️ 快捷键说明

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