1    /*******************************************************/
2    /*      "C" Language Integrated Production System      */
3    /*                                                     */
4    /*               CLIPS Version 6.30  08/22/14          */
5    /*                                                     */
6    /*                                                     */
7    /*******************************************************/
8 
9 /*************************************************************/
10 /* Purpose:                                                  */
11 /*                                                           */
12 /* Principal Programmer(s):                                  */
13 /*      Brian L. Dantes                                      */
14 /*                                                           */
15 /* Contributing Programmer(s):                               */
16 /*                                                           */
17 /* Revision History:                                         */
18 /*                                                           */
19 /*      6.23: Changed name of variable log to logName        */
20 /*            because of Unix compiler warnings of shadowed  */
21 /*            definitions.                                   */
22 /*                                                           */
23 /*      6.24: Removed IMPERATIVE_MESSAGE_HANDLERS            */
24 /*                    compilation flag.                      */
25 /*                                                           */
26 /*            Corrected code to remove run-time program      */
27 /*            compiler warnings.                             */
28 /*                                                           */
29 /*      6.30: Changed integer type/precision.                */
30 /*                                                           */
31 /*            Removed conditional code for unsupported       */
32 /*            compilers/operating systems (IBM_MCW,          */
33 /*            MAC_MCW, and IBM_TBC).                         */
34 /*                                                           */
35 /*            Added DeallocateMessageHandlerData to          */
36 /*            deallocate message handler environment data.   */
37 /*                                                           */
38 /*            Added const qualifiers to remove C++           */
39 /*            deprecation warnings.                          */
40 /*                                                           */
41 /*            Converted API macros to function calls.        */
42 /*                                                           */
43 /*************************************************************/
44 
45 #ifndef _H_msgcom
46 #define _H_msgcom
47 
48 #ifndef _H_object
49 #include "object.h"
50 #endif
51 
52 #ifndef _H_msgpass
53 #include "msgpass.h"
54 #endif
55 
56 #define MESSAGE_HANDLER_DATA 32
57 
58 struct messageHandlerData
59   {
60    ENTITY_RECORD HandlerGetInfo;
61    ENTITY_RECORD HandlerPutInfo;
62    SYMBOL_HN *INIT_SYMBOL;
63    SYMBOL_HN *DELETE_SYMBOL;
64    SYMBOL_HN *CREATE_SYMBOL;
65 #if DEBUGGING_FUNCTIONS
66    unsigned WatchHandlers;
67    unsigned WatchMessages;
68 #endif
69    const char *hndquals[4];
70    SYMBOL_HN *SELF_SYMBOL;
71    SYMBOL_HN *CurrentMessageName;
72    HANDLER_LINK *CurrentCore;
73    HANDLER_LINK *TopOfCore;
74    HANDLER_LINK *NextInCore;
75    HANDLER_LINK *OldCore;
76   };
77 
78 #define MessageHandlerData(theEnv) ((struct messageHandlerData *) GetEnvironmentData(theEnv,MESSAGE_HANDLER_DATA))
79 
80 
81 #ifdef LOCALE
82 #undef LOCALE
83 #endif
84 
85 #ifdef _MSGCOM_SOURCE_
86 #define LOCALE
87 #else
88 #define LOCALE extern
89 #endif
90 
91 #define INIT_STRING   "init"
92 #define DELETE_STRING "delete"
93 #define PRINT_STRING  "print"
94 #define CREATE_STRING "create"
95 
96    LOCALE void             SetupMessageHandlers(void *);
97    LOCALE const char      *EnvGetDefmessageHandlerName(void *,void *,int);
98    LOCALE const char      *EnvGetDefmessageHandlerType(void *,void *,int);
99    LOCALE int              EnvGetNextDefmessageHandler(void *,void *,int);
100    LOCALE HANDLER         *GetDefmessageHandlerPointer(void *,int);
101 #if DEBUGGING_FUNCTIONS
102    LOCALE unsigned         EnvGetDefmessageHandlerWatch(void *,void *,int);
103    LOCALE void             EnvSetDefmessageHandlerWatch(void *,int,void *,int);
104 #endif
105    LOCALE unsigned         EnvFindDefmessageHandler(void *,void *,const char *,const char *);
106    LOCALE int              EnvIsDefmessageHandlerDeletable(void *,void *,int);
107    LOCALE void             UndefmessageHandlerCommand(void *);
108    LOCALE int              EnvUndefmessageHandler(void *,void *,int);
109 #if DEBUGGING_FUNCTIONS
110    LOCALE void             PPDefmessageHandlerCommand(void *);
111    LOCALE void             ListDefmessageHandlersCommand(void *);
112    LOCALE void             PreviewSendCommand(void *);
113    LOCALE const char      *EnvGetDefmessageHandlerPPForm(void *,void *,int);
114    LOCALE void             EnvListDefmessageHandlers(void *,const char *,void *,int);
115    LOCALE void             EnvPreviewSend(void *,const char *,void *,const char *);
116    LOCALE long             DisplayHandlersInLinks(void *,const char *,PACKED_CLASS_LINKS *,int);
117 #endif
118 
119 #if ALLOW_ENVIRONMENT_GLOBALS
120 
121    LOCALE unsigned         FindDefmessageHandler(void *,const char *,const char *);
122    LOCALE const char      *GetDefmessageHandlerName(void *,int);
123    LOCALE const char      *GetDefmessageHandlerType(void *,int);
124    LOCALE int              GetNextDefmessageHandler(void *,int);
125    LOCALE int              IsDefmessageHandlerDeletable(void *,int);
126    LOCALE int              UndefmessageHandler(void *,int);
127 #if DEBUGGING_FUNCTIONS
128    LOCALE const char      *GetDefmessageHandlerPPForm(void *,int);
129    LOCALE unsigned         GetDefmessageHandlerWatch(void *,int);
130    LOCALE void             ListDefmessageHandlers(const char *,void *,int);
131    LOCALE void             PreviewSend(const char *,void *,const char *);
132    LOCALE void             SetDefmessageHandlerWatch(int,void *,int);
133 #endif /* DEBUGGING_FUNCTIONS */
134 
135 #endif /* ALLOW_ENVIRONMENT_GLOBALS */
136 
137 #endif /* _H_msgcom */
138 
139 
140 
141 
142 
143