|
|
1.1 ! root 1: /* $Header: misc.c,v 1.1 86/03/24 16:19:21 rcs Exp $ */ ! 2: /* (C) Copyright 1985 Third Eye Software, Inc. - All Rights Reserved */ ! 3: ! 4: #include "tes42.h" ! 5: ! 6: ! 7: /* D O R B R A C */ ! 8: ! 9: export void DoRBrac(nlist) ! 10: pNLISTR nlist; ! 11: { ! 12: pSYMR symEnd, symStart; ! 13: ! 14: symEnd = SymFInsert(); ! 15: symEnd->st = stEnd; ! 16: symEnd->sc = scText; ! 17: symEnd->value = vrgFd[vifd].adr + nlist->n_value; ! 18: if (symEnd->value < vdot) { ! 19: if (vfWarn) ! 20: printf("Warning: incorrect address in RBRAC symbol: %d, %lx < %lx\n", ! 21: visym, symEnd->value, vdot); ! 22: symEnd->value = vdot; ! 23: } /* if */ ! 24: symStart = vrgSymBrac[nlist->n_desc]; ! 25: symEnd->index = IsymFSym(symStart); ! 26: symStart->index = IsymFSym(symEnd) + 1; ! 27: if (symStart->value > symEnd->value) { ! 28: if (vfWarn) ! 29: printf("Warning: incorrect address in LBRAC symbol: %d, %lx > %lx\n", ! 30: symEnd->index, symStart->value, symEnd->value); ! 31: symStart->value = vsymProc->value; ! 32: } /* if */ ! 33: vdot = symEnd->value; ! 34: } /* DoRBrac */ ! 35: ! 36: ! 37: /* D O L B R A C */ ! 38: ! 39: export void DoLBrac(nlist) ! 40: pNLISTR nlist; ! 41: { ! 42: pSYMR sym; ! 43: LINER aline; ! 44: ! 45: if (vfBlockPending) { ! 46: sym = vsymBlock; ! 47: vfBlockPending = false; ! 48: } else { ! 49: sym = SymFInsert(); ! 50: } /* if */ ! 51: sym->st = stBlock; ! 52: sym->sc = scText; ! 53: sym->value = vrgFd[vifd].adr + nlist->n_value; ! 54: if (sym->value < vdot) ! 55: printf("Warning: incorrect address in RBRAC symbol: %d, %lx < %lx\n", ! 56: visym, sym->value, vdot); ! 57: vdot = sym->value; ! 58: vrgSymBrac[nlist->n_desc] = sym; ! 59: } /* DoLBrac */ ! 60: ! 61: ! 62: /* F C O M P L E X B T */ ! 63: ! 64: FComplexBt(bt) ! 65: int bt; ! 66: { ! 67: switch (bt) { ! 68: case btUnion: ! 69: case btStruct: ! 70: case btEnum: ! 71: case btTypedef: ! 72: return(true); ! 73: ! 74: default: ! 75: return(false); ! 76: } /* switch */ ! 77: } /* FComplexBt */ ! 78: ! 79: ! 80: /* F I N D C */ ! 81: ! 82: export char * FindC(src, ch) ! 83: register char *src; ! 84: register char ch; ! 85: { ! 86: while (*src && *src != ch) ! 87: src++; ! 88: ! 89: return(src); ! 90: } /* FindC */ ! 91: ! 92: ! 93: /* P A N I C */ ! 94: ! 95: export void panic(sb, arg) ! 96: char *sb; ! 97: int arg; ! 98: { ! 99: int *args = &arg; ! 100: ! 101: fprintf(stderr, sb, args[0], args[1], args[2], args[3], args[4]); ! 102: exit(1); ! 103: } /* panic */ ! 104: ! 105: ! 106: /* M A X */ ! 107: ! 108: export int Max(a, b) ! 109: int a, b; ! 110: { ! 111: return((a > b) ? a : b ); ! 112: } /* Max */ ! 113: ! 114: ! 115: /* C O P Y B L O C K */ ! 116: ! 117: export void CopyBlock(dest, src, size) ! 118: register char *dest; ! 119: register char *src; ! 120: register int size; ! 121: { ! 122: while (size--) ! 123: *(dest++) = *(src++); ! 124: } /* CopyBlock */ ! 125: ! 126: ! 127: #ifndef BSD ! 128: /* Z E R O B L O C K */ ! 129: ! 130: export void ZeroBlock(src, size) ! 131: register char *src; ! 132: register int size; ! 133: { ! 134: while (size--) ! 135: *(src++) = 0; ! 136: } /* ZeroBlock */ ! 137: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.