Rev 12964 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
12964 | bpr | 1 | !if $wims_read_parm!=slib_header |
2 | !goto proc |
||
3 | !endif |
||
12965 | bpr | 4 | slib_author=Bernadette, Perrin-Riou |
12964 | bpr | 5 | |
6 | slib_title=Numération romaine |
||
12965 | bpr | 7 | slib_parms=1\ |
8 | ,number to convert (less than 3999) |
||
9 | slib_out=Conversion en numération romaine |
||
12964 | bpr | 10 | |
11 | slib_example=456\ |
||
12 | 654\ |
||
13 | 12 |
||
12965 | bpr | 14 | |
12964 | bpr | 15 | !exit |
16 | |||
17 | :proc |
||
18 | |||
19 | slib_chif=$wims_read_parm |
||
20 | |||
21 | slib_romain= |
||
22 | !bound $slib_chif between 1 and 3999 |
||
23 | slib_number=1,I,V\ |
||
24 | 10,X,L\ |
||
25 | 100,C,D\ |
||
26 | 1000,M,MMMMM |
||
27 | slib_cnt=!charcnt $slib_chif |
||
28 | !for slib_a = 1 to $slib_cnt |
||
29 | slib_digit=!char $[$slib_cnt - $slib_a+1] of $slib_chif |
||
30 | slib_i= $(slib_number[$slib_a;2]) |
||
31 | slib_v=$(slib_number[$slib_a;3]) |
||
32 | !if $slib_digit iswordof 1 2 3 |
||
33 | slib_rom=!makelist $slib_i for x = 1 to $slib_digit |
||
34 | slib_romain= $slib_rom $slib_romain |
||
35 | !endif |
||
36 | !if $slib_digit=4 |
||
37 | slib_romain= $slib_i $slib_v $slib_romain |
||
38 | !endif |
||
39 | !if $slib_digit=5 |
||
40 | slib_romain= $slib_v $slib_romain |
||
41 | !endif |
||
42 | !if $slib_digit iswordof 6 7 8 |
||
43 | slib_rom= !makelist $slib_i for x = 1 to $slib_digit -5 |
||
44 | slib_romain=$slib_v$slib_rom $slib_romain |
||
45 | !endif |
||
46 | !if $slib_digit=9 |
||
47 | slib_x=$(slib_number[$slib_a+1;2]) |
||
48 | slib_romain=$slib_i$slib_x$slib_romain |
||
49 | !endif |
||
50 | !next |
||
51 | |||
12965 | bpr | 52 | slib_out=!replace internal , by in $slib_romain |
12964 | bpr | 53 | slib_out=!nospace $slib_out |