-
Notifications
You must be signed in to change notification settings - Fork 65
Transcode strings to UTF-16 before passing them to MATLAB #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -264,8 +264,8 @@ const _mx_create_logical_scalar = mxfunc(:mxCreateLogicalScalar) | |
| const _mx_create_sparse = mxfunc(:mxCreateSparse_730) | ||
| const _mx_create_sparse_logical = mxfunc(:mxCreateSparseLogicalMatrix_730) | ||
|
|
||
| const _mx_create_string = mxfunc(:mxCreateString) | ||
| #const _mx_create_char_array = mxfunc(:mxCreateCharArray_730) | ||
| # const _mx_create_string = mxfunc(:mxCreateString) | ||
| const _mx_create_char_array = mxfunc(:mxCreateCharArray_730) | ||
|
|
||
| const _mx_create_cell_array = mxfunc(:mxCreateCellArray_730) | ||
|
|
||
|
|
@@ -406,8 +406,13 @@ end | |
| # char arrays and string | ||
|
|
||
| function mxarray(s::String) | ||
| pm = ccall(_mx_create_string, Ptr{Void}, (Ptr{UInt8},), s) | ||
| MxArray(pm) | ||
| utf16string = transcode(UInt16, s) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should prolly use |
||
| pm = ccall(_mx_create_char_array, Ptr{Void}, (mwSize, Ptr{mwSize},), 2, | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| _dims_to_mwSize((1, length(utf16string)))) | ||
| mx = MxArray(pm) | ||
| ccall(:memcpy, Ptr{Void}, (Ptr{Void}, Ptr{Void}, UInt), data_ptr(mx), utf16string, | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The convention is usually "try to adhere to a 92 character line length limit" |
||
| length(utf16string)*sizeof(UInt16)) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| mx | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. return mx (trying to be consistent)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe, but not exactly consistent elsewhere in the file. |
||
| end | ||
|
|
||
| # cell arrays | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?