-
Notifications
You must be signed in to change notification settings - Fork 0
/
test1.p
54 lines (38 loc) · 1.09 KB
/
test1.p
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
import ('io', 'time');
main(){
print("Hello World!\n");
print("string is %s and number is %.5n \n", 'hello world!', 3.14, 'format %n\n', 2);
file = io.file;
keyboard = io.keyboard;
f = file.open("help.chw", 'r');
print("open file by fd %n\n", f.fd);
print("type of f %s\n", typeof(f));
buf = f.read(f.length());
print("%s\n", buf);
print("tell %n\n", f.tell());
print("cwd %s\n", file.cwd());
print("rename %n\n", file.rename("help","help.chw"));
f.close();
t = time.tick();
sum = 0;
i = 0;
while(i < 1000000){
sum = sum + i;
i = i + 1;
}
fmt = format("%.2n in %.8n sec\n", sum, (time.tick() - t) / 1000000);
print(fmt);
print("size of fmt %.2n\n", sizeof(fmt));
print("type of fmt %s\n", typeof(fmt));
list = [0,10,20,30,40,50,60,70,80,90];
insert(list, 1, 300);
delete(list, 1, 2, 3, 4, 5, 6, 7);
print("%s %n\n", list, count(list));
fls = file.walk("libs");
i = 0;
while(i < count(fls)){
print("%s\n", fls[i]);
i = i + 1;
}
keyboard.get();
}