📄 stfe.c
字号:
* it's a static proic and the idn points at the local symbol. * So we get the local symbol and update the end symbol reference * residing in the auxiliary entry to point at the stEnd local * symbol we emit. The stEnd will point back the local symbol * that begins the proc and a dense number to the stEnd is * returned. */ pEXTR pext; pSYMR psym; pAUXU paux; DNR dn; long index; long isextern; long tempifd; dn = *st_pdn_idn (idn); /* get the local symbol even if we have to go through the external */ if (dn.rfd == ST_EXTIFD) { isextern = 1; pext = st_pext_iext (dn.index); psym = st_psym_ifd_isym (pext->ifd, pext->asym.index); dn.rfd = pext->ifd; dn.index = index = pext->asym.index; } else { isextern = 0; psym = st_psym_ifd_isym (dn.rfd, dn.index); index = dn.index; } /* if */ /* add the stEnd and change the auxiliary */ tempifd = st_currentifd(); st_setfd(dn.rfd); index = st_symadd (psym->iss, valueNil, stEnd, scText, index); /* refresh pointer after symadd */ psym = st_psym_ifd_isym (dn.rfd, dn.index); if (st_pcfd_ifd(st_currentifd())->pfd->caux >= psym->index && psym->index != indexNil) { paux = st_paux_iaux (psym->index); paux->isym = index + 1; } /* if */ if (isextern == 1 && pext->asym.st == stStaticProc) { /* make sure that static procs dense numbers point to the * local symbols-- I guess this is a good time to do this!! */ long idnnew; idnnew = st_idn_index_fext (pext->asym.index, 0); st_setidn (idn, idnnew); pext->asym.sc = scNil; } /* if */ idn = st_idn_index_fext (index, 0); st_setfd(tempifd); return(idn);} /* st_procend */export long st_procbegin (idn){ /* this routine assumes that an external symbol has been added for * for the external referenced by our argument. * we make sure that the name is in this files string space, * copy the type if necessary and * then we create the local symbol for it in the symbol table * and patch some symbol fields in the external. */ long iss; pEXTR pext; pCFDR pcfd; DNR dn; dn = *st_pdn_idn (idn); if (dn.rfd != ST_EXTIFD) return (idn); pext = st_pext_iext (dn.index); if (pext->asym.sc == scText) return (idn); pext->asym.sc = scText; if (pext->ifd != st_currentifd()) { /* we have to make a copy of the name of the string in this */ if (st_pcfd_ifd(st_currentifd())->pfd->caux > 0 && pext->asym.index != indexNil) pext->asym.index = st_iaux_copyty (pext->ifd, &pext->asym); pext->ifd = st_currentifd (); } /* if */ iss = st_stradd (st_str_extiss (pext->asym.iss)); pext->asym.index = st_symadd (iss, valueNil, pext->asym.st, scText, pext->asym.index); st_pcfd_ifd (pext->ifd)->pfd->fMerge = 0; /* we got real code here */ return (idn);} /* st_procbegin */export char *st_sym_idn (idn,sc,st,value,index)long idn;long *sc;long *st;long *value;long *index;{ DNR dn; pSYMR psym; dn = *st_pdn_idn (idn); /* this is to help support anonymous names, i.e. an index * of ST_ANONINDEX in a dense number table entry says that the * this is a dummy dense number for anonymous name. */ if (dn.index == ST_ANONINDEX) return ((char *)-1); psym = st_psym_ifd_isym (dn.rfd, dn.index); *sc = psym->sc; *st = psym->st; *value = psym->value; *index = psym->index; return (st_str_ifd_iss (dn.rfd, psym->iss));} /* st_sym_idn */export char *st_str_idn (idn)long idn;{ DNR dn; pSYMR psym; dn = *st_pdn_idn (idn); /* this is to help support anonymous names, i.e. an index * of ST_ANONINDEX in a dense number table entry says that the * this is a dummy dense number for anonymous name. */ if (dn.index == ST_ANONINDEX) return ((char *)-1); psym = st_psym_ifd_isym (dn.rfd, dn.index); return (st_str_ifd_iss (dn.rfd, psym->iss));} /* st_str_idn */export long st_fglobal_idn (idn)long idn;{ DNR dn; pSYMR psym; dn = *st_pdn_idn (idn); /* this is to help support anonymous names, i.e. an index * of ST_ANONINDEX in a dense number table entry says that the * this is a dummy dense number for anonymous name. */ if (dn.index == ST_ANONINDEX) return (0); psym = st_psym_ifd_isym (dn.rfd, dn.index); /* jkh 3/21/86 added check for stStaticProc */ return ((psym->st != stStatic) && (psym->st != stStaticProc));} /* st_fglobal_idn */export pSYMR st_psym_idn_offset (idn, offset)long idn;long offset;{ DNR dn; pSYMR psym; long iend; pAUXU paux; pEXTR pext; /* this routine returns a pointer to a stParam or stLocal local symbol * encase by the procedure specified by idn and being offset from * the virtual frame pointer (the value field) */ dn = *st_pdn_idn (idn); if (dn.rfd == ST_EXTIFD) { /* check if it's external */ pext = st_pext_iext (dn.index); dn.rfd = pext->ifd; dn.index = pext->asym.index; } /* if */ /* get the index of the last symbol to check */ psym = st_psym_ifd_isym (dn.rfd, dn.index); if (psym->index == indexNil) return ((pSYMR) 0); paux = st_paux_ifd_iaux(dn.rfd, psym->index); if (paux == auxNil) return ((pSYMR) 0); iend = paux->isym; while (++dn.index < iend) { psym = st_psym_ifd_isym (dn.rfd, dn.index); if ((psym->st == stLocal || psym->st == stParam) && (psym->sc == scAbs || psym->sc == scVar) && psym->value == offset) return (psym); else if (psym->st == stProc || psym->st == stStaticProc) break; if (psym->sc == scInfo && psym->st == stBlock) dn.index = psym->index - 1; } /* while */ return ((pSYMR) 0);} /* st_psym_idn_offset */export void st_fixextindex(idn, index)long idn; /* from dense number, find ext table index */long index;{ pEXTR pext; DNR dn; dn = *st_pdn_idn(idn); pext = st_pext_iext (dn.index); pext->ifd = st_currentifd (); pext->asym.index = index; pext->asym.sc = scText;} /* st_fixext */export void st_fixextsc(idn, sc)long idn; /* from dense number, find ext table index */long sc;{ pEXTR pext; DNR dn; dn = *st_pdn_idn(idn); pext = st_pext_iext(dn.index); pext->asym.sc = sc;} /* st_fixext */export long st_pdadd_idn (idn)long idn;{ /* this routine will add a pd and get the isym from the dense number */ pDNR pdn; pEXTR pext; long isym; pdn = st_pdn_idn (idn); if (pdn->rfd == ST_EXTIFD) { pext = st_pext_iext (pdn->index); isym = pext->asym.index; } else { isym = pdn->index; } /* if */ return (st_pdadd(isym));} /* st_pdadd_idn */export st_fixiss (idn, iss)long iss;long idn;{ pSYMR psym; pDNR pdn; pdn = st_pdn_idn (idn); if (pdn->rfd == ST_EXTIFD) { psym = &(st_pext_iext (pdn->index)->asym); } else { psym = st_psym_ifd_isym (pdn->rfd, pdn->index); } /* if */ psym->iss = iss;} /* st_fixiss */export st_changedn (idn, rfd, index){ pDNR pdn; pdn = st_pdn_idn (idn); pdn->rfd = rfd; pdn->index = index;} /* st_changedn */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -