Using Grapnel Compiler
After installation of Grapnel Compiler you can use two programs:
grppars and grp2c
GRP parser utility: grppars
The parser utility should be run in the following way:
grppars [option(s)] inputfile(s)
Where options can be:
- -V
- The program writes out information about its activities. It is
useful for developers to determine problems and reason of the errors
occurred during the execution. See also -m.
- -P x
- In this option x sepcifies what to do when parser detects a
redefinition of an existing parameter in a parameter group. There are
three possibilities:
- -P a: append. If GRP parser finds a parameter
redefinition of an existing parameter then it will append values to
the existing value list of this parameter.
- -P o: overwrite. Redefinition of an existing parameter will
delete the existing parameter and its value list and a new and empty
parameter will be created. Values willl be placed on this empty list.
- -P e: error (this is the default behavior of the
parser). Redefinition of an existing parameter will abort parsing
phase.
- -d
- The program prints out informations about internal data structures
have been built during parsing phase. This option is not usefull for
users, it has been introduced to help developers. If -m options
was used than this options is skipped.
- -G
- The program generates GRP file and writes it back on standard
output. This must be semanticaly same as input GRP files and
sytacticaly correct. This option is ignored if -m options is
used.
- -t
- The program generates task graph on standard output.
- -m
- The program will generate its output in
HyperText Markup Language
format. If the -V option is not used, this option has no
effect.
- -e
- Change format of error messages to old format which is suitable
for Emacs. Default format is suitable for GRED program.
- -g URL
- URL which defines directory where GIF pictures can be found. For
example: "
http://www.cpc.wmin.ac.uk/~drotos/gifs
". This
parameter is used when parser makes debugging information in HTML form
(-m option was used).
- -v
- Prints out version number of the program. No other actions will be
taken.
- -h
- The program prints out it's legal options.
Grapnel Compiler: grp2c
The compiler should be run in the following way:
grp2c [option(s)] inputfile(s)
Every options described in grppars utility can be used with
grp2c. Additional options are:
- -s
- The compiler will not generate C source files. It can be used to
check GRP files syntactically or building up internal data structures
and generate some reports (see -d, -G options).
- -M
- The compiler will generate a Makefile which can be used to
compile generated C-source files into executable form. See also
-D, -p, and -I.
- -c
- If you use this option the compiler will generate a cross reference
file for every application defined in the GRP file. Name of the cross
reference files will be appname.crf where "appname" is name of the
application. This file is used by GRED system.
- -r path
- This option defines destination directory of the generated
C-source files and makefile as well as cross reference file. If this
option is not used then the Grapnel Compiler puts every output files
in the actual directory.
- -R path
- This option can be used to specify root directory where the
grp2c package is installed to if it differs from that one which
was specified at compilation of the package. If this option is not
specified then default value is used that can be defined at
configuration of the package, or the value of GRP2C_ROOT environment
variable. See Installing Grapnel Compiler.
- -D path
- Using this option you can define name of the directory where
compiler looks for template files when it generates Makefile. If this
option is not specified then default value is used that can be defined
at configuration of the package, or the value of
$GRP2C_ROOT/share. See Installing Grapnel
Compiler.
- -p platform
- This option determines target platform for grapnel library. At
that moment the grapnel library supports pvm platform only so there is
no reason to use this option yet.
- -I path
- This option defines the directory where the generated Makefile
(see option -M) installs binary files. path will be the
value of the installdir macro of the generated
Makefile. Default value is $HOME/pvm3/bin/$PVM_ARCH.
Notes for some
options:
- -m
- Generated source files can be put into any generated HTML
page. If this option is used then the Grapnel Compiler will generate
output files even if the -s option is used and print them on
output so they will be parts of the generated HTML page. If -s
option is used with -m option then the Grapnel Compiler will
delete output (C-source) files after compilation.
We can define more than one input file in the command line but it is
very important that these files will be concatenated together during
the compilation.
Tips
Merging GRP files
If you specify more than one input file, GRP parser will read every
files and merge them together. To produce merged GRP file, use
-G option of grppars or -sG of grp2c.
grppars -G file1.grp file2.grp ... >merged.grp
Remember that GRP file can contain more than one applications. If
input files discribe different applications then information of these
applications remain separated in different applications in one
(merged) file.
If input files describe same application, it is possible that a
parameter defined more than once. To avoid problems of parameter
redefinition use -P option.
Extending GRP files
If your task is to insert new information into an existing GRP file,
it can be done with grppars utility (or grp2c program
itself with -s option) from the shell because it can merge two
or more GRP files. In that case you can make an "empty" GRP file which
contains new information (for example parameters in MAPPING section)
but nothing else:
$ cat add.grp
Application: appname
{
HeaderPart
{
Section: MAPPING
{
Group: GroupName
{
Param1 = 123;
Param2 = 321;
OtherParams= 12, 23;
Additionals= 999, 1.23, "oops, it's text", 888;
}
}
}
}
$
Then you can parse original file and the new one, and the
parser merges them together. After parsing the merged result can be
written to a new GRP file (using the -G option).
grppars -G -P o original.grp add.grp >extended.grp
There is an other option (-P) for the parser which determines
how to handle parameter redefinitions. If a parameter is defined more
than once (for example in original GRP file and in your one) the new
definition can be appended into the old value list or it can replace
the old one. Note that the parser reads input files in same order as
they are specified in the command line. It means that orginal GRP file
should be specified first as you can see in the example above.
Back to
Grapnel Compiler.