Skip to content

Commit a3ae881

Browse files
committed
Move get_type docs to types.rst
1 parent 9df87ba commit a3ae881

File tree

2 files changed

+84
-83
lines changed

2 files changed

+84
-83
lines changed

doc/topics/contexts.rst

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,6 @@ Compilation contexts
2828
Invoking :py:meth:`gccjit.Context.compile` on it gives you a
2929
:py:class:`gccjit.Result`.
3030

31-
.. py:method:: get_type(type_enum)
32-
33-
Look up one of the standard types (see :py:class:`gccjit.TypeKind`)::
34-
35-
int_type = ctxt.get_type(gccjit.TypeKind.INT)
36-
37-
:param type_enum: Which type to lookup
38-
:type type_enum: :py:class:`gccjit.TypeKind`
39-
40-
.. py:method:: get_int_type(num_bytes, is_signed)
41-
42-
Look up an integet type of the given size::
43-
44-
int_type = ctxt.get_int_type(4, is_signed=True)
45-
4631
.. py:method:: dump_to_file(path, update_locations)
4732
4833
.. py:method:: get_first_error()
@@ -526,69 +511,3 @@ Integer options
526511
527512
The default value is 0 (unoptimized).
528513
529-
Standard types
530-
--------------
531-
532-
.. py:class:: gccjit.TypeKind
533-
534-
.. py:data:: VOID
535-
536-
C's "void" type.
537-
538-
.. py:data:: VOID_PTR
539-
540-
C's "void \*".
541-
542-
.. py:data:: BOOL
543-
544-
C++'s bool type; also C99's "_Bool" type, aka "bool" if using
545-
stdbool.h.
546-
547-
.. py:data:: CHAR
548-
.. py:data:: SIGNED_CHAR
549-
.. py:data:: UNSIGNED_CHAR
550-
551-
C's "char" (of some signedness) and the variants where the
552-
signedness is specified.
553-
554-
.. py:data:: SHORT
555-
.. py:data:: UNSIGNED_SHORT
556-
557-
C's "short" (signed) and "unsigned short".
558-
559-
.. py:data:: INT
560-
.. py:data:: UNSIGNED_INT
561-
562-
C's "int" (signed) and "unsigned int"::
563-
564-
int_type = ctxt.get_type(gccjit.TypeKind.INT)
565-
566-
.. py:data:: LONG
567-
.. py:data:: UNSIGNED_LONG
568-
569-
C's "long" (signed) and "unsigned long".
570-
571-
.. py:data:: LONG_LONG
572-
.. py:data:: UNSIGNED_LONG_LONG
573-
574-
C99's "long long" (signed) and "unsigned long long".
575-
576-
.. py:data:: FLOAT
577-
.. py:data:: DOUBLE
578-
.. py:data:: LONG_DOUBLE
579-
580-
Floating-point types
581-
582-
.. py:data:: CONST_CHAR_PTR
583-
584-
C type: (const char \*)::
585-
586-
const_char_p = ctxt.get_type(gccjit.TypeKind.CONST_CHAR_PTR)
587-
588-
.. py:data:: SIZE_T
589-
590-
The C "size_t" type.
591-
592-
.. py:data:: FILE_PTR
593-
594-
C type: (FILE \*)

doc/topics/types.rst

Lines changed: 84 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
.. Copyright 2014 David Malcolm <[email protected]>
2-
Copyright 2014 Red Hat, Inc.
1+
.. Copyright 2014-2015 David Malcolm <[email protected]>
2+
Copyright 2014-2015 Red Hat, Inc.
33
44
This is free software: you can redistribute it and/or modify it
55
under the terms of the GNU General Public License as published by
@@ -60,6 +60,88 @@ Types can be created in several ways:
6060

6161
:rtype: :py:class:`gccjit.Type`
6262

63+
Standard types
64+
--------------
65+
66+
.. py:method:: gccjit.Context.get_type(self, type_enum)
67+
68+
Look up one of the standard types (see :py:class:`gccjit.TypeKind`)::
69+
70+
int_type = ctxt.get_type(gccjit.TypeKind.INT)
71+
72+
:param type_enum: Which type to lookup
73+
:type type_enum: :py:class:`gccjit.TypeKind`
74+
75+
.. py:class:: gccjit.TypeKind
76+
77+
.. py:data:: VOID
78+
79+
C's "void" type.
80+
81+
.. py:data:: VOID_PTR
82+
83+
C's "void \*".
84+
85+
.. py:data:: BOOL
86+
87+
C++'s bool type; also C99's "_Bool" type, aka "bool" if using
88+
stdbool.h.
89+
90+
.. py:data:: CHAR
91+
.. py:data:: SIGNED_CHAR
92+
.. py:data:: UNSIGNED_CHAR
93+
94+
C's "char" (of some signedness) and the variants where the
95+
signedness is specified.
96+
97+
.. py:data:: SHORT
98+
.. py:data:: UNSIGNED_SHORT
99+
100+
C's "short" (signed) and "unsigned short".
101+
102+
.. py:data:: INT
103+
.. py:data:: UNSIGNED_INT
104+
105+
C's "int" (signed) and "unsigned int"::
106+
107+
int_type = ctxt.get_type(gccjit.TypeKind.INT)
108+
109+
.. py:data:: LONG
110+
.. py:data:: UNSIGNED_LONG
111+
112+
C's "long" (signed) and "unsigned long".
113+
114+
.. py:data:: LONG_LONG
115+
.. py:data:: UNSIGNED_LONG_LONG
116+
117+
C99's "long long" (signed) and "unsigned long long".
118+
119+
.. py:data:: FLOAT
120+
.. py:data:: DOUBLE
121+
.. py:data:: LONG_DOUBLE
122+
123+
Floating-point types
124+
125+
.. py:data:: CONST_CHAR_PTR
126+
127+
C type: (const char \*)::
128+
129+
const_char_p = ctxt.get_type(gccjit.TypeKind.CONST_CHAR_PTR)
130+
131+
.. py:data:: SIZE_T
132+
133+
The C "size_t" type.
134+
135+
.. py:data:: FILE_PTR
136+
137+
C type: (FILE \*)
138+
139+
.. py:method:: gccjit.Context.get_int_type(self, num_bytes, is_signed)
140+
141+
Look up an integet type of the given size::
142+
143+
int_type = ctxt.get_int_type(4, is_signed=True)
144+
63145
Structures
64146
----------
65147

0 commit comments

Comments
 (0)