1: /*
   2:  * Copyright (c) 1980 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  */
   6: 
   7: #ifndef lint
   8: static char sccsid[] = "@(#)objaddr.c	5.1 (Berkeley) 6/6/85";
   9: #endif not lint
  10: /*
  11:  * Lookup the object address of a given line from the named file.
  12:  *
  13:  * Potentially all files in the file table need to be checked
  14:  * until the line is found since a particular file name may appear
  15:  * more than once in the file table (caused by includes).
  16:  */
  17: 
  18: #include "defs.h"
  19: #include "mappings.h"
  20: #include "object.h"
  21: #include "source.h"
  22: #include "filetab.h"
  23: #include "linetab.h"
  24: 
  25: ADDRESS objaddr(line, name)
  26: LINENO line;
  27: char *name;
  28: {
  29:     register FILETAB *ftp;
  30:     register LINENO i, j;
  31:     BOOLEAN foundfile;
  32: 
  33:     if (nlhdr.nlines == 0) {
  34:     return(-1);
  35:     }
  36:     if (name == NULL) {
  37:     name = cursource;
  38:     }
  39:     foundfile = FALSE;
  40:     for (ftp = &filetab[0]; ftp < &filetab[nlhdr.nfiles]; ftp++) {
  41:     if (streq(ftp->filename, name)) {
  42:         foundfile = TRUE;
  43:         i = ftp->lineindex;
  44:         if (ftp == &filetab[nlhdr.nfiles-1]) {
  45:         j = nlhdr.nlines;
  46:         } else {
  47:         j = (ftp + 1)->lineindex;
  48:         }
  49:         while (i < j) {
  50:         if (linetab[i].line == line) {
  51:             return linetab[i].addr;
  52:         }
  53:         i++;
  54:         }
  55:     }
  56:     }
  57:     if (!foundfile) {
  58:     error("unknown source file \"%s\"", name);
  59:     }
  60:     return(-1);
  61: }

Defined functions

objaddr defined in line 25; never used

Defined variables

sccsid defined in line 8; never used
Last modified: 1985-06-06
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2100
Valid CSS Valid XHTML 1.0 Strict