org.dellroad.jc.cgen
Class C

java.lang.Object
  extended byorg.dellroad.jc.cgen.C

public class C
extends Object

Utility routines for generating C code.


Method Summary
static String accessDefs(int flags)
           
static String accessDefs(SootClass c)
           
static String accessDefs(SootField f)
           
static String accessDefs(SootMethod m)
           
static String encode(String name)
           
static String encode(String name, boolean ignoreSlashes)
           
static void include(String s)
           
static String jc_type(Type t)
           
static String jc_type(Value v)
           
static void main(String[] args)
           
static String name(SootClass c)
           
static String name(SootField f)
           
static String name(SootMethod m)
           
static String paramsDecl(SootMethod m, boolean withNames)
           
static String primName(Type t)
           
static boolean reserved(String s)
          Tells us whether the token is a reserved word that cannot be used in C source.
static String string(String s)
          Returns string(s, true).
static String string(String s, boolean enquote)
          Returns a doubly-quoted C string containing the UTF-8 encoded value of s with special characters suitably escaped.
static String type(SootClass sc)
           
static String type(SootClass sc, boolean withStruct)
           
static String type(SootField f)
           
static String type(SootField f, boolean withStruct)
           
static String type(SootMethod m)
           
static String type(SootMethod m, boolean withStruct)
           
static String type(Type t)
          Equivalent to type(t, false).
static String type(Type t, boolean withStruct)
          Return the C type for an object of type t, which must be a normal Java type, i.e., a type that can be the type of a variable.
static String type(Value v)
           
static String type(Value v, boolean withStruct)
           
static CExpr value(ValueBox vb)
           
static String valueType(Type t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

string

public static String string(String s)
Returns string(s, true).


string

public static String string(String s,
                            boolean enquote)
Returns a doubly-quoted C string containing the UTF-8 encoded value of s with special characters suitably escaped. If enquote is true, then enclose the string in double quotes.


name

public static String name(SootClass c)

name

public static String name(SootField f)

name

public static String name(SootMethod m)

reserved

public static boolean reserved(String s)
Tells us whether the token is a reserved word that cannot be used in C source. For example, we can't allow "jfloat" as a static variable name because it conflicts with the C typedef of the same name.


encode

public static String encode(String name)

encode

public static String encode(String name,
                            boolean ignoreSlashes)

type

public static String type(SootClass sc)

type

public static String type(SootMethod m)

type

public static String type(SootField f)

type

public static String type(Value v)

type

public static String type(SootClass sc,
                          boolean withStruct)

type

public static String type(SootMethod m,
                          boolean withStruct)

type

public static String type(SootField f,
                          boolean withStruct)

type

public static String type(Value v,
                          boolean withStruct)

value

public static CExpr value(ValueBox vb)

type

public static String type(Type t)
Equivalent to type(t, false).


type

public static String type(Type t,
                          boolean withStruct)
Return the C type for an object of type t, which must be a normal Java type, i.e., a type that can be the type of a variable. Reference types have the struct code prefixed if withStruct is true, but never have '*' appended.


valueType

public static String valueType(Type t)

jc_type

public static String jc_type(Value v)

jc_type

public static String jc_type(Type t)

primName

public static String primName(Type t)

accessDefs

public static String accessDefs(SootClass c)

accessDefs

public static String accessDefs(SootField f)

accessDefs

public static String accessDefs(SootMethod m)

accessDefs

public static String accessDefs(int flags)

paramsDecl

public static String paramsDecl(SootMethod m,
                                boolean withNames)

include

public static void include(String s)

main

public static void main(String[] args)