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