My preferred way of developing SIOC programs is to use a simple text editor, such as Microsoft's NotePad, to write SIOC scripts in text format. This approach gives us a lot of flexibility in editing, copying and pasting text. Much better then the Graphical User Interface (GUI) in config_sioc.exe.
The config_sioc.exe program is then used to compile the SIOC script in text format into a format that can be executed (run) by sioc.exe.
A .txt file may contain several SIOC declarations and statements. Config_sioc.exe transforms one textfile, or several text files at once, into a single .ssi file. I will describe both compilation methods here.
Note that sioc.exe can only run one .ssi file, indicated by the CONFIG_FILE parameter in sioc.ini.
In this example I will show the steps needed to write and compile howto example read from FSUIPC offset as a single text file.
First we use the Notepad editor to write the code. It is a good practice to assign symbolic names ('pb_state' and 'pb_led' in this example) for variable numbers. Your code is easier to read and it is less prone to errors when you change variable numbers. Also note that using comma's and leading zeroes in the variable declaration, like is used by the 'Export TXT' feature of config_sioc.exe (see further down), is not necessary.
This file is saved as parkbrake_light.txt
Then we run config_sioc.exe and select 'Files, Import TXT'
We select the file 'parkbrake_light.txt' and compilation will start immediately
There are no errors, so we click at the grey OK button, bottom right, to close the log window, and we inspect the config_sioc.exe main window showing the compiled code
This view is only of importance if you would enter code via the GUI (Graphical User Interface) of config_sioc (not using a text editor), so we directly go to the Files menu item and select 'Save as':
We fill in parkbrake_light.ssi, and we are ready. The folder also shows the compiled file (type SIOC compiled script):
It is good to notice that the compiled .ssi file is a bit different from compiled code of programming languages such as C/C++ or Java. The file not only contains executable code but also contains the complete source, comments included. Therefore config_sioc.exe also has the capability to export a .txt file (or to recreate one could say) from a .ssi file (Export to TXT).
I recommend to only use this feature if you have got a .ssi file without the original .txt file, this is for instance the case with .ssi files created via the config_sioc GUI. Otherwise there is no need to Export to TXT, always stick to your text file created with the Notepad Editor.
If the number of scripts for your cockpit grows it becomes more difficult to put them into one file without variable number clashes. You also have to manually group your Var 0 statements and getting the overall view over your program becomes dificult.
In those situations it is good software engineering practice to split up your application into several self-contained logical units. Config_sioc supports this practice.
I will show the necessary steps based on the same example as above in the single file approach. Of course one would not split up such a small file, but it is just the mechanism I'd like to show you.
We start with the Notepad editor and create first a file that handles the state of the parking brake
and then a text file that handles the led of the parking brake (note that both files have a variable numbered 10).
Both files are saved
In order to be able work with multiple files and config_sioc.exe we create a config_sioc.ini file that defines the text files that make up our application. We do that by writing such a file with the Notepad editor. The first line is fixed and defines the languages setting of config_sioc.exe (1 = Spanish, 2 = English), but the second and third line specify where config_sioc.exe should look for our script files. This file has to be put in the same folder as config_sioc.exe (normally the SIOC folder).
Instead of Files, Import TXT, like we do in the single file approach, we now select 'Group, Run', and compilation will start immediately
There are no errors. Note that config_sioc compiles in three phases, which is very convenient for us programmers, because we do not have to import missing variable names or -numbers into our file, we can just make use of a variable that is defined in another file.
We now click at the grey OK button, bottom right, to close the log window, and inspect the config_sioc.exe main window showing the compiled code.
There is one big difference with the single file approach: config_sioc has automatically renumbered the variable numbers in our files, instead of twice var number 10, we now see vars 1 and 2. It has resolved the number clash, something we as programmers no longer have to worry about.
Just like in the single file approach we select 'Files, Save as' and save the compiled code as parkbrake_light.ssi
We are ready, the folder shows the compiled file (type SIOC compiled script), next to the two text files
Note: the end result, the file parkbrake_light.ssi, is semantically the same as in the single file approach, only the way to get there is different. Sioc.exe will not see any difference at all.