When you generate code for the interface you have developed by clicking Generate Code in the Code Generator window or running dtcodegen from the command line, a number of files are generated in the project folder. If your project is called "test" and it has one module, called "mod1," for instance, the following files will be created:
Makefile (plus Makefiles for other platforms)
mod1.bil (module file)
test.bip (project file)
Test (resource file)
If you have made Call Function or Execute Code connections in the Connections Editor, those connections will show up in the generated code. All of the areas of the generated code that my be modified by you are marked with comments of the form:
/* DTB_USER_CODE_START */ /* DTB_USER_CODE_END */
The area between the START and END comments are considered a "user segment." Any text (even non-C code) may be added within a user segment, and the code generator will preserve this code in all future versions of the code. Each user segment begins with a comment that suggests what type of code should be added in that segment, or what state the application is in when that segment is executed. These suggestions are purely informational, and may be ignored.
Neither App Builder nor the code generator verify that the code added by you is legal C code. It is your responsibility to ensure that any file you modify can be processed satisfactorily by your compiler.
If you wish to destroy all of the hand-edited code, you must either explicitly select Don't Merge from the Options dialog of the Code Generator Window, or run dtcodegen with the -nomerge option. This should be done only with great caution, as large amounts of work may be lost.
Under no circumstances should the generated comments be modified. If they are modified, code generation will fail, and the resulting file will very likely be uncompilable. A backup file, with the extension .BAK, is preserved in the current directory to help recover from such mistakes.
The user code segments appear in strategic places in the code, to allow you a great deal of freedom in customizing the generated application. All code related to main() and application-wide data and structures are defined in <projectname>.h and <projectname>.c. In these files, fields may be added to the Xt resource data structure for the application, new developer-defined data types and variables may be added, and the application's startup procedures may be amended.
Each <modulename>_stubs.c file contains user segments for modifying the effects of generated connections. Your code may be added both before and after the automatically-generated code is executed.
In addition, each file contains a user segment at the top of each file that can be used to add a custom header or copyright notice.