-
Notifications
You must be signed in to change notification settings - Fork 0
/
other_funcs.go
232 lines (197 loc) · 5.22 KB
/
other_funcs.go
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
// Automatically generated by github.com/fardream/gen-gmsk
// function deinitions
package gmsk
// #include <stdlib.h> // for C.free
// #include <mosek.h>
import "C"
import (
"unsafe"
)
// CallbackcodeToStr is wrapping [MSK_callbackcodetostr]
//
// [MSK_callbackcodetostr]: https://docs.mosek.com/latest/capi/alphabetic-functionalities.html#mosek.env.callbackcodetostr
func CallbackcodeToStr(
code CallbackCode,
) (callbackcodestr string, r error) {
// function template: prepare for output of booleans
c_callbackcodestr := (*C.char)(C.calloc(MAX_STR_LEN+1, 1))
defer C.free(unsafe.Pointer(c_callbackcodestr))
r = ResCode(
C.MSK_callbackcodetostr(
C.MSKcallbackcodee(code),
c_callbackcodestr,
),
).ToError()
if r == nil {
callbackcodestr = C.GoString(c_callbackcodestr)
}
return
}
// DinfitemToStr is wrapping [MSK_dinfitemtostr]
//
// [MSK_dinfitemtostr]: https://docs.mosek.com/latest/capi/alphabetic-functionalities.html#mosek.env.dinfitemtostr
func DinfitemToStr(
item DInfItem,
) (str string, r error) {
// function template: prepare for output of booleans
c_str := (*C.char)(C.calloc(MAX_STR_LEN+1, 1))
defer C.free(unsafe.Pointer(c_str))
r = ResCode(
C.MSK_dinfitemtostr(
C.MSKdinfiteme(item),
c_str,
),
).ToError()
if r == nil {
str = C.GoString(c_str)
}
return
}
// GetBuildInfo is wrapping [MSK_getbuildinfo]
//
// [MSK_getbuildinfo]: https://docs.mosek.com/latest/capi/alphabetic-functionalities.html#mosek.env.getbuildinfo
func GetBuildInfo() (buildstate, builddate string, r error) {
// function template: prepare for output of booleans
c_buildstate := (*C.char)(C.calloc(MAX_STR_LEN+1, 1))
defer C.free(unsafe.Pointer(c_buildstate))
c_builddate := (*C.char)(C.calloc(MAX_STR_LEN+1, 1))
defer C.free(unsafe.Pointer(c_builddate))
r = ResCode(
C.MSK_getbuildinfo(
c_buildstate,
c_builddate,
),
).ToError()
if r == nil {
buildstate = C.GoString(c_buildstate)
builddate = C.GoString(c_builddate)
}
return
}
// GetCodedesc is wrapping [MSK_getcodedesc]
//
// [MSK_getcodedesc]: https://docs.mosek.com/latest/capi/alphabetic-functionalities.html#mosek.env.getcodedesc
func GetCodedesc(
code ResCode,
) (symname, str string, r error) {
// function template: prepare for output of booleans
c_symname := (*C.char)(C.calloc(MAX_STR_LEN+1, 1))
defer C.free(unsafe.Pointer(c_symname))
c_str := (*C.char)(C.calloc(MAX_STR_LEN+1, 1))
defer C.free(unsafe.Pointer(c_str))
r = ResCode(
C.MSK_getcodedesc(
C.MSKrescodee(code),
c_symname,
c_str,
),
).ToError()
if r == nil {
symname = C.GoString(c_symname)
str = C.GoString(c_str)
}
return
}
// GetResponseclass is wrapping [MSK_getresponseclass]
//
// [MSK_getresponseclass]: https://docs.mosek.com/latest/capi/alphabetic-functionalities.html#mosek.env.getresponseclass
func GetResponseclass(
r ResCode,
) (rc ResCodeType, rescode error) {
rescode = ResCode(
C.MSK_getresponseclass(
C.MSKrescodee(r),
(*C.MSKrescodetypee)(&rc),
),
).ToError()
return
}
// GetVersion is wrapping [MSK_getversion]
//
// [MSK_getversion]: https://docs.mosek.com/latest/capi/alphabetic-functionalities.html#mosek.env.getversion
func GetVersion() (major, minor, revision int32, r error) {
r = ResCode(
C.MSK_getversion(
(*C.MSKint32t)(&major),
(*C.MSKint32t)(&minor),
(*C.MSKint32t)(&revision),
),
).ToError()
return
}
// IinfitemToStr is wrapping [MSK_iinfitemtostr]
//
// [MSK_iinfitemtostr]: https://docs.mosek.com/latest/capi/alphabetic-functionalities.html#mosek.env.iinfitemtostr
func IinfitemToStr(
item IInfItem,
) (str string, r error) {
// function template: prepare for output of booleans
c_str := (*C.char)(C.calloc(MAX_STR_LEN+1, 1))
defer C.free(unsafe.Pointer(c_str))
r = ResCode(
C.MSK_iinfitemtostr(
C.MSKiinfiteme(item),
c_str,
),
).ToError()
if r == nil {
str = C.GoString(c_str)
}
return
}
// Isinfinity is wrapping [MSK_isinfinity]
//
// [MSK_isinfinity]: https://docs.mosek.com/latest/capi/alphabetic-functionalities.html#mosek.env.isinfinity
func Isinfinity(
value float64,
) bool {
return intToBool(
C.MSK_isinfinity(
C.MSKrealt(value),
),
)
}
// Licensecleanup is wrapping [MSK_licensecleanup]
//
// [MSK_licensecleanup]: https://docs.mosek.com/latest/capi/alphabetic-functionalities.html#mosek.env.licensecleanup
func Licensecleanup() error {
return ResCode(
C.MSK_licensecleanup(),
).ToError()
}
// LiinfitemToStr is wrapping [MSK_liinfitemtostr]
//
// [MSK_liinfitemtostr]: https://docs.mosek.com/latest/capi/alphabetic-functionalities.html#mosek.env.liinfitemtostr
func LiinfitemToStr(
item LIInfItem,
) (str string, r error) {
// function template: prepare for output of booleans
c_str := (*C.char)(C.calloc(MAX_STR_LEN+1, 1))
defer C.free(unsafe.Pointer(c_str))
r = ResCode(
C.MSK_liinfitemtostr(
C.MSKliinfiteme(item),
c_str,
),
).ToError()
if r == nil {
str = C.GoString(c_str)
}
return
}
// Symnamtovalue is wrapping [MSK_symnamtovalue]
//
// [MSK_symnamtovalue]: https://docs.mosek.com/latest/capi/alphabetic-functionalities.html#mosek.env.symnamtovalue
func Symnamtovalue(
name string,
value *byte,
) bool {
c_name := C.CString(name)
defer C.free(unsafe.Pointer(c_name))
return intToBool(
C.MSK_symnamtovalue(
c_name,
(*C.char)(unsafe.Pointer(value)),
),
)
}