DICT The DICT program demonstrates use of the implicit_handle, context_handle, in, and out attributes. SUMMARY ======= This sample program is an example of a non-trivial local application converted to a distributed RPC application. The local program is a character-oriented "play" program, which lets a user insert, delete, and iterate over a dictionary. The dictionary is based on splay trees, which are printed out in a format described below. We remoted the basic program by taking the interface to the dictionary (given in dict0.h) and creating an interface to a remote dictionary, (given in replay.idl) which is remoted using RPC. Following the local dictionary interface, which is minimal and uniform, the remote interface is also uniform. However, since the local dictionary is generic (can store any item type, using void* pointers to items), the interface needed to change to deal with predefined (Record) type items in order to be remoted using the Microsoft RPC system. Also, since the local implementation allows a "peek" at the root of the tree using a DICT_CURR_ITEM macro, the whole interface needed to change. Remote dictionaries are represented by context handles to demonstrate the use of [context_handle]. Context handles are currently initialized using a global primitive handle [implicit_handle]. State was added to remote dictionaries in order to allow sharing them, and maintain reference counts. At this time, however, access to shared dictionaries is *not* serialized! By default each client gets his own copy of the dictionaries. To use shared dictionaries, start the client using the -s switch. The use of context to maintain state is also demonstrated by differentiating between a private iterator, activated by "n" for "next" and "p" for "previous", and a global shared iterator, activated by "N" for "Next" and "P" for previous. To start iterators, use "h" - go to the "head" of the dictionary, or "t" - go to the "tail" of the dictionary. The private iterator can be reset to DICT_CURR_ITEM using "r". FILES ===== The directory samples\rpc\dict contains the following files for building the DICT distributed application: File Description README.TXT Readme file for the DICT sample REPLAY.IDL Interface definition language file REPLAY.ACF Attribute configuration file CLIENT.C Client main program SERVER.C Server main program PLAY.C PLAY.H UTIL0.C UTIL0.H DICT0.C DICT0.H REPLAY.C MAKEFILE Nmake file to build for Windows NT or Windows 95 MAKEFILE.DOS Nmake file to build for MS-DOS ------------------------------------ Building on Windows NT or Windows 95 ------------------------------------ The following environment variables should be already set for you: set CPU=i386 set INCLUDE=%SDKROOT%\h set LIB=%SDKROOT%\lib set PATH=%SDKROOT%\system32;%SDKROOT%\bin where %SDKROOT% is the root directory for the 32-bit Windows SDK. For mips, set CPU=mips For alpha, set CPU=alpha Build the sample distributed application: nmake cleanall nmake ------------------------------------------ Building the client application for MS-DOS ------------------------------------------ After installing the Microsoft Visual C/C++ version 1.50 development environment and the 16-bit RPC SDK on a Windows NT or Windows 95 computer, you can build the sample client application from Windows NT or Windows 95: nmake -f makefile.dos cleanall nmake -f makefile.dos This builds the client application client.exe. You may also execute the Microsoft Visual C/C++ compiler under MS-DOS. This requires a two-step build process. Step One: Compile the .IDL files under Windows NT or Windows 95: nmake -a -f makefile.dos replay.h Step Two: Compile the C sources (stub and application) under MS-DOS: nmake -f makefile.dos Using the program: ------------------ To use the local dictionary example, type "play". To use the remote versiom, type "server" on the server side. On the client side, for each client use "client" for a fresh,private copy of the dictionary, or "client -s" for a shared copy of the dictionary. The following command line options are available on the client side. Options: -------- The -? displays the following message: Usage : client [-s] [-n ] [-v ] The -s option is used for using a shared version of the dictionary. If none exist, a fresh shared version is created. The -v