Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[surf] Remove sg_cabinet_cb
[simgrid.git] / src / simix / simcalls.py
index a4eaa32..e65b78a 100755 (executable)
@@ -132,7 +132,7 @@ class Simcall(object):
                                                                 ''.join(', %s simcall->args[%d].%s'%(arg.cast(), i, arg.field()) 
                                                                         for i, arg in enumerate(self.args))))
       else:
-          res.append('      %ssimcall_%s(%s);'%('simcall->result.%s = '%self.res.field() if self.call_kind == 'Func' else ' ',
+          res.append('      %sSIMIX_%s(%s);'%('simcall->result.%s = '%self.res.field() if self.call_kind == 'Func' else ' ',
                                                 self.name,  
                                                 ','.join('%s simcall->args[%d].%s'%(arg.cast(), i, arg.field()) 
                                                          for i, arg in enumerate(self.args))))
@@ -151,7 +151,7 @@ class Simcall(object):
           res.append('    if (0) simcall_HANDLER_%s(%s);'%(self.name,
                                                            ', '.join(["&self->simcall"]+ [arg.name for arg in self.args])))
       else:
-          res.append('    if (0) simcall_%s(%s);'%(self.name,
+          res.append('    if (0) SIMIX_%s(%s);'%(self.name,
                                                    ', '.join(arg.name for arg in self.args)))
       res.append('    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */')
       res.append('')
@@ -177,7 +177,7 @@ class Simcall(object):
       
   def handler_prototype(self):
       if self.need_handler:
-          return "%s simcall_HANDLER_%s(smx_simcall_t simcall%s);"%(self.res.rettype() if self.call_kind == 'Func' else 'void', 
+          return "XBT_PRIVATE %s simcall_HANDLER_%s(smx_simcall_t simcall%s);"%(self.res.rettype() if self.call_kind == 'Func' else 'void', 
                                                                     self.name, 
                                                                     ''.join(', %s %s'%(arg.rettype(), arg.name) 
                     for i, arg in enumerate(self.args)))
@@ -227,7 +227,9 @@ def header(name):
     return fd
 
 def handle(fd,func, simcalls, guarded_simcalls):
-    fd.write('\n'.join(func(simcall) for simcall in simcalls))
+    def nonempty(e): return e != ''
+    fd.write('\n'.join( filter(nonempty, (func(simcall) for simcall in simcalls))))
+    
     for guard, list in guarded_simcalls.items():
         fd.write('\n#ifdef %s\n'%(guard))
         fd.write('\n'.join(func(simcall) for simcall in list))
@@ -277,9 +279,10 @@ if __name__=='__main__':
   
   fd = header("popping_generated.c")
   
+  fd.write('#include <xbt/base.h>\n');
   fd.write('#include "smx_private.h"\n');
   fd.write('#ifdef HAVE_MC\n');
-  fd.write('#include "mc/mc_private.h"\n');
+  fd.write('#include "src/mc/mc_forward.h"\n');
   fd.write('#endif\n');
   fd.write('\n');
   fd.write('XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping);\n\n');
@@ -326,7 +329,7 @@ if __name__=='__main__':
   ###
   fd = header('popping_bodies.c')
   fd.write('#include "smx_private.h"\n')
-  fd.write('#include "mc/mc_interface.h"\n')
+  fd.write('#include "src/mc/mc_forward.h"\n')
   fd.write('#include "xbt/ex.h"\n')
   handle(fd, Simcall.body, simcalls, simcalls_dict)
   fd.close()