next up previous contents index
Next: Examples of main files Up: How to use the Previous: The definition of command   Contents   Index


How to glue several applications in a single program

It is easy to glue several applications of the command interpreter. Here we call application a set of sources that can be linked with the command interpreter library to produce an executable, together with the corresponding initialization file. The global application should contain the sources of the various preceeding applications together with a global initialization file in such a way that the final program contains all the features of the particular ones. It is then possible to add new commands which may use several features (functions, object types...) of the initial applications.

The initialization file for the glogal application must contain the sections that can appear only once (i.e the sections !param, !rep and !init, cf. 3). These sections must then be removed from the initialization files of the applications. Then the initialization files of the applications must be included in the main one (for instance by using sections !include (cf. 3.11)). It is now necessary to define the array proc (cf. 5 and 14.1.2) containing the function lists of each application, in the same order as the order of the corresponding !func in the initialization files.

There can be problems with the order of the messages defined in the sections !message of the applications. This is why the arguments of the function error_mess in theses applications should be given in an appropriate way : for instance if in some application the message number 32 is to be printed we will use something like

error_mess(flow_interp, 32  +  __APPLI3)

rather than simply error_mess(flow_interp, 32). Here __APPLI3 is a globally defined variable corresponding to the given application to be glued. It will be set in the global application : its value is the number of messages defined in the global initialization file before the !message section of the given glued application appears. Of course in the particular application its value is set to 0. The same should be done for the object or structure types defined in the initial applications.


next up previous contents index
Next: Examples of main files Up: How to use the Previous: The definition of command   Contents   Index
2009-11-12