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 / kpathsea / str-llist.h < prev    next >
C/C++ Source or Header  |  1993-10-26  |  2KB  |  57 lines

  1. /* str-llist.h: A linked list of strings,
  2.  
  3. It's pretty disgusting that both this and str-list exist; the reason is
  4. that C cannot express iterators very well, and I don't want to change
  5. all the for loops right now.
  6.  
  7. Copyright (C) 1993 Karl Berry.
  8.  
  9. This program is free software; you can redistribute it and/or modify
  10. it under the terms of the GNU General Public License as published by
  11. the Free Software Foundation; either version 2, or (at your option)
  12. any later version.
  13.  
  14. This program is distributed in the hope that it will be useful,
  15. but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. GNU General Public License for more details.
  18.  
  19. You should have received a copy of the GNU General Public License
  20. along with this program; if not, write to the Free Software
  21. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  22.  
  23. #ifndef STR_LLIST_H
  24. #define STR_LLIST_H
  25.  
  26. #include <kpathsea/c-proto.h>
  27. #include <kpathsea/types.h>
  28.  
  29.  
  30. /* It's a little bizarre to be using the same type for the list and the
  31.    elements of the list, but no reason not to in this case, I think --
  32.    we never need a NULL string in the middle of the list, and an extra
  33.    NULL/NULL element always at the end is inconsequential.  */
  34.  
  35. struct str_llist_elt
  36. {
  37.   string str;
  38.   boolean moved;
  39.   struct str_llist_elt *next;
  40. };
  41. typedef struct str_llist_elt str_llist_elt_type;
  42. typedef struct str_llist_elt *str_llist_type;
  43.  
  44. #define STR_LLIST(sl) ((sl).str)
  45. #define STR_LLIST_MOVED(sl) ((sl).moved)
  46. #define STR_LLIST_NEXT(sl) ((sl).next)
  47.  
  48.  
  49. /* Add the new string E to the end of the list L.  */
  50. extern void str_llist_add P2H(str_llist_type * l, string e);
  51.  
  52. /* Reorganize L so that E is below only other elements that have already
  53.    been moved.  Set `moved' member for E.  */
  54. extern void str_llist_float P2H(str_llist_type *l, str_llist_elt_type *e);
  55.  
  56. #endif /* not STR_LLIST_H */
  57.