ceptr
|
implementation of ceptr processing: instructions and run tree reduction More...
#include "process.h"
#include "def.h"
#include "semtrex.h"
#include <stdarg.h>
#include "receptor.h"
#include "../spec/spec_utils.h"
#include "util.h"
#include "debug.h"
#include <errno.h>
#include "accumulator.h"
#include "protocol.h"
Go to the source code of this file.
#define | __p_dequeue(list, qe) |
#define | __p_enqueue(list, qe) |
#define | __p_append(list, qe) |
int | G_next_process_id = 0 |
char * | sn [] ={"Done","Ascend","Descend","Pushed","Pop","Eval","Block"} |
void | rt_check (Receptor *r, T *t) |
uint32_t | get_rt_cur_child (Receptor *r, T *tP) |
void | set_rt_cur_child (Receptor *r, T *tP, uint32_t idx) |
void | processUnblocker (Stream *st) |
T * | defaultRequestUntil () |
void | _p_fill_from_match (SemTable *sem, T *t, T *match_results, T *match_tree) |
Process | _p_get_transcoder (SemTable *sem, Symbol src_sym, Symbol to_sym) |
int | _p_transcode (SemTable *sem, T *src, Symbol to_sym, Structure to_s, T **result) |
Error | __p_check_signature (SemTable *sem, Process p, T *code, T *sem_map) |
void | __p_unwind_to_point (R *context, T *code_point, T *with) |
Error | __p_reduce_sys_proc (R *context, Symbol s, T *code, Q *q) |
R * | __p_make_context (T *run_tree, R *caller, int process_id, T *sem_map) |
void | pq (Qe *qe) |
void | _p_enqueue (Qe **listP, Qe *e) |
Qe * | __p_find_context (Qe *e, int process_id) |
void | __p_unblock (Q *q, Qe *e, Error err) |
Error | _p_unblock (Q *q, int id) |
void | _p_wakeup (Q *q, T *wakeup, T *with, Error err) |
Error | _p_reduce (SemTable *sem, T *rt) |
T * | __p_buildErr (R *context) |
Error | _p_step (Q *q, R **contextP) |
T * | __p_build_wakeup_info (T *code_point, int process_id) |
T * | __p_build_run_tree_va (T *code, int num_params, va_list params) |
T * | __p_build_run_tree (T *code, int num_params,...) |
T * | _p_make_run_tree (SemTable *sem, Process p, T *params, T *sem_map) |
Q * | _p_newq (Receptor *r) |
void | _p_free_context (R *c) |
void | _p_free_elements (Qe *e) |
void | _p_freeq (Q *q) |
Qe * | __p_addrt2q (Q *q, T *run_tree, T *sem_map) |
void * | _p_reduceq_thread (void *arg) |
void | debug_np (int type, T *np) |
char * | __debug_state_str (R *context) |
Error | _p_reduceq (Q *q) |
void | _p_cleanup (Q *q) |
T * | __p_make_form (Symbol sym, char *output_label, Symbol output_type, SemanticID output_sem,...) |
implementation of ceptr processing: instructions and run tree reduction
Definition in file process.c.
#define __p_append | ( | list, | |
qe | |||
) |
#define __p_dequeue | ( | list, | |
qe | |||
) |
#define __p_enqueue | ( | list, | |
qe | |||
) |
check a group of parameters to see if they match a process input signature
[in] | sem | Semantic table in use |
[in] | p | the Process we are checking against |
[in] | params | list of parameters |
T* __p_make_form | ( | Symbol | sym, |
char * | output_label, | ||
Symbol | output_type, | ||
SemanticID | output_sem, | ||
... | |||
) |
utility function to build process form structures
[in] | symbol | the type of process form to build, i.e. PROCESS_SIGNATURE |
[in] | output_label | |
[in] | output_symbol | |
[in] | var_args | triplets of label, symbol type, and symbol value for the signature |
[out] | form | tree |
reduce system level processes in a run tree. Assumes that the children have already been reduced and all parameters have been filled in
these system level processes are the equivalent of the instruction set of the ceptr virtual machine
void _p_cleanup | ( | Q * | q | ) |
implements the FILL_FROM_MATCH process
replaces the template tree with the matched sub-parts from a semtrex match results tree
[in] | sem | current semantic context |
[in] | t | template tree to be filled |
[in] | match_results | SEMTREX_MATCH_RESULTS tree |
[in] | match_tree | original tree that was matched (needed to build SEMANTIC_MAP) |
void _p_freeq | ( | Q * | q | ) |
reduce a run tree by executing the instructions in it and replacing the tree values in place
a run_tree is expected to have a code tree as the first child, parameters as the second, and optionally an error handling routine as the third child. This is a simplified reducer for testing purposes only, as real reduction happens in the context of a processing Q. This function makes a fake processing Q and Receptor.
[in] | processes | context of defined processes |
[in] | run_tree | the run tree being reduced |
Examples (from test suite):
Error _p_reduceq | ( | Q * | q | ) |
void* _p_reduceq_thread | ( | void * | arg | ) |
take one step in the execution state machine given a run-tree context
a run_tree is expected to have a code tree as the first child, parameters as the second, and optionally an error handling routine as the third child.
[in] | Processing | Q in which this step is taking place |
[in] | pointer | to context pointer |
Error _p_unblock | ( | Q * | q, |
int | id | ||
) |
wakeup a process that's been paused
[in] | q | the processing q in which to search for the process |
[in] | wakeup | the WAKEUP_REF tree that identifies what needs waking up |
[in] | with | a value to replace the current node_pointer with (i.e. a result) |
[in] | err | an error value if the wakeup should trigger the error handler instead of resuming processing |