gov.llnl.babel.backend.mangler
Class ShaMangler
java.lang.Object
gov.llnl.babel.backend.mangler.ShaMangler
- NameMangler
public class ShaMangler
extends java.lang.Object
This class uses the SHA message digest algorithm to generate
the mangled part of a shortened identifier. The message digest of the
symbol, method and suffix is converted into a sequence of allowable
characters. The mangled part of the name may appear random, but it is
completely deterministic and reproducible.
ShaMangler(int maxNameLen, int maxUnmangled, char[] charSet) - Create an instance of the
ShaMangler .
|
String | shortArrayName(String symbol, String method, String suffix) - Create the short name from the
symbol , method
and suffix .
|
String | shortName(String symbol, String suffix)
|
String | shortName(String symbol, String method, String suffix) - Create the short name from the
symbol , method
and suffix .
|
ShaMangler
public ShaMangler(int maxNameLen,
int maxUnmangled,
char[] charSet)
throws NoSuchAlgorithmException
Create an instance of the ShaMangler
.
maxNameLen
- this is the maximum number of characters that
a name may contain. For Fortran 90 and strict
ANSI C, this would be 31. For strict FORTRAN
77, this would be 6.maxUnmangled
- this indicates how many characters out of
maxNameLen
should be used for
unmangled content.charSet
- this provides the complete set of allowable
characters that are considered distinct by
the language compiler.
shortArrayName
public String shortArrayName(String symbol,
String method,
String suffix)
throws UnsupportedEncodingException
Create the short name from the symbol
, method
and suffix
. This mangler uses the SHA message digest to
generate the extra characters to attempt to avoid a symbol conflict.
- shortArrayName in interface NameMangler
symbol
- the fully qualified name of the class or interface
holding the method. This name has periods separating
the different package components and class name.method
- this is the full name of the method. For overloaded
methods, this should be the full method name.suffix
- this suffix is used to designate what kind of
kind of function name is being generated (i.e.,
stub, skel, or impl).
- a string whose length is less than or equal to the maximum
allowed length. The name will have an unmangled part and a mangled
part (assuming it needs to be shortened).
shortName
public String shortName(String symbol,
String suffix)
throws UnsupportedEncodingException
- shortName in interface NameMangler
shortName
public String shortName(String symbol,
String method,
String suffix)
throws UnsupportedEncodingException
Create the short name from the symbol
, method
and suffix
. This mangler uses the SHA message digest to
generate the extra characters to attempt to avoid a symbol conflict.
- shortName in interface NameMangler
symbol
- the fully qualified name of the class or interface
holding the method. This name has periods separating
the different package components and class name.method
- this is the full name of the method. For overloaded
methods, this should be the full method name.suffix
- this suffix is used to designate what kind of
kind of function name is being generated (i.e.,
stub, skel, or impl).
- a string whose length is less than or equal to the maximum
allowed length. The name will have an unmangled part and a mangled
part (assuming it needs to be shortened).