DDE Evaluator Module  PMX DDE Expression Evaluator v1.1 rev: 20.10.87 This module allows users a centralized expression evaluation facility, with 26 variables A through Z common to all users of EVAL. It supports full expression capability, including the usual array of trigonometric and transcendental functions. Support now includes 80x87 NPX for users of Windows 2.0. These users need WIN87EM.EXE available. 1.0 User Interface EVAL supports the following operations: arithmetic operators (+ - * / ^ !) relational operators (> < == != >= <=) return 0 for FALSE and 1 forTRUE trigonometric functions sin cos tan atn dms transcendental functions log ln exp other functions abs int Parentheses may be used to force grouping of operations to be other than the default order of operations. The default order is that of the C programming language. The user has access to twenty-six variables, named A through Z. These may be used to save values of prior calculations, and retain their values no matter what application uses them, i.e. variable A will retain the value set in it by APP1 if it is referenced in APP2. 2.0 Programmer Interface The DDE ID of EVAL is the string "pmx.dde.eval". Note that this is all lowercase. This string is registered by EVAL at its initialization with the DDE atom manager. The user-program should attempt to register this string also before sending the INITIATE message, and pass the returned atom with the message. If EVAL is loaded in the system, the user-program will receive an ACK message from EVAL. Be sure to save EVAL's returned window handle. Once EVAL's identity has been established, the user-program may freely send POKE messages to EVAL, containing the string of the expression to be evaluated. The handle of this data item must be a global handle, or the results will be undefined. EVAL will free this data item after evaluation of the expression. The user-program will then receive a DATA message from EVAL, containing the result of the expression and error information. The user-program should free this packet after use. The packet formats are as follows: DATA typedef struct{ short evalerr, /* error code */ errpos; /* position of error in data */ double evalue; /* expr value */ } DDEDATA, far *LPDDEDATA; REQUEST typedef struct{ short evalcode; /* request ID */ HANDLE expr; /* string mem object */ } DDEREQUEST, far *LPDDEREQUEST; complete information is found in the header file EVDDE.H. This also includes the server ID and error code values. 3.0 "Limitations" At the time of this typing, the evalcode field is unused. Since EVAL uses PostMessage() to send back packets, it will be used for the sending application to diffrentiate between packets if it has multiple expressions pending. A new field will also need to be added to the data packet to correspond to the ID field. Now that I have hardware NPX support, some of the earlier-mentioned float error problems may have disappeared. I would appreciate any help in locating these. I don't have any beta docs on this yet, so using SIGFPE or anything may or may not work as usual. I'll have this figured out when the docs come. Some may notice that this module does not exactly adhere to the DDE protocol document guidelines. This is mainly due to the fact that I wrote this server before I had the document. It was constructed from information taken from Microsoft Systems Journal. However, its better than nothing, and serves as something to mess around with to see how a server operates. 4.0 Notice This code is not public-domain, but is being made publicly available for free. I don't know if that is the same thing or not. It may be redistributed for free. The source code cannot be made available because it is proprietary to the company I work for. The main reason for providing this is to spread the word about Dynamic Data Exchange. I hope people will write applications which make use of this module, if only to educate themselves on the use of DDE. We will provide no support for this code, but updates will appear periodically as I more fully support the emerging DDE protocol. Feel free to provide bug reports on CIS--with any luck these will be incorporated into future updates. A couple lucky people have already helped us all in such manner (thanks much). John Gmutza (c)1987 PMX Inc.