ceptr
|
processing header files More...
#include "tree.h"
Go to the source code of this file.
Data Structures | |
struct | IterationState |
struct | CondState |
#define | _p_addrt2q(q, t) __p_addrt2q(q,t,NULL); |
#define | __p_make_signature(output_label, output_type, output_sem,...) __p_make_form(PROCESS_SIGNATURE,output_label,output_type,output_sem,__VA_ARGS__) |
enum | ReductionError { Ascend =-1, Descend =-2, Pushed =-3, Pop =-4, Eval =-5, Block =-6, Done =0, noReductionErr =0, redoReduction, raiseReductionErr, tooFewParamsReductionErr =TOO_FEW_PARAMS_ERR_ID, tooManyParamsReductionErr =TOO_MANY_PARAMS_ERR_ID, signatureMismatchReductionErr =SIGNATURE_MISMATCH_ERR_ID, notProcessReductionError =NOT_A_PROCESS_ERR_ID, divideByZeroReductionErr =ZERO_DIVIDE_ERR_ID, notInSignalContextReductionError =NOT_IN_SIGNAL_CONTEXT_ERR_ID, incompatibleTypeReductionErr =INCOMPATIBLE_TYPE_ERR_ID, unixErrnoReductionErr =UNIX_ERRNO_ERR_ID, deadStreamReadReductionErr =DEAD_STREAM_READ_ERR_ID, missingSemanticMapReductionErr =MISSING_SEMANTIC_MAP_ERR_ID, mismatchSemanticMapReductionErr =MISMATCH_SEMANTIC_MAP_ERR_ID, structureMismatchReductionErr =STRUCTURE_MISMATCH_ERR_ID } |
enum | QueueError { noErr = 0, contextNotFoundErr } |
enum | MagicProcesses { MagicReceptors, MagicQuit, MagicDebug } |
enum | IterationPhase { EvalCondition, EvalBody } |
enum | IterationType { IterateTypeCount, IterateTypeUnknown, IterateTypeCond, IterateTypeOnSymbol } |
enum | CondPhase { EvalCondCondtions, EvalCondResult } |
typedef struct IterationState | IterationState |
typedef struct CondState | CondState |
T * | defaultRequestUntil () |
R * | __p_make_context (T *run_tree, R *caller, int process_id, T *sem_map) |
Error | _p_step (Q *q, R **contextP) |
void | _p_fill_from_match (SemTable *sem, T *t, T *match_results, T *match_tree) |
Error | __p_check_signature (SemTable *sem, Process p, T *params, T *sem_map) |
Error | __p_reduce_sys_proc (R *context, Symbol s, T *code, Q *q) |
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 *run_tree) |
Q * | _p_newq (Receptor *r) |
void | _p_freeq (Q *q) |
void | _p_free_context (R *c) |
Qe * | __p_addrt2q (Q *q, T *t, T *sem_map) |
Error | _p_reduceq (Q *q) |
void * | _p_reduceq_thread (void *arg) |
T * | _p_make_run_tree (SemTable *sem, Process p, T *params, T *sem_map) |
T * | __p_build_wakeup_info (T *code_point, int process_id) |
T * | __p_build_run_tree (T *code, int num_params,...) |
void | _p_cleanup (Q *q) |
T * | __p_make_form (Symbol sym, char *output_label, Symbol output_type, SemanticID output_sem,...) |
processing header files
ceptr processing happens by instantiating code trees into run trees and reducing them
Definition in file process.h.
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 |