Skip to content

Commit 20277f3

Browse files
committed
Initial commit
0 parents  commit 20277f3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+45715
-0
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

0PRO.EX

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
without type_check
2+
without warning
3+
4+
include graphics.e
5+
include mouse2.e
6+
include font.e
7+
include image.e
8+
9+
atom key
10+
11+
if graphics_mode(18) then
12+
end if
13+
14+
procedure line(atom x, atom y, atom xx, atom yy, atom color)
15+
draw_line(color,{{x,y},{xx,yy}})
16+
end procedure
17+
18+
procedure rectangle(atom x,atom y,atom xx,atom yy,atom color,atom sel)
19+
polygon(color, sel, {{x, y}, {xx, y}, {xx, yy},{x,yy}})
20+
end procedure
21+
22+
sequence text, buffer
23+
integer chr1,line1
24+
text={}
25+
chr1=0
26+
line1=1
27+
buffer={}
28+
29+
procedure display_line()
30+
if length(buffer)<=1 then
31+
position(1,1)
32+
puts(1,text)
33+
else
34+
for i=1 to length(buffer) do
35+
position(i,1)
36+
puts(1,buffer[i])
37+
end for
38+
end if
39+
end procedure
40+
41+
procedure insert_chr(integer chr)
42+
sequence a,b
43+
if length(text)>0 then
44+
a=text[1..chr1]
45+
b=text[chr1+1..length(text)]
46+
text=a&chr&b
47+
end if
48+
if length(text)=0 then
49+
text&=chr
50+
end if
51+
chr1+=1
52+
end procedure
53+
54+
procedure user_input()
55+
if key >2 and key <256 then
56+
if key!=128 and key!=64 and key!=27 and key!=13 and key!=8 and key!=4 then
57+
insert_chr(key)
58+
display_line()
59+
end if
60+
end if
61+
end procedure
62+
63+
while 1 do
64+
key=get_key()
65+
if key != -1 then
66+
if key=27 then
67+
exit
68+
end if
69+
end if
70+
mouse()
71+
user_input()
72+
end while

1.BAT

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
ex.exe draw2.ex
3+

1.GAZ

+193
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
-- set the graphics mode to pixle screen 640/480
2+
graphics_mode(3)
3+
-- set the background color to blue
4+
bk_color(1)
5+
-- set the text color to light gray
6+
text_color(2)
7+
-- draw the title at positions 1/30
8+
position(1,30)
9+
print("Database Program")
10+
position(2,30)
11+
print("----------------")
12+
13+
-- draw the commands
14+
text_color(4)
15+
position(4,2)
16+
name="(1)"
17+
print(name)
18+
position(4,10)
19+
name="(2)"
20+
print(name)
21+
position(4,22)
22+
name="(3)"
23+
print(name)
24+
text_color(2)
25+
position(4,5)
26+
name="add"
27+
print(name)
28+
position(4,13)
29+
name="find"
30+
print(name)
31+
position(4,25)
32+
name="exit"
33+
print(name)
34+
--
35+
-- draw the input box
36+
position(28,1)
37+
name="-------------------------------------------------------------------------------"
38+
print(name)
39+
position(30,1)
40+
name="-------------------------------------------------------------------------------"
41+
print(name)
42+
--
43+
function get_chr()
44+
key=get_key()
45+
if key!=0 then
46+
if key>0 then
47+
if key<256 then
48+
if key!=27 then
49+
return key
50+
end if
51+
end if
52+
end if
53+
end if
54+
return 0
55+
end function
56+
57+
function get_input(info)
58+
timer=0
59+
len1=string_length(info)
60+
len1+=2
61+
position(29,1)
62+
print(info)
63+
pos=len1
64+
string=""
65+
while 1=1 do
66+
timer+=0.01
67+
if timer>5 then
68+
if timer<5.2 then
69+
position(29,pos)
70+
print("_")
71+
end if
72+
end if
73+
if timer>10 then
74+
position(29,pos)
75+
print(" ")
76+
timer=0
77+
end if
78+
key=get_chr()
79+
if key>0 then
80+
if key!=8 then
81+
if key!=13 then
82+
if key!=1 then
83+
chr=string_chr(key)
84+
string+=chr
85+
position(29,pos)
86+
print(" ")
87+
pos+=1
88+
position(29,len1)
89+
print(string)
90+
timer=0
91+
end if
92+
end if
93+
end if
94+
end if
95+
if key=13 then
96+
position(29,1)
97+
print(" ")
98+
return string
99+
end if
100+
if key=8 then
101+
len=string_length(string)
102+
if len>0 then
103+
string=string_remove_chr(string,len)
104+
position(29,pos)
105+
print(" ")
106+
pos-=1
107+
position(29,len1)
108+
print(string)
109+
timer=0
110+
end if
111+
end if
112+
end while
113+
end function
114+
115+
sub add()
116+
while 1=1 do
117+
temp=get_input("enter name?")
118+
if temp!="" then
119+
insert_row(temp)
120+
row=temp
121+
exit
122+
end if
123+
end while
124+
while 1=1 do
125+
temp=get_input("enter phone number?")
126+
if temp!="" then
127+
insert_col(row,"phone",temp)
128+
exit
129+
end if
130+
end while
131+
end sub
132+
133+
sub find()
134+
can=1
135+
while 1=1 do
136+
temp=get_input("enter name?")
137+
if temp!="" then
138+
col=get_data(temp,"phone")
139+
row=temp
140+
if col!="" then
141+
position(24,1)
142+
print("found ")
143+
print(row)
144+
exit
145+
end if
146+
if col="" then
147+
position(24,1)
148+
print("can't find ")
149+
print(row)
150+
can=0
151+
exit
152+
end if
153+
end if
154+
end while
155+
while can=1 do
156+
position(25,1)
157+
print(row)
158+
position(26,1)
159+
print(col)
160+
can=0
161+
end while
162+
end sub
163+
164+
sub main()
165+
temp=""
166+
err=db_open("1.txt")
167+
while 1=1 do
168+
key=get_key()
169+
if key=49 then
170+
add()
171+
end if
172+
if key=50 then
173+
find()
174+
end if
175+
if key=51 then
176+
while 1=1 do
177+
temp=get_input("do you want to exit y or n?")
178+
if temp="y" then
179+
bk_color(0)
180+
cls()
181+
db_close()
182+
abort()
183+
end if
184+
if temp="n" then
185+
exit
186+
end if
187+
end while
188+
end if
189+
end while
190+
db_close()
191+
end sub
192+
193+
main()

0 commit comments

Comments
 (0)