deploy
Topics covered in this chapter:
This module defines four I/O drivers, deploy.csrc, deploy.exe, deploy.ascii85 and deploy.skiphead for generating an executable program from a BIM file, along with three utility routines for accessing the program arguments with the Mosel model. Its use is discussed in Section Deploying models.
Procedures and functions
Retrieve the number of arguments passed to a model executable.
|
|
Retrieve an argument passed to a model executable.
|
|
Shift current positional program arguments.
|
I/O drivers
The two first I/O drivers provided by this module (deploy.csrc and deploy.exe) are designed to be used in combination with a Mosel command compiling a model by applying them to the output filename. They are not intended to be used in any other contexts.
deploy.*:filename[,p1[-z]=fp1[,...]]
Driver csrc
csrc:filename[,p1[-z]=fp1[,...]]
The csrc driver takes the following options:
- filename
- Destination file name
- p1[-z]=fp1
- list of labels and filenames, the optional -z flag indicates that compression is to be used
Example:
mosel comp mymodel.mos -o deploy.csrc:runmymod
This command produces a file runmymod.c that contains the model mymodel.mos in compiled (BIM) form and a complete C program for executing it via the Mosel C Library API. The generated code needs to be compiled into an executable for the targeted platform (see the makefile provided with the Mosel Library API examples).
Driver exe
exe:filename[,p1[-z]=fp1[,...]]
The exe driver takes the following options:
- filename
- Destination file name
- p1[-z]=fp1
- list of labels and filenames, the optional -z flag indicates that compression is to be used
Example:
mosel comp mymodel.mos -o deploy.exe:runmymod,MYFILE-z=otherfile.txt
Provided that a C compiler is available on the system, this command produces an executable for the platform in which it is invoked (resulting in a file named runmymod on Unix platforms or runmymod.exe under Windows). The executable serves for running the specified model, it also includes a second file otherfile.txt in compressed form, identified via the model parameter MYFILE.
The generation of this executable is obtained by producing a C source using the deploy.csrc driver that is compiled using the C-compiler installed on the system. This compiler can be specified by means of the CC environment variable (default value: cl on Windows and cc on Posix systems) and its default parameters can be selected with the environment variable CFLAGS. The location of the Xpress libraries is automatically deduced from the running program that is expected to be part of a standard Xpress installation.
For a full example, the reader is refered to the source of the moseldoc tool that is provided among the Mosel examples of the Xpress distribution.
Note that the generated executable only includes the compiled model and the specified additional files, it requires the same Xpress runtime dependencies (see the chapter Creating runtime distributions of the Xpress Installation Guide) for its execution as what would be required for running the model after compiling it into a standard BIM file.
Driver skipheader
skipheader:markerline,filename
The skipheader driver can only be used for reading and takes the following options:
- markerline
- Text line to find in the source file
- filename
- File to read
It is designed to be used as a filter to skip the beginning of a file to be read. The end of the section to ignore is characterised by the text line markeline (that is also skipped). For instance, the Mosel statement below will display the text following the 'end-model' of the model file 'mymod.mos':
fcopy("deploy.skiphead:end-model,mymod.mos","")
Driver ascii85
ascii85:[z85,][notag,][nonl,]filename
The ascii85 driver implements both an encoder (when writing) and a decoder (when reading) of the Ascii85 format that can represent any kind of binary data as a string of ascii characters. It provides similar functionality as the I/O driver mmssl.base64 (see Section Driver base64) with a slightly better efficiency as it encodes 4 bytes on 5 characters whereas the Base64 format requires 4 characters to represent 3 bytes.
By default the driver uses the Adobe variant of the format: the data block is enclosed in <~ and ~> and the document is split into lines of 76 symbols. When reading, anything preceding the starting tag <~ is skipped as well as anything following the terminating tag ~>. Using the option notag will remove the enclosing delimiters (and the entire stream will be processed when reading); the option nonl will generate a single line for the entire document (this option is ignored when reading).
The option z85 switches to the ZMODEM version of the format: the encoded document is returned as a single line (without delimiter) and a different lexicon is used. The set of characters selected with this option does not include the symbols "backslash" and "double quote" such that an encoded document can be saved directly as a quoted string, for instance in a data file.
© 2001-2025 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.