Subversion Repositories wimsdev

Rev

Rev 6057 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6057 Rev 6515
Line 1... Line 1...
1
fml=$formula
1
fml=$formula
-
 
2
fml=!translate ; to $\
-
 
3
$ in $fml
-
 
4
icnt=!itemcnt $fml
-
 
5
:retest
-
 
6
!if $icnt>1
-
 
7
 test=!item 1 of $fml
-
 
8
 test=!declosing $test
-
 
9
 tcnt=!itemcnt $test
-
 
10
 !if $tcnt=2
-
 
11
  form=!lines2items $fml
-
 
12
  form=!nonempty items $form
-
 
13
  lcnt=!itemcnt $form
-
 
14
  !reset fml
-
 
15
  !for i=1 to $lcnt
-
 
16
   l=!item $i of $form
-
 
17
   l=!declosing $l
-
 
18
   c=!itemcnt $l
-
 
19
   !if $c!=2
-
 
20
    error=bad_formula
-
 
21
    !exit
-
 
22
   !endif
-
 
23
   fml=!append line $l to $fml
-
 
24
  !next i
-
 
25
 !else
-
 
26
  tcnt=!wordcnt $test
-
 
27
  !if $tcnt=2
-
 
28
   form=!lines2items $fml
-
 
29
   form=!nonempty items $form
-
 
30
   lcnt=!itemcnt $form
-
 
31
   !reset fml
-
 
32
   !for i=1 to $lcnt
-
 
33
    l=!item $i of $form
-
 
34
    l=!declosing $l
-
 
35
    c=!wordcnt $l
-
 
36
    t=!itemcnt $l
-
 
37
    !if $c!=2 or $t!=1
-
 
38
     error=bad_formula
-
 
39
     !exit
-
 
40
    !endif
-
 
41
    !distribute words $l into x_,y_
-
 
42
    fml=!append line $x_,$y_ to $fml
-
 
43
   !next i
-
 
44
  !else
-
 
45
   form=$fml
-
 
46
   form=!nonempty lines $form
-
 
47
   lcnt=!linecnt $form
-
 
48
   !reset fml
-
 
49
   !for i=1 to $lcnt
-
 
50
    l=!line $i of $form
-
 
51
    c=!itemcnt $l
-
 
52
    !if $c!=2
-
 
53
     error=bad_formula
-
 
54
     !exit
-
 
55
    !endif
-
 
56
    fml=!append line $l to $fml
-
 
57
   !next i
-
 
58
  !endif
-
 
59
 !endif
-
 
60
!else
-
 
61
 fml=!lines2items $fml
-
 
62
 icnt=!itemcnt $fml
-
 
63
 !if $icnt>1
-
 
64
  !goto retest 
-
 
65
 !else
-
 
66
  error=bad_formula
-
 
67
  !exit
-
 
68
 !endif
-
 
69
!endif
-
 
70
 
-
 
71
fml=!nonempty lines $fml
-
 
72
cnt=!linecnt $fml
-
 
73
op=!lower $option
-
 
74
fml3=
-
 
75
!if exchange iswordof $op
-
 
76
 f=
-
 
77
 !for i=1 to $cnt
-
 
78
  l=!line $i of $fml
-
 
79
  !distribute items $l into x_,y_
-
 
80
  f=!append line $y_,$x_ to $f
-
 
81
  fml3=!append item ($y_,$x_) to $fml3
-
 
82
 !next i
-
 
83
 fml=$f
-
 
84
!else
-
 
85
 !for i=1 to $cnt
-
 
86
  l=!line $i of $fml
-
 
87
  fml3=!append item ($l) to $fml3
-
 
88
 !next i
-
 
89
!endif
-
 
90
fml2=!translate $\
-
 
91
$ to ; in $fml
-
 
92
fml2=!rawmath $fml2
-
 
93
fml2=!replace , by , $ in $fml2
-
 
94
fml2=!replace ; by ; $ in $fml2
-
 
95
fml2=!singlespace $fml2
-
 
96
fml3=!replace , by , $ in $fml3
-
 
97
fml3=!singlespace $fml3
-
 
98
 
-
 
99
# fml: x1,y1\
-
 
100
# x2,y2...
-
 
101
#
-
 
102
# fml2: x1,y1;x2,y2;...
-
 
103
#
-
 
104
# fml3: (x1,y1),(x2,y2),...
-
 
105