Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add new simcall interface definitions.
[simgrid.git] / src / simix / smx_smurf_private.h
1 /* Copyright (c) 2007, 2008, 2009, 2010. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #ifndef _SIMIX_SMURF_PRIVATE_H
8 #define _SIMIX_SMURF_PRIVATE_H
9
10 /********************************* Simcalls *********************************/
11
12 /* we want to build the e_smx_simcall_t enumeration and the table of the
13  * corresponding strings automatically, using macros */
14
15 #define SIMCALL_LIST1 \
16 SIMCALL_ENUM_ELEMENT(SIMCALL_NONE),\
17 SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_BY_NAME),\
18 SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_NAME),\
19 SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_PROPERTIES),\
20 SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_SPEED),\
21 SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_AVAILABLE_SPEED),\
22 SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_STATE),\
23 SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_DATA),\
24 SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_SET_DATA),\
25 SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTE),\
26 SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_PARALLEL_EXECUTE),\
27 SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTION_DESTROY),\
28 SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTION_CANCEL),\
29 SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTION_GET_REMAINS),\
30 SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTION_GET_STATE),\
31 SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTION_SET_PRIORITY),\
32 SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTION_WAIT),\
33 SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_CREATE),\
34 SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_KILL),\
35 SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_KILLALL),\
36 SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_CLEANUP),\
37 SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_CHANGE_HOST),\
38 SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_SUSPEND),\
39 SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_RESUME),\
40 SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_COUNT),\
41 SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_GET_DATA),\
42 SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_SET_DATA),\
43 SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_GET_HOST),\
44 SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_GET_NAME),\
45 SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_IS_SUSPENDED),\
46 SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_GET_PROPERTIES),\
47 SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_SLEEP),\
48 SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_ON_EXIT),\
49 SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_AUTO_RESTART_SET),\
50 SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_RESTART),\
51 SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_CREATE),\
52 SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_DESTROY),\
53 SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_GEY_BY_NAME),\
54 SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_COMM_COUNT_BY_HOST),\
55 SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_GET_HEAD),\
56 SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_SET_RECV),\
57 SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_GET_RECV),\
58 SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_SEND),\
59 SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_ISEND),\
60 SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_RECV),\
61 SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_IRECV),\
62 SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_DESTROY),\
63 SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_CANCEL),\
64 SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_WAITANY),\
65 SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_WAIT),\
66 SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_TEST),\
67 SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_TESTANY),\
68 SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_IPROBE),\
69 SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_GET_REMAINS),\
70 SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_GET_STATE),\
71 SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_GET_SRC_DATA),\
72 SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_GET_DST_DATA),\
73 SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_GET_SRC_PROC),\
74 SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_GET_DST_PROC),\
75 SIMCALL_ENUM_ELEMENT(SIMCALL_MUTEX_INIT),\
76 SIMCALL_ENUM_ELEMENT(SIMCALL_MUTEX_DESTROY),\
77 SIMCALL_ENUM_ELEMENT(SIMCALL_MUTEX_LOCK),\
78 SIMCALL_ENUM_ELEMENT(SIMCALL_MUTEX_TRYLOCK),\
79 SIMCALL_ENUM_ELEMENT(SIMCALL_MUTEX_UNLOCK),\
80 SIMCALL_ENUM_ELEMENT(SIMCALL_COND_INIT),\
81 SIMCALL_ENUM_ELEMENT(SIMCALL_COND_DESTROY),\
82 SIMCALL_ENUM_ELEMENT(SIMCALL_COND_SIGNAL),\
83 SIMCALL_ENUM_ELEMENT(SIMCALL_COND_WAIT),\
84 SIMCALL_ENUM_ELEMENT(SIMCALL_COND_WAIT_TIMEOUT),\
85 SIMCALL_ENUM_ELEMENT(SIMCALL_COND_BROADCAST),\
86 SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_INIT),\
87 SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_DESTROY),\
88 SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_RELEASE),\
89 SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_WOULD_BLOCK),\
90 SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_ACQUIRE),\
91 SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_ACQUIRE_TIMEOUT),\
92 SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_GET_CAPACITY),\
93 SIMCALL_ENUM_ELEMENT(SIMCALL_FILE_READ),\
94 SIMCALL_ENUM_ELEMENT(SIMCALL_FILE_WRITE),\
95 SIMCALL_ENUM_ELEMENT(SIMCALL_FILE_OPEN),\
96 SIMCALL_ENUM_ELEMENT(SIMCALL_FILE_CLOSE),\
97 SIMCALL_ENUM_ELEMENT(SIMCALL_FILE_STAT), \
98 SIMCALL_ENUM_ELEMENT(SIMCALL_FILE_UNLINK),\
99 SIMCALL_ENUM_ELEMENT(SIMCALL_FILE_LS),\
100 SIMCALL_ENUM_ELEMENT(SIMCALL_ASR_GET_PROPERTIES), \
101 /* ****************************************************************************************** */ \
102 /* TUTORIAL: New API                                                                        */ \
103 /* ****************************************************************************************** */ \
104 SIMCALL_ENUM_ELEMENT(SIMCALL_NEW_API_INIT)
105
106 /* SIMCALL_COMM_IS_LATENCY_BOUNDED and SIMCALL_SET_CATEGORY make things complicated
107  * because they are not always present */
108 #ifdef HAVE_LATENCY_BOUND_TRACKING
109 #define SIMCALL_LIST2 \
110 ,SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_IS_LATENCY_BOUNDED)
111 #else
112 #define SIMCALL_LIST2
113 #endif
114
115 #ifdef HAVE_TRACING
116 #define SIMCALL_LIST3 \
117 ,SIMCALL_ENUM_ELEMENT(SIMCALL_SET_CATEGORY)
118 #else
119 #define SIMCALL_LIST3
120 #endif
121
122 #ifdef HAVE_MC
123 #define SIMCALL_LIST4                                        \
124   ,SIMCALL_ENUM_ELEMENT(SIMCALL_MC_SNAPSHOT)                 \
125   ,SIMCALL_ENUM_ELEMENT(SIMCALL_MC_COMPARE_SNAPSHOTS)
126 #else
127 #define SIMCALL_LIST4
128 #endif
129
130 /* SIMCALL_LIST is the final macro to use */
131 #define SIMCALL_LIST SIMCALL_LIST1 SIMCALL_LIST2 SIMCALL_LIST3 SIMCALL_LIST4
132
133 /* you can redefine the following macro differently to generate something else
134  * with the list of enumeration values (e.g. a table of strings or a table of function pointers) */
135 #define SIMCALL_ENUM_ELEMENT(x) x
136
137 /**
138  * \brief All possible simcalls.
139  */
140 typedef enum {
141 SIMCALL_LIST
142 } e_smx_simcall_t;
143
144 /**
145  * \brief Represents a simcall to the kernel.
146  */
147 typedef struct s_smx_simcall {
148   e_smx_simcall_t call;
149   smx_process_t issuer;
150
151   union {
152
153     struct {
154       const char *name;
155       smx_host_t result;
156     } host_get_by_name;
157
158     struct {
159       smx_host_t host;
160       const char* result;
161     } host_get_name;
162
163     struct {
164       smx_host_t host;
165       xbt_dict_t result;
166     } host_get_properties;
167
168     struct {
169       smx_host_t host;
170       double result;
171     } host_get_speed;
172
173     struct {
174       smx_host_t host;
175       double result;
176     } host_get_available_speed;
177
178     struct {
179       smx_host_t host;
180       int result;
181     } host_get_state;
182
183     struct {
184       smx_host_t host;
185       void* result;
186     } host_get_data;
187
188     struct {
189       smx_host_t host;
190       void* data;
191     } host_set_data;
192
193     struct {
194       const char* name;
195       smx_host_t host;
196       double computation_amount;
197       double priority;
198       smx_action_t result;
199     } host_execute;
200
201     struct {
202       const char *name;
203       int host_nb;
204       smx_host_t *host_list;
205       double *computation_amount;
206       double *communication_amount;
207       double amount;
208       double rate;
209       smx_action_t result;
210     } host_parallel_execute;
211
212     struct {
213       smx_action_t execution;
214     } host_execution_destroy;
215
216     struct {
217       smx_action_t execution;
218     } host_execution_cancel;
219
220     struct {
221       smx_action_t execution;
222       double result;
223     } host_execution_get_remains;
224
225     struct {
226       smx_action_t execution;
227       e_smx_state_t result;
228     } host_execution_get_state;
229
230     struct {
231       smx_action_t execution;
232       double priority;
233     } host_execution_set_priority;
234
235     struct {
236       smx_action_t execution;
237       e_smx_state_t result;
238     } host_execution_wait;
239
240     struct {
241       smx_process_t *process;
242       const char *name;
243       xbt_main_func_t code;
244       void *data;
245       const char *hostname;
246       double kill_time;
247       int argc;
248       char **argv;
249       xbt_dict_t properties;
250       int auto_restart;
251     } process_create;
252
253     struct {
254       smx_process_t process;
255     } process_kill;
256
257     struct {
258       smx_process_t process;
259     } process_cleanup;
260
261     struct {
262       smx_process_t process;
263       smx_host_t dest;
264     } process_change_host;
265
266     struct {
267       smx_process_t process;
268     } process_suspend;
269
270     struct {
271       smx_process_t process;
272     } process_resume;
273
274     struct {
275       int result;
276     } process_count;
277
278     struct {
279       smx_process_t process;
280       void* result;
281     } process_get_data;
282
283     struct {
284       smx_process_t process;
285       void* data;
286     } process_set_data;
287
288     struct {
289       smx_process_t process;
290       smx_host_t result;
291     } process_get_host;
292
293     struct {
294       smx_process_t process;
295       const char *result;
296     } process_get_name;
297
298     struct {
299       smx_process_t process;
300       int result;
301     } process_is_suspended;
302
303     struct {
304       smx_process_t process;
305       xbt_dict_t result;
306     } process_get_properties;
307
308     struct {
309       double duration;
310       e_smx_state_t result;
311     } process_sleep;
312
313     struct {
314       smx_process_t process;
315       int_f_pvoid_t fun;
316       void *data;
317     } process_on_exit;
318
319     struct {
320       smx_process_t process;
321       int auto_restart;
322     } process_auto_restart;
323
324     struct {
325       smx_process_t process;
326       smx_process_t result;
327     } process_restart;
328
329     struct {
330       const char *name;
331       smx_rdv_t result;
332     } rdv_create;
333
334     struct {
335       smx_rdv_t rdv;
336     } rdv_destroy;
337
338     struct {
339       const char* name;
340       smx_rdv_t result;
341     } rdv_get_by_name;
342
343     struct {
344       smx_rdv_t rdv;
345       smx_host_t host;
346       unsigned int result; 
347     } rdv_comm_count_by_host;
348
349     struct {
350       smx_rdv_t rdv;
351       smx_action_t result;
352     } rdv_get_head;
353
354     struct {
355       smx_rdv_t rdv;
356       smx_process_t receiver;
357     } rdv_set_rcv_proc;
358
359     struct {
360       smx_rdv_t rdv;
361       smx_process_t result;
362     } rdv_get_rcv_proc;
363
364     struct {
365       smx_rdv_t rdv;
366       double task_size;
367       double rate;
368       void *src_buff;
369       size_t src_buff_size;
370       int (*match_fun)(void *, void *, smx_action_t);
371       void *data;
372       double timeout;
373     } comm_send;
374
375     struct {
376       smx_rdv_t rdv;
377       double task_size;
378       double rate;
379       void *src_buff;
380       size_t src_buff_size;
381       int (*match_fun)(void *, void *, smx_action_t);
382       void (*clean_fun)(void *);
383       void *data;
384       int detached;
385       smx_action_t result;
386     } comm_isend;
387
388     struct {
389       smx_rdv_t rdv;
390       void *dst_buff;
391       size_t *dst_buff_size;
392       int (*match_fun)(void *, void *, smx_action_t);
393       void *data;
394       double timeout;
395     } comm_recv;
396
397     struct {
398       smx_rdv_t rdv;
399       void *dst_buff;
400       size_t *dst_buff_size;
401       int (*match_fun)(void *, void *, smx_action_t);
402       void *data;
403       smx_action_t result;
404     } comm_irecv;
405
406     struct {
407       smx_rdv_t rdv;
408       int src;
409       int tag;
410       int (*match_fun)(void *, void *, smx_action_t);
411       void *data;
412       smx_action_t result;
413     } comm_iprobe;
414
415     struct {
416       smx_action_t comm;
417     } comm_destroy;
418
419     struct {
420       smx_action_t comm;
421     } comm_cancel;
422
423     struct {
424       xbt_dynar_t comms;
425       unsigned int result;
426     } comm_waitany;
427
428     struct {
429       smx_action_t comm;
430       double timeout;
431     } comm_wait;
432
433     struct {
434       smx_action_t comm;
435       int result;
436     } comm_test;
437
438     struct {
439       xbt_dynar_t comms;
440       int result;
441     } comm_testany;
442
443     struct {
444       smx_action_t comm;
445       double result;
446     } comm_get_remains;
447
448     struct {
449       smx_action_t comm;
450       e_smx_state_t result;
451     } comm_get_state;
452
453     struct {
454       smx_action_t comm;
455       void *result;
456     } comm_get_src_data;
457
458     struct {
459       smx_action_t comm;
460       void *result;
461     } comm_get_dst_data;
462
463     struct {
464       smx_action_t comm;
465       smx_process_t result;
466     } comm_get_src_proc;
467
468     struct {
469       smx_action_t comm;
470       smx_process_t result;
471     } comm_get_dst_proc;
472
473 #ifdef HAVE_LATENCY_BOUND_TRACKING
474     struct {
475       smx_action_t comm;
476       int result;
477     } comm_is_latency_bounded;
478 #endif
479
480 #ifdef HAVE_TRACING
481     struct {
482       smx_action_t action;
483       const char *category;
484     } set_category;
485 #endif
486
487     struct {
488       smx_mutex_t result;
489     } mutex_init;
490
491     struct {
492       smx_mutex_t mutex;
493     } mutex_lock;
494
495     struct {
496       smx_mutex_t mutex;
497       int result;
498     } mutex_trylock;
499
500     struct {
501       smx_mutex_t mutex;
502     } mutex_unlock;
503
504     struct {
505       smx_mutex_t mutex;
506     } mutex_destroy;
507
508     struct {
509       smx_cond_t result;
510     } cond_init;
511
512     struct {
513       smx_cond_t cond;
514     } cond_destroy;
515
516     struct {
517       smx_cond_t cond;
518     } cond_signal;
519
520     struct {
521       smx_cond_t cond;
522       smx_mutex_t mutex;
523     } cond_wait;
524
525     struct {
526       smx_cond_t cond;
527       smx_mutex_t mutex;
528       double timeout;
529     } cond_wait_timeout;
530
531     struct {
532       smx_cond_t cond;
533     } cond_broadcast;
534
535     struct {
536       int capacity;
537       smx_sem_t result;
538     } sem_init;
539
540     struct {
541       smx_sem_t sem;
542     } sem_destroy;
543
544     struct {
545       smx_sem_t sem;
546     } sem_release;
547
548     struct {
549       smx_sem_t sem;
550       int result;
551     } sem_would_block;
552
553     struct {
554       smx_sem_t sem;
555     } sem_acquire;
556
557     struct {
558       smx_sem_t sem;
559       double timeout;
560     } sem_acquire_timeout;
561
562     struct {
563       smx_sem_t sem;
564       int result;
565     } sem_get_capacity;
566
567     struct {
568       void *ptr;
569       size_t size;
570       size_t nmemb;
571       smx_file_t stream;
572       double result;
573     } file_read;
574
575     struct {
576       const void *ptr;
577       size_t size;
578       size_t nmemb;
579       smx_file_t stream;
580       size_t result;
581     } file_write;
582
583     struct {
584       const char* mount;
585       const char* path;
586       const char* mode;
587       smx_file_t result;
588     } file_open;
589
590     struct {
591       smx_file_t fp;
592       int result;
593     } file_close;
594
595     struct {
596       smx_file_t fd;
597       s_file_stat_t buf;
598       int result;
599     } file_stat;
600
601     struct {
602       smx_file_t fd;
603       int result;
604     } file_unlink;
605
606     struct {
607       const char *mount;
608       const char *path;
609       xbt_dict_t result;
610     } file_ls;
611
612     struct {
613       const char* name;
614       xbt_dict_t result;
615     } asr_get_properties;
616
617     struct{
618       void *s;
619     } mc_snapshot;
620
621     struct{
622       void *snapshot1;
623       void *snapshot2;
624       int result;
625     } mc_compare_snapshots;
626
627     /* ****************************************************************************************** */
628     /* TUTORIAL: New API                                                                        */
629     /* ****************************************************************************************** */
630     struct {
631       const char* param1;
632       double param2;
633       int result;
634     } new_api;
635
636   };
637 } s_smx_simcall_t, *smx_simcall_t;
638
639 /******************************** General *************************************/
640
641 void SIMIX_simcall_push(smx_process_t self);
642 void SIMIX_simcall_answer(smx_simcall_t);
643 void SIMIX_simcall_pre(smx_simcall_t, int);
644 void SIMIX_simcall_post(smx_action_t);
645 smx_simcall_t SIMIX_simcall_mine(void);
646 const char *SIMIX_simcall_name(e_smx_simcall_t kind);
647
648 /*************************** New simcall interface ****************************/
649
650 /* Pack all possible scalar types in an union */
651 typedef union {
652   char            c;
653   short           s;
654   int             i;
655   long            l;
656   unsigned char   uc;
657   unsigned short  us;
658   unsigned int    ui;
659   unsigned long   ul;
660   float           f;
661   double          d;
662   void            *p;
663 } u_smx_scalar_t;
664
665 /*
666  * Define scalar type wrappers to ease the use of simcalls.
667  * These are used to wrap the arguments in SIMIX_simcall macro.
668  */
669 #define CHAR(x) (c,x)
670 #define SHORT(x) (s,x)
671 #define INT(x) (i,x)
672 #define LONG(x) (l,x)
673 #define UCHAR(x) (uc,x)
674 #define USHORT(x) (us,x)
675 #define UINT(x) (ui,x)
676 #define ULONG(x) (ul,x)
677 #define FLOAT(x) (f,x)
678 #define DOUBLE(x) (d,x)
679 #define PTR(x)  (p,x)
680
681 /*
682  * Some macro machinery to get a MAP over the arguments of a variadic macro.
683  * It uses a FOLD to apply a macro to every argument, and because there is
684  * no recursion in the C preprocessor we must create a new macro for every
685  * depth of FOLD's recursion.
686  */
687
688 /* FOLD macro */
689 #define FE_1(WHAT, X) WHAT(X)
690 #define FE_2(WHAT, X, ...) WHAT(X), FE_1(WHAT, __VA_ARGS__)
691 #define FE_3(WHAT, X, ...) WHAT(X), FE_2(WHAT, __VA_ARGS__)
692 #define FE_4(WHAT, X, ...) WHAT(X), FE_3(WHAT, __VA_ARGS__)
693 #define FE_5(WHAT, X, ...) WHAT(X), FE_4(WHAT, __VA_ARGS__)
694 /* NOTE: add as many FE_n as needed (maximum number of simcall arguments )*/
695
696 /* Make a MAP macro usgin FOLD (will apply 'action' to the arguments.
697  * GET_MACRO is a smart hack that counts the number of arguments passed to
698  * the variadic macro, and it is used to invoke the right FOLD depth.
699  */
700 #define GET_MACRO(_1,_2,_3,_4,_5,NAME,...) NAME
701 #define MAP(action,...) \
702   GET_MACRO(__VA_ARGS__,FE_5,FE_4,FE_3,FE_2,FE_1) (action, __VA_ARGS__)
703
704
705 /* Generate code to initialize the field 'x' with value 'y' of an structure or union */
706 #define INIT_FIELD_(x,y) {.x = y}
707 #define INIT_FIELD(t) INIT_FIELD t
708
709 /* Project the second element of a tuple */
710 #define SECOND_(x, y) y
711 #define SECOND(t) SECOND_ t
712
713 /*
714  * \brief Simcall invocation macro
715  * It calls a dummy function that uses the format attribute to ensure typesafety (see
716  * gcc format attribute), then it invokes the real simcall function packing the
717  * user provided arguments in an array.
718  * \param id a simcall id (from the simcall enumeration ids)
719  *
720  */
721 #define SIMIX_simcall(id, ...) \
722   SIMIX_simcall_typecheck(simcall_types[id], MAP(SECOND, __VA_ARGS__)); \
723   __SIMIX_simcall(id, (mytype_t[]){MAP(INIT_FIELD, __VA_ARGS__)})
724
725 void __SIMIX_simcall(e_smx_simcall_t simcall_id, u_smx_scalar_t *args);
726
727 /*
728  * \biref Dummy variadic function used to typecheck the arguments of a simcall
729  * \param fmt A format string following printf style
730  */
731 void SIMIX_simcall_typecheck(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
732
733
734 #endif
735