merge
[cython.git] / Cython / Compiler / Naming.py
1 #
2 #   Pyrex - C naming conventions
3 #
4 #
5 #   Prefixes for generating C names.
6 #   Collected here to facilitate ensuring uniqueness.
7 #
8
9 pyrex_prefix    = "__pyx_"
10
11
12 codewriter_temp_prefix = pyrex_prefix + "t_"
13
14 temp_prefix       = u"__cyt_"
15
16 builtin_prefix    = pyrex_prefix + "builtin_"
17 arg_prefix        = pyrex_prefix + "arg_"
18 funcdoc_prefix    = pyrex_prefix + "doc_"
19 enum_prefix       = pyrex_prefix + "e_"
20 func_prefix       = pyrex_prefix + "f_"
21 pyfunc_prefix     = pyrex_prefix + "pf_"
22 genbody_prefix    = pyrex_prefix + "gb_"
23 gstab_prefix      = pyrex_prefix + "getsets_"
24 prop_get_prefix   = pyrex_prefix + "getprop_"
25 const_prefix      = pyrex_prefix + "k_"
26 py_const_prefix   = pyrex_prefix + "kp_"
27 label_prefix      = pyrex_prefix + "L"
28 pymethdef_prefix  = pyrex_prefix + "mdef_"
29 methtab_prefix    = pyrex_prefix + "methods_"
30 memtab_prefix     = pyrex_prefix + "members_"
31 interned_str_prefix = pyrex_prefix + "n_"
32 interned_num_prefix = pyrex_prefix + "int_"
33 objstruct_prefix  = pyrex_prefix + "obj_"
34 typeptr_prefix    = pyrex_prefix + "ptype_"
35 prop_set_prefix   = pyrex_prefix + "setprop_"
36 type_prefix       = pyrex_prefix + "t_"
37 typeobj_prefix    = pyrex_prefix + "type_"
38 var_prefix        = pyrex_prefix + "v_"
39 wrapperbase_prefix= pyrex_prefix + "wrapperbase_"
40 bufstruct_prefix  = pyrex_prefix + "bstruct_"
41 bufstride_prefix  = pyrex_prefix + "bstride_"
42 bufshape_prefix   = pyrex_prefix + "bshape_"
43 bufsuboffset_prefix  = pyrex_prefix + "boffset_"
44 vtable_prefix     = pyrex_prefix + "vtable_"
45 vtabptr_prefix    = pyrex_prefix + "vtabptr_"
46 vtabstruct_prefix = pyrex_prefix + "vtabstruct_"
47 opt_arg_prefix    = pyrex_prefix + "opt_args_"
48 convert_func_prefix = pyrex_prefix + "convert_"
49 closure_scope_prefix = pyrex_prefix + "scope_"
50 closure_class_prefix = pyrex_prefix + "scope_struct_"
51 lambda_func_prefix = pyrex_prefix + "lambda_"
52 module_is_main   = pyrex_prefix + "module_is_main_"
53
54 args_cname       = pyrex_prefix + "args"
55 sent_value_cname = pyrex_prefix + "sent_value"
56 pykwdlist_cname  = pyrex_prefix + "pyargnames"
57 obj_base_cname   = pyrex_prefix + "base"
58 builtins_cname   = pyrex_prefix + "b"
59 preimport_cname  = pyrex_prefix + "i"
60 moddict_cname    = pyrex_prefix + "d"
61 dummy_cname      = pyrex_prefix + "dummy"
62 filename_cname   = pyrex_prefix + "filename"
63 modulename_cname = pyrex_prefix + "modulename"
64 filetable_cname  = pyrex_prefix + "f"
65 intern_tab_cname = pyrex_prefix + "intern_tab"
66 kwds_cname       = pyrex_prefix + "kwds"
67 lineno_cname     = pyrex_prefix + "lineno"
68 clineno_cname    = pyrex_prefix + "clineno"
69 cfilenm_cname    = pyrex_prefix + "cfilenm"
70 module_cname     = pyrex_prefix + "m"
71 moddoc_cname     = pyrex_prefix + "mdoc"
72 methtable_cname  = pyrex_prefix + "methods"
73 retval_cname     = pyrex_prefix + "r"
74 reqd_kwds_cname  = pyrex_prefix + "reqd_kwds"
75 self_cname       = pyrex_prefix + "self"
76 stringtab_cname  = pyrex_prefix + "string_tab"
77 vtabslot_cname   = pyrex_prefix + "vtab"
78 c_api_tab_cname  = pyrex_prefix + "c_api_tab"
79 gilstate_cname   = pyrex_prefix + "state"
80 skip_dispatch_cname = pyrex_prefix + "skip_dispatch"
81 empty_tuple      = pyrex_prefix + "empty_tuple"
82 empty_bytes      = pyrex_prefix + "empty_bytes"
83 print_function   = pyrex_prefix + "print"
84 print_function_kwargs   = pyrex_prefix + "print_kwargs"
85 cleanup_cname    = pyrex_prefix + "module_cleanup"
86 pymoduledef_cname = pyrex_prefix + "moduledef"
87 optional_args_cname = pyrex_prefix + "optional_args"
88 import_star      = pyrex_prefix + "import_star"
89 import_star_set  = pyrex_prefix + "import_star_set"
90 outer_scope_cname= pyrex_prefix + "outer_scope"
91 cur_scope_cname  = pyrex_prefix + "cur_scope"
92 enc_scope_cname  = pyrex_prefix + "enc_scope"
93 frame_cname      = pyrex_prefix + "frame"
94 frame_code_cname = pyrex_prefix + "frame_code"
95 binding_cfunc    = pyrex_prefix + "binding_PyCFunctionType"
96
97 genexpr_id_ref = 'genexpr'
98
99 line_c_macro = "__LINE__"
100
101 file_c_macro = "__FILE__"
102
103 extern_c_macro  = pyrex_prefix.upper() + "EXTERN_C"
104
105 exc_type_name   = pyrex_prefix + "exc_type"
106 exc_value_name  = pyrex_prefix + "exc_value"
107 exc_tb_name     = pyrex_prefix + "exc_tb"
108 exc_lineno_name = pyrex_prefix + "exc_lineno"
109
110 exc_vars = (exc_type_name, exc_value_name, exc_tb_name)
111
112 api_name        = pyrex_prefix + "capi__"
113
114 h_guard_prefix   = "__PYX_HAVE__"
115 api_guard_prefix = "__PYX_HAVE_API__"
116 api_func_guard   = "__PYX_HAVE_API_FUNC_"
117
118 def py_version_hex(major, minor=0, micro=0, release_level=0, release_serial=0):
119     return (major << 24) | (minor << 16) | (micro << 8) | (release_level << 4) | (release_serial)