Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Deprecate the is_off() methods.
[simgrid.git] / src / msg / msg_legacy.cpp
1 /* Copyright (c) 2004-2019. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include "simgrid/Exception.hpp"
7 #include "src/msg/msg_private.hpp"
8
9 #define MSG_CALL(type, oldname, args)
10
11 /* ************************** Engine *************************** */
12 void MSG_create_environment(const char* filename)
13 {
14   simgrid_load_platform(filename);
15 }
16
17 void MSG_launch_application(const char* filename)
18 {
19   simgrid_load_deployment(filename);
20 }
21 msg_error_t MSG_main()
22 {
23   simgrid_run();
24   return MSG_OK;
25 }
26 void MSG_function_register(const char* name, xbt_main_func_t code)
27 {
28   simgrid_register_function(name, code);
29 }
30 void MSG_function_register_default(xbt_main_func_t code)
31 {
32   simgrid_register_default(code);
33 }
34 double MSG_get_clock()
35 {
36   return simgrid_get_clock();
37 }
38
39 /* ************************** Mailboxes ************************ */
40 void MSG_mailbox_set_async(const char* alias)
41 {
42   sg_mailbox_set_receiver(alias);
43 }
44 int MSG_task_listen(const char* alias)
45 {
46   return sg_mailbox_listen(alias);
47 }
48
49 /* ************************** Actors *************************** */
50 int MSG_process_get_PID(sg_actor_t actor)
51 {
52   return sg_actor_get_PID(actor);
53 }
54 int MSG_process_get_PPID(sg_actor_t actor)
55 {
56   return sg_actor_get_PPID(actor);
57 }
58 msg_process_t MSG_process_from_PID(int PID)
59 {
60   return sg_actor_by_PID(PID);
61 }
62 const char* MSG_process_get_name(sg_actor_t actor)
63 {
64   return sg_actor_get_name(actor);
65 }
66 sg_host_t MSG_process_get_host(sg_actor_t actor)
67 {
68   return sg_actor_get_host(actor);
69 }
70 xbt_dict_t MSG_process_get_properties(sg_actor_t actor)
71 {
72   return sg_actor_get_properties(actor);
73 }
74 const char* MSG_process_get_property_value(sg_actor_t actor, const char* name)
75 {
76   return sg_actor_get_property_value(actor, name);
77 }
78 void MSG_process_suspend(sg_actor_t actor)
79 {
80   sg_actor_suspend(actor);
81 }
82 void MSG_process_resume(sg_actor_t actor)
83 {
84   sg_actor_resume(actor);
85 }
86 int MSG_process_is_suspended(sg_actor_t actor)
87 {
88   return sg_actor_is_suspended(actor);
89 }
90 void MSG_process_restart(sg_actor_t actor)
91 {
92   sg_actor_restart(actor);
93 }
94 void MSG_process_auto_restart_set(sg_actor_t actor, int auto_restart)
95 {
96   sg_actor_set_auto_restart(actor, auto_restart);
97 }
98
99 void MSG_process_daemonize(sg_actor_t actor)
100 {
101   sg_actor_daemonize(actor);
102 }
103 void MSG_process_migrate(sg_actor_t actor, sg_host_t host)
104 {
105   sg_actor_migrate(actor, host);
106 }
107 void MSG_process_join(sg_actor_t actor, double timeout)
108 {
109   sg_actor_join(actor, timeout);
110 }
111 void MSG_process_kill(sg_actor_t actor)
112 {
113   sg_actor_kill(actor);
114 }
115 void MSG_process_killall()
116 {
117   sg_actor_kill_all();
118 }
119 void MSG_process_set_kill_time(sg_actor_t actor, double kill_time)
120 {
121   sg_actor_set_kill_time(actor, kill_time);
122 }
123 void MSG_process_yield()
124 {
125   sg_actor_yield();
126 }
127
128 msg_error_t MSG_process_sleep(double duration)
129 {
130   try {
131     sg_actor_sleep_for(duration);
132     return MSG_OK;
133   } catch (simgrid::HostFailureException& e) {
134     return MSG_HOST_FAILURE;
135   }
136 }
137 /* ************************** NetZones *************************** */
138 sg_netzone_t MSG_zone_get_root()
139 {
140   return sg_zone_get_root();
141 }
142 const char* MSG_zone_get_name(sg_netzone_t zone)
143 {
144   return sg_zone_get_name(zone);
145 }
146 sg_netzone_t MSG_zone_get_by_name(const char* name)
147 {
148   return sg_zone_get_by_name(name);
149 }
150 void MSG_zone_get_sons(sg_netzone_t zone, xbt_dict_t whereto)
151 {
152   return sg_zone_get_sons(zone, whereto);
153 }
154 const char* MSG_zone_get_property_value(sg_netzone_t zone, const char* name)
155 {
156   return sg_zone_get_property_value(zone, name);
157 }
158 void MSG_zone_set_property_value(sg_netzone_t zone, const char* name, char* value)
159 {
160   sg_zone_set_property_value(zone, name, value);
161 }
162 void MSG_zone_get_hosts(sg_netzone_t zone, xbt_dynar_t whereto)
163 {
164   sg_zone_get_hosts(zone, whereto);
165 }
166
167 /* ************************** Storages *************************** */
168 const char* MSG_storage_get_name(sg_storage_t storage)
169 {
170   return sg_storage_get_name(storage);
171 }
172 sg_storage_t MSG_storage_get_by_name(const char* name)
173 {
174   return sg_storage_get_by_name(name);
175 }
176 xbt_dict_t MSG_storage_get_properties(sg_storage_t storage)
177 {
178   return sg_storage_get_properties(storage);
179 }
180 void MSG_storage_set_property_value(sg_storage_t storage, const char* name, const char* value)
181 {
182   sg_storage_set_property_value(storage, name, value);
183 }
184 const char* MSG_storage_get_property_value(sg_storage_t storage, const char* name)
185 {
186   return sg_storage_get_property_value(storage, name);
187 }
188 xbt_dynar_t MSG_storages_as_dynar()
189 {
190   return sg_storages_as_dynar();
191 }
192 void MSG_storage_set_data(sg_storage_t storage, void* data)
193 {
194   sg_storage_set_data(storage, data);
195 }
196 void* MSG_storage_get_data(sg_storage_t storage)
197 {
198   return sg_storage_get_data(storage);
199 }
200 const char* MSG_storage_get_host(sg_storage_t storage)
201 {
202   return sg_storage_get_host(storage);
203 }
204 sg_size_t MSG_storage_read(sg_storage_t storage, sg_size_t size)
205 {
206   return sg_storage_read(storage, size);
207 }
208 sg_size_t MSG_storage_write(sg_storage_t storage, sg_size_t size)
209 {
210   return sg_storage_write(storage, size);
211 }
212
213 /* ************************** hosts *************************** */
214 xbt_dynar_t MSG_hosts_as_dynar()
215 {
216   return sg_hosts_as_dynar();
217 }
218 size_t MSG_get_host_number()
219 {
220   return sg_host_count();
221 }
222 sg_host_t MSG_get_host_by_name(const char* name)
223 {
224   return sg_host_by_name(name);
225 }
226 sg_host_t MSG_host_by_name(const char* name)
227 {
228   return sg_host_by_name(name);
229 }
230 const char* MSG_host_get_name(sg_host_t host)
231 {
232   return sg_host_get_name(host);
233 }
234 void* MSG_host_get_data(sg_host_t host)
235 {
236   return sg_host_user(host);
237 }
238 void MSG_host_set_data(sg_host_t host, void* data)
239 {
240   return sg_host_user_set(host, data);
241 }
242 xbt_dict_t MSG_host_get_mounted_storage_list(sg_host_t host)
243 {
244   return sg_host_get_mounted_storage_list(host);
245 }
246 xbt_dynar_t MSG_host_get_attached_storage_lists(sg_host_t host)
247 {
248   return sg_host_get_attached_storage_list(host);
249 }
250 double MSG_host_get_speed(sg_host_t host)
251 {
252   return sg_host_speed(host);
253 }
254 double MSG_host_get_power_peak_at(sg_host_t host, int pstate_index)
255 {
256   return sg_host_get_pstate_speed(host, pstate_index);
257 }
258 int MSG_host_get_core_number(sg_host_t host)
259 {
260   return sg_host_core_count(host);
261 }
262 int MSG_host_get_nb_pstates(sg_host_t host)
263 {
264   return sg_host_get_nb_pstates(host);
265 }
266 int MSG_host_get_pstate(sg_host_t host)
267 {
268   return sg_host_get_pstate(host);
269 }
270 void MSG_host_set_pstate(sg_host_t host, int pstate)
271 {
272   sg_host_set_pstate(host, pstate);
273 }
274 void MSG_host_on(sg_host_t h)
275 {
276   sg_host_turn_on(h);
277 }
278 void MSG_host_off(sg_host_t h)
279 {
280   sg_host_turn_off(h);
281 }
282 int MSG_host_is_on(sg_host_t h)
283 {
284   return sg_host_is_on(h);
285 }
286 int MSG_host_is_off(sg_host_t h) // deprecated
287 {
288   return not sg_host_is_on(h);
289 }
290 xbt_dict_t MSG_host_get_properties(sg_host_t host)
291 {
292   return sg_host_get_properties(host);
293 }
294 const char* MSG_host_get_property_value(sg_host_t host, const char* name)
295 {
296   return sg_host_get_property_value(host, name);
297 }
298 void MSG_host_set_property_value(sg_host_t host, const char* name, const char* value)
299 {
300   sg_host_set_property_value(host, name, value);
301 }
302 void MSG_host_get_process_list(sg_host_t host, xbt_dynar_t whereto)
303 {
304   sg_host_get_actor_list(host, whereto);
305 }
306 sg_host_t MSG_host_self()
307 {
308   return sg_host_self();
309 }
310
311 double MSG_host_get_load(sg_host_t host)
312 {
313   return sg_host_load(host);
314 }
315 /* ************************** Virtual Machines *************************** */
316 sg_vm_t MSG_vm_create_core(sg_host_t pm, const char* name)
317 {
318   return sg_vm_create_core(pm, name);
319 }
320 sg_vm_t MSG_vm_create_multicore(sg_host_t pm, const char* name, int coreAmount)
321 {
322   return sg_vm_create_multicore(pm, name, coreAmount);
323 }
324 int MSG_vm_is_created(sg_vm_t vm)
325 {
326   return sg_vm_is_created(vm);
327 }
328 int MSG_vm_is_running(sg_vm_t vm)
329 {
330   return sg_vm_is_running(vm);
331 }
332 int MSG_vm_is_suspended(sg_vm_t vm)
333 {
334   return sg_vm_is_suspended(vm);
335 }
336 const char* MSG_vm_get_name(sg_vm_t vm)
337 {
338   return sg_vm_get_name(vm);
339 }
340 void MSG_vm_set_ramsize(sg_vm_t vm, size_t size)
341 {
342   sg_vm_set_ramsize(vm, size);
343 }
344 size_t MSG_vm_get_ramsize(sg_vm_t vm)
345 {
346   return sg_vm_get_ramsize(vm);
347 }
348 sg_host_t MSG_vm_get_pm(sg_vm_t vm)
349 {
350   return sg_vm_get_pm(vm);
351 }
352 void MSG_vm_set_bound(sg_vm_t vm, double bound)
353 {
354   sg_vm_set_bound(vm, bound);
355 }
356 void MSG_vm_start(sg_vm_t vm)
357 {
358   sg_vm_start(vm);
359 }
360 void MSG_vm_suspend(sg_vm_t vm)
361 {
362   sg_vm_suspend(vm);
363 }
364 void MSG_vm_resume(sg_vm_t vm)
365 {
366   sg_vm_resume(vm);
367 }
368 void MSG_vm_shutdown(sg_vm_t vm)
369 {
370   sg_vm_shutdown(vm);
371 }
372 void MSG_vm_destroy(sg_vm_t vm)
373 {
374   sg_vm_destroy(vm);
375 }
376 /********* barriers ************/
377 sg_bar_t MSG_barrier_init(unsigned int count)
378 {
379   return sg_barrier_init(count);
380 }
381
382 void MSG_barrier_destroy(sg_bar_t bar)
383 {
384   sg_barrier_destroy(bar);
385 }
386
387 int MSG_barrier_wait(sg_bar_t bar)
388 {
389   return sg_barrier_wait(bar);
390 }
391
392 sg_sem_t MSG_sem_init(int initial_value)
393 {
394   return sg_sem_init(initial_value);
395 }
396 void MSG_sem_acquire(sg_sem_t sem)
397 {
398   sg_sem_acquire(sem);
399 }
400 int MSG_sem_acquire_timeout(sg_sem_t sem, double timeout)
401 {
402   return sg_sem_acquire_timeout(sem, timeout);
403 }
404 void MSG_sem_release(sg_sem_t sem)
405 {
406   sg_sem_release(sem);
407 }
408 int MSG_sem_get_capacity(sg_sem_t sem)
409 {
410   return sg_sem_get_capacity(sem);
411 }
412 void MSG_sem_destroy(sg_sem_t sem)
413 {
414   sg_sem_destroy(sem);
415 }
416 int MSG_sem_would_block(sg_sem_t sem)
417 {
418   return sg_sem_would_block(sem);
419 }