Skip to content
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

Closed
wants to merge 5 commits into from
Closed

Adding MATLAB support #5

wants to merge 5 commits into from

Conversation

wkozmaNTIA
Copy link
Member

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)

@wkozmaNTIA wkozmaNTIA requested a review from blainNTIA May 24, 2023 11:40
Copy link

@blainNTIA blainNTIA left a 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.

Comment on lines +37 to +38
strcat(root_str, base_name);
strcat(root_str, fn_name);

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

Comment on lines +23 to +28
/*if(nrhs!=1)
mexErrMsgIdAndTxt( "MATLAB:revord:invalidNumInputs",
"One input required.");
else if(nlhs > 1)
mexErrMsgIdAndTxt( "MATLAB:revord:maxlhs",
"Too many output arguments.");*/

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));

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));

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));

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));

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?

Comment on lines +12 to +15
| Output: [void]
|
| Returns: [void]
|

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]

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?

Comment on lines +12 to +15
| Output: [void]
|
| Returns: [void]
|

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?

@wkozmaNTIA
Copy link
Member Author

Closing this pull and (eventually) removing this branch, as it will be moved to its own language-specific repo going forward.

@wkozmaNTIA wkozmaNTIA closed this May 6, 2024
aromanielloNTIA added a commit that referenced this pull request Jan 10, 2025
PropLib Template 1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants