-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
EuSys2.ew
167 lines (95 loc) · 4.08 KB
/
EuSys2.ew
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
without warning
without type_check
include std/dll.e
include std/machine.e
include sfFlags.e
atom sys = open_dll("csfml-system-2.dll")
if sys = -1 then
puts(1,"Could not load csfml-system-2.dll!\n")
abort(0)
end if
--Clock functions
public constant xsfClock_create = define_c_func(sys,"+sfClock_create",{},C_POINTER),
xsfClock_copy = define_c_func(sys,"+sfClock_copy",{C_POINTER},C_POINTER),
xsfClock_destroy = define_c_proc(sys,"+sfClock_destroy",{C_POINTER}),
xsfClock_getElapsedTime = define_c_func(sys,"+sfClock_getElapsedTime",{C_POINTER},C_POINTER),
xsfClock_restart = define_c_func(sys,"+sfClock_restart",{C_POINTER},C_POINTER)
public function sfClock_create()
return c_func(xsfClock_create,{})
end function
public function sfClock_copy(atom clock)
return c_func(xsfClock_copy,{clock})
end function
public procedure sfClock_destroy(atom clock)
c_proc(xsfClock_destroy,{clock})
end procedure
public function sfClock_getElapsedTime(atom clock)
return c_func(xsfClock_getElapsedTime,{clock})
end function
public function sfClock_restart(atom clock)
return c_func(xsfClock_restart,{clock})
end function
--Time Functions
public constant xsfTime_asSeconds = define_c_func(sys,"+sfTime_asSeconds",{C_POINTER},C_FLOAT),
xsfTime_asMilliseconds = define_c_func(sys,"+sfTime_asMilliseconds",{C_POINTER},C_POINTER),
xsfTime_asMicroseconds = define_c_func(sys,"+sfTime_asMircoseconds",{C_POINTER},C_POINTER),
xsfSeconds = define_c_func(sys,"+sfTime_sfSeconds",{C_FLOAT},C_POINTER),
xsfMilliseconds = define_c_func(sys,"+sfTime_Milliseconds",{C_POINTER},C_POINTER),
xsfMicroseconds = define_c_func(sys,"+sfTime_Microseconds",{C_POINTER},C_POINTER)
public function sfTime_asSeconds(atom xtime)
return c_func(xsfTime_asSeconds,{xtime})
end function
public function sfTime_asMilliseconds(atom xtime)
return c_func(xsfTime_asMilliseconds,{xtime})
end function
public function sfTime_asMicroseconds(atom xtime)
return c_func(xsfTime_asMicroseconds,{xtime})
end function
public function sfSeconds(atom amount)
return c_func(xsfSeconds,{amount})
end function
public function sfMilliseconds(atom amount)
return c_func(xsfMilliseconds,{amount})
end function
public function sfMicroseconds(atom amount)
return c_func(xsfMicroseconds,{amount})
end function
--Mutex functions
public constant xsfMutex_create = define_c_func(sys,"+sfMutex_create",{},C_POINTER),
xsfMutex_destroy = define_c_proc(sys,"+sfMutex_destroy",{C_POINTER}),
xsfMutex_lock = define_c_proc(sys,"+sfMutex_lock",{C_POINTER}),
xsfMutex_unlock = define_c_proc(sys,"+sfMutex_unlock",{C_POINTER})
public function sfMutex_create()
return c_func(xsfMutex_create,{})
end function
public procedure sfMutex_destroy(atom mutex)
c_proc(xsfMutex_destroy,{mutex})
end procedure
public procedure sfMutex_lock(atom mutex)
c_proc(xsfMutex_lock,{mutex})
end procedure
public procedure sfMutex_unlock(atom mutex)
c_proc(xsfMutex_unlock,{mutex})
end procedure
--Thread functions
public constant xsfThread_create = define_c_func(sys,"+sfThread_create",{C_POINTER,C_POINTER,C_POINTER},C_POINTER),
xsfThread_destroy = define_c_proc(sys,"s+fThread_destroy",{C_POINTER}),
xsfThread_launch = define_c_proc(sys,"+sfThread_launch",{C_POINTER}),
xsfThread_wait = define_c_proc(sys,"+sfThread_wait",{C_POINTER}),
xsfThread_terminate = define_c_proc(sys,"+sfThread_terminate",{C_POINTER})
public function sfThread_create(object x,object func,object data)
return c_func(xsfThread_create,{x,func,data})
end function
public procedure sfThread_destroy(atom thread)
c_proc(xsfThread_destroy,{thread})
end procedure
public procedure sfThread_launch(atom thread)
c_proc(xsfThread_launch,{thread})
end procedure
public procedure sfThread_wait(atom thread)
c_proc(xsfThread_wait,{thread})
end procedure
public procedure sfThread_terminate(atom thread)
c_proc(xsfThread_terminate,{thread})
end procedure
136.46