Scilab Function
Last update : 1st-Nov-2004 - Revised 2005
scipad - Embedded Scilab text
editor
Calling Sequence
-
scipad()
-
scipad(f)
-
scipad([f1,f2,...])
-
scipad f1 f2 ...
Parameters
-
f, f1, f2...
: file pathnames
Description
Scipad is an embedded Scilab text editor written in TCL/TK. It can be
started with the "Editor" button on top of the main Scilab window, or from
Scilab command line with the instruction
scipad()
or
scipad f
.
The same invocation adds further files to an already opened scipad
session. Scipad allows Windows like edition modes. Keyboard shortcuts are
defined for most possible editing actions and reported by the menu
entries.
Additionally, the following shortcuts are defined:
| <F2> |
Save file |
| <F5> |
Save file and run it into Scilab |
| <F6>, <Control-F6> |
Show next buffer |
| <F7>, <Control-F7> |
Show previous buffer |
| <double-click
mouse-button1> |
Select word |
| <triple-click
mouse-button1> |
Select line |
| <Shift-Control-mouse-button1> |
Open the source of the library function under the
pointer |
| <mouse-button2> |
Paste selection |
| <mouse-button3> |
Popup edit menu, or debug menu if clicked during a
debug session |
| <Shift-mouse-button3> |
Popup Execute menu |
| <Control-mouse-button3> |
Popup Options menu |
| <Control-plus> |
Increase the font size |
| <Control-minus> |
Decrease the font size |
The "Load Into Scilab" (Ctrl-lowercase-l) menu entry can be used to
exec
the file content into Scilab, while "Execute selection"
(Ctrl-lowercase-y) passes the selected lines to the scilab shell using
ScilabEval
(i.e.
execstr
).
Debugger
Scipad 2.0 or later includes a debugger (for .sci files only). The user
can:
-
-
Set/remove breakpoints anywhere in the opened files.
The breakpointed lines get pink background.
-
Configure execution.
The user has to provide the function name to execute, its variable
names, and variable values. To ease this step, a scan of the currently
displayed buffer is implemented to look for functions defined in it,
scan their names and variable names. All this is displayed to the user
in a dialog for easy selection. First, he has to select a function in
a spinbox, then eventually one of its variables. Once a variable is
selected, the user can set/change its value (another dialog pops).
Variable values and names are displayed in listboxes. The user can
also add a new variable or remove already defined variables. This is
in case the user changes the input variables of his function in the
file, and he does not want to scan the buffer again (which causes all
the variable values to reset to a null value, actually "").
-
Launch execution with breakpoints.
Scipad execs the currently displayed buffer as well as all the
opened buffers that contain functions, sends to Scilab the buffer as
well as all the opened buffers that contain functions, sends to Scilab
the setbpt instructions relative to all the breakpoints that have been
set, and executes the selected function with the input variable values
provided during the configure execution step. Then the execution is
automagically stopped by Scilab at the first breakpoint.
At this point there are several possibilities for the user:
-
-
Continue up to next breakpoint.
Scilab resumes execution, and stops at the next breakpoint or goes
to the end of the file if there are no more breakpoints. The active
breakpoint is emphasized in Scipad so that it can easily be
identified.
-
Insert a new breakpoint or remove existing breakpoint during the debug.
The breakpointed lines get pink background, and lines where
breakpoints are removed restore their normal background. The new
breakpoint configuration is taken into account for the next steps of
execution or debug.
-
Execute step by step.
This is currently not available (it is always disabled in the
Debug menu). See proc stepbystep_bp in
SCI/tcl/scipadsources/db_debugsession.tcl for further details about
the problems encountered for this item.
-
Continue ignoring any breakpoint.
Finish execution in Scilab as if there was no breakpoint at all:
Breakpoints are removed from Scilab but kept in Scipad.
-
Abort debug.
Abort execution in Scilab and cancel the current debug session in
Scipad.
-
Remove all breakpoints.
This allows to quickly remove all the breakpoints from both Scilab
and Scipad.
At any time during the debug, a watch window can be displayed
on user request. It allows to monitor any variable value, or change a
variable value during a breakpoint stop and relaunch execution with the
modified value. The watch window also displays the calling stack.
After the end of the execution, the breakpoints are removed from Scilab
(but kept in Scipad).
In its current development state the debugger works well with
functions, i.e. pure .sci files. Support of .sce files or mixed
.sce/.sci files has been foreseen but not yet implemented. That means that
a .sce file will not crash Scipad, which is the very least, but more, once
a feasible solution for debugging this type of files is figured out, it
should be easy to add the functionality in the Scipad source code. Anyway,
if actually a debug is required in a .sce, you should first convert it
into a .sci function just by adding (output_vars)=function foo(input_vars)
/ endfunction and that's it. The absence of breakpoints management for
.sce is therefore not such a major drawback.
Remarks
-
-
Localisation:
Scipad menues and messages can be translated to several languages.
By default, they appear in the language of Scilab, which is either
English or French (see
setlanguage
), but other languages
are being added.
To this extent, the following commands have to be issued in
scilab once per session, before launching Scipad for the first time:
global %scipad_language; %scipad_language="XX"
where XX stands for the code of the language. Such commands
can be included, for instance, in the user .scilab file.
Currently, the supported
codes are: "de" (German) ,"eng" (English), "fr" (French),
"it" (Italian), "no" (Norwegian), "se" (Swedish).
Further languages can be added by creating the proper translation
file and putting it in SCI/tcl/scipadsources/msg_files/. If you plan
to do such a job and to contribute it to the community, please
contact the current mantainers for detailed instructions.
-
Drag and drop:
Drag and drop capability for a file or for a list of files can be
achieved in Scipad simply by installing the TkDnD package
(http://sourceforge.net/projects/tkdnd). Presence of this package
should be automatically detected by Scipad, enabling the corresponding
features at that time. Once TkDnD is intalled, dragging one or more
files from an explorer and dropping to Scipad will open the file(s) in
Scipad.
There is also a drag and drop feature for selected text within the
Scipad window. Possible actions are move (just use mouse button-1) and
copy (Control button-1).
Windows and linux-i386 binary versions of Scilab are currently shipped
with Tkdnd. If not, here are some installation instructions:
Windows platforms: Download the full package
(currently tkdnd-1.0a2.tar.gz), and uncompress it somewhere. Copy the
content of lib\tkdnd and paste it into SCI\tcl\tk8.4\tkdnd. That's
all!
linux-i386 platforms: Download the rpm package (currently
tkdnd-1.0-b2.i386.rpm). Install it with rpm -U (may
have to force --nodeps if it doesn't recognize an existing tcl
installation). If you have a source version of Scilab and an
installation of tcl-tk, check where they are installed (e.g.
/usr/share/) and move the newly created directory /usr/lib/tkdnd1.0/
to there. If you have a binary version of Scilab, move tkdnd1.0/ to
SCI/tcl/, where the supplied tcl-tk binaries are.
-
Known Issues:
Execute selection deals only with selections containing less than
a reasonable number of characters (~4000 on Linux, or ~500 on
Windows). It gets confused if the selection contains a
function
not terminated by an
endfunction
.
The commands passed are output on the Scilab window, but are not
recorded in the history.
-
Bugs:
There are still a few... Details can be found in file
SCI/tcl/scipadsources/BUGS
Examples
scipad SCI/scilab.star
Authors
-
Scipad is derived from
tknotepad
written by
Joseph Acosta;
-
Mathieu Philippe, INRIA, 2001;
-
Enrico Segre, Weizmann Institute, 2003-2005;
-
Francois Vogel, 2004-2005.