To run the progam, say at your shell prompt:
blop [options]
[files] Possible options:
- -x cmd
- Execute the command 'cmd'
- -s variable=value
- Create a global variable called 'variable', and set its value
to 'value. Equivalent to -x 'var variable="value";'
- -w filename
- The given file's status will be continuosly watched,
and if it changes, the whole command will be rerun.
This file will also be taken as a c++ script file to
be executed. For example, the command 'blop -w file.C'
will execute 'file.C' whenever it changes
- -W filename
- As -w filename, but the given file will not be taken
as a c++ script (useful to monitor the change of
datafiles) For example the command 'blop -W data.dat script.C'
will execute the script 'script.C' whenever the datafile
data.dat changes
- --version
- Print version info (date of the last cvs commit)
- -h topic
--help topic
- Display help about topic
- -m
- This argument is only useful when standard input is redirected.
In this case blop is by default in script
mode (see below... the input read from the standard input is interpreted as a
script file, that is, it can contain function definitions, and it must
contain a main function). The -m argument (with redirected input)
causes blop to switch to the interactive mode, when any input is
interpreted as if it was already within a main() { } function
- --update
- Check if there is a more recent version available. If yes,
download, compile and install it (via sudo)
- -c|--compile
- If your code is very heavy, or CINT fails to interpret it (which
is often the case with long chained member functions, for example
plot("datafile").ds(cboxes().dx(1).dy(1).title("title").logscale(true));),
then you may want to compile your code.
With -c or --compile blop will compile and run
the given file. If blop.h is not included in your source, blop
automatically
creates a wrapper source file, something like this:
#include "blop.h"
using namespace blop;
#include "/your/home/directory/.blop/bloprc.C" // if it #exists
// some code here to run your BLOP_USER_INIT() function from bloprc.C
#include "your_script_file.C"
The -s and -x command-line arguments do not work in this case.
Any other command line arguments are interpreted as filenames, which
must be valid C++ scripts. The interpreter will look for the function
int main() {...} in these files, and run that function. If
no filenames are given, or none of them contains the
main
function, the interpreter will run interactively, and further commands
(which may call the functions provided in these files) are expected
from the terminal.
The -x option can be used to communicate parameters to your scripts
from the command line. For example:
// ------ test.C int
main() {
cout<<"This is the parameter: "<<par<<endl; }
This script would not run without errors, because the variable
par is not defined. But you can define it from the command
line:
[host] ~/ > blop -x 'var par="Hello world";' test.C
or easier:
[host] ~/ > blop -s par="Hello world"
test.C
There are 2 different modes of blop:
- Script mode
- If blop is given a C++ script file, it is in script mode: the
file can contain function declarations/definitions, or anything that
a valid C++ file can contain. It also MUST contain a main(){..}
function, which will be executed.
By default, if no scriptfiles are provided on the command line, but
standard input is redirected, blop is also in script mode (unless
the -m option is given)
- Interactive mode
- If no scriptfiles are provided on the command line, and the
standard input is not redirected, blop is in
interactive mode: it expects commands from the terminal. These
commands are interpreted as if they were already within the
main(){..} function.
Upon startup, blop first loads the system-wide initialization file
init.C from its installation directory (which is by default
/usr/local/blop, unless changed during the installation). Then it
will look for the file
$HOME/.blop/bloprc.C. If this file
exists, this will also be loaded before reading any other files. The
user may provide handy functions in this file, which can be called
later. If the user provides a function
void
BLOP_USER_INIT(); in this file, this will be called automatically at
this point; this function can be used to set default values, or make
any initializations. After this all remaining files provided as
command line arguments are processed.
The directory
$HOME/.blop/ is the place, where frequently
used include-files should be placed. This directory is automatically
included into the search path, where blop looks for files, when it
finds a
#include "filename.h"
statement. (The bloprc.C file is also located in this directory)
When looking for help on a specific topic, say at your blop prompt:
help("topic"); (where "topic" should of course be replaced by
what you are looking for. It can be a regular expression as
well.). This command will browse the documentation, and provide you a
choice of different sections, which contain your keyword. (Currently
you might get too many choices, since this command looks for all files
in the documentation, which contain your keyword. This will improve in
the future, and specific files will be preferred for certain
keywords). The help system is HTML-based, the HTML browser to be used
is figured out automatically, unless you set the environment variable
BLOP_HELPVIEWER to some program. The pattern '
%f' is
replaced by the filename in this string. Example:
bash> export BLOP_HELPVIEWER="lynx %f"
bash> blop
You often find yourself not running blop interactively, but
instead, writing a script. Thus, you do not have any running blop
process, but you would like to look for help. It is painful to start a
blop process, type help("something"); and then terminate the process,
etc. Therefore the command line option -h is reserved to make your
life easier: saying
blop -h topic
will do this job
for your.