startmacro
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE
  switch BASELINE    baseline GET DEF=FALSE SDEF=TRUE

  call setDatDir
  res testfile ^{datDir}.sinewave.prm

  if interAct then
    pipe on
      panel/msgid=MAIN/setup/controls=gc

      noop/wrap/rt testfile _mypipe
      plot/id=plot01 _mypipe
      plot/id=plot02 _mypipe
      plot/id=plot03 _mypipe
      plot/id=plot04 _mypipe
      plot/id=plot05 _mypipe
      plot/id=plot06 _mypipe
      plot/id=plot07 _mypipe
      plot/id=plot08 _mypipe
      plot/id=plot09 _mypipe
      plot/id=plot10 _mypipe
      plot/id=plot11 _mypipe
      plot/id=plot12 _mypipe


      gcontrol text idtext "Instructions" "initializing..." 24 7 /title
      gcontrol menu main "Exit with Status = " "PASS,FAIL" /tleft
      set gc.main.itemColors {PASS=GREEN,FAIL=RED}
    pipe off
  endif
endmacro

!******************************************************************************!
procedure processMessage m:msg
  !say "msg.name ^msg.name, data ^msg.data"

  if msg.name eqs "MAIN" then
    assert/text="Pipe tests" msg.data eqss "PASS" 
    pipe stop
  else
    ! do nothing
    say "^reg.main.name: Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
  endif
return

!******************************************************************************!
! Set the dat directory
!******************************************************************************!
procedure setDatDir
  invoke nxmMajor env.nmversion.subString(0,1)
  invoke major java.lang.Integer.valueOf(nxmMajor)
  if major GE 4 then
    invoke s:datDir           nxm.sys.test.DatLocator.getDatDirLocation()
    invoke s:datDirSlash      nxm.sys.test.DatLocator.getDatDirSlashLocation()
    invoke z:sysDatFull       nxm.sys.test.DatLocator.sysDatFull()
    invoke z:sysTestDatExists nxm.sys.test.DatLocator.sysTestDatExists()
  else
    set s:datDir           "nxm.sys.dat"
    set s:datDirSlash      "nxm/sys/dat"
    set z:sysDatFull       true
    set z:sysTestDatExists false
  endif
return
