Hi,
As Fernando said the source code is not available. But you can write your own solution.
After, I'm not sure of the usefulness of such a procedure. Because a keyword is an option and should not be conflicting, you don't really have to test to see how many of those are set.
Anyway, I have done some work for you, here is my version of n_params() but for keyword.
;+
; Get the number of keyword set in a procedure.
;
; :Returns: integer
;
; :Examples:
; PRO procedure_name, param0, KEYWORD1=KEYWORD1, KEYWORD2=KEYWORD2, KEYWORD3=KEYWORD3
; PRINT, 'PARAM NUMBER: ', n_params()
; PRINT, 'KEYWORD NUMBER: ', vs_n_keywords()
; END
;
; IDL> procedure_name, fltarr(100), /KEYWORD1
; IDL Console :
; PARAM NUMBER: 1
; KEYWORD NUMBER: 1
;
; :Restrictions:
; Keywords have to be written properly:
; KEYWORD1=KEYWORD1
; not like:
; KEYWORD1=KEYWORD
;
; :Author:
; Vincent SARAGO
; Montreal, QC
; +1 514 779 3031
; vincent.sarago@gmail.com
;
http://vincentsarago.wordpress.com
;
; :History:
; 1.0 - 25 Oct. 2012 (V.S) - Initial Work
;
; :Version: 1.0
;
;-
Function VS_N_KEYWORDS
compile_opt idl2, hidden
catch, theerror
if (theerror ne 0) then begin
catch, /cancel
ok = dialog_message(!error_state.msg, /error)
return, -1
endif
ii = 0L
;find routines names and informations
res = n_elements(scope_traceback()) ; number of routine calls that have brought idl execution to the current point
if res le 2 then return, 0 ;if called in $MAIN$
routine_traceback = (scope_traceback(/structure))[res-2] ;routine we want to analyse is in res-2 position
routine_name = routine_traceback.routine
is_function = routine_traceback.is_function ;tag if function
;extract keywords names from routine info
keywords = (routine_info(routine_name, function = is_function, /PARAMETERS)).kw_args
for num = 0L, n_elements(keywords) - 1L do begin
if keyword_set((scope_varfetch(keywords[num], level = -1))) then ii++
endfor
return, ii
End ;{VS_N_KEYWORDS}
There are some limitation but this should work.
Cheers,
Vincent
Vincent Sarago, M.Sc.
Montréal, QC
Tel. +1 (514)-779-3031
Email. vincent.sarago@gmail.com
Linkedin. vincentsarago
Twit. _VincentS_
Web.
http://vincentsarago.wordpress.com