;+
; Project     :	SOHO - CDS
;
; Name        :	DO_FLAG_MASTER
;
; Purpose     :	Writes flag master commands to series table.
;
; Explanation :	Outputs the commands needed in flag master mode. 
;
;               Perl script uses format required by CB5FILS i.e token list for getpar :
;
;               1) COMMAND 1 2 3 4                    # simple scc
;
;               2) SCRIPT                             # script
;                  0x1 
;                  0x2
;                  TERMINATE
;
;               NB All commands or scripts must be to macro and so begin CB5* ...
;               Perl script need format:
;              
; Use         : <do_flag_master, flag_master_info>
;
; Inputs      : flag_master_info = structure giving information on associated flag master
;                                  scheme. 
;
; Opt. Inputs : None.
;
; Outputs     : Writes commands to series table.
;
; Opt. Outputs:	None.
;
; Keywords    : None.
;
; Calls       :	shorthex, fileout, set_ief.
;                
; Common      :	None.
;
; Restrictions:	None.
;
; Side effects:	None.
;
; Category    :	Command preparation.
;
; Prev. Hist. :	Created from do_previous.
;
; Written     :	Version 0.0, Martin Carter, RAL, 12/12/95
;
; Modified    :	None.
;
; Version     :	Version 0.0, 12/12/95
;-
;**********************************************************

PRO do_flag_master, flag_master_info

     ; set up IEF table 

    ief_table = set_ief ( flag_master_info )

    ; write IEF table command to series table

    FOR k = 0, 4 DO BEGIN

      fileout, words=17, 'CB5FILSE'       + '        # write IEF table'
      fileout, shorthex ( k )             + '          # table index 
      fileout, '0x0000'                   + '          # start location'
      FOR kk = 0, 13 DO fileout, shorthex ( ief_table(k,kk) )
      fileout, 'TERMINATE'                 
      fileout, ''

    ENDFOR

    ; dump IEF table

    fileout, words=2, 'CB5DMPSE'          + '        # dump IEF table'
    fileout, ''
          
END

