1 /* Copyright (c) 2007-2010, 2012-2014. The SimGrid Team.
2 * All rights reserved. */
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. */
7 #ifndef _SIMIX_SMURF_PRIVATE_H
8 #define _SIMIX_SMURF_PRIVATE_H
12 /********************************* Simcalls *********************************/
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:
22 * \brief All possible simcalls.
26 #include "simcalls_generated_enum.h"
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
35 /* Pack all possible scalar types in an union */
56 * \brief Represents a simcall to the kernel.
58 typedef struct s_smx_simcall {
64 union u_smx_scalar args[10];
65 union u_smx_scalar result;
66 //FIXME: union u_smx_scalar retval;
75 } s_smx_simcall_t, *smx_simcall_t;
78 #define SIMCALL_SET_MC_VALUE(simcall, value) ((simcall)->mc_value = (value))
79 #define SIMCALL_GET_MC_VALUE(simcall) ((simcall)->mc_value)
81 #define SIMCALL_SET_MC_VALUE(simcall, value) ((void)0)
82 #define SIMCALL_GET_MC_VALUE(simcall) 0
85 #include "simcalls_generated_res_getter_setter.h"
86 #include "simcalls_generated_args_getter_setter.h"
88 /******************************** General *************************************/
90 void SIMIX_simcall_push(smx_process_t self);
91 void SIMIX_simcall_answer(smx_simcall_t);
92 void SIMIX_simcall_pre(smx_simcall_t, int);
93 void SIMIX_simcall_post(smx_action_t);
94 smx_simcall_t SIMIX_simcall_mine(void);
95 const char *SIMIX_simcall_name(e_smx_simcall_t kind);
96 //TOFIX put it in a better place
97 xbt_dict_t SIMIX_pre_asr_get_properties(smx_simcall_t simcall, const char *name);
99 /*************************** New simcall interface ****************************/
101 typedef smx_action_t (*simcall_handler_t)(u_smx_scalar_t *);
103 extern const char *simcall_types[];
104 extern simcall_handler_t simcall_table[];