-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2.TXT
240 lines (233 loc) · 3.99 KB
/
2.TXT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
--
graphics_mode(3)
function get_command(string)
len=string_length(string)
for i=1 to len do
chr=string_chr_at(string,i)
if chr="-" then
ii=i
ii+=1
chr=string_chr_at(string,ii)
if chr="-" then
return 1
end if
end if
end for
find=0
for i=1 to len do
chr=string_chr_at(string,i)
if chr="=" then
for j=i to len do
chr=string_chr_at(string,j)
if chr="(" then
find=1
exit
end if
end for
if find=0 then
return 2
end if
return 3
end if
end for
return 0
end function
string_info[1,1]=""
number_info[1]=0
number_name[1]=""
num1=0
num2=0
global num1
global num2
global string_info
global number_info
global number_name
function get_info2(name)
for i=1 to num1 do
if string_info[i,1]=name then
return string_info[i,2]
end if
end for
for i=1 to num2 do
if number_name[i]=name then
return number_info[i]
end if
end for
return "#"
end function
sub set_info2(string)
len=string_length(string)
find=0
for i=1 to len do
chr=string_chr_at(string,i)
if chr="'" then
find=1
len=i
exit
end if
end for
if find=1 then
temp=""
for i=1 to len do
chr=string_chr_at(string,i)
if chr!=" " then
temp+=chr
end if
end for
len=string_length(temp)
for i=1 to len do
chr=string_chr_at(temp,i)
if chr="=" then
pos1=i
pos1-=1
exit
end if
end for
name=string_copy(temp,1,pos1)
len=string_length(string)
for i=1 to len do
chr=string_chr_at(string,i)
if chr="'" then
pos1=i
pos1+=1
exit
end if
end for
for i=pos1 to len do
chr=string_chr_at(string,i)
if chr="'" then
ii=i
ii-=1
val=string_copy(string,pos1,ii)
exit
end if
end for
find=0
for i=1 to num1 do
if string_info[i,1]=name then
string_info[i,2]=val
find=1
exit
end if
end for
if find=0 then
num1+=1
string_info[num1,1]=name
string_info[num1,2]=val
end if
find=1
end if
--
--
if find=0 then
pos1=0
pos2=0
for i=1 to len do
chr=string_chr_at(string,i)
if chr!=" " then
pos1=i
exit
end if
end for
for i=pos1 to len do
chr=string_chr_at(string,i)
if chr="=" then
pos2=i
pos2-=1
exit
end if
if chr=" " then
pos2=i
pos2-=1
exit
end if
end for
name=string_copy(string,pos1,pos2)
pos1=0
pos2=0
for i=1 to len do
chr=string_chr_at(string,i)
if chr="=" then
pos1=i
pos1+=1
exit
end if
end for
for i=pos1 to len do
chr=string_chr_at(string,i)
if chr!=" " then
pos1=i
exit
end if
end for
for i=pos1 to len do
chr=string_chr_at(string,i)
if chr=" " then
pos2=i
pos2-=1
exit
end if
if i=len then
pos2=i
exit
end if
end for
-- this is where the fun part starts
name2=string_copy(string,pos1,pos2)
vall=get_info2(name2)
type=is_real(vall)
if type=0 then
if vall="#" then
vall=name2
val=real(vall)
find=0
for i=1 to num2 do
if number_name[i]=name then
number_info[i]=val
find=1
exit
end if
end for
if find=0 then
num2+=1
number_name[num2]=name
number_info[num2]=val
end if
end if
if vall!="#" then
print(2)
end if
end if
---
---
if type=1 then
find=0
for i=1 to num2 do
if number_name[i]=name then
number_info[i]=vall
find=1
exit
end if
end for
if find=0 then
num2+=1
number_name[num2]=name
number_info[num2]=vall
end if
end if
end if
end sub
sub execute_string(string)
--1 is -- 2 is a=a 3 is a=gg()
code=get_command(string)
if code=2 then
set_info2(string)
end if
end sub
execute_string("text='a d f g '")
execute_string("asd='gaz'")
execute_string("num= 12")
execute_string("num2= num")
execute_string("asd=text")
a=get_info2("num2")
--print(a)