table.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* This file is part of the program psim.
  2. Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, see <http://www.gnu.org/licenses/>.
  13. */
  14. /* load a table into memory */
  15. typedef struct _table table;
  16. typedef struct _table_model_entry table_model_entry;
  17. struct _table_model_entry {
  18. table_model_entry *next;
  19. int line_nr;
  20. int nr_fields;
  21. char *fields[0]; /* User defined */
  22. };
  23. typedef struct _table_entry table_entry;
  24. struct _table_entry {
  25. int line_nr;
  26. int nr_fields;
  27. char *file_name;
  28. table_model_entry *model_first;
  29. table_model_entry *model_last;
  30. char *annex;
  31. char *fields[0]; /* User defined */
  32. };
  33. /* List of directories to search when opening a pushed file. Current
  34. directory is always searched first */
  35. typedef struct _table_include table_include;
  36. struct _table_include {
  37. char *dir;
  38. table_include *next;
  39. };
  40. extern table *table_open
  41. (const char *file_name,
  42. int max_nr_fields,
  43. int max_nr_model_fields);
  44. extern table_entry *table_entry_read
  45. (table *file);
  46. /* Push the the state of the current file and open FILE_NAME. When
  47. the end of FILE_NAME is reached, return to the pushed file */
  48. extern void table_push
  49. (table *file,
  50. table_include *search,
  51. const char *file_name,
  52. int nr_fields,
  53. int nr_model_fields);
  54. extern void dump_table_entry
  55. (table_entry *entry,
  56. int indent);
  57. extern void table_entry_print_cpp_line_nr
  58. (lf *file,
  59. table_entry *entry);