Code.pxd 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. from __future__ import absolute_import
  2. cimport cython
  3. from ..StringIOTree cimport StringIOTree
  4. cdef class UtilityCodeBase(object):
  5. cpdef format_code(self, code_string, replace_empty_lines=*)
  6. cdef class UtilityCode(UtilityCodeBase):
  7. cdef public object name
  8. cdef public object proto
  9. cdef public object impl
  10. cdef public object init
  11. cdef public object cleanup
  12. cdef public object proto_block
  13. cdef public object requires
  14. cdef public dict _cache
  15. cdef public list specialize_list
  16. cdef public object file
  17. cpdef none_or_sub(self, s, context)
  18. cdef class FunctionState:
  19. cdef public set names_taken
  20. cdef public object owner
  21. cdef public object scope
  22. cdef public object error_label
  23. cdef public size_t label_counter
  24. cdef public set labels_used
  25. cdef public object return_label
  26. cdef public object continue_label
  27. cdef public object break_label
  28. cdef public list yield_labels
  29. cdef public object return_from_error_cleanup_label # not used in __init__ ?
  30. cdef public object exc_vars
  31. cdef public object current_except
  32. cdef public bint in_try_finally
  33. cdef public bint can_trace
  34. cdef public bint gil_owned
  35. cdef public list temps_allocated
  36. cdef public dict temps_free
  37. cdef public dict temps_used_type
  38. cdef public set zombie_temps
  39. cdef public size_t temp_counter
  40. cdef public list collect_temps_stack
  41. cdef public object closure_temps
  42. cdef public bint should_declare_error_indicator
  43. cdef public bint uses_error_indicator
  44. @cython.locals(n=size_t)
  45. cpdef new_label(self, name=*)
  46. cpdef tuple get_loop_labels(self)
  47. cpdef set_loop_labels(self, labels)
  48. cpdef tuple get_all_labels(self)
  49. cpdef set_all_labels(self, labels)
  50. cpdef start_collecting_temps(self)
  51. cpdef stop_collecting_temps(self)
  52. cpdef list temps_in_use(self)
  53. cdef class IntConst:
  54. cdef public object cname
  55. cdef public object value
  56. cdef public bint is_long
  57. cdef class PyObjectConst:
  58. cdef public object cname
  59. cdef public object type
  60. cdef class StringConst:
  61. cdef public object cname
  62. cdef public object text
  63. cdef public object escaped_value
  64. cdef public dict py_strings
  65. cdef public list py_versions
  66. @cython.locals(intern=bint, is_str=bint, is_unicode=bint)
  67. cpdef get_py_string_const(self, encoding, identifier=*, is_str=*, py3str_cstring=*)
  68. ## cdef class PyStringConst:
  69. ## cdef public object cname
  70. ## cdef public object encoding
  71. ## cdef public bint is_str
  72. ## cdef public bint is_unicode
  73. ## cdef public bint intern
  74. #class GlobalState(object):
  75. #def funccontext_property(name):
  76. cdef class CCodeWriter(object):
  77. cdef readonly StringIOTree buffer
  78. cdef readonly list pyclass_stack
  79. cdef readonly object globalstate
  80. cdef readonly object funcstate
  81. cdef object code_config
  82. cdef object last_pos
  83. cdef object last_marked_pos
  84. cdef Py_ssize_t level
  85. cdef public Py_ssize_t call_level # debug-only, see Nodes.py
  86. cdef bint bol
  87. cpdef write(self, s)
  88. cpdef put(self, code)
  89. cpdef put_safe(self, code)
  90. cpdef putln(self, code=*, bint safe=*)
  91. @cython.final
  92. cdef increase_indent(self)
  93. @cython.final
  94. cdef decrease_indent(self)
  95. cdef class PyrexCodeWriter:
  96. cdef public object f
  97. cdef public Py_ssize_t level