-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add back string conversion functions. (#68)
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package gmsk | ||
|
||
// #include <mosek.h> | ||
import "C" | ||
|
||
import "unsafe" | ||
|
||
// MSKWchar is the char type of mosek's wide chars, or MSKwchart | ||
type MSKWchar C.MSKwchart | ||
|
||
// Utf8towchar is wrapping [MSK_utf8towchar] | ||
// | ||
// [MSK_utf8towchar]: https://docs.mosek.com/latest/capi/alphabetic-functionalities.html#mosek.env.utf8towchar | ||
func Utf8towchar( | ||
outputlen uint64, | ||
len []uint64, | ||
conv []uint64, | ||
output []MSKWchar, | ||
input string, | ||
) error { | ||
c_input := C.CString(input) | ||
defer C.free(unsafe.Pointer(c_input)) | ||
|
||
return ResCode( | ||
C.MSK_utf8towchar( | ||
C.size_t(outputlen), | ||
(*C.size_t)(getPtrToFirst(len)), | ||
(*C.size_t)(getPtrToFirst(conv)), | ||
(*C.MSKwchart)(getPtrToFirst(output)), | ||
c_input, | ||
), | ||
).ToError() | ||
} | ||
|
||
// Wchartoutf8 is wrapping [MSK_wchartoutf8] | ||
// | ||
// [MSK_wchartoutf8]: https://docs.mosek.com/latest/capi/alphabetic-functionalities.html#mosek.env.wchartoutf8 | ||
func Wchartoutf8( | ||
outputlen uint64, | ||
len []uint64, | ||
conv []uint64, | ||
output *byte, | ||
input []MSKWchar, | ||
) error { | ||
return ResCode( | ||
C.MSK_wchartoutf8( | ||
C.size_t(outputlen), | ||
(*C.size_t)(getPtrToFirst(len)), | ||
(*C.size_t)(getPtrToFirst(conv)), | ||
(*C.char)(unsafe.Pointer(output)), | ||
(*C.MSKwchart)(getPtrToFirst(input)), | ||
), | ||
).ToError() | ||
} |