1. 14 Sep, 2020 40 commits
    • Tony Farrell's avatar
      Ensure gitarg Get methods use defaults correctly · 65d20cef
      Tony Farrell authored
           gitarg was not correctly specifying default values
           for Get() calls in Int and Real classes.
      65d20cef
    • Tony Farrell's avatar
      Fix millisecond formating issue · cc3dbc5b
      Tony Farrell authored
           Logger was formating milliseconds incorrectly - was not filling
      	with zeros.  Resolved.
      cc3dbc5b
    • Tony Farrell's avatar
      Support action descriptions · 048726b0
      Tony Farrell authored
           Add GetActionName() method to TAction class.  The action name
           is captures when the orginal message is received avoiding the
           complexity required to grab it from DRAMA on each call.
      
           All Task methods which add actions now support an optional argument
      	 to add an action descrioption
      048726b0
    • Tony Farrell's avatar
      Resolve gcc 8.3 detected issues · 0c6061db
      Tony Farrell authored
           Deal with some decpreated C++ features picked up by gcc 8.3.0 and
      	don't throw from exception handlers in destructors (which would have
      	called terminate(), instead call terminate() directly as gcc was
      	warning about this and it is clear.
      
           In path.cpp, gcc picked up an implict fallthrough error in the handling
              of signals.  Resolved.  Line 1577.
      0c6061db
    • Tony Farrell's avatar
      Ensure the GIT SIMULATE_LEVEL action uses gitarg approach to getting arguments · 290c8ab6
      Tony Farrell authored
           gittask SIMULATE_LEVEL action was not using gitarg to fetch its arguments
      	 and hence would fail if the argument was not named Argument1.  Resolved.
      290c8ab6
    • Tony Farrell's avatar
      Reduce output from exceptions · e95373d4
      Tony Farrell authored
          drama::Exception no longer outputs the line
      		     "DRAMA Exception thrown and reported via ERS"
      
          drama::Exception now only outputs the line
      	"Task will report more details to stderr if DRAMA2_ERS_DUMP env variable is set"
      
            on the first message output.
      
          The above combination simplifies the exception reports.
      e95373d4
    • Tony Farrell's avatar
      Fix warnings from CLAng 11 · 1c29b563
      Tony Farrell authored
          Fix some compiler warnings picked up by CLang 11 on MacOsX 10.14.
      
          Drop DramaTHROW_F - has been deprecated for some time.
      1c29b563
    • Tony Farrell's avatar
      AddErs modified to ensure lines are output nicely · 79bda615
      Tony Farrell authored
          Drama::Exception::AddErs() needs to add the new line before
          adding the entry, not after it.  This ensures there is a break
          between the entry and the original exception line.
      79bda615
    • Tony Farrell's avatar
      Couple of comment changes · e4ce83e5
      Tony Farrell authored
          Just a couple of comments in thread.cpp.
      e4ce83e5
    • Tony Farrell's avatar
      Support C++17 · 89724793
      Tony Farrell authored
          Support building with C++17 if enabled.  Requires DramaConfig 5.20.
      89724793
    • Tony Farrell's avatar
      Update regression test expected output after SDS fix · fe79b54f
      Tony Farrell authored
              Update testsds.expected after fix to sds/arg.c UINT 64 bit code.
      fe79b54f
    • InstTestAcc's avatar
      Fix regression test · dd1d16d5
      InstTestAcc authored
      	Update regression test output after change to ditscmd changed the
              number of spaces it outputs.
      dd1d16d5
    • Tony Farrell's avatar
      Fix Exception.what problems. Resolve issues related to running in different... · 278258b6
      Tony Farrell authored
      Fix Exception.what problems. Resolve issues related to running in different threads. TUface context object allows specification of logger thread function
      
      	TUface constructor now takes a name for the thread function,
      	defaulting to the old name that was used, which removes
      	the need for a complex sequence to set this.
      
      	We can now disable the warning which appears when RunDrama() is
      	executed in a different thread from the thread in which the
      	task was constructed.  The logger now handles this properly.
      	Replaced GetTaskThreadId() by GetTaskCreThreadId() and
              GetTaskRunThreadId() as part of this.
      
      	Ensure the what() method of the exception class works. It was producing
      	rubbish in some cases, due I think to a temp going out of scope. Added
      	a string _whatString() to the class which is updated each time the
      	results of toString() might change. what() can return the c_str() of
      	that value safely.
      278258b6
    • Tony Farrell's avatar
      Fix problem triggering Veloce to reset real AAT TCS · 81019941
      Tony Farrell authored
      	gitpath.cpp Initialised was errantly setting flag to say things
              had failed, causing initialisation to occur when recovery was
      	needed.
      81019941
    • Tony Farrell's avatar
      SLog now takes std::string rather then char pointers · 985afa12
      Tony Farrell authored
      	Logger::SLog() now takes const std::string& rather then const char *.
      985afa12
    • Tony Farrell's avatar
      Add a new monitor constructor · a3b33f12
      Tony Farrell authored
            Add new Monitor constructor which takes a vector
            of strings. (As you can initialize a vector
           from an initialize list, but if you already
           have a vector, you can't initialize it with
           a vector.)
      a3b33f12
    • Tony Farrell's avatar
      Add AddMth and AddMthThd methods to the drama::Task class · 3db529ff
      Tony Farrell authored
      	Add new methods to drama::Task, AddMth() and AddMthThd(), used
      	to add action implementations via methods of the sub-class.
      3db529ff
    • Tony Farrell's avatar
      Add some extra tests around debugging what turned out to be a problem in git · f9ba642d
      Tony Farrell authored
      	As part of debugging a problem which turned out to be in
              DramaGit, added extra tests to examples/gitargtest.cpp,
              StringArgTest().
      f9ba642d
    • Tony Farrell's avatar
      Fix issues in monitoring of 64 bit items · 58789402
      Tony Farrell authored
      	MonitorByType code was not handling 64 array data correctly, which
      	it should be able to do.  Fixed.  Also was allowing handling
      	of 64 bit unsigned as a long int on 32 bit machines, which is
      	wrong.
      58789402
    • Tony Farrell's avatar
      parsys get methods should be const · 2a5fe303
      Tony Farrell authored
      	parSys parameter Get() operations should be const.
      2a5fe303
    • Tony Farrell's avatar
      Add RemoteNetStart method to git::Path to allow Taipan contorl task to start remote drama network · 06de022e
      Tony Farrell authored
      	git::Path now has a RemoteNetStart() method, which can be used
      	to start DRAMA networking on a remote node using, for example,
      	DramaUnixStart.
      06de022e
    • Tony Farrell's avatar
      Add DRAMA2_LOCK_DEBUG2 macro to allow debuging of deadlocks · cfb67344
      Tony Farrell authored
      	By defining the macro  DRAMA2_LOCK_DEBUG2 in task.hh, it is
      	now possible to build a version that writes a lock log file name
      	DramaLock-<pid>.log.  This is intended to help debug deadlock
      	situations (but performance changes may mean problems go away!!)
      cfb67344
    • Tony Farrell's avatar
      Add support for formated arguments to MessageUser and ErsReport · 21739a6e
      Tony Farrell authored
      	MessageUser() now implements a template which takes a
      		      variable length format list to the same style
      		      as SafePrintf().  I needed to implement this
      		      independently for each version
      
      	Similiary for ErsReport().
      
      	Path.StateString() methods are now public.
      21739a6e
    • Tony Farrell's avatar
      Fix lock order issue in KickNotifier · 62fe6e07
      Tony Farrell authored
      	Resolve a possible sequence error in KickNotifier, the
              lock was not supplied to the condition variable until
              after the thread had started, which might cause an issue
              if the thread runs immediately after the async() is invoked.
      62fe6e07
    • Tony Farrell's avatar
      Rework new ERS functions · 1790b660
      Tony Farrell authored
             New Ers functions - Annul and Flush, not implemented correctly and
             the calling sequence needs to include status.  Reworked.
      1790b660
    • Tony Farrell's avatar
      Check locks around calls that use ERS · b2dd1c36
      Tony Farrell authored
      	WARNING: This update could cause some code to fail - code
                 using drama::gitarg classes, invoking ErsReport() or
                 using methods of drama::Exception which use ERS.  Such
                 code is faulty!  The change to check the user code
                 is right.  See the release method documentation or
      
      i            https://confluence.aao.gov.au/pages/viewpage.action?pageId=21823544
      
              for the required fix.
      
      	gitarg classes need to Add ERS information to exceptions any
      	time they might be creating an exception where ERS information
      	is available.
      
      	Add CheckLockTaken() static method to drama::Task, which allows
      	the gitarg methods to ensure the DRAMA lock is taken when they
      	are invoked.
      
      	Add the CheckLockTaken global method which invokes the drama::Task
      	    equivalent (since somes the relevant include file is not
      	    yet available - .e.g. exception.hh.
      
      	Invoke the CheckLockTaken() methods in exception.hh around use of
      	     ERS.
      
      	Add new  methods to drama.hh, ErsFlushStack() and ErsAnullStack()
      	    so that we don't have to create a status variable to
      	    manage ERS.
      b2dd1c36
    • Tony Farrell's avatar
      Add IsRunningType class, Add Exists to ParSys class, Improve KickNotifier... · fe9fafa7
      Tony Farrell authored
      Add IsRunningType class, Add Exists to ParSys class, Improve KickNotifier signal handling. git::Path should not send EXIT to dead tasks
      
      	Add IsRunningType class (message event handler which can be used
      	to work out if an action is running.)
      
      	Improve documentations in a couple of places.
      
      	Add Exists() method to ParSys class.
      
      	git::Path should not send EXIT to dead tasks.
      
              Was not correctly blocking signals in the KickNotifier code, now
      		does this correctly.
      
      		Note - thread creation code must always do this stuff
                      correctly, KickNotifier appeared to be ok because none
                      of my test code enabled signal handlers in any form before
                      invoking it, but that doesn't mean code won't do this.
      fe9fafa7
    • Tony Farrell's avatar
      A few bug fixes as well as adding extra sds::Id::CreateArgCmdStruct method and... · 29158150
      Tony Farrell authored
      A few bug fixes as well as adding extra sds::Id::CreateArgCmdStruct method and ParSys constructor overload
      
      	task.cpp/task.hh -> Was not actually setting self buffer size in call
      	to DitsAppInit since was not setting flag. Set it
              and also validate selfBuf and buffer values against
              defaults (which are now the minimums).
      
      	Add an overload of sds::Id::CreateArgCmdStruct() which takes an
      	    initializer_list argument.
      
      	LockWithInfo->CheckTaken...() series of checks now take as arguments
      	  the source code info (func, file, line) and construct the exception
      	  with those rather then with the misleading info at the point
      	  where the exception is thrown.  Lots of source changes to
      	  pass this through.
      
              Add ParId() constructor which takes a ParSys() rather then a Task.
      29158150
    • Tony Farrell's avatar
      Add gitarg::Filename and gitarg::ArgFlags, fix some gitarg errors · 3d8408a0
      Tony Farrell authored
      	Add git::Path::GetSimulation() method.
      
      	gitarg::Flags::Lower was defined incorrectly to GIT_M_ARG_UPPER.
      
      	gitarg::String was not correctly converting the case.  Fixed.
      
      	Added obeyself test program to test a task sending obeys to itself
      	 (seems to work perfectly).  Added test6 to test this.
      
      	Add gitarg::Filename and gitarg::ArgFlags
      3d8408a0
    • Tony Farrell's avatar
      Do not output log log messages to stderr when log file not open · 39a524d9
      Tony Farrell authored
      	No longer output DRAMA internal log message to stdout when there
      	is no longer file.  Since DITS 3.106 this has been generating a lot
              of unwanted messages.
      39a524d9
    • InstTestAcc's avatar
      Fix bug in previous change · 7ab086b1
      InstTestAcc authored
      	Previous change dmakefile wasn't quite right - fixed.
      7ab086b1
    • Tony Farrell's avatar
      Work around problem with test5 on macs · e332d077
      Tony Farrell authored
      	RunProgram/RunProgramWaitUntil won't work with DITS_M_MAY_LOAD flag
      	(when IMP master is not running) on a MAC.  This appears to be signal
              management related, when IMP sets the signal handler mask whilst
              loading, it in effect overrides the mask of the main program with the
              mask of the thread - blocking all signals.  The proper fix is to have
              IMP use pthread_sigmask when thread support is available rather
              then sigprocmask().  But I need to think about that.
      		Resolved for the moment by removing having the test
      		sequence start master (change in dmakefile only).
      e332d077
    • Tony Farrell's avatar
      Add ArrayParameter classes. Add sds methods to create single dimensional arrays · 6d3916f6
      Tony Farrell authored
              Add ArrayParameter class, equivalent of Parrameter for scalar
      	    parameters.  Tests added to parsystest.cpp.  Required
      	    addition of parameter.cpp module to remove excess code
      	    from parameter.hh, including code for Parameter<drama::sds::Id>.
      
      	Add new sds method overloads, CreateChildArray() and CreateTopLevelArray()
      	    which create single dimensional arrays only.
      6d3916f6
    • Tony Farrell's avatar
      Ensure logger::RegisterThread is thread safe. Fix some stream buffer reporting issues · 5ad2c5ef
      Tony Farrell authored
      	Logger::RegisterThread() must take DRAMA lock. This seems to have
      		elminated unknown thread issues in TICT.
      
      	ErsReport() and Task::_MessageUser() must not report empty lines.
      
      	LogStreamBuf::flushBuffer() must not long empty lines and should
      				    convert any tailing new-line to a space
      				    to avoid extra lines in the log files.
      5ad2c5ef
    • Tony Farrell's avatar
      Add RunProgram and RunProgramUntilWait functions to thread namespace · b5ee17c1
      Tony Farrell authored
      	Add RunProgram and RunProgramWaitUntil functions to drama::thread namespace.
      		Prototypes in thread.hh.  Implementations in thread.cpp.
      
      	Rename testloadnondrama.cpp to testrunprogram.cpp and re-implement using
      		RunProgram.
      
      	Ensure that when run with DITS 3.105 or later, you get a quality report when
      	loading a file with a file name that is too long for IMP.
      b5ee17c1
    • Tony Farrell's avatar
      Add CreateSds method to ParSys · abf2bd7a
      Tony Farrell authored
      	Add CreateSds() method to ParSys, which allows us to build
      	a complex parameter in place and keep the ID about.
      
      	Add examples/testloadnondrama.cpp - start of developing a way
      	of loading non-drama tasks.
      abf2bd7a
    • Tony Farrell's avatar
      Updated to add Task::SetDetails method and assoicated get methods · 9a7d573b
      Tony Farrell authored
      	   Add SetDetails(), GetTaskDescription() and GetTaskType() methods
      	   to Task class.
      9a7d573b
    • Tony Farrell's avatar
      Fix crash in exception handler. Exception::Print no longer outputs stack trace by default · c8105fdf
      Tony Farrell authored
      	Fix string overrun issue in drama/exception.hh AddStackTraceLine(), due
                to missuse of strncat().
      
      	Exception::Print() method now only outputs the stack-trace if either
                an extra argument is set true (defaults to fault) or if the
                environment variable DRAMA2_EXCEPT_PRINT_DUMP is set.
      c8105fdf
    • Tony Farrell's avatar
      Revamp stream output code to deal with crashes on later MacOsX · 9e612f23
      Tony Farrell authored
      	LogStream changes didn't work under Mac OSX ElCapitan and
      		  Serria.  This appears to be due to a problem with
      		  the move assignment/copy operators in either LogStream
      		  or LogStreamBuf.  I couldn't work this out, through
      		  I am fairly sure that as implemented is probably wrong.
      		  Was forced to disable the LogStream class and the
      		  CreateLogStream method of Logger to ensure it is all
      		  reliable and portable. The correct approach is now
      		  to create the LogStreamBuf explictly and use the
      		  address of that to create an iostream() item. It all then
      		  works as expected.
      
      	The above problem also occurs with MessageUserStream.  Same resolution
      	    required.
      
       	Warnings are being output by LogS() under CLang compiler.  Use flags
      	  to disable as nothing is wrong.
      9e612f23
    • Tony Farrell's avatar
      Fix issues with regression testing of previous change · 4cee3f77
      Tony Farrell authored
      	msgoutstream.cpp test run is not reliable on Macs, modify
              test and expected output to make it more reliable.
      4cee3f77