!******************************************************************************!
! Run sigstatdemo - not "official", just trying to see example
!
! @author  Jeanette McCall
! @issue   NXM-3128  Add complex input support to SIGSTATISTICS
! @since   NeXtMidas 3.9.3
!******************************************************************************!
startmacro

  call setDatDir

  !demux fm_capture_t1000.prm fm_capture_t1000_real.tmp{AUX=RAM} fm_capture_t1000_imag.tmp{AUX=RAM}
  !mergefile fm_capture_t1000_real.tmp{AUX=RAM} fm_capture_t1000_real_mult.tmp /REPLAY=100
  ! complex input support added for NXM-3128
  mergefile ^{datDir}.fm_capture_t1000.prm fm_capture_t1000_mult.tmp /REPLAY=100 !Can 
!  fft fm_capture_t1000_real.tmp{AUX=RAM} ram:fft_fm 512
!  plot/bg ram:fft_fm

  pipe on
    sigstatdemo fm_capture_t1000_mult.tmp 512 0 1.2e6
  pipe off

  !erase fm_capture_t1000_real_mult.tmp
  erase fm_capture_t1000_mult.tmp
endmacro

!******************************************************************************!
! If an unexpected exception is caught, mark test as failed, unless it is expected
!******************************************************************************!
procedure processException m:emsg
  if expectedException REXISTS then
    assert/text="^reg.main.name: Expected ERROR starts with: ^{expectedException}" expectedException EQSS emsg.data.message
    remove expectedException
  else
    assert/text="^reg.main.name: Caught unexpected exception ^{emsg.data}" "FALSE" isTrue
    if "Trace" SUBS ENV.DEBUG then invoke ,, emsg.data.printStackTrace()
  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

