ceptr
 All Data Structures Files Functions Variables Typedefs Macros Modules Pages
System Processes Reference

The ceptr processing model consits of reducing a semantic tree of process nodes. Processes can either be system processes (provided by the virtual machine) or composed processes declared in in the context of the receptor.

The virtual machine provides the following system processes:

ProcessChildren (inputs)Reduces To (output)Comments
NOOP
  1. do(ANY:NULL_STRUCTURE)
result(PASSTHRU:NULL_STRUCTURE)no-op
this process reduces to its single "do" parameter.
DEF_SYMBOL
  1. def(SYMBOL:SYMBOL_DEFINITION)
symbol(SYMBOL:RESULT_SYMBOL)define a new symbol
DEF_STRUCTURE
  1. def(SYMBOL:SYMBOL_DEFINITION)
structure(STRUCTURE:RESULT_STRUCTURE)define a new structure
DEF_PROCESS
  1. def(SYMBOL:PROCESS_DEFINITION)
process(PROCESS:RESULT_PROCESS)define a new process
DEF_RECEPTOR
  1. def(SYMBOL:RECEPTOR_DEFINITION)
receptor(RECEPTOR:RESULT_RECEPTOR)define a new receptor
DEF_PROTOCOL
  1. def(SYMBOL:PROTOCOL_DEFINITION)
protocol(PROTOCOL:RESULT_PROTOCOL)define a new protocol
NEW
  1. what(SYMBOL:NEW_TYPE)
  2. value(ANY:NULL_STRUCTURE)
xaddr(SYMBOL:WHICH_XADDR)new instance
reduces to the xaddr of a newly created instance of type NEW_TYPE. the structures of "what" and "value" must match, but not the symbols
GET
  1. what(SYMBOL:WHICH_XADDR)
value(ANY:NULL_STRUCTURE)get instance value
reduces to the value of the instance at the xaddr of the "what" parameter
DEL
  1. what(SYMBOL:WHICH_XADDR)
value(ANY:NULL_STRUCTURE)delete instance
reduces to the value of the deleted instance at the xaddr of the "what" parameter
DO
  1. actions(SYMBOL:SCOPE)
result(PASSTHRU:NULL_STRUCTURE)do
execute a SCOPE of instructions for side-effects returning the value of the last one. I would like it better if the actions could just be the children of the DO process
PARAMETER
  1. reference(SYMBOL:PARAMETER_REFERENCE)
  2. as(SYMBOL:PARAMETER_RESULT)
result(PASSTHRU:NULL_STRUCTURE)get parameter data
DISSOLVE
  1. tree(ANY:NULL_STRUCTURE)
result(PASSTHRU:NULL_STRUCTURE)merge children into parent's children
remove the root of the child, merging it's children into the parent's children at the process's spot
TRANSCODE
  1. using(SYMBOL:TRANSCODE_PARAMS)
  2. convert(SYMBOL:TRANSCODE_ITEMS)
result(PASSTHRU:NULL_STRUCTURE)transform semantic type
transform the semantic types of a itemstree to a different type as specified in the parameters. If TRANSCODE_ITEMS has multiple children DISSOLVE is implied
GET_LABEL
  1. of(SYMBOL:LABEL_SYMBOL)
  2. type(SYMBOL:LABEL_TYPE)
  3. [as(SYMBOL:RESULT_SYMBOL)]
result(PASSTHRU:NULL_STRUCTURE)get a symbol's label
COND
  1. conditions(SYMBOL:CONDITIONS)
result(PASSTHRU:NULL_STRUCTURE)cond
this is a traditional lisp "cond" process that reduces conditionally to the COND_PAIR that evaluates to true, or to the COND_ELSE in none of them do.
IF
  1. condition(PROCESS:BOOLEAN)
  2. then(ANY:NULL_STRUCTURE)
  3. [else(ANY:NULL_STRUCTURE)]
result(PASSTHRU:NULL_STRUCTURE)if
this is a traditional "if" process that reduces conditionally to either the "then" or the "else" parameter depending on the value of the "condition" parameter. Note: we may be replacing this with a more lispy COND process
ITERATE
  1. condtion(PROCESS:BOOLEAN)
  2. do(ANY:NULL_STRUCTURE)
