Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Simcalls generated by python script
[simgrid.git] / src / simix / smx_smurf_private.h
1 /* Copyright (c) 2007-2010, 2012-2013. 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 SG_BEGIN_DECL()
11
12 /********************************* Simcalls *********************************/
13
14 /* we want to build the e_smx_simcall_t enumeration, the table of the
15  * corresponding simcalls string names, and the simcall handlers table
16  * automatically, using macros.
17  * To add a new simcall follow the following syntax:
18  *
19  * */
20
21 /**
22  * \brief All possible simcalls.
23  */
24 typedef enum {
25 SIMCALL_NONE,
26 #include "simcalls_generated_enum.h"
27 SIMCALL_NEW_API_INIT,
28 NUM_SIMCALLS
29 } e_smx_simcall_t;
30
31 typedef int (*simix_match_func_t)(void *, void *, smx_action_t);
32 typedef void (*simix_clean_func_t)(void *);
33 typedef void (*FPtr)(void); // Hide the ugliness
34
35 /* Pack all possible scalar types in an union */
36 union u_smx_scalar {
37   char            c;
38   const char*     cc;
39   short           s;
40   int             i;
41   long            l;
42   unsigned char   uc;
43   unsigned short  us;
44   unsigned int    ui;
45   unsigned long   ul;
46   float           f;
47   double          d;
48   size_t          sz;
49   sg_size_t       sgsz;
50   void*           dp;
51   FPtr            fp;
52   const void*     cp;
53 };
54
55 /**
56  * \brief Represents a simcall to the kernel.
57  */
58 typedef struct s_smx_simcall {
59   e_smx_simcall_t call;
60   smx_process_t issuer;
61   int mc_value;
62   union u_smx_scalar args[10];
63   union u_smx_scalar result;
64   //FIXME: union u_smx_scalar retval;
65   union {
66     struct {
67       const char* param1;
68       double param2;
69       int result;
70     } new_api;
71
72   };
73 } s_smx_simcall_t, *smx_simcall_t;
74
75 #include "simcalls_generated_res_getter_setter.h"
76 #include "simcalls_generated_args_getter_setter.h"
77
78 /******************************** General *************************************/
79
80 void SIMIX_simcall_push(smx_process_t self);
81 void SIMIX_simcall_answer(smx_simcall_t);
82 void SIMIX_simcall_pre(smx_simcall_t, int);
83 void SIMIX_simcall_post(smx_action_t);
84 smx_simcall_t SIMIX_simcall_mine(void);
85 const char *SIMIX_simcall_name(e_smx_simcall_t kind);
86 //TOFIX put it in a better place
87 xbt_dict_t SIMIX_pre_asr_get_properties(smx_simcall_t simcall, const char *name);
88
89 /*************************** New simcall interface ****************************/
90
91 typedef smx_action_t (*simcall_handler_t)(u_smx_scalar_t *);
92
93 extern const char *simcall_types[];
94 extern simcall_handler_t simcall_table[];
95
96 SG_END_DECL()
97
98 #endif