-
Notifications
You must be signed in to change notification settings - Fork 0
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
Adding MATLAB support #5
Conversation
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.
Looks good. I made some suggestions for possible improvements and called out a typo. Please see my comments.
strcat(root_str, base_name); | ||
strcat(root_str, fn_name); |
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.
strcat
can be an unsafe function. Consider using strncat
instead. Ref: https://stackoverflow.com/questions/6491038/strcat-vs-strncat-when-should-which-function-be-used
/*if(nrhs!=1) | ||
mexErrMsgIdAndTxt( "MATLAB:revord:invalidNumInputs", | ||
"One input required."); | ||
else if(nlhs > 1) | ||
mexErrMsgIdAndTxt( "MATLAB:revord:maxlhs", | ||
"Too many output arguments.");*/ |
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.
Dead code?
buflen = (mxGetM(prhs[0]) * mxGetN(prhs[0])) + 1; | ||
|
||
// allocate memory for output string | ||
output_buf = mxCalloc(buflen, sizeof(char)); |
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.
Does output_buf
need to be freed?
if (!mxIsNumeric(prhs[i + 1])) | ||
{ | ||
// build error msg | ||
full_msg = mxCalloc(strlen(msg_start) + strlen(input_vars[i]) + strlen(msg_end) + 1, sizeof(char)); |
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.
Does full_msg
need to be freed?
if (!mxIsNumeric(prhs[i + 1])) | ||
{ | ||
// build error msg | ||
full_msg = mxCalloc(strlen(msg_start) + strlen(input_vars[i]) + strlen(msg_end) + 1, sizeof(char)); |
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.
Does full_msg
need to be freed?
if (!mxIsNumeric(prhs[i + 1])) | ||
{ | ||
// build error msg | ||
full_msg = mxCalloc(strlen(msg_start) + strlen(input_vars[i]) + strlen(msg_end) + 1, sizeof(char)); |
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.
Does full_msg
need to be freed?
| Output: [void] | ||
| | ||
| Returns: [void] | ||
| |
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.
Since this returns nothing and there are no outputs, it would be good to expand the description to say what affects. For example, what happens if validation fails? How would the error be propagated back?
| prhs - Array of pointers to input arguments | ||
| fn_name - Function name | ||
| | ||
| Output: [void] |
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.
Since this returns nothing and there are no outputs, it would be good to expand the description to say what affects. For example, what happens if validation fails? How would the error be propagated back?
| Output: [void] | ||
| | ||
| Returns: [void] | ||
| |
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.
Since this returns nothing and there are no outputs, it would be good to expand the description to say what affects. For example, what happens if validation fails? How would the error be propagated back?
Closing this pull and (eventually) removing this branch, as it will be moved to its own language-specific repo going forward. |
This PR adds support for MATLAB via directly compiling the source code into a MATLAB library via the
mex
command. Validation tests are also include (same data that is used in .NET validation)