00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PLANG_CONTEXT_H
00021 #define PLANG_CONTEXT_H
00022
00023 #ifdef __cplusplus
00024 extern "C" {
00025 #endif
00026
00027 typedef struct p_context p_context;
00028 typedef union p_term p_term;
00029
00030 p_context *p_context_create(void);
00031 void p_context_free(p_context *context);
00032
00033 void *p_context_mark_trail(p_context *context);
00034 void p_context_backtrack_trail(p_context *context, void *marker);
00035
00036 typedef enum {
00037 P_CONSULT_DEFAULT = 0,
00038 P_CONSULT_ONCE = 1
00039 } p_consult_option;
00040
00041 int p_context_consult_file
00042 (p_context *context, const char *filename, p_consult_option option);
00043 int p_context_consult_string(p_context *context, const char *str);
00044
00045 typedef enum {
00046 P_RESULT_FAIL = 0,
00047 P_RESULT_TRUE = 1,
00048 P_RESULT_ERROR = 2,
00049 P_RESULT_HALT = 3
00050 } p_goal_result;
00051
00052 p_goal_result p_context_execute_goal
00053 (p_context *context, p_term *goal, p_term **error);
00054 p_goal_result p_context_reexecute_goal
00055 (p_context *context, p_term **error);
00056 void p_context_abandon_goal(p_context *context);
00057
00058 double p_context_fuzzy_confidence(p_context *context);
00059 void p_context_set_fuzzy_confidence(p_context *context, double value);
00060
00061 p_goal_result p_context_call_once
00062 (p_context *context, p_term *goal, p_term **error);
00063
00064 int p_context_is_debug(p_context *context);
00065 void p_context_set_debug(p_context *context, int debug);
00066
00067 void p_context_add_import_path(p_context *context, const char *path);
00068 void p_context_add_library_path(p_context *context, const char *path);
00069
00070 #ifdef __cplusplus
00071 };
00072 #endif
00073
00074 #endif