Topics

SNIP FAQ

If you do not find the answer to your question here, please email us support@codepatterns.com

Running SNIP

Q: I want to generate code with SNIP from within a command shell script; can I do that?

A: Yes… Use the program snipb.exe, located in your installation. This is SNIP’s generation engine build as a command line tool. Invoke the tool with no arguments and it will display its help/usage notes.

Q: I want to generate code using SNIP from within a program; can I do that?

A: Yes… Use the DLL SnipCgenAPI.dll, also located in your installation. This is SNIP’s generation engine build as a ActiveX control for use in Microsoft COM or .NET applications. With it, you can embed the SNIP generation engine in your application.

Metadata/Model Input Formats

Q: I want to use UML as my metadata/model input; what should I do?

A: There are several things to know about using UML as input. First, your UML tool needs to be able to export valid XMI files. These files contain the information about the classes, attributes and relationships that are expressed in your UML Class Diagrams. (XMI most typically contains information from class diagrams only). When you run SNIP, import the XMI file into your DSM using an import directive like this:

import filename.xmi;

SNIP will convert the XMI file into DSM format on the fly when you invoke the generator.

Alternatively, you can convert the XMI file to a DSM format using the stand-alone XmiToDsm.exe tool found in the SNIP installation directory.

Q: I want to use XML as my metadata/model input; what should I do?

A: When you run SNIP, import the XML file into your DSM using an import directive like this:

import filename.xml;

SNIP will convert the XML file into DSM format on the fly when you invoke the generator.

Alternatively, you can convert the XML file to a DSM format using the stand-alone XmlToDsm.exe tool found in the SNIP installation directory. All XML Elements are seen as Objects, and their Attributes are seen as Object Characteristics. If you want to use an XML format that looks more natively like class information descriptions, use XDSM format.

Q: What is XDSM format?

A: XDSM format is Metadata/Model information expressed in XML as a structure of objects, attributes and associated characteristics. XDSM carries the same information as SNIP’s native DSM format, but uses XML Elements and Attributes to express this information. This format was established to take advantage of the relative ease with which many tools can be used to acquire and format information in XML, making a large number of information sources available to feed metadata/model information into SNIP for use in code generation.

A description of XDSM format is located in the document Using SNIP With XML.doc, which is located in the documentation that comes with the SNIP installation.

Licensing

Q: My installation of SNIP is complaining about my license information; what should I do?

A: Look in your system directory for SNIP.INI—The name and license key need to match. If you have changed the name but not the key, SNIP will not start. Key’s are assigned by AST to match the name agreed upon by the originator of your license request. If you want to change the name of the licensee, a new key will be required. We can supply that key.

Q: We have a project/site license; how many developers can use SNIP?

A: SNIP is normally licensed by project and site. That is, a license is specific to a particular project at a particular site. Any number of developers on your project at that site can use SNIP under such a license. Developers on your project at another site would need a license for that site. Developers on another project at your site would also need a separate license. If you need more flexibility than this, a corporate license is required.

Debugging

Q: I need to find which template lines are producing certain code; how can I debug my template?

A: SNIP has an option for emitting template line numbers in the code it generates. The interactive SNIP executable offers this setting under advanced code generation options. The program snipb.exe allows you to turn on template line tracing with a command line option. You can also temporarily generate lines in your output that are readily identifiable. Both of these mechanisms will allow you to isolate which template lines are producing certain lines of output.