Show
Ignore:
Timestamp:
07/05/07 04:03:51 (17 months ago)
Author:
krobillard
Message:

Added component! & lit-select! datatypes.
ur_makeBlockT() now has a ptr return argument.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/thune/thread_safe/doc/UserManual

    r415 r426  
    8888select!      obj/x my-block/2 
    8989set-select!  :obj/x :my-block/2 
     90lit-select!  'obj/x 'my-block/2 
    9091slice! 
    9192time!        10:02 -0:0:32.08 
    9293context! 
     94component! 
    9395===========  ========== 
    9496 
     
    102104 
    103105Macros can be used wherever a constant is needed to improve evaluation 
    104 speed. 
     106speed.  They are also useful for conditional code generation. 
    105107 
    106108Example:: 
     
    110112    box-width <border> add 
    111113 
     114Conditional Example:: 
     115 
     116    <script-env/os [ 
     117        linux   ["Linux"] 
     118        solaris ["Solaris"] 
     119        ["Unsupported OS" error] 
     120     ] case> 
     121    print 
    112122 
    113123Currently, macro! values cannot be created by the user. 
     
    243253.. The Evaluator 
    244254   Contexts & Binding 
     255 
     256 
     257Components 
     258---------- 
     259 
     260Components are similar to functions, but they operate via a dataflow model. 
     261They have inputs, outputs which are connected to the inputs of other 
     262components, and a body which is evaluated when all inputs are set. 
     263 
     264Components must have at least one input, but they don't require any outputs. 
     265 
     266Here is an example of how to create and connect components:: 
     267 
     268    [a b -- out] [a b mul :out] component :c1 
     269    [val] [val .] component :probe 
     270    'c1/out 'probe/val connect 
     271 
     272Now, when the inputs to *c1* are set, *probe* will automatically be invoked:: 
     273 
     274    3 :c1/a 
     275    5 :c1/b 
     276    15 
     277 
     278Further changes to the inputs will continue to invoke the *probe* component:: 
     279 
     280    5 :c1/a 
     281    25 
     282 
     283*Connect* also accepts components as arguments.  This is short-hand for 
     284refering to the first input or output. 
     285The following call makes the same connection as the example above:: 
     286 
     287    c1 probe connect 
    245288 
    246289 
     
    533576:: 
    534577 
    535         (logic -- ) 
     578    (logic -- ) 
    536579 
    537580Evaluate next value if TOS is true.  To evaluate more than one value use 
     
    558601:: 
    559602 
    560         (ser new [part int!] -- ser) 
     603    (ser new [part int!] -- ser) 
    561604 
    562605Change series at current position. 
     
    568611:: 
    569612 
    570         (ser pat -- end series!/none!) 
     613    (ser pat -- end series!/none!) 
    571614 
    572615Move position to end of matching pattern. 
     
    584627 
    585628 
     629Extending The System 
     630==================== 
     631 
     632Adding C Functions 
     633------------------ 
     634 
     635C functions are defined with the *UR_CALL* macro. 
     636 
     637The function is responsible for checking that arguments are of the correct 
     638type and for reporting any errors.  If type checking were built into the 
     639evaluator there would be redundant checks for the typical case where the 
     640function accepts multiple types for a given argument or pattern of 
     641arguments. 
     642 
     643Always access and check stack arguments starting with *tos* and work down. 
     644Since the bottom of the stack contains *UT_UNSET*, checking in this order 
     645avoids an extra check to make sure that the stack holds at least the number 
     646of expected arguments. 
     647 
     648