Ignore:
Timestamp:
04/17/14 10:49:43 (10 years ago)
Author:
pinsard
Message:

fix thanks to coding rules; typo; dupe empty lines; trailing blanks

Location:
trunk/SRC/ToBeReviewed/STRING
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/SRC/ToBeReviewed/STRING/chkeywd.pro

    r372 r495  
    55; We change the value of one of keywords. 
    66; 
    7 ; More generally, in a string, we look for the character  
     7; More generally, in a string, we look for the character 
    88; chain: ', keywdname= ..., and we change the value of... 
    99; 
     
    5151; Double-precision complex, Pointer, Object reference, Unsigned Integer, 
    5252; Unsigned Longword Integer, 64-bit Integer or Unsigned 64-bit Integer. 
    53 ; 
    5453; 
    5554; @examples 
  • trunk/SRC/ToBeReviewed/STRING/delchr.pro

    r325 r495  
    33; @file_comments 
    44; Delete all occurrences of a character from a text string. 
    5 ;  
     5; 
    66; @categories 
    77; 
    88; @param OLD {in}{required} 
    99; original text string. 
    10 ;  
     10; 
    1111; @param C {in}{required} 
    1212; character to delete. 
     
    1616; @returns 
    1717; new = resulting string. 
    18 ;  
     18; 
    1919; @history 
    2020;       R. Sterner.  5 Jul, 1988. 
     
    3737  compile_opt idl2, strictarrsubs 
    3838; 
    39   
     39 
    4040if (n_params(0) lt 2) or keyword_set(hlp) then begin 
    4141  ras = report(['Delete all occurrences of a character from a text string.', $ 
     
    4646  return, -1 
    4747endif 
    48   
     48 
    4949B = BYTE(OLD) ; convert string to a byte array. 
    5050CB = BYTE(C)  ; convert char to byte. 
  • trunk/SRC/ToBeReviewed/STRING/getfile.pro

    r374 r495  
    3636; 
    3737;       search the file in the all !path directories (use <pro>find</pro>) 
    38 ;       when using /find keyword. Use <proidl>SPAWN</proidl>, 'cat...' for  
     38;       when using /find keyword. Use <proidl>SPAWN</proidl>, 'cat...' for 
    3939;       unix os. 
    4040; 
  • trunk/SRC/ToBeReviewed/STRING/isnumber.pro

    r493 r495  
    1414; 
    1515; @returns 
    16 ;       x = optionally returned numeric value if valid.   
    17 ;       i = test flag:                                   
     16;       x = optionally returned numeric value if valid. 
     17;       i = test flag: 
    1818;           0: not a number. 
    1919;           1: txt is a long integer. 
     
    2121;           -1: first word of txt is a long integer. 
    2222;           -2: first word of txt is a float. 
    23 ;  
     23; 
    2424; @history 
    2525;  - R. Sterner.  15 Oct, 1986. Johns Hopkins Applied Physics Lab. 
     
    4141; 
    4242  compile_opt idl2, strictarrsubs 
    43 ;  
     43; 
    4444        if (n_params(0) lt 1) or keyword_set(hlp) then begin 
    4545          print,' Determine if a text string is a valid number.' 
     
    5555          return, -1 
    5656        endif 
    57   
     57 
    5858        txt = strtrim(txt0,2)   ; trim blanks. 
    5959        x = 0                   ; define X. 
    60   
     60 
    6161        if txt eq '' then return, 0     ; null string not a number. 
    62   
     62 
    6363        sn = 1 
    6464        if nwrds(txt) gt 1 then begin   ; get first word if more than one. 
     
    6666          txt = getwrd(txt,0) 
    6767        endif 
    68            
     68         
    6969        f_flag = 0                      ; Floating flag. 
    7070        b = byte(txt)                   ; Convert to byte array. 
     
    102102        ;-----  Allow no alphabetic characters  ----------- 
    103103        if total((b ge 65) and (b le 122)) ne 0 then return, 0 
    104   
     104 
    105105        c = strmid(t,0,1) 
    106106        if (c lt '0') or (c gt '9') then return, 0  ; First char not a digit. 
    107   
     107 
    108108        x = txt + 0.0                               ; Convert to a float. 
    109109        if f_flag eq 1 then return, 2*sn            ; Was floating. 
     
    114114          return, 2*sn 
    115115        endelse 
    116   
     116 
    117117        end 
  • trunk/SRC/ToBeReviewed/STRING/lenstr.pro

    r493 r495  
    55; input: 
    66;  str             a single string or string array. 
    7 ;  
     7; 
    88; output: 
    99;  result          length of the string(s) in normalized units 
    10 ;                  the number of elements of RESULT matches the number of  
    11 ;                  elements of STRING.  
     10;                  the number of elements of RESULT matches the number of 
     11;                  elements of STRING. 
    1212; 
    1313; procedure: 
     
    2525;           University of California, Santa Barbara 
    2626; 
    27 ; @todo seb  
     27; @todo seb 
    2828; 
    2929;- 
  • trunk/SRC/ToBeReviewed/STRING/nwrds.pro

    r372 r495  
    33; @file_comments 
    44; Return the number of words in the given text string. 
    5 ;  
     5; 
    66; @categories 
    77; 
     
    1111; @keyword DELIMITER 
    1212; = d. Set delimiter character (def = space). 
    13 ;  
     13; 
    1414; @keyword HELP 
    1515; 
    1616; @returns 
    1717; n = number of words found. 
    18 ;  
     18; 
    1919; @restrictions 
    2020; See also <pro>getwrd</pro> 
    21 ;  
     21; 
    2222; @history 
    2323;  - R. Sterner,  7 Feb, 1985. Johns Hopkins University Applied Physics Laboratory. 
     
    3838  compile_opt idl2, strictarrsubs 
    3939; 
    40   
     40 
    4141        if (n_params(0) lt 1) or keyword_set(hlp) then begin 
    4242          print,' Return the number of words in the given text string.' 
     
    4949          return, -1 
    5050        endif 
    51   
     51 
    5252        if strlen(txtstr) eq 0 then return,0    ; A null string has 0 words. 
    5353        ddel = ' '                      ; Default word delimiter is a space. 
     
    6161        x = tb ne tst                           ; Locate words. 
    6262        x = [0,x,0]                             ; Pad ends with delimiters. 
    63   
     63 
    6464        y = (x-shift(x,1)) eq 1                 ; Look for word beginnings. 
    65   
     65 
    6666        n = fix(total(y))                       ; Count word beginnings. 
    67   
     67 
    6868        return, n 
    69   
     69 
    7070        end 
  • trunk/SRC/ToBeReviewed/STRING/putfile.pro

    r374 r495  
    33; @file_comments 
    44; Write a text file from a string array. 
    5 ;  
     5; 
    66; @categories 
    77; 
     
    1414; @keyword ERROR 
    1515; error flag: 0=ok, 1=invalid string array. 
    16 ;  
     16; 
    1717; @history 
    1818;  - R. Sterner, 20 Mar, 1990 
     
    3333  compile_opt idl2, strictarrsubs 
    3434; 
    35   
     35 
    3636        if (n_params(0) lt 1) or keyword_set(hlp) then begin 
    3737          print,' Write a text file from a string array.' 
     
    4848           return 
    4949        endif 
    50 ;  
     50; 
    5151        if size(s, /type) ne 7 then begin 
    5252          print,' Error in putfile: argument must be a string array.' 
     
    5454          return 
    5555        endif 
    56   
     56 
    5757        get_lun, lun 
    5858        openw, lun, file 
    59   
     59 
    6060        for i = 0, n_elements(s)-1 do begin 
    6161          t = s[i] 
     
    6363          printf, lun, t 
    6464        endfor 
    65   
     65 
    6666        close, lun 
    6767        free_lun, lun 
    6868        err = 0 
    6969        return 
    70   
     70 
    7171        end 
  • trunk/SRC/ToBeReviewed/STRING/string2struct.pro

    r374 r495  
    3939; 
    4040; @param STRVAL {IN}{REQUIRED} 
    41 ; String set up as keywords. Keywords require a little special treatment.  
     41; String set up as keywords. Keywords require a little special treatment. 
    4242; Such as 
    4343; 
  • trunk/SRC/ToBeReviewed/STRING/strkeywd.pro

    r372 r495  
    22; 
    33; @file_comments 
    4 ; Translate a structure in a string able to be used to specify keywords  
     4; Translate a structure in a string able to be used to specify keywords 
    55; in the calling of a function when we use EXECUTE (see example) 
    66; 
    7 ; @categories  
    8 ;  
     7; @categories 
     8; 
    99; @param STRUCT 
    1010; a structure 
     
    1212; @returns 
    1313; a string composed like following: 
    14 ; For each element of the structure, we write a part of the string as:  
     14; For each element of the structure, we write a part of the string as: 
    1515;         'name_of_the_element=content_of_the_element' 
    1616; 
    1717; @restrictions 
    18 ; If an element of the structure contain an array, it will be convert in a  
     18; If an element of the structure contain an array, it will be convert in a 
    1919; vector. 
    2020; 
    2121; @restrictions 
    22 ; Beware, this function has loops, ifs and cases everywhere. So it can  
    23 ; not be used by big keywords (with a lot of elements which are big  
    24 ; arrays). The input keyword must not contain Complex floatings, structure,  
    25 ; Double-precision complex, Pointer, Object reference, Unsigned Integer,  
     22; Beware, this function has loops, ifs and cases everywhere. So it can 
     23; not be used by big keywords (with a lot of elements which are big 
     24; arrays). The input keyword must not contain Complex floatings, structure, 
     25; Double-precision complex, Pointer, Object reference, Unsigned Integer, 
    2626; Unsigned Longword Integer, 64-bit Integer or Unsigned 64-bit Integer. 
    2727; 
  • trunk/SRC/ToBeReviewed/STRING/strright.pro

    r374 r495  
    66; @categories 
    77; String 
    8 ;  
     8; 
    99; @param S {in}{required} 
    1010; the string to be searched 
     
    2020; 
    2121; @examples 
    22 ;  
     22; 
    2323; add a "/" in to path if it "/" is not at the end : 
    2424; 
     
    4848  compile_opt idl2, strictarrsubs 
    4949; 
    50   
     50 
    5151    on_error,2   ; return to caller 
    52   
     52 
    5353    if (n_elements(s) le 0) then return,-1L 
    54   
     54 
    5555    l = strlen(s) 
    56   
     56 
    5757    if (n_elements(lastn) le 0) then lastn = 1 
    5858    if lastn gt l then lastn = l 
    59   
     59 
    6060    result = strmid(s,l-lastn,l) 
    61   
     61 
    6262    return,result 
    6363end 
  • trunk/SRC/ToBeReviewed/STRING/strsci.pro

    r374 r495  
    1515; The format specification used in the string 
    1616; conversion for the mantissa (i.e. the 
    17 ; "A" of "A x 10^B").   
     17; "A" of "A x 10^B"). 
    1818; 
    1919; @keyword POT_ONLY 
     
    4141; 
    4242;   IDL> Result = STRSCI( 2000000, format='(i1)' ) 
    43 ;   IDL> print, result                 
     43;   IDL> print, result 
    4444;   2 x 10!u6!n 
    45 ;  
    46 ; which gets plotted as 2 x 10  
    47 ;         
     45; 
     46; which gets plotted as 2 x 10 
     47; 
    4848;   IDL> Result = STRSCI( -0.0001 ) 
    4949;   IDL> print, result 
     
    5555;   IDL> print, result 
    5656;   0.00000000 
    57 ;  
    5857; 
    5958; @history 
     
    7675;           - now can handle DATA=0.0 correctly 
    7776;           - updated comments 
    78 ;        mgs, 03 Jun 1999:  
     77;        mgs, 03 Jun 1999: 
    7978;           - can now also handle values lt 1 ;-) 
    8079;           - and doesn't choke on arrays 
     
    8382; $Id$ 
    8483; 
    85 ; Copyright (C) 1998, 1999 Bob Yantosca and Martin Schultz,  
     84; Copyright (C) 1998, 1999 Bob Yantosca and Martin Schultz, 
    8685; Harvard University 
    8786; This software is provided as is without any warranty 
     
    125124      ;==================================================================== 
    126125      if ( Abs( Data[i] ) ne 0.0 ) then begin 
    127     
     126 
    128127         ; take the common log and store in LOG10DATA 
    129          Log10Data = ALog10( Abs( Data[i] ) )   
    130     
     128         Log10Data = ALog10( Abs( Data[i] ) ) 
     129 
    131130         ; Boolean flag if data < 0 
    132          sign = ( Data[i] lt 0.0 )  
    133     
     131         sign = ( Data[i] lt 0.0 ) 
     132 
    134133         ; Compute the characteristic (int part) 
    135134         ; Add the 1d-6 to prevent roundoff errors 
    136135         Characteristic = Fix( Log10Data + 1.0d-6 ) 
    137136         if (Log10Data lt 0) then $ 
    138             Characteristic = Characteristic - 1  
    139     
     137            Characteristic = Characteristic - 1 
     138 
    140139         ; Compute the Mantissa (frac part) and take its antilog. 
    141          Mantissa = Log10Data - Characteristic  
     140         Mantissa = Log10Data - Characteristic 
    142141         Mantissa = 10.0^Mantissa 
    143     
     142 
    144143   ;  print,data[i],log10data,mantissa,characteristic,format='(3f24.14,i8)' 
    145     
    146          ; String for the coefficient part,  
     144 
     145         ; String for the coefficient part, 
    147146         ; The coefficient is just antilog of the Mantissa 
    148147         ; Add the minus sign if DATA < 0.0 
    149148         A = StrTrim( String( Mantissa, Format=Format ), 2 ) 
    150149         if ( Sign ) then A = '-' + A 
    151     
     150 
    152151         ; String for the power of 10 part 
    153152         B = '10!u' + strtrim( string( Characteristic ), 2 ) + '!n' 
     
    156155            if ( Characteristic eq 1 ) then B = '10' 
    157156         endif 
    158     
     157 
    159158         ; composite string 
    160159         Result[i] = A + ' x ' + B 
    161160         if ( Short AND B eq '1') then Result[i] = A 
    162     
    163     
     161 
    164162      ;==================================================================== 
    165163      ; If DATA = 0, then we cannot take the common log, so return 
     
    170168         B      = A 
    171169         Result[i] = A 
    172     
     170 
    173171      endelse 
    174     
     172 
    175173      ;==================================================================== 
    176174      ; Return result to calling program (depending on keyword settings) 
     
    183181      if ( Trim ) then $ 
    184182         Result[i] = StrCompress( Result[i], /Remove_All ) 
    185       
     183 
    186184   endfor 
    187185 
    188186   if (n_elements(Result) eq 1) then $ 
    189187      Result = Result[0] 
    190   
     188 
    191189   return, Result 
    192190 
  • trunk/SRC/ToBeReviewed/STRING/strsed.pro

    r372 r495  
    11;+ 
    22; 
    3 ; @file_comments  
     3; @file_comments 
    44; replace one (or more) character(s)/string(s) in a string array 
    55; "modern" version of the obsolete strrepl 
     
    1818; 
    1919; @keyword FOLD_CASE 
    20 ; Indicates that the regular expression matching should be done in  
     20; Indicates that the regular expression matching should be done in 
    2121; a case-insensitive fashion. 
    2222; 
     
    5454       strout[line[i]] = strjoin(strsplit(strout[line[i]], exp1, /extract $ 
    5555                                          , /regex, /preserve_null, FOLD_CASE = fold_case), exp2) 
    56   ENDIF  
     56  ENDIF 
    5757; 
    5858  return, strout 
  • trunk/SRC/ToBeReviewed/STRING/tostr.pro

    r372 r495  
    44; Convert an input in a string. 
    55; 
    6 ; @categories  
     6; @categories 
    77; String 
    88; 
     
    2121; 
    2222; @restrictions 
    23 ; Beware, this function has loops, ifs and cases everywhere. So it can  
    24 ; not be used by big keywords (with a lot of elements which are big  
     23; Beware, this function has loops, ifs and cases everywhere. So it can 
     24; not be used by big keywords (with a lot of elements which are big 
    2525; arrays). 
    26 ;  
     26; 
    2727; @examples 
    2828;   IDL> help, tostr(1),tostr('a'),tostr(indgen(4)),tostr(['a','jkfjo']) 
     
    4848 
    4949   case 1 of 
    50       size(input, /type) LE 5:BEGIN  
     50      size(input, /type) LE 5:BEGIN 
    5151         if size(input, /type) EQ 1 then input = long(input) 
    5252         if n_elements(input) EQ 1 then res = strtrim(input, 1) $ 
    53          ELSE BEGIN  
     53         ELSE BEGIN 
    5454            res = '['+strtrim((input)[0], 1) 
    5555            for i = 1,  n_elements(input)-1 do res = res+','+strtrim((input)[i], 1) 
    5656            res = res+']' 
    57          ENDELSE  
     57         ENDELSE 
    5858      END 
    59       size(input, /type) eq 7:BEGIN  
     59      size(input, /type) eq 7:BEGIN 
    6060         if n_elements(input) EQ 1 then BEGIN 
    6161            sinput = strrepl(input, '''', '''''') 
    6262            res = ''''+sinput+'''' 
    63          ENDIF ELSE BEGIN  
     63         ENDIF ELSE BEGIN 
    6464            res = '['''+strrepl(input[0], '''', '''''')+'''' 
    6565            for i = 1,  n_elements(input)-1 do res = res+','''+strrepl(input[i], '''', '''''')+'''' 
    6666            res = res+']' 
    67          ENDELSE  
     67         ENDELSE 
    6868      END 
    69       ELSE:BEGIN  
     69      ELSE:BEGIN 
    7070         ras = report('la fonction tostr ne marche pas pour input qui est de type '+size(input, /tname)) 
    7171         res = '' 
Note: See TracChangeset for help on using the changeset viewer.