Solutions of common problems
This C module implements functions that turn their arguments
into strings which then play the role of identifiers as if
they occurred in the input, i.e. they are entered in the identifier
table, and their symbol code is returned.
The module is instantiated by
$/Tech/MakeName.gnrc +instance=IDENT :inst
The generic instance parameter
IDENT has to be
set to the terminal symbol used for identifiers.
The module can also be used to generate and store identifiers
in processors that do not have a scanner and a parser. In this case
+instance parameter has to be omitted.
All entities exported by this module can be used in specifications
They can also be used in
.pdl specifications or in C modules
if the interface file
MakeName.h is imported there.
The module exports the following functions:
int MakeName (char *c)
c is a character string that may coincide with an
already existing name. The result the is the encoding of the name
int GenerateName (char *c)
c is a character string.
The name is generated by appending a number to the prefix
such that the
name is different from all others encountered so far (on input and
int IdnNumb (int id, int num)
id is the encoding of an existing identifier;
a nonnegative number. The new name is formed by appending the number to
the identifier string. It may coincide with an already existing name.
This function may be used to derive arbitrary names from existing
int PreIdnPost (char *pre, int id, char *post)
id is the encoding of an existing identifier,
post are arbitrary character strings.
The generated name is formed
by catenation of
pre, the identifier string and
It may coincide with an already existing name.
This function may be used to derive different names (e. g. for different
target objects) from an existing name.