Namespaces | |
pyratemp | |
Classes | |
class | DsdlCompilerException |
Functions | |
def | die (text) |
def | generate_one_type (template_expander, t) |
def | make_template_expander (filename) |
def | makedirs (path) |
def | pretty_filename (filename) |
def | run (source_dirs, include_dirs, output_dir) |
def | run_generator (types, dest_dir) |
def | run_parser (source_dirs, search_dirs) |
def | type_output_filename (t) |
def | type_to_cpp_type (t) |
def | write_generated_data (filename, data) |
Variables | |
list | __all__ = ['run', 'logger', 'DsdlCompilerException'] |
logger = logging.getLogger(__name__) | |
string | OUTPUT_FILE_EXTENSION = 'hpp' |
int | OUTPUT_FILE_PERMISSIONS = 0o444 |
str = unicode | |
TEMPLATE_FILENAME = os.path.join(os.path.dirname(__file__), 'data_type_template.tmpl') | |
def libuavcan_dsdl_compiler.die | ( | text | ) |
Definition at line 89 of file libuavcan_dsdl_compiler/__init__.py.
def libuavcan_dsdl_compiler.generate_one_type | ( | template_expander, | |
t | |||
) |
Definition at line 167 of file libuavcan_dsdl_compiler/__init__.py.
def libuavcan_dsdl_compiler.make_template_expander | ( | filename | ) |
Templating is based on pyratemp (http://www.simple-is-better.org/template/pyratemp.html). The pyratemp's syntax is rather verbose and not so human friendly, so we define some custom extensions to make it easier to read and write. The resulting syntax somewhat resembles Mako (which was used earlier instead of pyratemp): Substitution: ${expression} Line joining through backslash (replaced with a single space): ${foo(bar(very_long_arument=42, \ second_line=72))} Blocks: % for a in range(10): % if a == 5: ${foo()} % endif % endfor The extended syntax is converted into pyratemp's through regexp substitution.
Definition at line 246 of file libuavcan_dsdl_compiler/__init__.py.
def libuavcan_dsdl_compiler.makedirs | ( | path | ) |
Definition at line 79 of file libuavcan_dsdl_compiler/__init__.py.
def libuavcan_dsdl_compiler.pretty_filename | ( | filename | ) |
Definition at line 67 of file libuavcan_dsdl_compiler/__init__.py.
def libuavcan_dsdl_compiler.run | ( | source_dirs, | |
include_dirs, | |||
output_dir | |||
) |
This function takes a list of root namespace directories (containing DSDL definition files to parse), a possibly empty list of search directories (containing DSDL definition files that can be referenced from the types that are going to be parsed), and the output directory path (possibly nonexistent) where the generated C++ header files will be stored. Note that this module features lazy write, i.e. if an output file does already exist and its content is not going to change, it will not be overwritten. This feature allows to avoid unnecessary recompilation of dependent object files. Args: source_dirs List of root namespace directories to parse. include_dirs List of root namespace directories with referenced types (possibly empty). This list is automaitcally extended with source_dirs. output_dir Output directory path. Will be created if doesn't exist.
Definition at line 37 of file libuavcan_dsdl_compiler/__init__.py.
def libuavcan_dsdl_compiler.run_generator | ( | types, | |
dest_dir | |||
) |
Definition at line 100 of file libuavcan_dsdl_compiler/__init__.py.
def libuavcan_dsdl_compiler.run_parser | ( | source_dirs, | |
search_dirs | |||
) |
Definition at line 92 of file libuavcan_dsdl_compiler/__init__.py.
def libuavcan_dsdl_compiler.type_output_filename | ( | t | ) |
Definition at line 75 of file libuavcan_dsdl_compiler/__init__.py.
def libuavcan_dsdl_compiler.type_to_cpp_type | ( | t | ) |
Definition at line 138 of file libuavcan_dsdl_compiler/__init__.py.
def libuavcan_dsdl_compiler.write_generated_data | ( | filename, | |
data | |||
) |
Definition at line 114 of file libuavcan_dsdl_compiler/__init__.py.
|
private |
Definition at line 30 of file libuavcan_dsdl_compiler/__init__.py.
libuavcan_dsdl_compiler.logger = logging.getLogger(__name__) |
Definition at line 35 of file libuavcan_dsdl_compiler/__init__.py.
string libuavcan_dsdl_compiler.OUTPUT_FILE_EXTENSION = 'hpp' |
Definition at line 26 of file libuavcan_dsdl_compiler/__init__.py.
int libuavcan_dsdl_compiler.OUTPUT_FILE_PERMISSIONS = 0o444 |
Definition at line 27 of file libuavcan_dsdl_compiler/__init__.py.
libuavcan_dsdl_compiler.str = unicode |
Definition at line 22 of file libuavcan_dsdl_compiler/__init__.py.
libuavcan_dsdl_compiler.TEMPLATE_FILENAME = os.path.join(os.path.dirname(__file__), 'data_type_template.tmpl') |
Definition at line 28 of file libuavcan_dsdl_compiler/__init__.py.