libtrigger.c File Reference

#include <sys/param.h>
#include <sys/time.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include "libicl_private.h"
#include "libicl.h"
#include "libdb.h"
#include "libcom_tcp.h"
#include "liboaa.h"
#include "dictionary.h"

Go to the source code of this file.

Functions

int oaa_remove_trigger_local (char *type, ICLTerm *condition, ICLTerm *action, ICLTerm *params)
int oaa_add_trigger_local (char *type, ICLTerm *condition, ICLTerm *action, ICLTerm *params)
EXTERN int oaa_solve_local (ICLTerm *full_goal, ICLTerm *params, ICLTerm **solutions)
EXTERN ICLTermremove_element (ICLTerm *elt, ICLTerm *list, ICLTerm **rest)
EXTERN int oaa_remove_data_local (ICLTerm *clause1, ICLTerm *params)
EXTERN int oaa_add_data_local (ICLTerm *clause1, ICLTerm *params)
EXTERN int oaa_Inform (ICLTerm *type_info, char *format_string, ICLTerm *args)
EXTERN int icl_param_arg (char *param, ICLTerm *value, ICLTerm *paramlist, ICLTerm **result)
 Searches for a parameter in a parameter list.
EXTERN int icl_standardize_params (ICLTerm *Params, int KeepDefaults, ICLTerm **Standardized)
 Standardizes a permissions list, removing defaults if requested.
EXTERN int replace_element (ICLTerm *elt, ICLTerm *old_list, ICLTerm *new, ICLTerm **new_list)
EXTERN ICLTermvalid_oaa_solvables ()
EXTERN int oaa_data_matches_solvables (ICLTerm *Clause, ICLTerm *Solvables, ICLTerm *Perm, ICLTerm **RealClause, ICLTerm **RealMatched)
 Determine whether Clause can be read or written by the agent with these Solvables, and return the "real" form of the clause that takes synonyms into account.
EXTERN int oaa_class (char *class)
EXTERN char * new_goal_id ()
EXTERN int oaa_poll_until_event (ICLTerm *event, ICLTerm **solution)
EXTERN int icl_replace_param_value (ICLTerm *param, ICLTerm *param_list)
 If param unifies with an element of param list, replace the element with the unified result.
int oaa_remove_local_trigger_by_id (ICLTerm *trigger_id)
 Removes a local trigger given its unique identifier.
int oaa_fire_trigger (ICLTerm *term)
int oaa_CheckTriggers (char *type, ICLTerm *condition_var, char *op)
 Given a trigger type, a mask and an Op (e.g.
int oaa_update_trigger (char *mode, char *type, ICLTerm *condition, ICLTerm *action, ICLTerm *in_params, ICLTerm **out_params)
int oaa_AddTrigger (char *type, ICLTerm *condition, ICLTerm *action, ICLTerm *initial_params, ICLTerm **out_params)
 Adds a trigger according to parameters.
int oaa_RemoveTrigger (char *type, ICLTerm *condition, ICLTerm *action, ICLTerm *initial_params, ICLTerm **out_params)
 Removes a trigger from a local or remote agent.


Detailed Description

Definition in file libtrigger.c.


Function Documentation

EXTERN int icl_param_arg ( char *  param,
ICLTerm value,
ICLTerm paramlist,
ICLTerm **  result 
)

Searches for a parameter in a parameter list.

Just like icl_ParamValue() except it returns the argument of the result instead of the whole unified term. Returns a newly allocated copy.

Definition at line 1353 of file liboaa.c.

EXTERN int icl_replace_param_value ( ICLTerm param,
ICLTerm param_list 
)

If param unifies with an element of param list, replace the element with the unified result.

Does *not* replace default values.

Definition at line 5614 of file liboaa.c.

EXTERN int icl_standardize_params ( ICLTerm Params,
int  KeepDefaults,
ICLTerm **  Standardized 
)

Standardizes a permissions list, removing defaults if requested.

Normally there's no need to keep the default value of a param, but there are exceptional situations. If KeepDefaults is true, default values are kept. Standardized is all newly allocated stuff.

Definition at line 1219 of file liboaa.c.

EXTERN char* new_goal_id (  ) 

EXTERN int oaa_add_data_local ( ICLTerm clause1,
ICLTerm params 
)

int oaa_add_trigger_local ( char *  type,
ICLTerm condition,
ICLTerm action,
ICLTerm params 
)

int oaa_AddTrigger ( char *  type,
ICLTerm condition,
ICLTerm action,
ICLTerm initial_params,
ICLTerm **  out_params 
)

Adds a trigger according to parameters.

Type = comm, data, task, time

Condition= comm:event to match, data:data to match, task:solvable to call time:@

Action = Can be any of these:

Params =

Default destination for triggers:

Definition at line 558 of file libtrigger.c.

int oaa_CheckTriggers ( char *  type,
ICLTerm condition_var,
char *  op 
)

Given a trigger type, a mask and an Op (e.g.

[send, receive], [add, remove], etc), see if any triggers fire.

Definition at line 99 of file libtrigger.c.

EXTERN int oaa_class ( char *  class  ) 

EXTERN int oaa_data_matches_solvables ( ICLTerm Clause,
ICLTerm Solvables,
ICLTerm Perm,
ICLTerm **  RealClause,
ICLTerm **  RealMatched 
)

Determine whether Clause can be read or written by the agent with these Solvables, and return the "real" form of the clause that takes synonyms into account.

Parameters:
Clause must be non-compound (basic) to match: no address, no params, no subClauses.
Solvables must be in standard form.
Perm is 'read' or 'write'.
RealClause is what should actually be used (asserted, retracted, replaced).
RealMatched is the solvable record corresponding to RealClause.
Remarks:

Definition at line 2322 of file liboaa.c.

int oaa_fire_trigger ( ICLTerm term  ) 

Definition at line 274 of file libtrigger.c.

EXTERN int oaa_Inform ( ICLTerm type_info,
char *  format_string,
ICLTerm args 
)

EXTERN int oaa_poll_until_event ( ICLTerm event,
ICLTerm **  solution 
)

EXTERN int oaa_remove_data_local ( ICLTerm clause1,
ICLTerm params 
)

int oaa_remove_local_trigger_by_id ( ICLTerm trigger_id  ) 

Removes a local trigger given its unique identifier.

Definition at line 622 of file libtrigger.c.

int oaa_remove_trigger_local ( char *  type,
ICLTerm condition,
ICLTerm action,
ICLTerm params 
)

int oaa_RemoveTrigger ( char *  type,
ICLTerm condition,
ICLTerm action,
ICLTerm initial_params,
ICLTerm **  out_params 
)

Removes a trigger from a local or remote agent.

Definition at line 567 of file libtrigger.c.

EXTERN int oaa_solve_local ( ICLTerm full_goal,
ICLTerm params,
ICLTerm **  solutions 
)

int oaa_update_trigger ( char *  mode,
char *  type,
ICLTerm condition,
ICLTerm action,
ICLTerm in_params,
ICLTerm **  out_params 
)

Definition at line 353 of file libtrigger.c.

EXTERN ICLTerm* remove_element ( ICLTerm elt,
ICLTerm list,
ICLTerm **  rest 
)

EXTERN int replace_element ( ICLTerm elt,
ICLTerm old_list,
ICLTerm new,
ICLTerm **  new_list 
)

EXTERN ICLTerm* valid_oaa_solvables (  ) 

Definition at line 4097 of file liboaa.c.


Generated on Wed May 23 17:20:16 2007 using doxygen 1.5.2