#! /usr/lib/veetest/veetest -d /usr/lib/veetest -r
(revision "A.00.00")
(date "Thu 11/Apr/1991")
(component 0 "Context"
 (interface
 )
 (implementation
  (trigMode deg)
  (locked no)
  (component 0 "Context"
   (name "File Editor")
   (interface
    (sequence in)
    (sequence out)
    (input 1
     (type data)
     (name "File Name")
     (requires
      (datatype Text)
      (shape "Scalar")
     )
     (optional yes)
    )
   )
   (implementation
    (trigMode deg)
    (locked no)
    (component 0 "RepeatUntilBreak"
     (interface
      (sequence in)
      (sequence out)
      (output 1
       (type data)
       (name "Continuous")
       (lock name constraints)
      )
     )
     (implementation
     )
     (views
      (description 5 7
       Since we don't know how many lines are in the file,
       the read operation must be repeated until EOF is
       found.  The EOF triggers the collector to send
       all accumulated lines of text, then does the
       BREAK device that terminates this iterator.  
      )
      (icon
       (origin 35 288)
       (extent 110 64)
       (iconImage loop.icon)
      )
      (detail
      )
      (terminals on)
      (active icon)
     )
    )
    (component 1 "Formula"
     (name "Editing:")
     (interface
      (sequence in)
      (sequence out)
      (input 1
       (type data)
       (name "A")
       (optional yes)
      )
      (output 1
       (type data)
       (name "Result")
       (lock name constraints)
      )
     )
     (implementation
      (component isLocked no)
      (component expr 1 "\"Editing: \"+A")
     )
     (views
      (description 2 7
       This device constructs the "Editing: <filename>"
       text string displayed while editing is allowed.
      )
      (icon
       (origin 35 408)
       (extent 110 25)
      )
      (detail
       (origin 120 380)
       (extent 151 60)
      )
      (terminals on)
      (active icon)
     )
    )
    (component 2 "Junction"
     (name "JCT")
     (interface
      (input 1
       (type data)
       (name "A")
       (lock name constraints)
      )
      (input 2
       (type data)
       (name "B")
       (lock name constraints)
      )
      (output 1
       (type data)
       (name "Data")
       (lock name constraints)
      )
     )
     (implementation
     )
     (views
      (description 2 7
       This device passes thru either the Loading or the
       Editing string to the display device.
      )
      (icon
       (origin 187 398)
       (extent 46 25)
      )
      (detail
      )
      (terminals on)
      (active icon)
     )
    )
    (component 3 "ToFile"
     (interface
      (sequence in)
      (sequence out)
      (input 1
       (type data)
       (name "StrArray")
       (tag "A")
       (optional yes)
      )
      (input 2
       (type control)
       (name "File Name")
       (tag "File Name")
       (requires
        (datatype Text)
        (shape "Scalar")
       )
       (lock name constraints)
       (optional yes)
      )
     )
     (implementation
      (attr iopath file write "/dev/null"
       (readTerm "\n")
       (fs "\n")
       (eol "\n")
       (multiField fullSyntax)
       (arrayFormat block)
      )
      (procedure
        WRITE TEXT StrArray STR EOL
      )
     )
     (views
      (description 22 7
       Using the file name supplied on the Control input
       pin, the ToFile device overwrites the existing
       contents of the file with the array of data sent
       from the "Editable Text Constant" device. 
       
       The transaction uses STR format to write each 
       array element as a Text STRing.  The Config
       options are set to add a "\n" (newline) after
       each array element is written.  Since the last
       element receives no "\n" separator character, the
       Array separator char is set to "\n" to provide
       the final newline.
       
       Note that the ToFile device is set to Clear File
       at Prerun, causing any data written to start at
       the beginning of the file, rather than to be
       appended to the file.  (The file isn't actually
       cleared at pre-run; it is opened for overwriting
       at prerun, but not truncated until the first
       write operation takes place.  Thus, CANCELing
       the edit session does not truncate the file.)
       
      )
      (icon
       (origin 381 308)
       (extent 78 25)
      )
      (detail
       (origin 502 571)
       (extent 327 98)
      )
      (terminals on)
      (active detail)
     )
    )
    (component 4 "TextDisplay"
     (name "File Name")
     (interface
      (sequence in)
      (sequence out)
      (input 1
       (type data)
       (name "Data")
      )
     )
     (implementation
      (component clearAtPrerun 1)
      (component clearAtActivate 1)
     )
     (views
      (description 3 7
       This device has been added to the File Editor
       Panel view to allow the user to see what file is
       being loaded and edited.
      )
      (icon
       (origin 255 398)
       (extent 110 25)
      )
      (detail
       (origin 165 463)
       (extent 190 35)
      )
      (active icon)
     )
    )
    (component 5 "Confirm"
     (name "WRITE")
     (interface
      (sequence in)
      (sequence out)
      (output 1
       (type data)
       (name "Go")
       (lock name constraints)
      )
     )
     (implementation
     )
     (views
      (description 12 7
       This Confirm/OK device is added to the Panel view
       to allow the user to initiate a write of the
       data in the Text Constant to the named file.
       
       If the user clicks on this button, the "Editable
       Text Constant" will operate, sending it's current
       data to the ToFile divide.  
       
       Note that the Cancel button is activated in 
       parallel with the Write; whichever one is pressed
       first by the user will allow control to continue
       from that device.
      )
      (icon
       (origin 37 472)
       (extent 67 37)
      )
      (detail
       (origin 36 120)
       (extent 59 40)
      )
      (terminals on)
      (active icon)
     )
    )
    (component 6 "Junction"
     (name "JCT")
     (interface
      (input 1
       (type data)
       (name "A")
       (lock name constraints)
      )
      (input 2
       (type data)
       (name "B")
       (lock name constraints)
      )
      (output 1
       (type data)
       (name "Data")
       (lock name constraints)
      )
     )
     (implementation
     )
     (views
      (description 3 7
       To feed either the collected text array or an 
       empty text array to the Editable Text Constant,
       the JCT device is used.
      )
      (icon
       (origin 327 468)
       (extent 46 25)
      )
      (detail
      )
      (terminals on)
      (active icon)
     )
    )
    (component 7 "ExitContext"
     (interface
      (sequence in)
     )
     (implementation
     )
     (views
      (description 6 7
       Executing this device terminates the File Edit
       operation without writing the modified text to
       the file.  The Editable Text Constant device is
       first cleared by sending an empty array to it.
       
       
      )
      (icon
       (origin 178 618)
       (extent 145 25)
      )
      (detail
      )
      (terminals on)
      (active icon)
     )
    )
    (component 8 "ExitContext"
     (interface
      (sequence in)
     )
     (implementation
     )
     (views
      (description 4 7
       Operating this device terminates the File Edit
       session after dumping the edited text to the 
       ToFile device for writing.
       
      )
      (icon
       (origin 28 618)
       (extent 145 25)
      )
      (detail
      )
      (terminals on)
      (active icon)
     )
    )
    (component 9 "Confirm"
     (name "CANCEL")
     (interface
      (sequence in)
      (sequence out)
      (output 1
       (type data)
       (name "Go")
       (lock name constraints)
      )
     )
     (implementation
     )
     (views
      (description 12 7
       This Confirm/OK device allows the user to cancel
       an edit session without writing the possibly 
       modified data to the file.  It does this by first
       clearing the "Editable Text Constant" by sending
       an empty array to it, then using the ExitUserObj
       device to terminate all operations in the File
       Editor User Object.
       
       Note that this device operates in parallel with
       the Write button; whichever is pressed first by
       the user will allow propagation to proceed from 
       that device.
      )
      (icon
       (origin 132 472)
       (extent 76 37)
      )
      (detail
       (origin 561 170)
       (extent 68 40)
      )
      (terminals on)
      (active icon)
     )
    )
    (component 10 "Do"
     (interface
      (sequence in)
      (sequence out)
      (output 1
       (type data)
       (name "Do")
       (lock name constraints)
      )
     )
     (implementation
     )
     (views
      (icon
       (origin 147 528)
       (extent 46 25)
      )
      (detail
      )
      (terminals on)
      (active icon)
     )
    )
    (component 11 "Junction"
     (name "JCT")
     (interface
      (input 1
       (type data)
       (name "A")
       (lock name constraints)
      )
      (input 2
       (type data)
       (name "B")
       (lock name constraints)
      )
      (output 1
       (type data)
       (name "Data")
       (lock name constraints)
      )
     )
     (implementation
     )
     (views
      (icon
       (origin 217 538)
       (extent 46 25)
      )
      (detail
      )
      (terminals on)
      (active icon)
     )
    )
    (component 12 "LiteralConstant"
     (name "Empty")
     (interface
      (sequence in)
      (sequence out)
      (output 1
       (type data)
       (name "Text")
       (lock name constraints)
      )
     )
     (implementation
      (component value Text
       (name "Empty")
       (numDims 1)
       (size 1)
       (data
        [ "" ]
       )
      )
      (component autoTrigger off)
      (component initializeAtPrerun off)
      (component initializeAtActivate off)
      (component initValue Text
       (datum "")
      )
     )
     (views
      (description 11 7
       Although the "Editable Text Constant" can have a
       "RESET" control input added, that input only 
       clears each element of the existing array and does
       not re-size the configured array.
       
       Thus, we use this small Text Constant to load an
       empty array into the edit constant after a Cancel
       request or after the file has been written.  If
       we did not clear the Editable Text Constant, it's
       current contents would be saved along with the
       user's program needlessly.
      )
      (icon
       (origin 261 568)
       (extent 78 25)
      )
      (detail
       (origin 220 538)
       (extent 201 64)
      )
      (active icon)
     )
    )
    (component 13 "FromFile"
     (interface
      (sequence in)
      (sequence out)
      (input 1
       (type control)
       (name "File Name")
       (tag "File Name")
       (requires
        (datatype Text)
        (shape "Scalar")
       )
       (lock name constraints)
       (optional yes)
      )
      (output 1
       (type data)
       (name "X")
       (lock constraints)
       (optional yes)
      )
      (output 2
       (type data)
       (name "EOF")
       (tag "EOF")
       (lock name constraints)
       (optional yes)
      )
     )
     (implementation
      (attr iopath file read "/dev/null"
       (readTerm "\n")
       (fs " ")
       (eol "\n")
       (multiField fullSyntax)
       (arrayFormat block)
      )
      (procedure
        READ TEXT x TOKEN EXCLUDE:"\n" COUNT:1
        READ TEXT null CHAR:1 COUNT:1
      )
     )
     (views
      (description 25 7
       The From File device is specially configured to
       read complete lines of text from the specified
       file, including blank lines consisting of just
       a newline.
       
       The method used is to read each line as one large
       TOKEN composed of all characters except the "\n"
       marking the end of a line.   Reading the file as
       an TEXT STRING instead of a TOKEN would cause all
       empty lines to be skipped, since STRING format
       collapses multiple white space into one separator.
       
       After reading the text (possibly nil) up to the
       newline ("\n"), we must read and discard the \n
       itself.  The CHAR read into "null" consumes the
       newline and puts it in the special variable "null"
       that discards all input.
       
       The EOF pin is added to allow detection of End of
       File which occurs on the read following the last
       successful TEXT read, if any.  The EOF pin is 
       used to cause the Collector to output the array
       of text strings it has been building as each line
       is read from the file.
       
      )
      (icon
       (origin 525 138)
       (extent 110 25)
      )
      (detail
       (origin 284 297)
       (extent 393 86)
      )
      (terminals on)
      (active detail)
     )
    )
    (component 14 "FromFile"
     (name "Rewind File")
     (interface
      (sequence in)
      (sequence out)
      (input 1
       (type control)
       (name "File Name")
       (requires
        (datatype Text)
        (shape "Scalar")
       )
       (lock name constraints)
       (optional yes)
      )
     )
     (implementation
      (attr iopath file read "/dev/null"
       (readTerm "\n")
       (fs " ")
       (eol "\n")
       (multiField fullSyntax)
       (arrayFormat block)
      )
      (procedure
        EXECUTE REWIND
      )
     )
     (views
      (description 7 7
       Each time the editor is invoked, we need to rewind
       the file.  Since all instances of a From File with
       the same file share a single file pointer, and
       since that pointer is only cleared when the file
       is closed at post-run, attempts to re-edit a file
       would fail if the pointer were not reset to the
       start of the file.
      )
      (icon
       (origin 285 178)
       (extent 110 25)
      )
      (detail
       (origin 136 158)
       (extent 239 65)
      )
      (terminals on)
      (active detail)
     )
    )
    (component 15 "Formula"
     (name "Loading:")
     (interface
      (sequence in)
      (sequence out)
      (input 1
       (type data)
       (name "A")
       (optional yes)
      )
      (output 1
       (type data)
       (name "Result")
       (lock name constraints)
      )
     )
     (implementation
      (component isLocked no)
      (component expr 1 "\"Loading: \"+A")
     )
     (views
      (description 3 7
       This device constructs the "loading: <filename>"
       string displayed while reading the file into the
       edit buffer.
      )
      (icon
       (origin 35 248)
       (extent 110 25)
      )
      (detail
       (origin 120 220)
       (extent 151 60)
      )
      (terminals on)
      (active icon)
     )
    )
    (component 16 "Collector"
     (interface
      (sequence in)
      (sequence out)
      (input 1
       (type data)
       (name "Data")
       (tag "Data")
      )
      (input 2
       (type trigger)
       (name "XEQ")
       (lock name constraints)
      )
      (output 1
       (type data)
       (name "Array")
       (tag "Array")
       (lock constraints)
      )
     )
     (implementation
      (component clearAtPrerun 1)
      (component clearAtActivate 1)
     )
     (views
      (description 7 7
       Each line of text is taken from the From File as
       a text string and added as the next element of a
       1-D array of text strings.  After the final line
       line has been read, the EOF pin operates to have
       the Collector send the entire collected array of
       text strings to the Editable Text Constant.
       
      )
      (icon
       (origin 745 318)
       (extent 110 25)
      )
      (detail
      )
      (terminals on)
      (active icon)
     )
    )
    (component 17 "Break"
     (interface
      (sequence in)
     )
     (implementation
     )
     (views
      (description 7 7
       This device terminates the endless Until Bread
       used to read each line from the file.  After the
       Collector has passed the collected array of text
       to the next device, it's Sequence Out pin will
       let the Break device operate to terminate the 
       loop.  Control will proceed with the device 
       connected tot he Until Break's Sequence Out pin.
      )
      (icon
       (origin 761 368)
       (extent 78 25)
      )
      (detail
      )
      (terminals on)
      (active icon)
     )
    )
    (component 18 "Note"
     (name "HINTS:")
     (interface
     )
     (implementation
      (component text 3 7
       See the Show Description on most
       of the devices for more detailed
       descriptions.
      )
     )
     (views
      (icon
       (extent 78 0)
       (iconImage notepad.icon)
      )
      (detail
       (origin 496 159)
       (extent 308 63)
       (editing enabled)
      )
      (active detail)
     )
    )
    (component 19 "LiteralConstant"
     (name "Editable Text Constant")
     (interface
      (sequence in)
      (sequence out)
      (input 1
       (type control)
       (name "Default Value")
       (requires
        (datatype Text)
        (shape "Array 1D")
       )
       (lock name constraints)
       (optional yes)
      )
      (output 1
       (type data)
       (name "Text")
       (lock name constraints)
      )
     )
     (implementation
      (component value Text
       (name "Editable Text Constant")
       (numDims 1)
       (size 1)
       (data
        [ "" ]
       )
      )
      (component autoTrigger off)
      (component initializeAtPrerun off)
      (component initializeAtActivate off)
      (component initValue Text
       (datum "")
      )
     )
     (views
      (description 24 7
       This device, used somewhat differently, is the
       basis for the editing function.  A resized view
       of this device has been added to the File Editor
       Panel that pops up when the User Object executes.
       
       How does the editing work? In general, each of the
       Data Constant devices can be configured as scalar
       or 1D arrays.  When configed as an array, the
       size of the array changes as the user edits the
       data from the keyboard.  By configing a Text Constant
       as an array, we allow the user to modify each line
       of the array independently.
       
       To load an entire new set of values into a Data
       Constant, the Default Value control input is used.
       A "control" pin operates asynchronously, meaning
       that data arriving on the pin is "used" immediately
       by the device without waiting for other DATA or
       Sequence In pins to be activated.  This allows us
       to load the text array read from the file over any
       existing data in the Text Constant, where the user
       can modify it.
       
       
      )
      (icon
       (extent 208 0)
      )
      (detail
       (origin 532 448)
       (extent 276 64)
      )
      (terminals on)
      (active detail)
     )
    )
    (configuration
     (connect D15:0 D0:0)
     (connect D0:0 D1:0)
     (connect I1:1 D1:1)
     (connect D15:1 D2:1)
     (connect D1:1 D2:2)
     (connect D19:0 D3:0)
     (connect D19:1 D3:1)
     (connect I1:1 D3:2)
     (connect D2:1 D4:1)
     (connect D1:0 D5:0)
     (connect D16:1 D6:1)
     (connect D12:1 D6:2)
     (connect D10:0 D7:0)
     (connect D5:0 D8:0)
     (connect D1:0 D9:0)
     (connect D9:1 D10:0)
     (connect D10:1 D11:1)
     (connect D3:0 D11:2)
     (connect D11:1 D12:0)
     (connect D0:1 D13:0)
     (connect I1:1 D13:1)
     (connect I1:1 D14:1)
     (connect D14:0 D15:0)
     (connect I1:1 D15:1)
     (connect D13:1 D16:1)
     (connect D13:2 D16:2)
     (connect D16:0 D17:0)
     (connect D5:1 D19:0)
     (connect D6:1 D19:1)
    )
    (ShowOnExecPanel
     (origin 15 76)
     (extent 846 609)
     (panel
      (origin 19 115)
      (extent 842 571)
      (widget 4 detail
       (title off)
       (origin 39 642)
       (extent 370 36)
      )
      (widget 9 icon
       (title off)
       (origin 624 642)
       (extent 76 37)
      )
      (widget 5 icon
       (title off)
       (origin 538 642)
       (extent 67 37)
      )
      (widget 19 detail
       (title off)
       (origin 32 127)
       (extent 815 503)
      )
     )
    )
   )
   (views
    (description 36 5
     The FILE EDITOR device implements a simple text
     editor that operates on the supplied file name
     text string.  The named file is opened, if it
     exists, and read into the "edit buffer".  The user
     can modify the buffer as desired, then choose the
     Write or Cancel buttons.  Although limited, this
     device allows you to edit a file using Vee objects
     rather than using HP-UX escape to spawn an unix
     file editor.
     
     DESCRIPTION:
     The Detail view of the File Editor will let you
     examine the Show Description selections for most
     of the devices.
       
     CAVEATS:  
     Because the Text Constant device was not designed
     for use as a Text Edit window, several edit
     operations are somewhat different.  For example,
     the TAB key is used to move to the next "line",
     and cannot be inserted into the text file.  When
     positioned at the last line, a TAB will create ONE
     new line for input.  If several "blank" lines are
     needed at the end, temporarily create a dummy line
     with some text and use the Insert Line key to
     create the black lines about it, then delete or
     edit the dummy line.
         
     Because X-windows/ Motif style guides mandate that
     the "Return" key be used to terminate editing on a
     field, you must learn not to use the Return KEY;
     the TAB key performs the required line termination.
         
     You can move around the edit window with the key-
     board Arrows, Prev and Next keys, etc.  You can
     also use Emacs key mappings if you know them.
    )
    (icon
     (origin 405 408)
     (extent 110 25)
    )
    (detail
     (origin 9 114)
     (extent 882 593)
     (configuration
      (connect D15:0 D0:0
       (Point 90 275)
       (Point 90 285)
      )
      (connect D0:0 D1:0
       (Point 90 354)
       (Point 90 405)
      )
      (connect I1:1 D1:1
       (Point 11 420)
       (Point 11 420)
       (Point 21 420)
       (Point 32 420)
      )
      (connect D15:1 D2:1
       (Point 147 260)
       (Point 170 260)
       (Point 170 400)
       (Point 184 400)
      )
      (connect D1:1 D2:2
       (Point 147 420)
       (Point 184 420)
      )
      (connect D19:0 D3:0
       (Point 630 514)
       (Point 630 538)
      )
      (connect D19:1 D3:1
       (Point 860 480)
       (Point 880 480)
       (Point 880 520)
       (Point 380 520)
       (Point 380 590)
       (Point 399 590)
      )
      (connect I1:1 D3:2
       (Point 11 420)
       (Point 20 420)
       (Point 20 650)
       (Point 399 650)
      )
      (connect D2:1 D4:1
       (Point 235 410)
       (Point 252 410)
      )
      (connect D1:0 D5:0
       (Point 90 435)
       (Point 90 450)
       (Point 70 450)
       (Point 70 469)
      )
      (connect D16:1 D6:1
       (Point 857 330)
       (Point 870 330)
       (Point 870 400)
       (Point 370 400)
       (Point 370 440)
       (Point 310 440)
       (Point 310 470)
       (Point 324 470)
      )
      (connect D12:1 D6:2
       (Point 341 580)
       (Point 360 580)
       (Point 360 550)
       (Point 310 550)
       (Point 310 490)
       (Point 324 490)
      )
      (connect D10:0 D7:0
       (Point 170 555)
       (Point 170 570)
       (Point 250 570)
       (Point 250 615)
      )
      (connect D5:0 D8:0
       (Point 70 511)
       (Point 70 530)
       (Point 100 530)
       (Point 100 615)
      )
      (connect D1:0 D9:0
       (Point 90 435)
       (Point 90 450)
       (Point 170 450)
       (Point 170 469)
      )
      (connect D9:1 D10:0
       (Point 210 490)
       (Point 230 490)
       (Point 230 520)
       (Point 170 520)
       (Point 170 525)
      )
      (connect D10:1 D11:1
       (Point 195 540)
       (Point 214 540)
      )
      (connect D3:0 D11:2
       (Point 630 671)
       (Point 630 690)
       (Point 200 690)
       (Point 200 560)
       (Point 214 560)
      )
      (connect D11:1 D12:0
       (Point 265 550)
       (Point 300 550)
       (Point 300 565)
      )
      (connect D0:1 D13:0
       (Point 147 320)
       (Point 160 320)
       (Point 160 250)
       (Point 450 250)
       (Point 450 264)
      )
      (connect I1:1 D13:1
       (Point 11 420)
       (Point 20 420)
       (Point 20 370)
       (Point 160 370)
       (Point 160 340)
       (Point 181 340)
      )
      (connect I1:1 D14:1
       (Point 11 420)
       (Point 20 420)
       (Point 20 190)
       (Point 33 190)
      )
      (connect D14:0 D15:0
       (Point 220 225)
       (Point 220 240)
       (Point 90 240)
       (Point 90 245)
      )
      (connect I1:1 D15:1
       (Point 11 420)
       (Point 20 420)
       (Point 20 260)
       (Point 32 260)
      )
      (connect D13:1 D16:1
       (Point 719 320)
       (Point 742 320)
      )
      (connect D13:2 D16:2
       (Point 719 360)
       (Point 730 360)
       (Point 730 340)
       (Point 742 340)
      )
      (connect D16:0 D17:0
       (Point 800 345)
       (Point 800 365)
      )
      (connect D5:1 D19:0
       (Point 106 490)
       (Point 120 490)
       (Point 120 440)
       (Point 180 440)
       (Point 180 450)
       (Point 380 450)
       (Point 380 410)
       (Point 630 410)
       (Point 630 415)
      )
      (connect D6:1 D19:1
       (Point 375 480)
       (Point 399 480)
      )
     )
    )
    (active icon)
   )
  )
  (configuration
  )
 )
 (views
  (detail
   (origin 0 67)
   (extent 978 635)
   (configuration
   )
  )
  (active detail)
  (numberFormats
   (realFormat standard)
   (realSigDigits 4)
   (realRadixSpec 4)
   (integerBase decimal)
  )
  (waveformSettings
   (timeSpan 0.02)
   (numPoints 256)
  )
 )
)
