![]() |
![]() |
![]() |
![]() |
![]() |
Generated Files
The C files, which are generated by the Cmicro SDL to C Compiler, can only be used in connection with the Cmicro Library and the SDL Target Tester. It is not possible to validate and simulate the SDL system with the C code generated by Cmicro as this code is only suitable for target applications. To simulate and validate the SDL system within the SDL Suite, the user has to choose the Cbasic SDL to C Compiler. In order to view the process of generating C applications see the Organizer's Make dialog in The Organizer.
The SDL Analyzer, which contains the Cmicro SDL to C Compiler can also be started as a stand-alone tool. For more information about this possibility please see The SDL Analyzer.
There are several steps that must be carried out before the generated C files can be compiled and linked together with the Cmicro Library. The user should follow the procedures that are documented in the section Targeting using the Cmicro Package.
In the following subsections the different files that are generated are explained.
Generated Configuration File
The first file that is generated from the Cmicro SDL to C Compiler is called sdl_cfg.h. It is used to scale the Cmicro Kernel depending on what characteristics the SDL system has. This is called automatic scaling and automatic dimensioning facility.
The file contains a header, process ID declarations, and then a #define or a /*NOT define ... */ for each of the flags that the Cmicro SDL to C Compiler can generate automatically.
Example 571 : The Header of an sdl_cfg.h
/* Program generated by SDL Suite.Cmicro <version> <date> */#ifndef XSCT_CMICRO#define XSCT_CMICRO#endif/* "sdl_cfg.h" file generated for system <systemname> */#define XMK_CFG_TIME <GenerationTime>The XMK_CFG_TIME macro is used internally when compiling and executing with the SDL Target Tester takes place. With this macro, a rough consistency check for the generated files is done. The <GenerationTime> of the different files that are generated is compared in the Library and by the SDL Target Tester. If there is an inconsistency, compilation errors will occur.
The rest of the file sdl_cfg.h is about the automatic scaling and automatic dimensioning of the SDL system. It may look for example like:
Example 572 : The Tail of an sdl_cfg.h
#define MAX_SDL_PROCESS_TYPES <N>#define XMK_USED_ONLY_X_1#define MAX_SDL_TIMER_TYPES <X>#define MAX_SDL_TIMER_INSTS <Z>#define XMK_HIGHEST_SIGNAL_NR 4/* NOT #define XMK_USED_TIMER *//* NOT #define XMK_USED_DYNAMIC_CREATE *//* NOT #define XMK_USED_DYNAMIC_STOP *//* NOT #define XMK_USED_SAVE */#define XMK_USED_SIGNAL_WITH_PARAMS/* NOT #define XMK_USED_TIMER_WITH_PARAMS *//* NOT #define XMK_USED_SENDER *//* NOT #define XMK_USED_OFFSPRING *//* NOT #define XMK_USED_PARENT *//* NOT #define XMK_USED_SELF *//* NOT #define XMK_USED_PWOS *//* NOT #define XMK_USED_INITFUNC */For a first rough understanding of the meaning of the different flags: The SDL system from above contains <N> process types (using SDL'88 terminology), all the processes are declared in the form (0,1) or (1,1). There are <X> timers declared (in this case, <X> must be 0, because XMK_USED_TIMER is undefined, and the system uses an amount of <Z> signals. The system does not use any create or stop (XMK_USED_DYNAMIC_CREATE and XMK_USED_DYNAMIC_STOP are undefined). In this way all the other flags have special meaning.
For explanations about the different flags the user should refer to Automatic Scaling Included in Cmicro.
Generated C File
Assumed, that the user selected "No separation" in the Organizer's Make Dialog, and no partitioning is used, then the Cmicro SDL to C Compiler will generate one C file per SDL system. This file contains all the characteristics of the SDL system including all the declarations that the SDL system itself needs. For an explanation of this file see Output of Code Generation.
Generated Environment Header File
There is one file generated from the Cmicro SDL to C Compiler that contains all the definitions and declarations that are necessary to implement the environment functions xInEnv and xOutEnv.
The file is generated only if the option Environment header file in the Targeting Experts is switched on.
The file is called <systemname>.ifc and it contains a header, the type definitions used on system level (newtypes, syntypes, synonyms), the signal IDs and the structure type definitions for the parameters of the signals.
The IFC_FILENAME macro is defined when generating code from the Make dialog, i.e. when using the comp.opt and make.opt files. The macro is not automatically defined when using Targeting Expert. The macro contains the full path to the ifc file, even if that file has been chosen not to be generated.
Typical usage of this macro is to include the ifc file when implementing the environment functions or whenever you would like to include the ifc file in external code.
Example 573 : Compiler options macro when using Targeting Expert
-DIFC_FILENAME="'C:\MyProject\MySys._0\Application_CA\MySys.ifc'"If Targeting Expert is used and you would like to use the IFC_FILENAME, you must define the macro by yourself in the compiler options.
Example 574 : The Header of an <systemname>.ifc file
#ifndef X_IFC_z_env01#define X_IFC_z_env01#define XMK_IFC_TIME <GenerationTime>The XMK_IFC_TIME macro is used internally when compiling and executing with the SDL Target Tester takes place. With this macro, a rough consistency check for the generated files is done. The <GenerationTime> of the different files that are generated is compared in the Library and by the SDL Target Tester. If there is an inconsistency, compilation errors will occur.
More explanation about the environment header file is given in The Cmicro Library.
Sorts
Followed by the header the section about sorts follows. The sorts are generated according to the documentation in The Cadvanced/Cbasic SDL to C Compiler.
Signal IDs and Parameter Structures
Next, the definitions for signals follows, which consists of:
- A C comment with a comment explaining if the signal is IN or OUT as seen from SDL
- An optional declaration of a C structure type definition (if the signal carries parameters)
- The definition of the signal ID
For easy interpretation: For an SDL signal without parameters, going from the environment to SDL, like:
signal SIn;the following is generated into the .ifc file:
/* SIn IN */#define SIn <X>For an SDL signal with parameters, going from SDL to the environment, like
signal SOut (integer, mystruct, boolean);the following is generated into the .ifc file:
/* SOut OUT */typedef struct {SIGNAL_VARSSDL_Integer Param1;mystruct Param2;/* mystruct declared in the section *//* declaring sorts */SDL_Boolean Param3;} yPDef_<UniquePrefix>_SOut;typedef yPDef_<UniquePrefix>_SOut *yPDP_<UniquePrefix>_SOut;#define yPDP_SOut yPDP_<UniquePrefix>_SOut#define yPDef_SOut yPDef_<UniquePrefix>_SOut#define SOut <X>At least the signal ID (here: SOut) and the name of the structure (here: yPDef_SOut) must be used in the xOutEnv C function in this case.
The code generation of structure types and signal IDs is (except the C comment about IN or OUT) independent from the direction the signal goes.
Process IDs
At last the process ID declarations are generated as #define values in C, like:
#define XPTID_<auto-prefix>_MyProcess 0where the first process in the system is the value of 0 assigned, the second process gets the value 1, and so on. Due to the implementation of SDL'92 object orientation in the Cmicro SDL to C Compiler, there is also an automatic prefix generated. Using this prefix in the user's environment functions, it is possible to distinguish between several processes with the same name. Please refer to Generation of Identifiers for more information.
Generated Make File
The Cmicro SDL to C Compiler generates a file that contains production rules for the C program. This file can be used together with "make" facility only. The file is called <systemname>.m.
Additionally there is an ASCII file called <systemname>_gen.m which gives a list of all the generated files. This files is used by the Targeting Expert to generate a makefile. Please see Generated Makefile.
Generated Symbol File
The generated symbol file is used to store symbolic information about the SDL system. The file has meaning for the host part of the SDL Target Tester only and is called <systemname>.sym. It is used for SDL Target Tester purposes only and is described within The Host Symbol Table.
Generated Kernel Group File
The generated kernel group file contains information about process names. This file is especially used in integrations, when OO is used and processes are instantiated. Using the information from this file, it is possible to distinguish between several process instantiations with the same name.
http://www.ibm.com/rational |
![]() |
![]() |
![]() |
![]() |