;+ ; NAME: ; www_help_is_code ; PURPOSE: ; Checks whether 'line' is an external or include declaration, or a ; comma-separated list of names. ; CATEGORY: ; www_help ; CALLING SEQUENCE: FUNCTION www_help_is_code, style, line, name, front, back ; INPUTS: ; style array[1]; type: structure ; www_help_style structure ; Only used style.commentchar ; line scalar; type: string ; text line from header ; OUTPUTS: ; is_code scalar; type: integer ; 0: not a line of code ; 1; is a line of code ; name scalar or array: type: string ; if is_code=1 then name will be a scalar containing ; the name of the include or extenal module ; if is_code=0 then name is an array containing the ; entries in a comma-separated list (as found in a CALLS ; of SEE ALSO section). ; front scalar: type: string ; back scalar: type: string ; if is_code is 1 then 'name' is the name of the ; file used in the include and external statements. ; 'front' and 'back' returns the leading and trailing ; parts of 'line'. ; if is_code is 0 then neither will exist ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; destroyvar ; PROCEDURE: ; Trivial ; MODIFICATION HISTORY: ; FEB-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- is_code = 0 piece = strtok(line, /extract) npiece = n_elements(piece) CASE style.commentchar OF ';': BEGIN IF strmid(piece[0],0,1) EQ '@' THEN BEGIN p1 = strpos(line,'@') p2 = strpos(line, ".", p1+1) is_code = p2 NE -1 AND p2 GT p1+1 IF is_code THEN BEGIN front = strmid(line, 0 , p1+1) name = strmid(line, p1+1, p2-p1-1) back = strmid(line, p2) ENDIF ENDIF END 'C': BEGIN IF npiece GE 2 THEN BEGIN IF strupcase(piece[0]) EQ 'EXTERNAL' THEN BEGIN is_code = 1 name = piece[1] p1 = strpos(line, name) front = strmid(line, 0, p1) back = strmid(line, p1+strlen(name)) ENDIF ELSE IF strupcase(piece[0]) EQ 'INCLUDE' THEN BEGIN ; KLUDGE: lines like ; include 'dirspec [1].h' ; have been broken at the space. Put them back together again ; before continuing. IF npiece GE 3 THEN $ IF strmid(piece[2],0,1) EQ '[' THEN $ piece[1] = piece[1]+' '+piece[2] p1 = strpos(piece[1], "'") p2 = strpos(piece[1], ".", p1+1) is_code = p1 EQ 0 AND p2 GT p1+1 IF is_code THEN BEGIN p1 = strpos(line, piece[1]) p2 = strpos(line, ".", p1+1) front = strmid(line, 0 , p1+1) name = strmid(line, p1+1, p2-p1-1) back = strmid(line, p2) ENDIF ENDIF ENDIF END ELSE: ; Nothing to do ENDCASE IF NOT is_code THEN BEGIN ; Comma-separated list of routine names. name = strtrim(strtok(line, ',', /extract), 2) p1 = where(strlen(name) NE 0) ; Drop zero-length entries IF p1[0] NE -1 THEN name = name[p1] ELSE p1 = temporary(name) ENDIF RETURN, is_code & END