22 #include "mod_utils.h" 23 #include <default-hook.h> 24 #include <oprs-rerror_f-pub.h> 28 typedef struct op_structure Op_Structure;
30 typedef enum {IS_ACTIVE, IS_SLEEPING, IS_SUSP_ACTIVE, IS_SUSP_SLEEPING} Intention_Status;
31 typedef Slist *Thread_Intention_Block_List;
32 typedef Slist *Condition_List;
36 Thread_Intention_Block_List fils;
37 Thread_Intention_Block_List active_tibs;
40 Intention_Status status;
42 Thread_Intention_Block *critical_section;
44 Condition_List activation_conditions_list;
45 Sprinter *failed_goal_sprinter;
46 OPRS_LIST failed_goal_stack;
51 #include <op-instance_f-pub.h> 52 #include <op-structure_f-pub.h> 53 #include <lisp-list_f-pub.h> 57 func_op_name(TermList terms)
62 op_t = (Term *)get_list_pos(terms, 1);
64 report_fatal_external_error((
char *)
"Cannot retrieve OP instance term");
66 if (op_t->type != TT_OP_INSTANCE) {
67 report_fatal_external_error((
char *)
"Term is not of type OP_INSTANCE");
70 opi = (Op_Instance *)(op_t->u.opi);
71 Op_Structure *op_s = op_instance_op(opi);
73 report_fatal_external_error((
char *)
"Failed to get OP structure from OP instance");
76 return build_id(op_name(op_s));
82 func_op_names(TermList terms)
86 ops_t = (Term *)get_list_pos(terms, 1);
88 report_fatal_external_error((
char *)
"Cannot retrieve OP instance term");
90 if (ops_t->type != LISP_LIST) {
91 report_fatal_external_error((
char *)
"Term is not of type LISP_LIST");
94 TermList name_list = sl_make_slist();
96 for (L_List p_l = ops_t->u.l_list; p_l; p_l = l_cdr(p_l)) {
98 if (t->type == TT_INTENTION) {
99 Op_Instance *opi = (Op_Instance *)(t->u.in->top_op);
100 Op_Structure *op_s = op_instance_op(opi);
101 name_list = build_term_list(name_list, build_id(op_name(op_s)));
102 }
else if (t->type == TT_OP_INSTANCE) {
103 Op_Instance *opi = (Op_Instance *)(t->u.opi);
104 Op_Structure *op_s = op_instance_op(opi);
106 name_list = build_term_list(name_list, build_id(declare_atom(
"NOT-AN-OP")));
108 name_list = build_term_list(name_list, build_id(op_name(op_s)));
111 name_list = build_term_list(name_list, build_id(declare_atom(
"NOT-AN-OP-INSTANCE")));
115 return build_term_l_list_from_c_list(name_list);
123 printf(
"*** LOADING mod_utils\n");
124 make_and_declare_eval_funct(
"op-name", func_op_name, 1);
125 make_and_declare_eval_funct(
"op-names", func_op_names, 1);
127 const char *gdb_delay_env = getenv(
"FAWKES_OPRS_GDB_DELAY");
128 if (gdb_delay_env && strcmp(gdb_delay_env,
"true") == 0) {
130 "\n============================================================================\n\n" 131 "GDB delay enabled. Waiting for 10 seconds. Connect with GDB using:\n\n" 133 "============================================================================\n\n",