The browsegen Utility

 This utility is a modified version of the compiler that will produce a browse file containing the position in the given source file or its included headers of the symbols used. The format of the generated browse files is described in the technical documentation. Use this utility only if you want to build browse information for use in another software. Normally, this utility is only used by the IDE (Wedit) to answer queries. A more detailed description of how it works is found in the technical documentation.

 Browsegen accepts the following command line options:

·        showifdeflines. This will trigger line numbers of inactive lines to be printed in standard output or in the given output file. This is useful for finding out which lines in a source file are being compiled or not.  

·        writefunctions This will write into standard output the locations of all the functions and types in the given file.

·        M1. This will show in the standard output all include files by the given input file.

·        Fo<file>. Writes all output in the given file. This is exactly the same as the compiler option Fo.

·        -P –P1 –P2 –P3 –P4. This generates a C source file that contains the public or public and private interface for the given source file.

 

Option

Description

-P or –P1

Will write all the prototypes for the public (i.e. not static) functions defined in the module.

-P2

Will write the public prototypes and data definitions for the given module.

-P3

Will write the prototypes for both the public and static functions, and the public data dependencies.

-P4

Will write the public and static function prototypes, and the public and static data definitions.

 

The format of the .xrf files

This files have three sections:

  1. A list of files that are used for building the module. The first one in this list is the root file, i.e. the file that was given in the command line. The others that follow are the included files, directly or indirectly. When a file is referenced later in a definition, it will be referenced with the index in this list. For instance a coordinate 6 25 means the 6th file in the list line 25. The format of the file list is as follows: A letter 'f' for file, followed by the full path to the file. The main file (or root file) is referenced with a capital 'F'.

  2. A list of symbols follows. This list consists of a line started with a letter that describes the type of symbol, a space, then the symbol name, then the coordinates, followed by the type of the symbol.

  3. A list of types follows, numbered from T00000001 upwards. Each type definition is followed by a colon (:) then optionally a '*' meaning it is a pointer, then the name of the type. If it is a structure or a union, a list follows, enclosed within '{' and '}'. After the opening brace, an 's' means structure, or a 'u' means union.

The different type letters

'A': means assignment. This record references a preceding symbol and gives the coordinate pairs where a direct assignment to that symbol was done.

'C': means a list of coordinates for aliases of this type follows.

'E' means external variable name, defined in this module. It is followed by the file index, the starting line and the ending line of the definition, and its type description.

'e': means external function defined in this module. Followed by a coordinate pair of file index, line number.

'L': means local variable. This records follow always a function definition record and apply to the immediately preceding function. The format is a pair of type reference, variable name.

'M': means reference to an external symbol. It is followed by pairs of coordinates of the references to that symbol.

'R': means reference.  It is used to mean references to the preceding symbol. For instance if a global variable 'x' is described, then the following 'R' records mean references to that variable. The coordinates are pairs of integers with file index and line in each pair.

'P': means command line parameter. ALl command line parameters given to browsegen are listed with this kind of records.

'S' means static global variable.  It is followed by file index, starting definition line, ending definition line, and the type reference.

's':means static function. It is followed by a coordinate pair file index, line number of the start of its definition.

'T': means type name defined in another included file. It is followed by the file index, the starting line of the definition, the ending line, and the type description.

't': means type name defined in the main file. Its format is identical to the 'T' record above.

'#' means this is a preprocessor symbol. (macro). It is followed by the coordinate pair of file index and line number.

 

An example of a type definition:

T00000024:{s 00000023 _ptr; 00000005 _cnt; 00000023 _base; 00000005 _flag; 
00000005 _file 00000023 _tmpfname; } _iobuf.

This defines a structure type with fields 's', 'ptr', '_cnt', '_base' , '_flag', '-file' and , '-tmpfname', named '_iobuf'.

The type of each field is written before the field name.