Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
some more cleanups in ruby bindings. Still not working damnit (but getting clearer)
[simgrid.git] / src / bindings / ruby / rb_application_handler.c
1 /*
2  * Copyright 2010. The SimGrid Team. All right 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 #include "bindings/ruby_bindings.h"
8 #include "surf/surfxml_parse.h"
9
10 static VALUE application_handler_class; // The Current Instance of ApplicationHandler Class
11
12 void rb_application_handler_on_start_document(void) {
13   application_handler_class = rb_funcall3(rb_const_get(rb_cObject, rb_intern("ApplicationHandler")),  rb_intern("new"), 0, 0);
14 }
15
16 void rb_application_handler_on_end_document(void) {
17   application_handler_class = Qnil;
18 }
19
20 void rb_application_handler_on_begin_process(void) {
21   VALUE hostName = rb_str_new2(A_surfxml_process_host);
22   VALUE function = rb_str_new2(A_surfxml_process_function);
23   rb_funcall(application_handler_class,rb_intern("onBeginProcess"),2,hostName,function);
24 }
25
26 void rb_application_handler_on_process_arg(void) {
27   VALUE arg = rb_str_new2(A_surfxml_argument_value);
28   rb_funcall(application_handler_class,rb_intern("onProcessArg"),1,arg);
29 }
30
31 void rb_application_handler_on_property(void) {
32   VALUE id = rb_str_new2(A_surfxml_prop_id);
33   VALUE val =  rb_str_new2(A_surfxml_prop_value);
34   rb_funcall(application_handler_class,rb_intern("onProperty"),2,id,val);
35 }
36
37
38 void rb_application_handler_on_end_process(void) {
39   rb_funcall(application_handler_class,rb_intern("onEndProcess"),0);
40 }