Prev Parsers | Up Synopsis | Next Formatters


Synopsis Linker

After Parsing or reading from file, and before formatting or saving, the in-memory AST is Linked by the Linker module. The Linker has three functions:

Unduplicator

The Unduplicator recursively traverses the AST using the Visitor pattern, and replaces any duplicate types with their originals, and removes duplicate declarations. References to the removed declarations are replaced with a reference to the original. This action is largely unncessary due to the -m flags, but can still be useful in some situations, such as when you have nested classes defined in separate files. It also converts AST.Modules into AST.MetaModules, which list all the files a module is defined in.

Filtering

Mixed in with the Unduplicator is a filtering process. If the -s option is used, then any declaration or type that is not in a specified module/namespace is removed. This is generally unncessary due to the parsers performing main-file only filtering, but it allows you to filter by namespace which you may also want.

Mapper

The Mapper is a feature unique to Synopsis - it is the core of the process that allows you to link between languages, by mapping Unknown types to other names and/or languages that may be referenced in a TOC (table of contents) file. You may write your own mapping functors, but an example is included in the demo/Mixed/ directory. This example maps the POA_* names generated by omniORB to the appropriate names that reference the interfaces in the IDL documentation. This feature is used by the Berlin Project to link implementation classes in C++ to their IDL interfaces.

Stripper

The Stripper, which is currently disabled in the code, strips the namespace from all declaration and type names specified in the -s flag. This is generally unneccessary due to formatter features, but if you need it you are free to uncomment it in the Linker.py module.

IDL Options

-sThe scoped name to filter declarations with. The name is separated by :: operators, and this option may be used multiple times to allow multiple scopes.
-m pluginspecifies the plugin to use for mapping

Prev Parsers | Up Synopsis | Next Formatters


Synopsis Documentation. Copyright (c) 2001 by Stephen Davies