22 #include "mod_utils.h"
24 #include <default-hook.h>
25 #include <oprs-rerror_f-pub.h>
29 typedef struct op_structure Op_Structure;
31 typedef enum { IS_ACTIVE, IS_SLEEPING, IS_SUSP_ACTIVE, IS_SUSP_SLEEPING } Intention_Status;
32 typedef Slist *Thread_Intention_Block_List;
33 typedef Slist *Condition_List;
41 Thread_Intention_Block_List fils;
43 Thread_Intention_Block_List active_tibs;
47 Intention_Status status;
50 Thread_Intention_Block *critical_section;
53 Condition_List activation_conditions_list;
55 Sprinter *failed_goal_sprinter;
56 OPRS_LIST failed_goal_stack;
61 #include <lisp-list_f-pub.h>
62 #include <op-instance_f-pub.h>
63 #include <op-structure_f-pub.h>
66 func_op_name(TermList terms)
71 op_t = (Term *)get_list_pos(terms, 1);
73 report_fatal_external_error((
char *)
"Cannot retrieve OP instance term");
75 if (op_t->type != TT_OP_INSTANCE) {
76 report_fatal_external_error((
char *)
"Term is not of type OP_INSTANCE");
79 opi = (Op_Instance *)(op_t->u.opi);
80 Op_Structure *op_s = op_instance_op(opi);
82 report_fatal_external_error((
char *)
"Failed to get OP structure from OP instance");
85 return build_id(op_name(op_s));
89 func_op_names(TermList terms)
93 ops_t = (Term *)get_list_pos(terms, 1);
95 report_fatal_external_error((
char *)
"Cannot retrieve OP instance term");
97 if (ops_t->type != LISP_LIST) {
98 report_fatal_external_error((
char *)
"Term is not of type LISP_LIST");
101 TermList name_list = sl_make_slist();
103 for (L_List p_l = ops_t->u.l_list; p_l; p_l = l_cdr(p_l)) {
104 Term *t = l_car(p_l);
105 if (t->type == TT_INTENTION) {
106 Op_Instance * opi = (Op_Instance *)(t->u.in->top_op);
107 Op_Structure *op_s = op_instance_op(opi);
108 name_list = build_term_list(name_list, build_id(op_name(op_s)));
109 }
else if (t->type == TT_OP_INSTANCE) {
110 Op_Instance * opi = (Op_Instance *)(t->u.opi);
111 Op_Structure *op_s = op_instance_op(opi);
113 name_list = build_term_list(name_list, build_id(declare_atom(
"NOT-AN-OP")));
115 name_list = build_term_list(name_list, build_id(op_name(op_s)));
118 name_list = build_term_list(name_list, build_id(declare_atom(
"NOT-AN-OP-INSTANCE")));
122 return build_term_l_list_from_c_list(name_list);
129 printf(
"*** LOADING mod_utils\n");
130 make_and_declare_eval_funct(
"op-name", func_op_name, 1);
131 make_and_declare_eval_funct(
"op-names", func_op_names, 1);
133 const char *gdb_delay_env = getenv(
"FAWKES_OPRS_GDB_DELAY");
134 if (gdb_delay_env && strcmp(gdb_delay_env,
"true") == 0) {
136 "\n============================================================================\n\n"
137 "GDB delay enabled. Waiting for 10 seconds. Connect with GDB using:\n\n"
139 "============================================================================\n\n",