;+
; NAME:
;	MAKE_SMEI_OPF
;
;
; PURPOSE:
;	Functional interface for MAKE_SMEI_OP
;
;
; CATEGORY:
;	ops
;
;
; CALLING SEQUENCE:
;	ref = make_smei_opf(operator, arg0[,...argn])
;
;
; INPUTS:
;	operator	string	The operator or function to apply
;	arg0		obj/str	Either: a SMEI_ARGUMENT object
;				reference, or a string defining an
;				argument , or a numeric (possibly
;				array) value.
;
;
;
; OPTIONAL INPUTS:
;	arg1 .. arg9	obj/str	Up to 9 further arguments to the
;				operator in the same form as arg0
;
;
; KEYWORD PARAMETERS:
;	/return_operator	If set, then return the SMEI_OPERATOR
;				object reference, by default the
;				generated sequence is returned.
;	get_level	int	The calling level from which to get
;				the object being argumentified
;				(usually only used by the
;				interpreter).
;
;	For "function" operators, any keys to the function can be passed.
;
;
;
; OUTPUTS:
;	ref	objref	The sequence or operator reference generated.
;
;
;
; NOTES:
;	When the argument is expressed as a string, then the object
;	referred must exist at the top $MAIN$ level in SSWIDL. The
;	format is "name{plane}[start:stop:step]", if no plane is given
;	then the "processed" plane is assumed, if no range specifier
;	is given for a sequence then the whole sequence is assumed.
;
; RESTRICTIONS:
;	A Maximum of 10 arguments to the operator may be specified
;
; MODIFICATION HISTORY:
;	Original: 28/10/03; SJT
;	Add get_level keyword: 30/10/03; SJT
;-

function make_smei_opf, operator, arg0, arg1, arg2, arg3, arg4, $
                        arg5, arg6, arg7, arg8, arg9, return_operator $
                        = return_operator, get_level = get_level, $
                        _extra = _extra

case n_params() of
    2: make_smei_op, return_operator = return_operator, _extra = $
      _extra, ref, operator, arg0, get_level = get_level
    3: make_smei_op, return_operator = return_operator, _extra = $
      _extra, ref, operator, arg0, arg1, get_level = get_level
    4: make_smei_op, return_operator = return_operator, _extra = $
      _extra, ref, operator, arg0, arg1, arg2, get_level = get_level
    5: make_smei_op, return_operator = return_operator, _extra = $
      _extra, ref, operator, arg0, arg1, arg2, arg3, get_level = $
      get_level 
    6: make_smei_op, return_operator = return_operator, _extra = $
      _extra, ref, operator, arg0, arg1, arg2, arg3, arg4, get_level = $
      get_level 
    7: make_smei_op, return_operator = return_operator, _extra = $
      _extra, ref, operator, arg0, arg1, arg2, arg3, arg4, arg5, $
      get_level = get_level 
    8: make_smei_op, return_operator = return_operator, _extra = $
      _extra, ref, operator, arg0, arg1, arg2, arg3, arg4, arg5, arg6, $
      get_level = get_level 
    9: make_smei_op, return_operator = return_operator, _extra = $ 
      _extra, ref, operator, arg0, arg1, arg2, arg3, arg4, arg5, arg6, $
      arg7, get_level = get_level
    10: make_smei_op, return_operator = return_operator, _extra = $ 
      _extra, ref, operator, arg0, arg1, arg2, arg3, arg4, arg5, arg6, $
      arg7, arg8, get_level = get_level
    11: make_smei_op, return_operator = return_operator, _extra = $ 
      _extra, ref, operator, arg0, arg1, arg2, arg3, arg4, arg5, arg6, $
      arg7, arg8, arg9, get_level = get_level
    else: begin
        smei_msg, /alert, 'SMEI_MAKE_OPF must have between 2 and 11 ' + $
                  'arguments'
        return, 0
    end
endcase

return, ref

end