result(PASSTHRU:NULL_STRUCTURE)iterate a process
this process checks the structure of the result of the "condition" param, if it's a BOOLEAN, it treats the iteration as a while loop and iterates until the BOOLEAN is false; if it's an INTEGER it treats the iteration as repeat loop and iterates as many times as the value of the INTEGER; if it's a ITERATE_ON_SYMBOL then it iterates on all the instances of that symbol type which get added into the PARAMS each time through
SAY
  1. to(SYMBOL:TO_ADDRESS)
  2. on(SYMBOL:ASPECT_IDENT)
  3. carrier(SYMBOL:CARRIER)
  4. message(ANY:NULL_STRUCTURE)
signal id(SYMBOL:SIGNAL_UUID)send a message to a receptor
REQUEST
  1. of(SYMBOL:TO_ADDRESS)
  2. on(SYMBOL:ASPECT_IDENT)
  3. carrier(SYMBOL:CARRIER)
  4. message(ANY:NULL_STRUCTURE)
  5. expect response on(SYMBOL:RESPONSE_CARRIER)
  6. [until(SYMBOL:END_CONDITIONS)]
  7. [callback(PROCESS:NULL_SYMBOL)]
response(ANY:NULL_STRUCTURE)send a request to a receptor
if there is no "callback" param, then this process will block until the result comes back or the "until" causes cleanup of pending request.
CONVERSE
  1. do(PROCESS:NULL_SYMBOL)
  2. [until(SYMBOL:END_CONDITIONS)]
  3. [wait(SYMBOL:BOOLEAN)]
result(PASSTHRU:NULL_STRUCTURE)set up a conversation scope for signaling
Use "until" to specify when the system will terminate the conversation. Use "wait" to specify whether the CONVERSE instruction should be paused when it goes out of scope waiting for the conversation to complete. If you use asynchronous REQUEST or LISTEN instructions in the scope the conversation and you don’t set "wait" to TRUE you will want to use the THIS_SCOPE instruction to get the conversation identifier so you can call the COMPLETE instruction someplace later or the conversation will never get cleaned up.
COMPLETE
  1. with(ANY:NULL_STRUCTURE)
  2. [conversation(SYMBOL:CONVERSATION_UUID)]
