home *** CD-ROM | disk | FTP | other *** search
/ ftptest.leeds.ac.uk / 2015.02.ftptest.leeds.ac.uk.tar / ftptest.leeds.ac.uk / bionet / CAE-GROUP / SCL-WIN3x / FED_PLUS.EXE / DICT.H < prev    next >
C/C++ Source or Header  |  1994-07-23  |  3KB  |  122 lines

  1. #ifndef DICT_H
  2. #define DICT_H
  3.  
  4. /* $Id: dict.h,v 1.2 1993/10/15 18:49:23 libes Exp $ */
  5.  
  6. /************************************************************************
  7. ** Module:    Dictionary
  8. ** Description:    This module implements the dictionary abstraction.  A
  9. **    dictionary is a repository for a number of objects, all of which
  10. **    can be named using the same function.  A dictionary is limited to
  11. **    storing items which can be cast to Generic (void*); in addition,
  12. **    the constant NULL is used to report errors, so this is one value
  13. **    which it is probably not a good idea to store in a dictionary.
  14. ** Constants:
  15. **    DICTIONARY_NULL    - the null dictionary
  16. **
  17. ************************************************************************/
  18.  
  19. /*
  20.  * This work was supported by the United States Government, and is
  21.  * not subject to copyright.
  22.  *
  23.  * $Log: dict.h,v $
  24.  * Revision 1.2  1993/10/15  18:49:23  libes
  25.  * CADDETC certified
  26.  *
  27.  * Revision 1.5  1993/01/19  22:45:07  libes
  28.  * *** empty log message ***
  29.  *
  30.  * Revision 1.4  1992/08/18  17:15:40  libes
  31.  * rm'd extraneous error messages
  32.  *
  33.  * Revision 1.3  1992/06/08  18:07:35  libes
  34.  * prettied up interface to print_objects_when_running
  35.  */
  36.  
  37. /*************/
  38. /* constants */
  39. /*************/
  40.  
  41. #define DICTIONARY_NULL    (Dictionary)NULL
  42.  
  43. /*****************/
  44. /* packages used */
  45. /*****************/
  46.  
  47. #include "hash.h"
  48. #include "error.h"
  49. #include "dict.h"
  50.  
  51. /************/
  52. /* typedefs */
  53. /************/
  54.  
  55. typedef struct Hash_Table    *Dictionary;
  56. typedef HashEntry        DictionaryEntry;
  57.  
  58. /****************/
  59. /* modules used */
  60. /****************/
  61.  
  62. #include "symbol.h"
  63.  
  64. /***************************/
  65. /* hidden type definitions */
  66. /***************************/
  67.  
  68. /********************/
  69. /* global variables */
  70. /********************/
  71.  
  72. #ifdef DICT_C
  73. #include "defstart.h"
  74. #else
  75. #include "decstart.h"
  76. #endif /*DICTIONARY_C*/
  77.  
  78. GLOBAL char DICT_type;    /* set as a side-effect of DICT lookup routines */
  79.             /* to type of object found */
  80.  
  81. #include "de_end.h"
  82.  
  83. /*******************************/
  84. /* macro function definitions */
  85. /*******************************/
  86.  
  87. #define DICTcreate(estimated_max_size)    HASHcreate(estimated_max_size)
  88. /* should really can DICTdo_init and rename do_type_init to do_init! */
  89. #define DICTdo_init(dict,de)        HASHlistinit((dict),(de))
  90. #define DICTdo_type_init(dict,de,t)    HASHlistinit_by_type((dict),(de),(t))
  91. #define    DICTdo_end(hash_entry)        HASHlistend(hash_entry)
  92.  
  93. /* modify dictionary entry in-place */
  94. #define DICTchange(e,obj,sym,typ)    { \
  95.                     (e)->data = (obj); \
  96.                     (e)->symbol = (sym); \
  97.                     (e)->type = (typ); \
  98.                     }
  99.  
  100.  
  101. /***********************/
  102. /* function prototypes */
  103. /***********************/
  104.  
  105. extern void        DICTinitialize PROTO((void));
  106. extern int        DICTdefine PROTO((Dictionary,char *,Generic,Symbol *,char));
  107. extern int        DICT_define PROTO((Dictionary,char *,Generic,Symbol *,char));
  108. extern void        DICTundefine PROTO((Dictionary, char *));
  109. extern Generic        DICTlookup PROTO((Dictionary, char *));
  110. extern Generic        DICTlookup_symbol PROTO((Dictionary, char *,Symbol **));
  111. extern Generic        DICTdo PROTO((DictionaryEntry *));
  112. extern void        DICTprint PROTO((Dictionary));
  113.  
  114. /********************/
  115. /* inline functions */
  116. /********************/
  117.  
  118. #if supports_inline_functions || defined(DICTIONARY_C)
  119. #endif /*supports_inline_functions || defined(DICTIONARY_C)*/
  120.  
  121. #endif /*DICTIONARY_H*/
  122.