PLAY.H
上传用户:bangxh
上传日期:2007-01-31
资源大小:42235k
文件大小:4k
源码类别:

Windows编程

开发平台:

Visual C++

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