-
Notifications
You must be signed in to change notification settings - Fork 28
/
_builtin.gop
182 lines (141 loc) · 6.05 KB
/
_builtin.gop
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/*
Copyright 2021 The GoPlus Authors (goplus.org)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// +build ignore
// -----------------------------------------------------------------------------
type ninteger interface {
type int, int64, int32, int16, int8, uint, uintptr, uint64, uint32, uint16, uint8
}
type integer interface {
ninteger
}
type float interface {
type float32, float64
}
type number interface { // - * /
integer
float
type complex64, complex128
}
type addable interface { // +
number
type string
}
type orderable interface { // < <= > >=
integer
float
type string
}
type comparable interface { // == !=
addable
type bool, interface, pointer, array, chan, struct
// slice/map/func is very special, can only be compared to nil
}
func [T addable] (a T) + (b T) T // func Gop_Add[T addable](a, b T) T
func [T number] (a T) - (b T) T // func Gop_Sub[T number](a, b T) T
func [T number] (a T) * (b T) T // func Gop_Mul[T number](a, b T) T
func [T number] (a T) / (b T) T // func Gop_Quo[T number](a, b T) T
func [T integer] (a T) % (b T) T // func Gop_Rem[T integer](a, b T) T
func [T integer] (a T) | (b T) T // func Gop_Or[T integer](a, b T) T
func [T integer] (a T) ^ (b T) T // func Gop_Xor[T integer](a, b T) T
func [T integer] (a T) & (b T) T // func Gop_And[T integer](a, b T) T
func [T integer] (a T) &^ (b T) T // func Gop_AndNot[T integer](a, b T) T
func [T integer, N ninteger] (a T) << (n N) T // func Gop_Lsh[T integer, N ninteger](a T, n N) T
func [T integer, N ninteger] (a T) >> (n N) T // func Gop_Rsh[T integer, N ninteger](a T, n N) T
func [T orderable] (a T) < (b T) untyped_bool // func Gop_LT[T orderable](a, b T) untyped_bool
func [T orderable] (a T) <= (b T) untyped_bool // func Gop_LE[T orderable](a, b T) untyped_bool
func [T orderable] (a T) > (b T) untyped_bool // func Gop_GT[T orderable](a, b T) untyped_bool
func [T orderable] (a T) >= (b T) untyped_bool // func Gop_GE[T orderable](a, b T) untyped_bool
func [T comparable] (a T) == (b T) untyped_bool // func Gop_EQ[T comparable](a, b T) untyped_bool
func [T comparable] (a T) != (b T) untyped_bool // func Gop_NE[T comparable](a, b T) untyped_bool
func [T bool] (a T) || (b T) T // func Gop_LOr[T bool](a, b T) T
func [T bool] (a T) && (b T) T // func Gop_LAnd[T bool](a, b T) T
func [T number] -(a T) T // func Gop_Neg[T number](a T) T
func [T number] +(a T) T // func Gop_Dup[T number](a T) T
func [T integer] ^(a T) T // func Gop_Not[T integer](a T) T
func [T bool] !(a T) T // func Gop_LNot[T bool](a T) T
func [T addable] (a *T) += (b T) // func Gop_AddAssign[T addable](a *T, b T)
func [T number] (a *T) -= (b T) // func Gop_SubAssign[T number](a *T, b T)
func [T number] (a *T) *= (b T) // func Gop_MulAssign[T number](a *T, b T)
func [T number] (a *T) /= (b T) // func Gop_QuoAssign[T number](a *T, b T)
func [T integer] (a *T) %= (b T) // func Gop_RemAssign[T integer](a *T, b T)
func [T integer] (a *T) |= (b T) // func Gop_OrAssign[T integer](a *T, b T)
func [T integer] (a *T) ^= (b T) // func Gop_XorAssign[T integer](a *T, b T)
func [T integer] (a *T) &= (b T) // func Gop_AndAssign[T integer](a *T, b T)
func [T integer] (a *T) &^= (b T) // func Gop_AndNotAssign[T integer](a *T, b T)
func [T integer, N ninteger] (a *T) <<= (n N) // func Gop_LshAssign[T integer, N ninteger](a *T, n N)
func [T integer, N ninteger] (a *T) >>= (n N) // func Gop_RshAssign[T integer, N ninteger](a *T, n N)
// -----------------------------------------------------------------------------
func [T integer] ++(a *T) // func Gop_Inc[T integer](a *T)
func [T integer] --(a *T) // func Gop_Dec[T integer](a *T)
// -----------------------------------------------------------------------------
func [T any, N ninteger, U int] arrayGet(a *[U]T, i N) T
func [T any, N ninteger, U int] sliceGet(a *[U]T, i N) T
func [K comparable, V any] mapGet(a map[K]V, key K) T
func [T any, N ninteger, U int] arraySet(a *[U]T, i N, elem T)
func [T any, N ninteger, U int] sliceSet(a *[U]T, i N, elem T)
func [K comparable, V any] mapSet(a map[K]V, key K, elem T)
func [] = (
sliceGet
sliceSet
mapGet
mapSet
arrayGet
arraySet
)
// -----------------------------------------------------------------------------
type any interface {
}
type capable interface {
type slice, chan, array, array_pointer
}
type lenable interface {
capable
type map, string
}
type makable interface {
type slice, chan, map
}
func [Type any] copy(dst, src []Type) int
func [Type any] close(c chan<- Type)
func [Type lenable] len(v Type) int
func [Type capable] cap(v Type) int
// new & make are special cases, they require to pass a type.
func [] new(T any) *T
func [N ninteger] make(Type makable, size ...N) Type
// As a special case, it is legal to append a string to a byte slice, like this:
// slice = append([]byte("hello "), "world"...)
func [Type any] append(slice []Type, elems ...Type) []Type
func complexFlt32(r, i float32) complex64
func complexFlt64(r, i float64) complex128
func complex = (
complexFlt32
complexFlt64
)
func realComplex64(c complex64) float32
func realComplex128(c complex128) float64
func real = (
realComplex64
realComplex128
)
func imagComplex64(c complex64) float32
func imagComplex128(c complex128) float64
func imag = (
imagComplex64
imagComplex128
)
func [Key comparable, Elem any] delete(m map[Key]Elem, key Key)
func panic(v interface{})
func recover() interface{}
func print(args ...interface{})
func println(args ...interface{})
// -----------------------------------------------------------------------------