next up previous 61
Next: Completion of a timed interval
Up: ADAM Guide to Writing Instrumentation Tasks
Previous: Carrying out a simple command


A task with two actions

Let us make the task SUMS able to accept two different commands. SUMS.IFL contains

interface SUMS
   parameter VALUE
      type '_REAL'
   endparameter
   action SQUARE
      obey needs VALUE
      endobey
   endaction
   action ADD
      obey needs VALUE
      endobey
   endaction
endinterface

and SUMS.FOR contains

      SUBROUTINE SUMS ( STATUS )
      IMPLICIT NONE
      INCLUDE 'SAE_PAR'
      INCLUDE 'ACT_ERR'
      INTEGER STATUS
      REAL VALUE
      CHARACTER*(PAR__SZNAM) NAME

      IF ( STATUS .NE. SAI__OK ) RETURN
      CALL TASK_GET_NAME ( NAME, STATUS )
      IF ( NAME .EQ. 'SQUARE' ) THEN
         CALL PAR_GET0R ( 'VALUE', VALUE, STATUS )
         CALL MSG_SETR ( 'ANS', VALUE**2 )
         CALL MSG_OUT ( ' ', 'answer is = ^ANS', STATUS )
      ELSE IF ( NAME .EQ. 'ADD' ) THEN
         CALL PAR_GET0R ( 'VALUE', VALUE, STATUS )
         CALL MSG_SETR ( 'ANS', VALUE+VALUE )
         CALL MSG_OUT ( ' ', 'answer is = ^ANS', STATUS )
      ENDIF
      END

As above, you can issue the ICL command

ICL> send sums obey square

and you will be prompted for VALUE. Thereafter, that same value of VALUE will be used, even if you

ICL> send sums obey add

However, notice that the interface file has now been changed to specify that VALUE is NEEDed by the actions. This means that you can

ICL> send sums obey add 42

and the value 42 is put into the parameter by the fixed-part before your application is called.



next up previous 61
Next: Completion of a timed interval
Up: ADAM Guide to Writing Instrumentation Tasks
Previous: Carrying out a simple command

ADAM Guide to Writing Instrumentation Tasks
Starlink User Note 134
B D Kelly
A J Chipperfield

30 March 1992
E-mail:ussc@star.rl.ac.uk

Copyright © 2000 Council for the Central Laboratory of the Research Councils