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