1. Porting Scicos 4.2 into Scilab 5.0
Contents
- These notes are relative to the tasks done for the scilab-5.0-alpha-1 release.
- Development of the Scilab code relative to Scicos is very dynamic so a large part of these notes will become obsolete in the following weeks.
- We have modified the Scicos code source in many places in order to adapt it to the state of the Scilab functions available at the moment of the release.
1.1. From SCICOS_WORK to TRUNK: the reorganization of the Scicos 4.2 source files inside Scilab 5.0
(31 Jan 2008)
The next Scilab 5.0 will contain a Scicos derived from the version present inside Scilab 4.1.2, but with a different organization and some adjustments in order to support Scilab 5.0 features. In the spirit of Scilab 5.0 modular architecture, the application program are organized as "modules". The "modules" reside in the folder "scilab/modules". We provide two basic Scicos modules:
scicos: editor (GUI), compiler, simulator, G.P. code generator (for internal use), modelica utils, modelical compiler, integrated Modelica simulator
scicos_blocks: the default Scicos libraries of blocks organized in "palettes". Interfacing functions, computational functions and Modelica models of explicit and implicit blocks
as well as two additional modules:
scicos-hil: Scicos Hardware In the Loop. Real time execution of Scicos diagram in connection with real devices
- Linux: support for Comedi and Measurement Computing cards
- Windows: support for Measurement Computing cards
scicos-flex: standalone code generation for embedded systems. Flexible code generator (Roberto Bucher), hard real time support and compilation environment (Paolo Gai), optimized palettes and Scicos blocks (Simone Mannori). Only the code generator and the palettes of blocks are included in Scilab 5.0. Cross compilation environments are available from Evidence (http://www.evidence.eu.com/) as GLP2 packages.
1.1.1. Basic Scicos Modules
The first section is composed of the scicos and scicos_blocks modules.
modules / scicos / demos / help / en_US / fr_FR / images / scicos_doc / includes / macros / scicos_auto / scicos_scicos / scicos_menus / scicos_utils / sci_gateway / c / fortran / src / c / fortran / modelica_compiler / ocaml / scicos_sundials / scicos.start scicos.quit scicos_blocks / demos / etc / scicos_blocks.start scicos_blocks.quit examples / help / en_US / fr_FR / images / includes / locales / macros / <palette_name> / sci_gateway / c / fortran / src / c / fortran / modelica / tests / benchmarks / unit_tests / nonreg_tests /
1.1.2. How we dit it
(Allan, Sylvestre, Simone, Laurent)
All Scicos-related files inside the SCICOS_WORK branch have been marked using standard GPL2 header.
Marked files:
- C
- Fortran
- Scilab
- Modelica
- OCaml
In following folders:
scilab/util (* please check this folder *) scilab/ocaml scilab/routine/scicos scilab/routine/scicos/sundials scilab/macros scilab/macros/util (* please check this folder *) scilab/macros/auto scilab/macros/scicos scilab/macros/scicos_blocks scilab/demos/scicos (* please check this folder *) scilab/man/scicos (* used but not marked *)
1.1.3. Copying the files
From |
SCICOS_WORK/scilab/routines/scicos/sundials |
To |
TRUNK/modules/scicos/src/scicos_sundials |
ViewVC |
http://viewvc.scilab.org/bin/cgi/viewvc.cgi?view=rev&revision=22036 |
Remark |
This port is easy and transparent. The files are not marked because Sundials is release with a very permissive GPL2 compatible license. We use "scicos_sundials" because the files are patched. |
From |
SCICOS_WORK/scilab/routines/scicos/ |
To |
TRUNK/modules/scicos/src/fortran |
TRUNK/modules/scicos_blocks/src/fortran |
|
ViewVC |
http://viewvc.scilab.org/bin/cgi/viewvc.cgi?view=rev&revision=22038 |
Remark |
This port of FORTRAN files it is a bit more tricky because we have separated the Scicos "core" files from the old Scicos bloks computational functions. These almost obsolete computational functions must be kept to ensure backward compatibility. |
From |
SCICOS_WORK/scilab/routines/scicos/ |
To |
TRUNK/modules/scicos/includes |
TRUNK/modules/scicos_blocks/includes |
|
ViewVC |
http://viewvc.scilab.org/bin/cgi/viewvc.cgi?view=rev&revision=22039 |
Remark |
Same job than above, but this time for the include "*.h" files. In this stage of the Scicos evolution, the "includes" files must be kept global. |
- TODO: "scilab/routine/scicos/" genblocks Make.block "modules/scicos_blocks/include" en refere par Sylvestre
From |
SCICOS_WORK/scilab/routines/scicos/ |
To |
TRUNK/modules/scicos/src/c |
TRUNK/modules/scicos_blocks/src/c |
|
ViewVC |
http://viewvc.scilab.org/bin/cgi/viewvc.cgi?view=rev&revision=22041 |
Remark |
As above, but this time for the C files. |
From |
SCICOS_WORK/scilab/ocaml/ |
To |
TRUNK/modules/scicos/src/modelica_compiler |
ViewVC |
http://viewvc.scilab.org/bin/cgi/viewvc.cgi?view=rev&revision=22044 |
Remark |
Modelica compiler and utilities are copied in the corresponding module folder. |
From |
man |
To |
man |
ViewVC |
http://viewvc.scilab.org/bin/cgi/viewvc.cgi?view=rev&revision=22048 |
http://viewvc.scilab.org/bin/cgi/viewvc.cgi?view=rev&revision=22051 |
|
http://viewvc.scilab.org/bin/cgi/viewvc.cgi?view=rev&revision=22052 |
|
http://viewvc.scilab.org/bin/cgi/viewvc.cgi?view=rev&revision=22055 |
|
Remark |
All help files moved to corresponding folder. |
From |
SCICOS_WORK/scilab/macros/auto |
To |
TRUNK/modules/scicos/macros/scicos_auto |
ViewVC |
http://viewvc.scilab.org/bin/cgi/viewvc.cgi?view=rev&revision=22046 |
Remark |
Special attention is required for this macros: remember to load this library at the module activation (scicos.star). |
From |
SCICOS_WORK/scilab/macros/util |
To |
TRUNK/modules/scicos/macros/scicos_utils |
ViewVC |
http://viewvc.scilab.org/bin/cgi/viewvc.cgi?view=rev&revision=22047 |
Remark |
Some useful macros used by Scicos. |
From |
SCICOS_WORK/scilab/macros/scicos |
To |
TRUNK/modules/scicos/macros/scicos_scicos |
ViewVC |
http://viewvc.scilab.org/bin/cgi/viewvc.cgi?view=rev&revision=22054 |
Remark |
The main folder that contains editor (GUI), compiler, simulator (some parts) and the internal code generator. |
From |
SCICOS_WORK/scilab/macros/scicos_blocks |
To |
TRUNK/modules/scicos_blocks/macros |
ViewVC |
http://viewvc.scilab.org/bin/cgi/viewvc.cgi?view=rev&revision=22053 |
Remark |
Full tree preserved. |
1.1.4. Activation of Scicos modules
- In Scilab 5 folder, open the file "scilab/etc/modules.xml" and verify the presence of the lines :
<module name="scicos" activate="yes"/> <module name="scicos_blocks" activate="yes"/>
./configure
make
- TODO:
a) check these original SCICOS_WORK folders:
scilab/util scilab/macros/util scilab/demos/scicos
- verify that all files are marked GPL2
- verify that they are committed in "TRUNK"
b) all the "buildmacros.sce" in all "macros" folders need revision (they contain some old references).
http://viewvc.scilab.org/bin/cgi/viewvc.cgi?view=rev&revision=22064
c) add some comment for :http://viewvc.scilab.org/bin/cgi/viewvc.cgi?view=rev&revision=22062
1.1.5. Summary of Sylvestre's work
Retrieve both Makefile.am
Move scicos_blocks/includes/import.h to scicos/src/c/
On both modules (scicos and scicos_blocks) :
Replace |
#include "../machine.h" |
With |
#include "machine.h" |
Remark |
Already provided by the -I directive |
Command |
sed -i -e "s|../machine.h|machine.h|g" grep -r "../machine.h" *|grep -v .svn|cut -d: -f1|sort -u |
Replace |
#include "../stack-c.h" |
With |
#include "stack-c.h" |
Remark |
Already provided by the -I directive |
Command |
sed -i -e "s|../stack-c.h|stack-c.h|g" grep -r "../stack-c.h" *|grep -v .svn|cut -d: -f1|sort -u |
Replace |
#include "../stack.h" |
With |
#include "stack.h" |
Remark |
Already provided by the -I directive |
Command |
sed -i -e "s|../stack.h|stack.h|g" grep -r "../stack.h" *|grep -v .svn|cut -d: -f1|sort -u |
Replace |
#include "../callinter.h" |
With |
#include "callinter.h" |
Remark |
Already provided by the -I directive |
Command |
sed -i -e "s|../callinter.h|callinter.h|g" grep -r "../callinter.h" *|grep -v .svn|cut -d: -f1|sort -u |
Replace |
*->pixmap |
With |
sciSetPixmapMode and sciGetPixmapMode |
Remark |
- |
Replace |
../os_specific/*_mem_alloc.h |
With |
MALLOC.h |
Remark |
- |
Remove |
#define abs(x) ((x) >= 0 ? (x) : -(x)) |
#define max(a,b) ((a) >= (b) ? (a) : (b)) |
|
#define min(a,b) ((a) <= (b) ? (a) : (b)) |
|
Remark |
Defined in #include "core_math.h" |
Replace |
#include "sundials/ida_impl.h" |
With |
#include "ida_impl.h" |
Remark |
Included by the makefile (-Isrc/scicos_sundials/) |
Replace |
#include "../os_specific/link.h" |
With |
#include "dynamic_link.h" |
Remark |
Module name changed and include |
In import.h: add #include "machine.h" (for integer)
Take the latest version of GenBlocks.sh and put it in TRUNK/modules/scicos_blocks/src/scripts/
ConstructPolyline and sciSetText changed since Scilab 4:
sciSetText needs nbrow & nbcol
ConstructPolyline has one less input argument)
1.2. Modification of the Scicos code for Scilab 5 compatibility
Event handling
xclick() and xgetmouse() have been rewritten natively in Java for maximum portability. Bruno has done most of the dirty work using the "Communist Listener": a Java class capable of retrieving all the elementary events (keyboard and mouse) from all the active Scilab windows and recreate an interface layer compatible with the old functions.
- TODO:
- seteventhandler() is not yet active
Menu
- All functions relative to menus have been rewritten natively in Java. A particular attention has been put in order to ensure perfect backward compatibility with old mechanisms of automatic function calling and callback string generation. All the menus are now UICONTROLS standard menus and they appear as "children" in the figure data structure (Vincent COUVERT).
- TODO:
- - nested menus ?
Graphics Dialog boxes
- All the old TCL/TK boxes have been rewritten natively in Java (Bruno JOFRET, Vincent COUVERT).
- TODO:
- - better looking dialog boxes ?