2 * Copyright 2010. The SimGrid Team. All right 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 #include "bindings/ruby_bindings.h"
8 #include "surf/surfxml_parse.h"
10 static VALUE application_handler_class; // The Current Instance of ApplicationHandler Class
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);
16 void rb_application_handler_on_end_document(void) {
17 application_handler_class = Qnil;
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);
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);
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);
38 void rb_application_handler_on_end_process(void) {
39 rb_funcall(application_handler_class,rb_intern("onEndProcess"),0);