Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
asdl_c.TypeDefVisitor Class Reference
Inheritance diagram for asdl_c.TypeDefVisitor:
Inheritance graph
[legend]
Collaboration diagram for asdl_c.TypeDefVisitor:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def visitModule
def visitType
def visitSum
def simple_sum
def sum_with_constructors
def visitProduct
def emit
def visit

Public Attributes

 file
 cache
 skip
_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Detailed Description

Definition at line 100 of file asdl_c.py.


Member Function Documentation

def asdl_c.EmitVisitor.emit (   self,
  s,
  depth,
  reflow = True 
) [inherited]

Definition at line 89 of file asdl_c.py.

00089 
00090     def emit(self, s, depth, reflow=True):
00091         # XXX reflow long lines?
00092         if reflow:
00093             lines = reflow_lines(s, depth)
00094         else:
00095             lines = [s]
00096         for line in lines:
00097             line = (" " * TABSIZE * depth) + line + "\n"
00098             self.file.write(line)
00099 

Here is the call graph for this function:

def asdl_c.TypeDefVisitor.simple_sum (   self,
  sum,
  name,
  depth 
)

Definition at line 114 of file asdl_c.py.

00114 
00115     def simple_sum(self, sum, name, depth):
00116         enum = []
00117         for i in range(len(sum.types)):
00118             type = sum.types[i]
00119             enum.append("%s=%d" % (type.name, i + 1))
00120         enums = ", ".join(enum)
00121         ctype = get_c_type(name)
00122         s = "typedef enum _%s { %s } %s;" % (name, enums, ctype)
00123         self.emit(s, depth)
00124         self.emit("", depth)

Here is the call graph for this function:

Here is the caller graph for this function:

def asdl_c.TypeDefVisitor.sum_with_constructors (   self,
  sum,
  name,
  depth 
)

Definition at line 125 of file asdl_c.py.

00125 
00126     def sum_with_constructors(self, sum, name, depth):
00127         ctype = get_c_type(name)
00128         s = "typedef struct _%(name)s *%(ctype)s;" % locals()
00129         self.emit(s, depth)
00130         self.emit("", depth)

Here is the call graph for this function:

Here is the caller graph for this function:

def asdl.VisitorBase.visit (   self,
  object,
  args 
) [inherited]

Definition at line 319 of file asdl.py.

00319 
00320     def visit(self, object, *args):
00321         meth = self._dispatch(object)
00322         if meth is None:
00323             return
00324         try:
00325             meth(object, *args)
00326         except Exception:
00327             output("Error visiting" + repr(object))
00328             output(str(sys.exc_info()[1]))
00329             traceback.print_exc()
00330             # XXX hack
00331             if hasattr(self, 'file'):
00332                 self.file.flush()
00333             os._exit(1)

Here is the call graph for this function:

Here is the caller graph for this function:

def asdl_c.TypeDefVisitor.visitModule (   self,
  mod 
)

Definition at line 101 of file asdl_c.py.

00101 
00102     def visitModule(self, mod):
00103         for dfn in mod.dfns:
00104             self.visit(dfn)

Here is the call graph for this function:

def asdl_c.TypeDefVisitor.visitProduct (   self,
  product,
  name,
  depth 
)

Definition at line 131 of file asdl_c.py.

00131 
00132     def visitProduct(self, product, name, depth):
00133         ctype = get_c_type(name)
00134         s = "typedef struct _%(name)s *%(ctype)s;" % locals()
00135         self.emit(s, depth)
00136         self.emit("", depth)
00137 

Here is the call graph for this function:

def asdl_c.TypeDefVisitor.visitSum (   self,
  sum,
  name,
  depth 
)

Definition at line 108 of file asdl_c.py.

00108 
00109     def visitSum(self, sum, name, depth):
00110         if is_simple(sum):
00111             self.simple_sum(sum, name, depth)
00112         else:
00113             self.sum_with_constructors(sum, name, depth)

Here is the call graph for this function:

def asdl_c.TypeDefVisitor.visitType (   self,
  type,
  depth = 0 
)

Definition at line 105 of file asdl_c.py.

00105 
00106     def visitType(self, type, depth=0):
00107         self.visit(type.value, type.name, depth)

Here is the call graph for this function:


Member Data Documentation

Definition at line 316 of file asdl.py.

Definition at line 86 of file asdl_c.py.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.

asdl.VisitorBase.skip [inherited]

Definition at line 317 of file asdl.py.


The documentation for this class was generated from the following file: