Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: UP scripts to change and move code Up: Code development Previous: ldmap

Subsections



Template management


reident

Remake the idents in a templates list.

Synopsis

reident [-z] [-t] [file [file ...]]

Description

reident reads a template file (templates by default, see mkinst (p[*])), sort/uniqs it on the name of the class implementation .cc file (second field), and replaces the idents on some or all lines so that each combination of ident and .cc file is unique.

reident also converts each entry in the input to a canonical form with respect to the use of spacing and typedef'd variables so that trivial duplications are automatically eliminated, and it warns of any non-trivial deviation from the canonical forms.

reident does not check for duplicate template definitions. The duplicates (p[*]) program is available for that purpose.

reident also converts each entry in the input to a formatted multi-line output that can be read by mkinst (p[*]).

If multiple files are specified they will be merged together. One file may be specified as ``-'' to denote input from stdin. Output is written to templates or to stdout - if the input came from templates it will be overwritten.

Missing idents (the preferred way of adding template definitions), idents specified as less than 1000 (another safe way to add new templates) and the second and subsequent occurrence of duplicate idents are replaced by a unique value for each .cc file. If the -z option is specified, all idents are replaced with an ascending sequence starting at 1000 for each .cc file.

The idents are incremented by 10 to allow manual insertion of new template declarations in the correct sequence.

Comments in the templates file (lines beginning with ``#'') will either stay at the top of the file, or stay tuned to the template definition line(s) they occur at.

Options

-z
Replace all idents with an ascending sequence restarting at 1000 for each .cc file.
-t
Write the output to the terminal (stdout) in stead of ./templates.

Notes

Diagnostics

Status return values
0: success
1: file not found

Examples

To merge a private templates list into the system's list for the aips package and at the same time completely refresh the idents

   cd $HOME/aips++/code/aips/implement/_ReposFiller
   ao -l templates
   reident -z templates myTemplates
   ai templates

To check a newly created templates list and check it for duplicates internally and against the trial repository:

    reident -t | duplicates -r trial -

If seldom used the -z option has the potential to cause a great deal of recompilation because of accumulated changes. However, if used regularly the incremental cost should be modest. Also, all care should be taken that templates included are not duplicated (see duplicates (p[*])).

See also

mkinst (p[*]), Generate template instantiation files from a list.
duplicates (p[*]), Checks for duplicate entries in templates lists across the system.
unused (p[*]), Checks for usage of templates in binary modules (executables or object modules).
used (p[*]), find any undefined classes and global methods.

Author

Original: 1996/04/16 by Mark Calabretta, ATNF.


duplicates

Look for duplicate entries in AIPS++ templates instantiation files

Synopsis

duplicates [-p package|all] [-r package|all] [-u package|all] ... [templates file] ...

Description

duplicates is a C++ executable program which looks for duplicate entries in AIPS++ templates files. This is useful for finding redundant templates entries, and for moving duplicate entries into a common templates file.

One entry in the template file list may be specified as - to indicate standard input.

If no list of files is provided, the list used is the combination of:

1.
A file named templates in the current working directory if any; and
2.
All files named templates under the $AIPSCODE tree, unless switches restrict the search to specified packages and/or repositories and/or non-repositories.

Duplicates found in the first (or the default templates file) are indicated by asterisks next to the line number.

The output can be restricted to duplicates that are only present in a package repository file and/or in a single file.

Options

Options are provided to limit the number of templates files that will be included in the search. Check with:

   duplicates -h

to find the currently available switches.

-h
Give some useage information
-s
Restrict the output ('s' for 'system') to duplicates found in a single file or in _ReposFiller files.
-p package|all
Restrict tests to templates files in the specified package (or all packages)
-r package|all
Restrict tests to the repository templates files in the specified package (or all packages)
-u package|all
Restrict tests to the non-repository templates files in the specified package (or all packages)

Examples

   duplicates
   duplicates templates /aips++/code/aips/implement/_ReposFiller/templates
   reident -t | duplicates -r trial -

The first line finds all duplicates in ./templates and all templates files checked into the system. The second example finds duplicates only in the listed files. The third line reformats and checks ./templates, and then checks for duplicates in this file and in
trial/implement/_ReposFiller/templates.

See also

AIPS++ do-it-yourself template instantiation (mkinst (p[*])).
reident (p[*]), reformat in canonical form the template instantiation file.
unused (p[*]), check usage of templates in binary executables and object modules.
used (p[*]), find any undefined classes and global methods.

Author

Original: 1997/06/09 by Brian Glendenning, NRAO


unused

Check for unused (or used) template object modules in binaries and/or object modules and/or libraries.

Synopsis

unused [-z|-nz|-a|-[0-9]...] [-p|-r|-u package] ... [-t templates1 [templates2 ...]] -f|-b file1 [file2 ...] [-i list1 [list2 ...]]

Description

unused reads binary files (either executables, object modules or object libraries) specified by the -b switch or the output of the g++filt filtered output of the nm or gnm program of such files as specified by the -f switch. I.e. files that are to be specified following an -f switch should have the following pre-processing:

        [g]nm binary.file | g++filt >! file.f
(Note that internally unused uses the gnm and g++filt synonyms. If they are not available on your system, the full path of these programs (or for the nm program) can be specified in the aipsrc file variables unused.file.nm and unused.file.gfilt.)

The other part of the input is a set of templates files. They can be specified as individual templates files (following the -t switch), or as a set of templates files in a package (like aips, trial or all to indicate all packages).

The templates in the specified templates files (including those specified with the -i switch) will be checked against the templates defined in the binary files . Depending on the show switches (-a, -z, -nz, -number) the output will contain templates used or unused in the specified binary files.

Options

-z
Show the unused templates only (this is the default if no show switch is given)
-nz
Show the used templates only (if the output is saved to a file, it can be used in a subsequent run of the unused program with the -i switch in stead of the original binary files)
-a
Show all the templates used in the binaries (i.e. both the used and unused ones)
-number
Show only the templates that are used in at least the number of binary files specified. I.e. if the switch given is -2, and two binary files are given as input, only templates occurring in both of these will be shown. If only one binary file was given nothing will be shown; if three binary files were specified all templates used in at least two of them will be shown.
-p package
Use all templates files found in the specified package (the package name may be ``all'')
-r package
Use all templates files in the repository directory of the specified package (or ``all'')
-u package
Use all user templates files in the package (i.e. excluding the ones in the repositories)
-t file [file ...]
Use the explicitly specified templates files
-i file [file ...]
Use the specified files as a source of templates. The files must be the ouput of an earlier run of the unused program (e.g. with the -nz switch).
-b|-f file [file ...]
Specify the binary files (-b) to be checked. The files can be executables, object libraries or object modules (i.e. files that can be handled by some nm program). If the -f switch is used in stead of the -b switch, the binary files are supposed to have been filtered already by a nm program and the g++filt program.

Notes

Diagnostics

Status return values
0: success
1: no files found

Examples

To show all the templates specified in the Tables/test/templates file that are used in a demonstration program dM30:

   unused -a ~/aips++/sun4sol_gnu/bindbg/dM30 -b `which dM30`

Using [/aips++/code/aips/implement/Tables/test/templates]
176 templates in 1 files
176 templates in 1 files after 0 inclusion files
Checked against 11259 names in 1 name files
# Template usage: 
    0: AiPs_hidden_type_(Array<ExampleDesc> *)
    0: AiPs_hidden_type_(Array<RetypedArrayEx1> *)
    0: AiPs_hidden_type_(Array<RetypedArrayEx2> *)
    0: AiPs_hidden_type_(Array<VSCExample> *)
.......
    0: valDataTypeId(RetypedArrayEx2 const *)
    0: valDataTypeId(VSCExample const *)
176 templates shown

In this case all the templates in the templates file have a count zero (none used in the binary). The same output would have been generated with the (default) -z switch, while no templates would have been shown if the -nz switch had been used.

See also

mkinst (p[*]), Generate template instantiation files from a list.
duplicates (p[*]), Checks for duplicate entries in templates lists across the system.

Author

Original: 1997/07/16 by Wim Brouw, ATNF.


used

Check for undefined classes and global functions in object libraries and object modules.

Synopsis

used [-ng] [-nc] [-tc] [[-f|-b] file1 [file2 ...]] ...

Description

used reads binary files (either object modules or object libraries) specified by the -b switch (default) and/or the output of the g++filt filtered output of the nm or gnm program of such files if specified by the -f switch. I.e. files that are to be specified following an -f switch should have the following pre-processing:

        [g]nm binary.file | g++filt >! file.f
(Note that internally used uses the gnm and g++filt synonyms. If they are not available on your system, the full path of these programs (or for the nm program) can be specified in the aipsrc file variables unused.file.nm and unused.file.gfilt.)

The first file specified is checked for any undefined global names. These undefined names are then checked against any definitions in all files given. Finally the resulted list of undefined names is output to stdout. The standard checking is for all global names. The -ng -nc and -tc switches can be used to limit the output.

Options

-nc
Show no classes (i.e. only the global functions)
-ng
Show no global functions (i.e. only classes)
-tc
Show for classes only templated classes
-b|-f file [file ...]
Specify the binary files (-b), also the default, to be checked. The files can be executables, object libraries or object modules (i.e. files that can be handled by some nm program). If the -f switch is used in stead of the (default) -b switch, the binary files are supposed to have been filtered already by an nm program and the g++filt program.

Notes

Diagnostics

Status return values
0: success
1: no files found

Examples

To show the missing templated classes used in the given file:

   used -ng -tc  ~/aips++/sun4sol_gnu/libdbg/libaips-Measures-test.a

Using [/u/wbrouw/aips++/sun4sol_gnu/libdbg/libaips-Measures-test.a]
Checked 7 undefineds against 2 defineds
# Undefined templated classes
    1: Array<Bool>
   18: Array<Quantum<Double> >
    7: Array<Double>
   14: Quantum<Vector<Double> >
   18: Quantum<Double>
    6: Vector<Double>
6 undefined objects/global functions shown

To check if the modules in libtrial.a have still some undefined references:

   used /aips++/weekly/sun4sol_egcs/lib/{libtrial,libaips}.a

The counts shown are the number of references to the class or global function found.

See also

mkinst (p[*]), Generate template instantiation files from a list.
unused (p[*]), Checks for usage of templates in binary modules (executables or object modules).
duplicates (p[*]), Checks for duplicate entries in templates lists across the system.

Author

Original: 1997/09/14 by Wim Brouw, ATNF.


next up previous contents index
Next: UP scripts to change and move code Up: Code development Previous: ldmap   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15