このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。
コード テンプレート
コード生成テンプレートを使用して、カスタム コード バナーを追加し、データと関数を再配置し、追加のコード セグメントとドキュメンテーションを生成コード ファイルに挿入します。
トピック
- コードの編成と形式のカスタマイズ
カスタム ファイル処理 (CFP) ツールで生成コードの編成と形式をカスタマイズできます。
- Code Generation Template (CGT) Files
Code Generation Template (CGT) files define the top-level organization and formatting of generated source code and header files. CGT files have the following applications:
- Custom File Processing (CFP) Templates
A custom file processing (CFP) template imposes a simple structure on the code generation process.
- Specify Templates For Code Generation
Create CGT files and CFP templates to use custom file processing features.
- Generate Custom File and Function Banners
Using code generation template (CGT) files, you can specify custom file banners and function banners for the generated code files. File banners are comment sections in the header and trailer sections of a generated file. Function banners are comment sections for each function in the generated code. Use these banners to add a company copyright statement, specify a special version symbol for your configuration management system, remove time stamps, and for many other purposes. These banners can contain characters, which propagate to the generated code.
- Change the Organization of a Generated File
Use data and code templates to change the organization of generated files.
- Customize Generated File Names
Customize generated file names by using file naming rules.
- Generate Source and Header Files with a Custom File Processing (CFP) Template
This example shows you the process of generating a simple source (
.c
or.cpp
) and header (.h
) file using the example CFP template. Then, it examines the template and the code generated by the template. - Comparison of a Template and Its Generated File
You can use a template to define what code the code generator adds to the generated file, control the location of code in the file, and optionally insert comments in the generated file.
- Code Template API Summary
The code template API includes functions to obtain the names of the standard model files and other model-related information.
- Template Symbols and Rules
This topic describes template symbols and rules for using them.