|
|
1.1 root 1: /*************************************************************/
2: /** **/
3: /** Microsoft RPC Examples **/
4: /** Dictionary Application **/
1.1.1.2 root 5: /** Copyright(c) Microsoft Corp. 1992 **/
1.1 root 6: /** **/
7: /*************************************************************/
8:
9: #define IN
10: #define OUT
11: #define STRING
12: #define CONTEXT_HANDLE
13:
14: /*************************************************************************/
15: /*** Strongly typed tree nodes and dictionaries ***/
16: /*************************************************************************/
17:
18: /*
19: ************************************************************************
20: * Record type - previously imported from util1.idl
21: * This is the type of items stored in the remote dictionary.
22: ************************************************************************
23: */
24:
25: typedef struct _Record {
26: short key; // RPC "generation"
27: STRING char* name; // contributor
28: } Record;
29:
30: /*
31: ************************************************************************
32: * The following definitions (RDict, RecordTreeNode) are required
33: * for marshalling a complete dictionary, binary tree, respectively.
34: * All pointers are based on RPC-able types, replacing "void*"
35: * pointers in the local dictionary (dict0) which are non-transmissible.
36: ************************************************************************
37: */
38:
39: typedef struct _RecordTreeNode {
40: struct _RecordTreeNode *left; // left child pointer
41: struct _RecordTreeNode *right; // right child pointer
42: Record *item; // pointer to a Record structure
43: } RecordTreeNode;
44:
45: typedef struct _DictState {
46: short ref_count; // for shared dictionaries
47: Record * curr_record; // for global iterators
48: } DictState;
49:
50: typedef struct _RDict {
51: RecordTreeNode *root; // pointer to the root of a SAT
52: long size; // number of records in dictionary
53: DictState * state; // pointer to state info
54: } RDict;
55:
56: /*
57: * VDict is a "virtual dictionary" object. It is used in the client
58: * application as a handle on a dictionary maintained by a server
59: */
60: typedef CONTEXT_HANDLE void * VDict;
61:
62: typedef enum {
63: DICT_SUCCESS,
64: DICT_ITEM_ALREADY_PRESENT,
65: DICT_ITEM_NOT_FOUND,
66: DICT_FIRST_ITEM,
67: DICT_LAST_ITEM,
68: DICT_EMPTY_DICTIONARY,
69: DICT_NULL_ITEM
1.1.1.3 ! root 70: } VDict_Status;
1.1 root 71:
72:
73: /*************************************************************************/
74: /*** Generic Dictionary Operations: (From dict0.h) ***/
75: /*** ***/
76: /*** Dictionary *Dict_New(Cmp_rec*, Splay*, print_rec*) ***/
77: /*** ***/
78: /*** Dict_Status Dict_Find(Dictionary*, Item*) ***/
79: /*** Dict_Status Dict_Next(Dictionary*, Item*) ***/
80: /*** Dict_Status Dict_Prev(Dictionary*, Item*) ***/
81: /*** Dict_Status Dict_Insert(Dictionary*, Item*) ***/
82: /*** Dict_Status Dict_Delete(Dictionary*, Item**) ***/
83: /*** ***/
84: /*** Item* DICT_CURR_ITEM(Dict*) ***/
85: /*************************************************************************/
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.