home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / octave-1.1.1p1-base.tgz / octave-1.1.1p1-base.tar / fsf / octave / dld / list_undef.c < prev    next >
C/C++ Source or Header  |  1991-05-30  |  1KB  |  57 lines

  1. /* list_undefined.c -- return a list of strings containing the names of the
  2.    undefined symbols. */
  3.  
  4. /* This file is part of DLD, a dynamic link/unlink editor for C.
  5.    
  6.    Copyright (C) 1990 by W. Wilson Ho.
  7.  
  8.    The author can be reached electronically by how@cs.ucdavis.edu or
  9.    through physical mail at:
  10.  
  11.    W. Wilson Ho
  12.    Division of Computer Science
  13.    University of California at Davis
  14.    Davis, CA 95616
  15.  */
  16.  
  17. /* This program is free software; you can redistribute it and/or modify it
  18.    under the terms of the GNU General Public License as published by the
  19.    Free Software Foundation; either version 1, or (at your option) any
  20.    later version. */
  21.  
  22. #include "defs.h"
  23.  
  24. /*
  25.  * Return an array of strings, each of which is the name of an undefined
  26.  * symbol.  Return 0 if there is no undefined symbol.
  27.  *
  28.  * The caller is responsible to free this array.
  29.  */
  30. char **
  31. dld_list_undefined_sym ()
  32. {
  33.     register symbol *sp;
  34.     register int i;
  35.     register int count = 0;
  36.     register char **list;
  37.  
  38.     if (!dld_undefined_sym_count)
  39.     return 0;
  40.  
  41.     if (setjmp (_dld_env))
  42.     return 0;
  43.  
  44.     list = (char **) _dld_malloc (sizeof(char *) * dld_undefined_sym_count);
  45.     
  46.     for (i=0; i<TABSIZE; i++)
  47.     for (sp = _dld_symtab[i]; sp; sp = sp->link)
  48.         if (!sp->defined) {
  49.         list[count++] = sp->name;
  50.         if (count >= dld_undefined_sym_count)
  51.             break;
  52.         }
  53.  
  54.     return list;
  55. } /* dld_list_undefined_sym */
  56.  
  57.