Subversion Repositories tendra.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
 
31
/*** key.h --- Key ADT.
32
 *
33
 ** Author: Steve Folkes <smf@hermes.mod.uk>
34
 *
35
 *** Commentary:
36
 *
37
 * See the file "key.c" for more information.
38
 *
39
 *** Change Log:
40
 * $Log: key.h,v $
41
 * Revision 1.1.1.1  1998/01/17  15:57:46  release
42
 * First version to be checked into rolling release.
43
 *
44
 * Revision 1.2  1994/12/15  09:58:21  smf
45
 * Brought into line with OSSG C Coding Standards Document, as per
46
 * "CR94_178.sid+tld-update".
47
 *
48
 * Revision 1.1.1.1  1994/07/25  16:04:35  smf
49
 * Initial import of SID 1.8 non shared files.
50
 *
51
**/
52
 
53
/****************************************************************************/
54
 
55
#ifndef H_KEY
56
#define H_KEY
57
 
58
#include "os-interface.h"
59
#include "dstring.h"
60
 
61
/*--------------------------------------------------------------------------*/
62
 
63
#ifdef FS_NO_ENUM
64
typedef int KeyTypeT, *KeyTypeP;
65
#define KT_STRING	(0)
66
#define KT_NUMERIC	(1)
67
#else
68
typedef enum {
69
    KT_STRING,
70
    KT_NUMERIC
71
} KeyTypeT, *KeyTypeP;
72
#endif /* defined (FS_NO_ENUM) */
73
 
74
typedef struct KeyT {
75
    KeyTypeT			type;
76
    NStringT			string;
77
    unsigned			number;
78
} KeyT, *KeyP;
79
 
80
/*--------------------------------------------------------------------------*/
81
 
82
extern void			key_init_from_string
83
	PROTO_S ((KeyP, NStringP, unsigned));
84
extern void			key_init_from_number
85
	PROTO_S ((KeyP, unsigned));
86
extern CmpT			key_compare
87
	PROTO_S ((KeyP, KeyP));
88
extern BoolT			key_is_string
89
	PROTO_S ((KeyP));
90
extern NStringP			key_get_string
91
	PROTO_S ((KeyP));
92
extern unsigned			key_get_number
93
	PROTO_S ((KeyP));
94
extern unsigned			key_hash_value
95
	PROTO_S ((KeyP));
96
 
97
extern void			write_key
98
	PROTO_S ((OStreamP, KeyP));
99
 
100
/*--------------------------------------------------------------------------*/
101
 
102
#ifdef FS_FAST
103
#define key_is_string(k) ((k)->type == KT_STRING)
104
#define key_is_number(k) ((k)->type == KT_NUMBER)
105
#define key_get_string(k) (&((k)->string))
106
#define key_get_number(k) ((k)->number)
107
#endif /* defined (FS_FAST) */
108
 
109
#endif /* !defined (H_KEY) */
110
 
111
/*
112
 * Local variables(smf):
113
 * eval: (include::add-path-entry "../os-interface" "../library")
114
 * eval: (include::add-path-entry "../generated")
115
 * end:
116
**/
117