Subversion Repositories wimsdev

Rev

Rev 13902 | Rev 15402 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
20 reyssat 1
!if $wims_read_parm!=slib_header
13585 bpr 2
  !goto proc
20 reyssat 3
!endif
4
 
4701 bpr 5
slib_author=Fabrice, Guerimand
15272 guerimand 6
!!201904 : rajout option tex (par Gilles Marbeuf)
7
!!202007 : change space by   in html mode (by FG)
8
 
4701 bpr 9
slib_example=4345678\
13902 bpr 10
4345678,tex\
4701 bpr 11
5678\
13902 bpr 12
5678,tex\
4701 bpr 13
5 234\
13902 bpr 14
5 234,tex\
4701 bpr 15
456.789567\
13902 bpr 16
456.789567,tex\
4701 bpr 17
456.789567,comma\
13902 bpr 18
456.789567,comma tex\
19
[897456,789],comma\
20
[897456,789],comma tex
20 reyssat 21
!exit
22
 
23
:proc
4701 bpr 24
slib_input=$(wims_read_parm[1])
25
slib_input=!declosing $slib_input
26
slib_input=!replace internal , by . in $slib_input
27
!if comma isin $wims_read_parm
13902 bpr 28
  slib_point=,
4701 bpr 29
!endif
30
!default slib_point=.
20 reyssat 31
 
13902 bpr 32
!if tex isin $wims_read_parm
33
  slib_sep=\:
34
!else
15272 guerimand 35
  slib_sep= 
13902 bpr 36
!endif
37
 
4701 bpr 38
slib_test=$[$slib_input]
39
!if NaN isin $slib_test
13585 bpr 40
  slib_out=NaN
41
  !exit
20 reyssat 42
!endif
43
 
44
!if e isin $slib_input
13585 bpr 45
  slib_out=$slib_input
46
  !exit
20 reyssat 47
!endif
4701 bpr 48
slib_input=!nospace $slib_input
49
slib_decomp=!replace internal . by , in $slib_input
50
slib_part=!item 1 of $slib_decomp
51
slib_nbchi=!charcnt $slib_part
52
slib_nbgrp=$[floor($slib_nbchi/3)]
20 reyssat 53
slib_out=$empty
4701 bpr 54
!ifval $slib_nbgrp*3!=$slib_nbchi
13585 bpr 55
  slib_out=!char 1 to $[$slib_nbchi-3*$slib_nbgrp] of $slib_part
20 reyssat 56
!endif
7692 bpr 57
!for slib_i=0 to $slib_nbgrp-1
13585 bpr 58
  slib_tmp=!char $[$slib_nbchi-3*($slib_nbgrp-$slib_i)+1] to $[$slib_nbchi-3*($slib_nbgrp-$slib_i-1)] of $slib_part
13902 bpr 59
  slib_out=$slib_out$slib_sep$slib_tmp
4701 bpr 60
!next slib_i
20 reyssat 61
 
4701 bpr 62
slib_tst=!itemcnt $slib_decomp
63
!if $slib_tst=1
13585 bpr 64
  slib_out=!singlespace $slib_out
65
  !exit
20 reyssat 66
!endif
4701 bpr 67
slib_part=!item 2 of $slib_decomp
68
slib_nbchi=!charcnt $slib_part
69
slib_nbgrp=$[ceil($slib_nbchi/3)]
70
slib_tmp=!char 1 to 3 of $slib_part
71
slib_out=$(slib_out)$slib_point$slib_tmp
7692 bpr 72
!for slib_i=1 to $slib_nbgrp
13585 bpr 73
  slib_tmp=!char $[1+3*($slib_i)] to $[3+3*$slib_i] of $slib_part
13902 bpr 74
  slib_out=$slib_out$slib_sep$slib_tmp
4701 bpr 75
!next slib_i
76
 
7692 bpr 77
slib_out=!singlespace $slib_out
13902 bpr 78
 
79
!reset slib_input slib_point slib_decomp slib_sep slib_test slib_part slib_nbchi slib_nbgrp slib_tmp