Message Boards Message Boards

1
|
4056 Views
|
2 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Manual ArgumentType in MathLink templates without curly brackets

Posted 12 years ago
When using the MathLink C interface, if we want to get arguments manually, we need to put the following in the template file:
:ArgumentTypes: { Manual }
:ReturnType: Manual
I accidentally used
:ArgumentTypes: Manual
:ReturnType: Manual
instead.

mprep does 'compile' this template file without errors, and generates valid C code for it, but it doesn't have the same behaviour as the standard :ArgumentTypes: {Manual} specification.

Diffing the outputs shows only one difference: the f_nargs member of the "func" struct is set to -1 for this function with :ArgumentTypes: Manual, while with {Manual} it is 0.

Question: Is :ArgumentTypes: Manual meaningful, and if yes, what is its use?
POSTED BY: Szabolcs Horvát
2 Replies
:ArgumentTypes: Manual is meaningful and is intended for use with one argument functions as follows:
:Begin:
:Function: bar
:Pattern: Bar[i_Integer]
:Arguments: i
:ArgumentTypes: Manual
:ReturnType: Manual
:End:
Mprep (the program that parses template files) allows the braces to be optional in the case of Manual argument types.   You cannot however specify arbitrary argument types in
in this form.   Manual is the only type allowed to not have the braces wrapper.
POSTED BY: Steve Wilson
Thank you for the explanation.  I think the reason it gave me strange results when I ommitted the braces was that I have a two-argument function, like this:
:Begin:
:Function: eng_make_Struct
:Pattern: engMakeStruct[fields_, handles_]
:Arguments: {fields, handles}
:ArgumentTypes:    {Manual}
:ReturnType:    Manual
:End:
The first one (fields) is a list of strings, so I needed to use Manual.  The syntax above does seem to work correctly.
POSTED BY: Szabolcs Horvát
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract