00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef _H_agenda
00037
00038 #define _H_agenda
00039
00040 #ifndef _H_ruledef
00041 #include "ruledef.h"
00042 #endif
00043 #ifndef _H_symbol
00044 #include "symbol.h"
00045 #endif
00046 #ifndef _H_match
00047 #include "match.h"
00048 #endif
00049
00050 #define WHEN_DEFINED 0
00051 #define WHEN_ACTIVATED 1
00052 #define EVERY_CYCLE 2
00053
00054 #define MAX_DEFRULE_SALIENCE 10000
00055 #define MIN_DEFRULE_SALIENCE -10000
00056
00057
00058
00059
00060
00061 struct activation
00062 {
00063 struct defrule *theRule;
00064 struct partialMatch *basis;
00065 int salience;
00066 unsigned long long timetag;
00067 int randomID;
00068 struct activation *prev;
00069 struct activation *next;
00070 };
00071
00072 struct salienceGroup
00073 {
00074 int salience;
00075 struct activation *first;
00076 struct activation *last;
00077 struct salienceGroup *next;
00078 struct salienceGroup *prev;
00079 };
00080
00081 typedef struct activation ACTIVATION;
00082
00083 #define AGENDA_DATA 17
00084
00085 struct agendaData
00086 {
00087 #if DEBUGGING_FUNCTIONS
00088 unsigned WatchActivations;
00089 #endif
00090 unsigned long NumberOfActivations;
00091 unsigned long long CurrentTimetag;
00092 int AgendaChanged;
00093 intBool SalienceEvaluation;
00094 int Strategy;
00095 };
00096
00097 #define EnvGetActivationSalience(theEnv,actPtr) (((struct activation *) actPtr)->salience)
00098 #define GetActivationRule(actPtr) (((struct activation *) actPtr)->theRule)
00099 #define GetActivationBasis(actPtr) (((struct activation *) actPtr)->basis)
00100 #define AgendaData(theEnv) ((struct agendaData *) GetEnvironmentData(theEnv,AGENDA_DATA))
00101
00102 #ifdef LOCALE
00103 #undef LOCALE
00104 #endif
00105
00106 #ifdef _AGENDA_SOURCE_
00107 #define LOCALE
00108 #else
00109 #define LOCALE extern
00110 #endif
00111
00112
00113
00114
00115
00116 #define Agenda(a,b) EnvAgenda(GetCurrentEnvironment(),a,b)
00117 #define DeleteActivation(a) EnvDeleteActivation(GetCurrentEnvironment(),a)
00118 #define GetActivationName(a) EnvGetActivationName(GetCurrentEnvironment(),a)
00119 #define GetActivationPPForm(a,b,c) EnvGetActivationPPForm(GetCurrentEnvironment(),a,b,c)
00120 #define GetActivationSalience(actPtr) (((struct activation *) actPtr)->salience)
00121 #define GetAgendaChanged() EnvGetAgendaChanged(GetCurrentEnvironment())
00122 #define GetNextActivation(a) EnvGetNextActivation(GetCurrentEnvironment(),a)
00123 #define GetSalienceEvaluation() EnvGetSalienceEvaluation(GetCurrentEnvironment())
00124 #define Refresh(a) EnvRefresh(GetCurrentEnvironment(),a)
00125 #define RefreshAgenda(a) EnvRefreshAgenda(GetCurrentEnvironment(),a)
00126 #define ReorderAgenda(a) EnvReorderAgenda(GetCurrentEnvironment(),a)
00127 #define SetActivationSalience(a,b) EnvSetActivationSalience(GetCurrentEnvironment(),a,b)
00128 #define SetAgendaChanged(a) EnvSetAgendaChanged(GetCurrentEnvironment(),a)
00129 #define SetSalienceEvaluation(a) EnvSetSalienceEvaluation(GetCurrentEnvironment(),a)
00130
00131 LOCALE void AddActivation(void *,void *,void *);
00132 LOCALE void ClearRuleFromAgenda(void *,void *);
00133 LOCALE void *EnvGetNextActivation(void *,void *);
00134 LOCALE char *EnvGetActivationName(void *,void *);
00135 LOCALE int EnvSetActivationSalience(void *,void *,int);
00136 LOCALE void EnvGetActivationPPForm(void *,char *,unsigned,void *);
00137 LOCALE void EnvGetActivationBasisPPForm(void *,char *,unsigned,void *);
00138 LOCALE intBool MoveActivationToTop(void *,void *);
00139 LOCALE intBool EnvDeleteActivation(void *,void *);
00140 LOCALE intBool DetachActivation(void *,void *);
00141 LOCALE void EnvAgenda(void *,char *,void *);
00142 LOCALE void RemoveActivation(void *,void *,int,int);
00143 LOCALE void RemoveAllActivations(void *);
00144 LOCALE int EnvGetAgendaChanged(void *);
00145 LOCALE void EnvSetAgendaChanged(void *,int);
00146 LOCALE unsigned long GetNumberOfActivations(void *);
00147 LOCALE intBool EnvGetSalienceEvaluation(void *);
00148 LOCALE intBool EnvSetSalienceEvaluation(void *,intBool);
00149 LOCALE void EnvRefreshAgenda(void *,void *);
00150 LOCALE void EnvReorderAgenda(void *,void *);
00151 LOCALE void InitializeAgenda(void *);
00152 LOCALE void *SetSalienceEvaluationCommand(void *);
00153 LOCALE void *GetSalienceEvaluationCommand(void *);
00154 LOCALE void RefreshAgendaCommand(void *);
00155 LOCALE void RefreshCommand(void *);
00156 LOCALE intBool EnvRefresh(void *,void *);
00157 #if DEBUGGING_FUNCTIONS
00158 LOCALE void AgendaCommand(void *);
00159 #endif
00160
00161 #endif
00162
00163
00164
00165
00166
00167