Rev 4349 | 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 |
4158 | bpr | 4 | |
4349 | bpr | 5 | slib_author=Gang, XIAO |
4158 | bpr | 6 | |
20 | reyssat | 7 | !exit |
8 | |||
9 | :proc |
||
10 | slib_ltest=!linecnt $wims_read_parm |
||
11 | !if $slib_ltest>1 |
||
13585 | bpr | 12 | slib_inp=!lines2rows $wims_read_parm |
13 | slib_type=lines |
||
20 | reyssat | 14 | !else |
13585 | bpr | 15 | slib_inp=$wims_read_parm |
16 | slib_type=rows |
||
20 | reyssat | 17 | !endif |
18 | slib_n=!item 1 of $slib_inp |
||
19 | slib_option=!item 2 of $slib_inp |
||
20 | slib_data=!item 3 to -1 of $slib_inp |
||
21 | slib_r1=!row 1 of $slib_data |
||
22 | slib_N=!itemcnt $slib_r1 |
||
23 | !bound $slib_n between integer 1 and $slib_N default 1 |
||
24 | slib_key=!column $slib_n of $slib_data |
||
25 | slib_tt=0 |
||
26 | !if reverse iswordof $slib_option |
||
13585 | bpr | 27 | slib_tt=$[$slib_tt+1] |
20 | reyssat | 28 | !endif |
29 | !if numeric iswordof $slib_option |
||
13585 | bpr | 30 | slib_tt=$[$slib_tt+2] |
20 | reyssat | 31 | !endif |
32 | !if nocase iswordof $slib_option |
||
13585 | bpr | 33 | slib_tt=$[$slib_tt+4] |
20 | reyssat | 34 | !endif |
35 | |||
36 | !goto sort$slib_tt |
||
37 | |||
38 | :sort0 |
||
13585 | bpr | 39 | slib_out=!sort items $slib_key |
40 | !goto send |
||
20 | reyssat | 41 | :sort1 |
13585 | bpr | 42 | slib_out=!sort reverse items $slib_key |
43 | !goto send |
||
20 | reyssat | 44 | :sort2 |
13585 | bpr | 45 | slib_out=!sort numeric items $slib_key |
46 | !goto send |
||
20 | reyssat | 47 | :sort3 |
13585 | bpr | 48 | slib_out=!sort reverse numeric items $slib_key |
49 | !goto send |
||
20 | reyssat | 50 | :sort4 |
13585 | bpr | 51 | slib_out=!sort nocase items $slib_key |
52 | !goto send |
||
20 | reyssat | 53 | :sort5 |
13585 | bpr | 54 | slib_out=!sort reverse nocase items $slib_key |
55 | !goto send |
||
20 | reyssat | 56 | :sort6 |
13585 | bpr | 57 | slib_out=!sort numeric nocase items $slib_key |
58 | !goto send |
||
20 | reyssat | 59 | :sort7 |
13585 | bpr | 60 | slib_out=!sort numeric nocase reverse items $slib_key |
20 | reyssat | 61 | |
62 | :send |
||
63 | slib_out=!row $wims_sort_order of $slib_data |
||
64 | !if $slib_type=lines |
||
13585 | bpr | 65 | slib_out=!rows2lines $slib_out |
20 | reyssat | 66 | !endif |