1 #include <portability.h>
46 if ((!attr) || (!value))
67 bool sym_constant_start_found =
FALSE;
68 bool sym_constant_end_found =
FALSE;
70 for (c = the_lexeme, i = 0; *c; c++, i++)
74 if (!sym_constant_start_found)
77 sym_constant_start_found =
TRUE;
82 sym_constant_end_found =
TRUE;
95 if (sym_constant_end_found)
106 Symbol **dest_attr_of_slot,
107 Symbol **dest_current_value)
140 *dest_attr_of_slot =
NIL;
141 *dest_current_value =
NIL;
146 while (g && levels_up) {
153 *dest_current_value =
NIL;
158 *dest_current_value = g;
161 *dest_current_value = w ? w->
value :
NIL;
184 print (agnt,
"Expected identifier (or context variable)\n");
201 print (agnt,
"Expected identifier (or context variable)\n");
206 #ifdef REAL_TIME_BEHAVIOR
208 void init_real_time (
agent* thisAgent) {
210 (
struct timeval *) malloc(
sizeof(
struct timeval));
214 (
struct timeval *) malloc(
sizeof(
struct timeval));
216 void test_for_input_delay (
agent* thisAgent) {
220 start_timer (thisAgent, current_real_time);
225 print_phase (thisAgent,
"\n--- Real-time Idle Phase ---\n");
235 current_real_time->tv_usec +
244 #endif // REAL_TIME_BEHAVIOR
246 #ifdef ATTENTION_LAPSE
249 void init_attention_lapse (
void) {
251 (
struct timeval *) malloc(
sizeof(
struct timeval));
252 wake_from_attention_lapse();
253 #ifndef REAL_TIME_BEHAVIOR
255 (
struct timeval *) malloc(
sizeof(
struct timeval));
256 #endif // REAL_TIME_BEHAVIOR
258 void start_attention_lapse (int64_t duration) {
269 void wake_from_attention_lapse (
void) {
274 void determine_lapsing (
agent* thisAgent) {
279 start_timer (thisAgent, current_real_time);
280 if (`cmp(current_real_time,
282 wake_from_attention_lapse();
287 if (lapse_duration > 0) {
288 start_attention_lapse(lapse_duration);
294 When doing attentional lapsing, we need a
function that determines
295 when (and
for how
long) attentional lapses should occur. This
296 will normally be provided as a user-defined TCL procedure. But
297 we need to put a placeholder
function here just to be safe.
299 int64_t init_lapse_duration(
struct timeval *tv) {
302 #endif // ATTENTION_LAPSE
336 return static_cast<double>(sym->
ic.
value);
346 const char *db_path =
":memory:";
357 print( my_agent, buf );
370 void stats_db_store(
agent* my_agent,
const uint64_t& dc_time,
const uint64_t& dc_wm_changes,
const uint64_t& dc_firing_counts)
391 add_structure(
"CREATE TABLE IF NOT EXISTS stats (dc INTEGER PRIMARY KEY, time INTEGER, wm_changes INTEGER, firing_count INTEGER)" );
392 add_structure(
"CREATE INDEX IF NOT EXISTS stats_time ON stats (time)" );
393 add_structure(
"CREATE INDEX IF NOT EXISTS stats_wm_changes ON stats (wm_changes)" );
394 add_structure(
"CREATE INDEX IF NOT EXISTS stats_firing_count ON stats (firing_count)" );
449 #ifndef NO_TIMING_STUFF