Code.pxd 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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 size_t temp_counter
  39. cdef public list collect_temps_stack
  40. cdef public object closure_temps
  41. cdef public bint should_declare_error_indicator
  42. cdef public bint uses_error_indicator
  43. @cython.locals(n=size_t)
  44. cpdef new_label(self, name=*)
  45. cpdef tuple get_loop_labels(self)
  46. cpdef set_loop_labels(self, labels)
  47. cpdef tuple get_all_labels(self)
  48. cpdef set_all_labels(self, labels)
  49. cpdef start_collecting_temps(self)
  50. cpdef stop_collecting_temps(self)
  51. cpdef list temps_in_use(self)
  52. cdef class IntConst:
  53. cdef public object cname
  54. cdef public object value
  55. cdef public bint is_long
  56. cdef class PyObjectConst:
  57. cdef public object cname
  58. cdef public object type
  59. cdef class StringConst:
  60. cdef public object cname
  61. cdef public object text
  62. cdef public object escaped_value
  63. cdef public dict py_strings
  64. cdef public list py_versions
  65. @cython.locals(intern=bint, is_str=bint, is_unicode=bint)
  66. cpdef get_py_string_const(self, encoding, identifier=*, is_str=*, py3str_cstring=*)
  67. ## cdef class PyStringConst:
  68. ## cdef public object cname
  69. ## cdef public object encoding
  70. ## cdef public bint is_str
  71. ## cdef public bint is_unicode
  72. ## cdef public bint intern
  73. #class GlobalState(object):
  74. #def funccontext_property(name):
  75. cdef class CCodeWriter(object):
  76. cdef readonly StringIOTree buffer
  77. cdef readonly list pyclass_stack
  78. cdef readonly object globalstate
  79. cdef readonly object funcstate
  80. cdef object code_config
  81. cdef object last_pos
  82. cdef object last_marked_pos
  83. cdef Py_ssize_t level
  84. cdef public Py_ssize_t call_level # debug-only, see Nodes.py
  85. cdef bint bol
  86. cpdef write(self, s)
  87. cpdef put(self, code)
  88. cpdef put_safe(self, code)
  89. cpdef putln(self, code=*, bint safe=*)
  90. @cython.final
  91. cdef increase_indent(self)
  92. @cython.final
  93. cdef decrease_indent(self)
  94. cdef class PyrexCodeWriter:
  95. cdef public object f
  96. cdef public Py_ssize_t level