Package instant :: Module codegeneration
[hide private]
[frames] | no frames]

Module codegeneration

source code

This module contains helper functions for code generation.

Functions [hide private]
 
mapstrings(format, sequence) source code
 
reindent(code)
Reindent a multiline string to allow easier to read syntax.
source code
 
write_interfacefile(filename, modulename, code, init_code, additional_definitions, additional_declarations, system_headers, local_headers, wrap_headers, arrays)
Generate a SWIG interface file.
source code
 
write_setup(filename, modulename, csrcs, cppsrcs, local_headers, include_dirs, library_dirs, libraries, swig_include_dirs, swigargs, cppargs, lddargs)
Generate a setup.py file.
source code
 
_test_write_interfacefile() source code
 
_test_write_setup() source code
 
unique(list) source code
 
find_vtk_classes(str) source code
 
create_typemaps(classes) source code
 
generate_vtk_includes(classes) source code
 
generate_interface_file_vtk(signature, code) source code
 
write_cmakefile(module_name, cmake_packages, csrcs, cppsrcs, local_headers, include_dirs, library_dirs, libraries, swig_include_dirs, swigargs, cppargs, lddargs) source code
 
write_itk_cmakefile(name) source code
 
write_vmtk_cmakefile(name) source code
 
write_vtk_interface_file(signature, code) source code
Variables [hide private]
  __package__ = 'instant'
Function Details [hide private]

reindent(code)

source code 

Reindent a multiline string to allow easier to read syntax.

Each line will be indented relative to the first non-empty line. Start the first line without text like shown in this example:

   code = reindent("""
       Foo
       Bar
           Blatti
       Ping
       """)

makes all indentation relative to Foo.

write_interfacefile(filename, modulename, code, init_code, additional_definitions, additional_declarations, system_headers, local_headers, wrap_headers, arrays)

source code 

Generate a SWIG interface file. Intended for internal library use.

The input arguments are as follows:

  • modulename (Name of the module)
  • code (Code to be wrapped)
  • init_code (Code to put in the init section of the interface file)
  • additional_definitions (Definitions to be placed in initial block with C code as well as in the main section of the SWIG interface file)
  • additional_declarations (Declarations to be placed in the main section of the SWIG interface file)
  • system_headers (A list of system headers with declarations needed by the wrapped code)
  • local_headers (A list of local headers with declarations needed by the wrapped code)
  • wrap_headers (A list of local headers that will be included in the code and wrapped by SWIG)
  • arrays (A nested list, the inner lists describing the different arrays)

The result of this function is that a SWIG interface with the name modulename.i is written to the current directory.

write_setup(filename, modulename, csrcs, cppsrcs, local_headers, include_dirs, library_dirs, libraries, swig_include_dirs, swigargs, cppargs, lddargs)

source code 

Generate a setup.py file. Intended for internal library use.