IBM
Contents Index Previous Next



Introduction


The overall purpose of the CPP2SDL tool is to provide a convenient means of making external C or C++ declarations available in an SDL context. This is accomplished by translating the C/C++ declarations into representing SDL declarations. These resulting declarations can be injected at an arbitrary level in the SDL scope hierarchy, and may then be used just as if they actually were declared at that scope level. When target code is generated for the SDL system, the Code Generator produces C or C++ code for usages of generated SDL declarations that matches the original C/C++ declarations. The picture below depicts the data flow when using CPP2SDL, and the context of the tool.

.

Figure 166 CPP2SDL Data Flow and Context

As can be seen in the figure, the input to CPP2SDL is a set of C/C++ header files and, optionally, an import specification. From this input CPP2SDL generates an SDL/PR file containing SDL representations for the declarations in the header files, or for a subset of these declarations according to what is specified in the import specification. The generated SDL/PR is analyzed together with other SDL/PR, e.g. the SDL/PR for the SDL system. The Code Generator then generates target C/C++ code which is compiled by a C/C++ compiler. Note that the original C/C++ headers are used in this compilation. The resulting object code is linked together with the object files belonging to the C/C++ headers. Other object files are also included, e.g. the precompiled SDL kernel that is to be used. The result is an executable application.

CPP2SDL translates from C/C++ to SDL according to certain translation rules. These translation rules have been designed to be as simple and intuitive as possible. A user that is familiar with C/C++ should find it straight-forward to use a C/C++ declaration from SDL. The translation rules are described in full detail in C/C++ to SDL Translation Rules. Although CPP2SDL supports translation of a major part of the C and C++ languages, not everything is supported. The limitations of CPP2SDL are listed in CPP2SDL.


http://www.ibm.com/rational
Contents Index Previous Next