harpoon.Backend.Maps
Class DefaultNameMap

java.lang.Object
  extended by harpoon.Backend.Maps.NameMap
      extended by harpoon.Backend.Maps.DefaultNameMap
All Implemented Interfaces:
Serializable

public class DefaultNameMap
extends NameMap

DefaultNameMap implements a JNI-compliant method name mangling, and class and field name mangling "in the spirit of" the JNI.

The resulting names are C-compliant; that is, they can be referenced from native code written in C.

Version:
$Id: DefaultNameMap.java,v 1.4 2002/04/10 03:03:02 cananian Exp $
Author:
Felix S. Klock II <pnkfelix@mit.edu>, C. Scott Ananian <cananian@alumni.princeton.edu>
See Also:
Serialized Form

Constructor Summary
DefaultNameMap(boolean prependUnderscore)
          Creates a DefaultNameMap.
 
Method Summary
 String c_function_name(String fn)
          Maps a C function name to the appropriate label string.
 String mangle(HClass hc, String suffix)
          Mangle a class name.
 String mangle(HField hf, String suffix)
          Mangle a field name.
 String mangle(HMethod hm, String suffix)
          Mangle a method name.
 String mangle(String string_constant, String suffix)
          Mangle a string constant reference.
 
Methods inherited from class harpoon.Backend.Maps.NameMap
label, label, label, label, label, label, label, label, mangle, mangle, mangle, mangle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultNameMap

public DefaultNameMap(boolean prependUnderscore)
Creates a DefaultNameMap. If prependUnderscore is true, then underscores are prepended to c function names. Otherwise, the appear in the assembly output exactly as they do in C.

Method Detail

c_function_name

public String c_function_name(String fn)
Description copied from class: NameMap
Maps a C function name to the appropriate label string. For many platforms, the label string has an underscore prepended. For others, the label string is the function name exactly.

Specified by:
c_function_name in class NameMap

mangle

public String mangle(HMethod hm,
                     String suffix)
Mangle a method name.

Specified by:
mangle in class NameMap

mangle

public String mangle(HField hf,
                     String suffix)
Mangle a field name.

Specified by:
mangle in class NameMap

mangle

public String mangle(HClass hc,
                     String suffix)
Mangle a class name.

Specified by:
mangle in class NameMap

mangle

public String mangle(String string_constant,
                     String suffix)
Mangle a string constant reference.

Specified by:
mangle in class NameMap