result(PASSTHRU:NULL_STRUCTURE)cause a conversation to come to completion
Cleans up a conversation and causes the CONVERSE instruction to reduce to value of "with". If "conversation" provided, completes that conversation, otherwise assumes the value of THIS_SCOPE. If the specified conversation doesn’t exist (i.e. because it was cleaned up by its end conditions) COMPLETE will invoke the error handler. Note that it’s possible that the CONVERSE instruction was already reduced, in which case the value of with_someting will get ignored. If the COMPLETE instruction is not inside a CONVERSE scope, it will be reduced to the value of "conversation"
THIS_SCOPE
    conversation(SYMBOL:CONVERSATION_UUID)get the conversation id of the current scope
    Reduces to the identifier of the current conversation. Executing THIS_SCOPE not somewhere inside a CONVERSE will invoke the error handler.
    SELF_ADDR
    1. as(SYMBOL:RESULT_SYMBOL)
    address(PASSTHRU:NULL_STRUCTURE)self address
    reduces to current RECEPTOR_ADDRESS as a use of the as symbol
    LISTEN
    1. on(SYMBOL:ASPECT_IDENT)
    2. for(SYMBOL:CARRIER)
    3. match(SYMBOL:PATTERN)
    4. [do(SYMBOL:ACTION)]
    5. [with(SYMBOL:PARAMS)]
    6. [until(SYMBOL:END_CONDITIONS)]
    error(SYMBOL:REDUCTION_ERROR_SYMBOL)plant a listener
    If you don't provide an action, the assumption is that the LISTEN process will block and will reduce to the SEMTREX_MATCH. This will also force the END_CONDITIONS/REPETITIONS to COUNT:1. If "for" carrier is NULL_SYMBOL the expectation will match on all carriers.
    MATCH
    1. pattern(STRUCTURE:SEMTREX)
    2. against(ANY:NULL_STRUCTURE)
    3. [return match(SYMBOL:BOOLEAN)]
    matched(SYMBOL:BOOLEAN)semtrex match
    RESPOND
    1. respond on(SYMBOL:CARRIER)
    2. response contents(ANY:NULL_STRUCTURE)
    response id(SYMBOL:SIGNAL_UUID)respond to signal
    QUOTE
    1. process(PROCESS:NULL_PROCESS)
    result(PASSTHRU:NULL_STRUCTURE)quote a process so that it can be passed as a value
    FILL
    1. template(ANY:NULL_STRUCTURE)
    2. map(SYMBOL:SEMANTIC_MAP)
    result(PASSTHRU:NULL_STRUCTURE)fill template from map
    FILL_FROM_MATCH
      result(ANY:NULL_STRUCTURE)fill template from match results
      RAISE
      1. error(SYMBOL:REDUCTION_ERROR_SYMBOL)
      result(STRUCTURE:NULL_STRUCTURE)raise reduction error
      this process doesn't really return anything, because it triggers the handler for the error in the "error" parameter
      STREAM_READ
      1. stream(SYMBOL:EDGE_STREAM)
      2. into(SYMBOL:RESULT_SYMBOL)
      result(PASSTHRU:NULL_STRUCTURE)read from a stream
      the data on the stream will appear as the surface of the symbol type given by the "into" param. Clearly this could get ugly as there is no semantic checking that that's ok...
      STREAM_WRITE
      1. stream(SYMBOL:EDGE_STREAM)
      2. what(ANY:NULL_STRUCTURE)
      result(PASSTHRU:NULL_STRUCTURE)write to a stream
      STREAM_ALIVE
      1. stream(SYMBOL:EDGE_STREAM)
      alive(SYMBOL:BOOLEAN)test if stream is alive for reading
      STREAM_CLOSE
      1. stream(SYMBOL:EDGE_STREAM)
      true(SYMBOL:BOOLEAN)close a stream
      CONCAT_STR
      1. into(SYMBOL:RESULT_SYMBOL)
      2. str1(STRUCTURE:CSTRING)
      3. str2(STRUCTURE:CSTRING)
      concatenation(STRUCTURE:CSTRING)concatinate strings
      concatenates two strings of any symbol type into an new symbol type specified by the "into" parameter
      EXPAND_STR
      1. str(STRUCTURE:CSTRING)
      ascii tree(SYMBOL:ASCII_CHARS)expand string
      converts a CSTRING into an ASCII_CHARS tree
      CONTRACT_STR
      1. into(SYMBOL:RESULT_SYMBOL)
      string(STRUCTURE:CSTRING)contract to string
      converts any number of chars or cstring into a single cstring of symbol type indicated by the into param
      EQ_SYM
      1. symbol1(STRUCTURE:SYMBOL)
      2. symbol2(STRUCTURE:SYMBOL)
      equality(SYMBOL:BOOLEAN)test equality
      test the quality of two SYMBOL type parameters
      ADD_INT
      1. augend(STRUCTURE:INTEGER)
      2. addend(STRUCTURE:INTEGER)
      sum(STRUCTURE:INTEGER)addition
      SUB_INT
      1. minuend(STRUCTURE:INTEGER)
      2. subtrahend(STRUCTURE:INTEGER)
      difference(STRUCTURE:INTEGER)subtract
      MULT_INT
      1. multiplicand(STRUCTURE:INTEGER)
      2. multiplier(STRUCTURE:INTEGER)
      product(STRUCTURE:INTEGER)multiply
      DIV_INT
      1. dividend(STRUCTURE:INTEGER)
      2. divisor(STRUCTURE:INTEGER)
      quotient(STRUCTURE:INTEGER)divide
      MOD_INT
      1. dividend(STRUCTURE:INTEGER)
      2. divisor(STRUCTURE:INTEGER)
      remainder(STRUCTURE:INTEGER)modulo
      EQ_INT
      1. int1(STRUCTURE:INTEGER)
      2. int2(STRUCTURE:INTEGER)
      equality(SYMBOL:BOOLEAN)test equality
      LT_INT
      1. int1(STRUCTURE:INTEGER)
      2. int2(STRUCTURE:INTEGER)
      result(SYMBOL:BOOLEAN)test less than
      GT_INT
      1. int1(STRUCTURE:INTEGER)
      2. int2(STRUCTURE:INTEGER)
      result(SYMBOL:BOOLEAN)test greater than
      LTE_INT
      1. int1(STRUCTURE:INTEGER)
      2. int2(STRUCTURE:INTEGER)
      result(SYMBOL:BOOLEAN)test less than or equal
      GTE_INT
      1. int1(STRUCTURE:INTEGER)
      2. int2(STRUCTURE:INTEGER)
      result(SYMBOL:BOOLEAN)test greater than or equal
      POP_PATH
      1. path(STRUCTURE:TREE_PATH)
      2. as(SYMBOL:RESULT_SYMBOL)
      3. [count(SYMBOL:POP_COUNT)]
      result(PASSTHRU:NULL_SYMBOL)pop values off a tree path
      CONTINUE
      1. at(SYMBOL:CONTINUE_LOCATION)
      2. with(SYMBOL:CONTINUE_VALUE)
      result(PASSTHRU:NULL_SYMBOL)restart reduction at some parent
      INITIATE_PROTOCOL
      1. protocol(SYMBOL:PNAME)
      2. interaction(SYMBOL:WHICH_INTERACTION)
      3. bindings(SYMBOL:PROTOCOL_BINDINGS)
      error(SYMBOL:REDUCTION_ERROR_SYMBOL)initiate the first step of a protocol
      MAGIC
        result(ANY:NULL_STRUCTURE)dark magic
        this process reduces to hardcoded special things as a scaffold for things we don't know how to build in ceptr yet.
        date2usshortdate
        1. from(STRUCTURE:DATE)
        to(SYMBOL:US_SHORT_DATE)date to us short format date transcoder
        time2shortime
        1. from(STRUCTURE:TIME)
        to(SYMBOL:SHORT_TIME)time to short format date transcoder
        send_request
          response(ANY:NULL_STRUCTURE)send request
          send_response
            response id(SYMBOL:SIGNAL_UUID)send response
            fill_i_am
            1. [pattern(SYMBOL:are_you)]
            identity(STRUCTURE:RECEPTOR_IDENTITY)fill i am
            line_2_command
              signal id(SYMBOL:SIGNAL_UUID)parse a COMMAND from a LINE
              respond_with_yup
                response id(SYMBOL:SIGNAL_UUID)respond with yup
                request_membership
                  result(SYMBOL:SIGNAL_UUID)request membership
                  enroll
                    result(STRUCTURE:NULL_STRUCTURE)enroll client
                    speak
                      result(SYMBOL:SIGNAL_UUID)speak
                      group_listen
                        result(SYMBOL:SIGNAL_UUID)group_listen
                        time_request
                          response(SYMBOL:TICK)request current time
                          meda_type_2_ascii_str
                          1. input(STRUCTURE:MEDIA_TYPE)
                          output(SYMBOL:ASCII_STR)media type transcoder
                          content_type_2_line
                          1. input(SYMBOL:CONTENT_TYPE)
                          output(SYMBOL:LINE)content type transcoder
                          http_response_status_2_ascii_str
                          1. input(SYMBOL:HTTP_RESPONSE_STATUS)
                          output(SYMBOL:ASCII_STR)http response status transcoder
                          http_response_2_lines
                          1. input(SYMBOL:HTTP_RESPONSE)
                          output(SYMBOL:LINES)http response transcoder
                          line_2_httpreq
                            signal id(SYMBOL:SIGNAL_UUID)parse an HTTP_REQUEST from a LINE
                            ascii_chars_2_http_req
                            1. input(SYMBOL:ASCII_CHARS)
                            output(SYMBOL:HTTP_REQUEST)http req transcoder
                            httpresp
                              response(SYMBOL:HTTP_RESPONSE)build an HTTP_RESPONSE