Example #1
0
def GenAll():
  from convcode import generate_conv_code
  from basecode import all_types

  generate_conv_code("Src/_convmodule.c")

  from bytescode import generate_bytes_code
  generate_bytes_code("Src/_bytesmodule.c")

  from sortcode import generate_sort_code
  generate_sort_code("Src/_sortmodule.c")

  from ufunccode import generate_ufunc_code
  for t in all_types():
    source = "Src/_ufunc%smodule.c" % (t,)
    generate_ufunc_code(source, t)
Example #2
0
    def generate(self, filename):
        """emits the code for the entire module to the specified file."""
        gen = UFuncCodeGenerator(UFUNC_HEADER, _TAIL, self._ufuncs, None)
        # "/*********************  %s  *********************/\n")
        gen.gen_header()
        gen.codelist.extend(self._code)

        for cfg in self._ufuncs:
            ufo = UFuncParams(*cfg)

        for c in self._cfuncs:
            gen.addcfunc(*c)
        
        for t in all_types():
            gen.gen_body(t)
        gen.module = self.module
        gen.gen_trailer()
        gen.emit_code(filename)
Example #3
0
 def gen_body(self):
     for t in all_types():
         d = {}
         d["typename"] = t
         if t in ["Complex32", "Complex64"]:
             d.update(sort_complex_td)
         else:
             d.update(sort_operator_td)
         self.codelist.append((self.separator + SORT_TEMPLATE) % d)
         self.addcfunc(t, "sort")
         self.addcfunc(t, "asort")
         self.addcfunc(t, "searchsorted")
         self.addcfunc(t, "fillarray")
         self.addcfunc(t, "nonzeroCoords")
         self.addcfunc(t, "quicksort")
         self.addcfunc(t, "aquicksort")
         self.addcfunc(t, "mergesort")
         self.addcfunc(t, "amergesort")
         self.addcfunc(t, "heapsort")
         self.addcfunc(t, "aheapsort")
Example #4
0
 def gen_body(self):
     for t in all_types():
         d = {}
         d["typename"] = t
         if t in ["Complex32","Complex64"]:
           d.update(sort_complex_td)
         else:
           d.update(sort_operator_td)
         self.codelist.append((self.separator + SORT_TEMPLATE) % d)
         self.addcfunc(t, "sort")
         self.addcfunc(t, "asort")
         self.addcfunc(t, "searchsorted")
         self.addcfunc(t, "fillarray")
         self.addcfunc(t, "nonzeroCoords")
         self.addcfunc(t, "quicksort")
         self.addcfunc(t, "aquicksort")
         self.addcfunc(t, "mergesort")
         self.addcfunc(t, "amergesort")
         self.addcfunc(t, "heapsort")
         self.addcfunc(t, "aheapsort")