;+ ; NAME: ; www_help_tree ; PURPOSE: ; Creates html help files for IDL software in a directory tree ; (defaults are set up to process the SSW tree on ips.ucsd.edu) ; CATEGORY: ; www_help ; CALLING SEQUENCE: PRO www_help_tree, destination, tree, master, files, $ cgi_bin=cgi_bin, email=email, iselect=iselect, list=list, $ use_path=use_path, copyright=copyright, prefix=prefix, $ _extra=_extra ; INPUTS: ; destination scalar; type: string ; destination directory of all html files ; tree scalar; type: string; default: getenv('SSW') ; top directory ; master scalar; type: string; default: 'SSW' ; name of the master catalogue ; OPTIONAL INPUT PARAMETERS: ; cgi_bin=cgi_bin scalar; type: string; default: http://cass185.ucsd.edu/cgi-bin/ ; directory where web server looks for cgi files. ; Typically has the form: ; server.domain.edu/cgi-bin/ ; This is the directory where the python script ; www_help.cgi should be installed. If this keyword is ; specified the file name in the html files will be ; hyperlinks to the cgi script. If not specified these ; links are not created. ; ; email=email array; type: string; default: pphick@ucsd.edu ; list of email addresses. If any of these addresses is found it ; is converted to an html link ; OUTPUTS: ; (html files) ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; FindAllSubDirs, strposn, os_separator, www_help_style, www_help_section ; www_help_files, www_help_make, www_help_master, InitVar, IsType ; TimeSystem, TimeGet, TimeUnit, TimeOp ; PROCEDURE: ; Directory tree is recursively searched for source code files *.pro. ; Separate catalogues are created for all subdirectories in tree ; with one master catalogue. ; MODIFICATION HISTORY: ; JAN-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- tstart = TimeSystem(/silent) InitVar, master, 'SSW' InitVar, tree , getenv('SSW') tree = filepath(root=tree,'') ; Collect all subdirectories in SSW sub = FindAllSubDirs(tree, count=nsub) IF nsub EQ 0 THEN BEGIN message, /info, 'no subdirectories found in: '+tree RETURN ENDIF FOR i=0,nsub-1 DO print, i, ' ',sub[i] IF keyword_set(list) THEN RETURN IF IsType(destination, /undefined) THEN BEGIN message, /info, 'Usage: www_help_tree, destination [, tree, master]' message, /info, 'no destination directory specified' RETURN ENDIF tmp = strmid(sub, strlen(tree)) tmp = strposn(tmp, os_separator(/dir), short, /frontdefault) InitVar, cgi_bin, 'http://cass185.ucsd.edu/cgi-bin/' InitVar, email , 'pphick@ucsd.edu' InitVar, files , '*.pro' InitVar, prefix , '' html_top = [master, tree] CASE IsType(files, /defined) OF 0: sswcode = 1 1: BEGIN CASE files[0] OF '*.pro': sswcode = 1 '*.f' : fortran = 1 '*.c' : c_code = 1 '*.cpp': cppcode = 1 ENDCASE END ENDCASE ; First collect all the headers for all subdirectories in the whole tree. ; The full html links in header.flink will be based on html_name=short[isub] style = www_help_style(sswcode=sswcode, fortran=fortran, c_code=c_code, cppcode=cppcode) section = www_help_section(style, list=list) FOR isub=0,nsub-1 DO BEGIN style = www_help_style(sswcode=sswcode, fortran=fortran, c_code=c_code, $ cppcode=cppcode, html_name=prefix+short[isub],_extra=_extra) nhead = www_help_files(style, section, files, header, paths=sub[isub], /recursive, nosort=isub NE nsub-1) ENDFOR IF nhead GT 0 THEN BEGIN ; For www_help_get_calls style.automatic, style.html_top, style.commentchar ; and style.anycase matter. html_top needs to be set to the top of the directory ; tree to set the IDL search path across the whole tree when resolving references. style = www_help_style(sswcode=sswcode, fortran=fortran, c_code=c_code, $ cppcode=cppcode, use_path=use_path) section = www_help_section(style, list=list) FOR isub=0,nsub-1 DO BEGIN style = www_help_style(sswcode=sswcode, fortran=fortran, $ c_code=c_code, cppcode=cppcode, $ html_name = prefix+short[isub], $ html_top = html_top, $ master = master, $ /automatic) mask = where(strpos(header.origin[0],sub[isub]) eq 0,nhdr) message, /info, short[isub]+','+strcompress(nhdr)+'/'+strcompress(nhead,/rem)+' headers' IF nhdr GT 0 THEN $ www_help_make, destination, header, section, style, $ cgi_bin = cgi_bin, $ email = email, $ mask=mask, calls=calls, includes=includes, externals=externals, copyright=copyright ENDFOR ; Clean up ptr_free, header.lines IF ptr_valid(calls ) THEN www_help_ptr, calls , /free IF ptr_valid(includes ) THEN www_help_ptr, includes , /free IF ptr_valid(externals) THEN www_help_ptr, externals, /free www_help_master, destination, style, copyright=copyright ENDIF print FOR i=0,nsub-1 DO print, i, ' ',sub[i] print tend = TimeSystem(/silent) print, 'Start: ', TimeGet(tstart, /ymd, /scalar),' ', $ 'Stop: ' , TimeGet(tend , /ymd, /scalar)+' (' , $ TimeOp(/subtract,tend, tstart, TimeUnit(/hours)),')' RETURN & END