Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Ongoing cleanup in ruby bindings. Does not compile yet, but commiting anyway because...
[simgrid.git] / src / bindings / ruby_bindings.h
1 /* SimGrid -- Ruby bindings */
2
3 /* Copyright (c) 2010, the SimGrid team. All right reserved */
4
5 /* This program is free software; you can redistribute it and/or modify it
6  * under the terms of the license (GNU LGPL) which comes with this package. */
7
8
9 #ifndef RB_SG_BINDINGS
10 #define RB_SG_BINDINGS
11 /*
12  * There is 4 sections in this file:
13  *  - Header loading (ruby makes it quite difficult, damn it)
14  *  - definitions of ruby contextes for use in simix
15  *  - Functions to Manage The Ruby Process  (named Up Calls)
16  *  - Functions to Manage The Native Process Simulation Bound (named Down Calls)
17  */
18
19 #include "msg/msg.h"
20 #include "msg/datatypes.h"
21
22 //#include "msg/private.h"
23 //#include "msg/mailbox.h"
24 #include "surf/surfxml_parse.h"
25 #include "simix/simix.h"
26 #include "simix/private.h"
27 #include "xbt/sysdep.h"
28 #include "xbt/log.h"
29 #include "xbt/asserts.h"
30 //#include "rb_msg_host.h"
31
32 /* Damn Ruby. They load their full config.h, which breaks since we also load ours.
33  * So, we undef the offending defines
34  */
35 #undef PACKAGE_VERSION
36 #undef PACKAGE_NAME
37 #undef PACKAGE_TARNAME
38 #undef PACKAGE_STRING
39 #undef PACKAGE_BUGREPORT
40 #undef _GNU_SOURCE
41 #include <ruby.h>
42
43
44
45 /* ********************* *
46  * Context related stuff *
47  * ********************* */
48 typedef struct s_smx_ctx_ruby {
49   SMX_CTX_BASE_T;
50   VALUE process;   // The  Ruby Process Instance
51   //...
52 }s_smx_ctx_ruby_t,*smx_ctx_ruby_t;
53 void SIMIX_ctx_ruby_factory_init(smx_context_factory_t *factory);
54
55
56 void initRuby(void); // Mandatory to call Ruby methods from C
57
58 /* *********************************************** *
59  * Functions for Ruby Process Management (Up Call) *
60  *                                                 *
61  * Independent Methods                             *
62  * *********************************************** */
63
64 VALUE rb_process_getName( VALUE ruby_process );
65 VALUE rb_process_getID(VALUE ruby_process);
66 VALUE rb_process_getBind(VALUE ruby_class);
67 void  rb_process_setBind(VALUE ruby_class,long bind);
68 VALUE rb_process_isAlive(VALUE ruby_process);
69 void  rb_process_kill(VALUE ruby_process);
70 void  rb_process_join( VALUE ruby_process );
71 void  rb_process_unschedule( VALUE ruby_process );
72 void  rb_process_schedule( VALUE ruby_process );
73
74
75 /* ********************************************** *
76  * Function for Native Process (Bound) Management *
77  *                                                *
78  * Methods Belonging to The MSG Module            *
79  * ********************************************** */
80
81 // ProcessBind Method ; Process Ruby >> Process C
82
83 //friend Method // Not belong to the Class but Called within !!
84 m_process_t rb_process_to_native(VALUE ruby_process);
85
86 // Binding Process >> Friend Method
87 void rb_processBind(VALUE ruby_class,m_process_t process);
88
89 // CreateProcess Method
90 void rb_processCreate(VALUE Class,VALUE rb_process,VALUE host);
91
92 // ProcessSuspend
93 void rb_processSuspend(VALUE Class,VALUE ruby_process);
94
95 // ProcessResume
96 void rb_processResume(VALUE Class,VALUE ruby_process);
97
98 //ProcessIsSuspend return Boolean ( Qtrue / Qfalse )
99 VALUE rb_processIsSuspend(VALUE Class,VALUE ruby_process);
100
101 //Processkill
102 void rb_processKill(VALUE Class,VALUE ruby_process);
103
104 //ProcessGetHost
105 VALUE rb_processGetHost(VALUE Class,VALUE ruby_process);
106
107 //ProcessExit
108 void rb_processExit(VALUE Class,VALUE ruby_process);
109
110 #endif /* RB_SG_BINDINGS */