Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[popping] cosmetics in doc and generator
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 2 Nov 2014 00:32:06 +0000 (01:32 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 2 Nov 2014 00:32:06 +0000 (01:32 +0100)
doc/doxygen/inside_extending.doc
src/simix/simcalls.py

index 27d1aca..546a6c6 100644 (file)
@@ -131,13 +131,14 @@ The workflow of a simcall is the following:
   - If not, call `SIMIX_process_yield` to give back the control to maestro
   - ========== KERNEL MODE ==========
   - `SIMIX_simcall_handle` large switch (on simcall) doing for each:
-   - `SIMIX_pre_<name>(simcall, <args>)`
+   - `simcall_HANDLER_<name>(simcall, <args>)`
    - `SIMIX_simcall_answer(simcall)`
 
 To simplify the simcall creation, a python script generates most of
 the code and give helpers for the remaining stuff. That script reads
-the simcall definitions from src/simix/simcalls.in and generates the
-following files:
+the simcall definitions from src/simix/simcalls.in, checks that both
+`simcall_<name>()` and `simcall_HANDLER()` are defined somewhere, and
+generates the following files:
 
 - smx_popping_accessors.h:
   Helper functions to get and set simcall arguments and results
@@ -149,9 +150,6 @@ following files:
   Definitions of `simcall_names[]` (debug name of each simcall), and
   SIMIX_simcall_enter() that deals with the simcall from within the kernel
 
-Furthermode if the simcall_<name> or the SIMIX_pre_<name> function are missing,
-a warning will show up with a prototype of the corresponding fonction to fill.
-
 The simcall.in file list all the simcalls in sections. A line starting by "##"
 define a new section which will be replace by a "ifdef" in the generated code.
 There is a simcall by line which follow this format:
index 7adcb74..354dddd 100755 (executable)
@@ -55,12 +55,7 @@ class Simcall(object):
     self.has_answer = has_answer
 
   def check(self):
-    # smx_user.c  simcall_BODY_
-    # smx_*.c void simcall_HANDLER_host_on(smx_simcall_t simcall, smx_host_t h)
-    self.check_body()
-    self.check_pre()
-
-  def check_body(self):
+      # libsmx.c  simcall_BODY_
       if self.simcalls_BODY is None:
           f = open('libsmx.c')
           self.simcalls_BODY = set(re.findall('simcall_BODY_(.*?)\(', f.read()))
@@ -68,38 +63,30 @@ class Simcall(object):
       if self.name not in self.simcalls_BODY:
           print '# ERROR: No function calling simcall_BODY_%s'%self.name
           print '# Add something like this to libsmx.c:'
-          print '''%s simcall_%s(%s)
-{
-  return simcall_BODY_%s(%s);
-}\n'''%(self.res.ret()
-     ,self.name
-     ,', '.join('%s %s'%(arg.ret(), arg.name)
-                  for arg in self.args)
-     ,self.name
-     ,', '.join(arg.name for arg in self.args))
+          print '%s simcall_%s(%s) {'%(self.res.ret() ,self.name ,', '.join('%s %s'%(arg.ret(), arg.name) for arg in self.args))
+          print '  return simcall_BODY_%s(%s);'%(self.name)
+          print '}'
+          return False
+      
+      # smx_*.c void simcall_HANDLER_host_on(smx_simcall_t simcall, smx_host_t h)
+      if self.simcalls_PRE is None:
+        self.simcalls_PRE = set()
+        for fn in glob.glob('smx_*') + glob.glob('../mc/*'):
+            f = open(fn)
+            self.simcalls_PRE |= set(re.findall('simcall_HANDLER_(.*?)\(', f.read()))
+            f.close()
+      if self.name not in self.simcalls_PRE:
+          print '# ERROR: No function called simcall_HANDLER_%s'%self.name
+          print '# Add something like this to the relevant C file (like smx_io.c if it\'s an IO call):'
+          print '%s simcall_HANDLER_%s(smx_simcall_t simcall%s) {'%(self.res.ret()
+                                                                    ,self.name                                               
+                                                                    ,''.join(', %s %s'%(arg.ret(), arg.name)
+                                                                             for arg in self.args))
+          print '  // Your code handling the simcall'
+          print '}'
           return False
       return True
 
-  def check_pre(self):
-    if self.simcalls_PRE is None:
-      self.simcalls_PRE = set()
-      for fn in glob.glob('smx_*') + glob.glob('../mc/*'):
-        f = open(fn)
-        self.simcalls_PRE |= set(re.findall('simcall_HANDLER_(.*?)\(', f.read()))
-        f.close()
-    if self.name not in self.simcalls_PRE:
-      print '# ERROR: No function called simcall_HANDLER_%s'%self.name
-      print '# Add something like this to smx_.*.c:'
-      print '''%s simcall_HANDLER_%s(smx_simcall_t simcall%s)
-{
-  // Your code handling the simcall
-}\n'''%(self.res.ret()
-       ,self.name
-       ,''.join(', %s %s'%(arg.ret(), arg.name)
-                  for arg in self.args))
-      return False
-    return True
-
   def enum(self):
     return '  SIMCALL_%s,'%(self.name.upper())