Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
In article <1991Oct24.160355.25612@casbah.acns.nwu.edu>, jimmylee@casbah.acns.nwu.edu (Jim Pendleton) writes... > This is a new group for us, so pardon me if there have been previous > requests and/or replies. We're looking for a program (C, FORTRAN, IDL) > which will read straight ASCII text files (better yet, ".HLP" files) > and convert them to IDL-format .HELP files on VMS. First of all, you're in the wrong group--through no fault of your own. COMP.LANG.IDL is not the IDL we all know and love; it's something else. The group you really want is COMP.LANG.IDL-PVWAVE. It's a good idea to keep track of both groups, though. The following program should do what I think you want. It should work in both VMS and UNIX. Bill Thompson PRO MAKE_HELP,PATHDIR,HELPNAME,INFONAME ;+ ; NAME: ; MAKE_HELP ; PURPOSE: ; Extract documentation from programs in an IDL version 2 ; library format it in a form for a HELP library ; CALLING SEQUENCE: ; make_help ; INPUTS: ; None. ; OUTPUTS: ; None. ; SIDE EFFECTS: ; The file helpname.HELP is produced. ; MODIFICATION HISTORY: ; Written, K. Rhode, STX, May 1990 ; (The part of the program that extracts templates from the users' library ; text file is adapted from USERS_LIB.PRO.) ; W.T.T., Feb. 1991, modified to work with Unix, and to allow the ; inclusion of additional information as subject "*INFO*". ;- IF N_PARAMS() LT 2 THEN BEGIN PRINT,'*** MAKE_HELP must be called with 2-3 parameters:' PRINT,' PATHDIR, HELPNAME [, INFONAME ]' RETURN ENDIF ; F1 = '$(A,T16,I0)' LINE = ' ' FDECOMP,HELPNAME,DISK,DIR,HELP_NAME HELP_NAME = HELP_NAME + '.help' IF !VERSION.OS EQ 'vms' THEN HELP_NAME = STRUPCASE(HELP_NAME) ; F = FINDFILE(PATHDIR + '*.pro',COUNT = NFILES) IF NFILES EQ 0 THEN $ MESSAGE,'No ".pro" files found in specified directory.' CURRENT_POSN = LONARR(NFILES+100) PRONAME = STRARR(NFILES+100) ; PRINT,'This program will create a file, ' + HELP_NAME + $ ', which contains' PRINT,' documentation and a lookup table for the help facility. ' OPENW,UNIT2,'TEMPLATES.HELP',/STREAM,/GET_LUN ; GET_LUN,UNIT1 FGOOD = 0 ; ; If the name of a file containing additional information has been passed, ; then make "*INFO*" the first help file. ; IF N_PARAMS(0) EQ 3 THEN BEGIN CLOSE,UNIT1 OPENR,UNIT1,INFONAME STATUS = FSTAT(UNIT2) CURRENT_POSN(FGOOD) = STATUS.CUR_PTR PRINTF,UNIT2,';+' PRONAME(FGOOD) = '*INFO*' FGOOD = FGOOD+1 WHILE NOT EOF(UNIT1) DO BEGIN READF,UNIT1,LINE PRINTF,UNIT2,LINE ENDWHILE PRINTF,UNIT2,';-' ENDIF ; FOR I=0,N_ELEMENTS(F)-1 DO BEGIN FDECOMP,F(I),DISK,DIR,NAME,EXT,VER ; ; Read the documentation of each help procedure. ; CLOSE,UNIT1 OPENR,UNIT1,F(I) ; ; Find templates & procedure names in text file. ; WHILE NOT EOF(UNIT1) DO BEGIN READF,UNIT1,LINE IF STRMID(LINE,0,2) EQ ';+' THEN BEGIN STATUS = FSTAT(UNIT2) CURRENT_POSN(FGOOD) = STATUS.CUR_PTR PRINTF,UNIT2,';+' PRONAME(FGOOD) = STRUPCASE(NAME) FGOOD = FGOOD+1 READF,UNIT1,LINE WHILE STRMID(LINE,0,2) NE ';-' DO BEGIN NEWLINE = STRMID(LINE,1,STRLEN(LINE)) PRINTF,UNIT2,NEWLINE READF,UNIT1,LINE ENDWHILE PRINTF,UNIT2,';-' ENDIF ENDWHILE ENDFOR FREE_LUN,UNIT1,UNIT2 ; ; Print the number of templates to the help files. ; OPENW,UNIT3,HELP_NAME,/STREAM,/GET_LUN PRINTF,UNIT3,FGOOD ; FOR K=0,(FGOOD-1) DO $ PRINTF,UNIT3,F1,PRONAME(K),CURRENT_POSN(K) ; IF !VERSION.OS EQ 'vms' THEN BEGIN FREE_LUN,UNIT3 SPAWN,'APPEND TEMPLATES.HELP ' + HELP_NAME SPAWN,'DELETE/NOCONFIRM TEMPLATES.HELP;' END ELSE BEGIN OPENR,UNIT1,'TEMPLATES.HELP',/STREAM,/GET_LUN LINE = ' ' WHILE NOT EOF(UNIT1) DO BEGIN READF,UNIT1,LINE PRINTF,UNIT3,LINE ENDWHILE FREE_LUN,UNIT1,UNIT3 SPAWN,'rm TEMPLATES.HELP' ENDELSE ; END