Subversion Repositories wimsdev

Rev

Rev 14245 | Blame | Compare with Previous | Last modification | View Log | RSS feed

!!INPUT name of csv file, keyword to look for
!!OUTPUT : position of the keyword, bad item for this keyword :
!! logtest loglist dep_$ltest  got$keyword types ???
!! list of types
!distribute items $wims_read_parm into file,keyword
n=!recordcnt $file
!if $n<=0
  !exit
!endif

loglist=
logtest=
!! look for the position of keyword in the two first lines
!! check if the keyword have more than 4 characters in all lines not commented by #
!for i=1 to $n
  l=!record $i of $file
  l=!replace internal ; by , in $l
  l=!replace internal $ $ by , in $l
  !if $(got$keyword)!=$empty
    ltest=!item $(got$keyword) of $l
    ll=!wordcnt $ltest
    !if $ll=1 and # notin $ltest
      ltest_cnt=!charcnt $ltest
      !if ($ltest_cnt<4 and $keyword notwordof external_auth) or $ltest_cnt<2
        bad_$keyword=!append item $ltest to $(bad_$keyword)
      !else
        loglist=!append item $ltest to $loglist
        !if @ isin $ltest or . isin $ltest or - isin $ltest
          !!!FIXME bidouillage - useful only to be able to define a variable dep_$ltest
          !!!! variables names must not content @ and -
          !!! replace by writing in a file ???
          ltest=!replace internal @ by in $ltest
          ltest=!replace internal . by in $ltest
          ltest=!replace internal - by in $ltest
          ttt=0
          ltest1=$ltest
          !while $ltest1 isitemof $logtest
            ltest1=$ltest$ttt
            !increase ttt
          !endwhile
          ltest=$ltest1
        !endif
        logtest=!append item $ltest to $logtest
      !endif
      dep_$ltest=$l
    !endif
  !else
    !if $i>3
      !exit
    !endif
    !if $keyword isitemof $l
      l=!lower $l
      types=!nospace $l
      got$keyword=!positionof item $keyword in $l
      got$keyword=!item 1 of $(got$keyword)
    !endif
  !endif
!next i