Syntax
Line 2: | Line 2: | ||
The single-line function usage statement is meant to be a quick reference on how to call a function. Within the parentheses are listed the arguments (or inputs) needed to properly call the function. As not all arguments are passed to the function the same way, the syntax of the argument declaration tells the user how to pass it. | The single-line function usage statement is meant to be a quick reference on how to call a function. Within the parentheses are listed the arguments (or inputs) needed to properly call the function. As not all arguments are passed to the function the same way, the syntax of the argument declaration tells the user how to pass it. | ||
− | Most inputs in davinci functions are davinci objects either stored in variables or created during the function call. | + | Most inputs in davinci functions are davinci objects either stored in variables or created during the function call. The function usage statement will sometimes contain a declaration telling the user what type of data is expected for a specific input (in the case of pass-by-reference or explicit inputs). |
'''Input Types:''' | '''Input Types:''' | ||
Line 14: | Line 14: | ||
#STRING - a arbitrary length object composed of characters | #STRING - a arbitrary length object composed of characters | ||
#TEXT - an array of strings | #TEXT - an array of strings | ||
− | + | ||
+ | |||
+ | Davinci objects, as arguments, may be passed by reference (explicit) or passed by value (inexplicit). Arguments passed by reference explicitly tell the user the name of the variable as it is called and manipulated within the function (ideally it is also intuitively descriptive) followed by an "=" sign and ended with the type of data in capital letters that should be passed (types 1 - 9) above. | ||
+ | |||
+ | The format of an explicit pass-by-reference function usage statement looks like this: | ||
+ | |||
+ | function1(variable_name = TYPE) | ||
+ | |||
+ | An example of such a function usage statement is abs(): | ||
+ | |||
+ | abs(obj = VAL) | ||
+ | |||
+ | The function abs() returns the absolute value of the given numeric davinci object of any numeric type of any three dimensions. If abs() had only accepted integer inputs it would have looked like this: | ||
+ | |||
+ | abs(obj = INT) | ||
+ | |||
+ | The user may call this function in a couple ways. Explicit inputs may be called by | ||
+ | |||
'''Definition of Inputs:''' | '''Definition of Inputs:''' |
Revision as of 13:16, 21 March 2006
Description The single-line function usage statement is meant to be a quick reference on how to call a function. Within the parentheses are listed the arguments (or inputs) needed to properly call the function. As not all arguments are passed to the function the same way, the syntax of the argument declaration tells the user how to pass it. Most inputs in davinci functions are davinci objects either stored in variables or created during the function call. The function usage statement will sometimes contain a declaration telling the user what type of data is expected for a specific input (in the case of pass-by-reference or explicit inputs). Input Types:
The format of an explicit pass-by-reference function usage statement looks like this: function1(variable_name = TYPE) An example of such a function usage statement is abs(): abs(obj = VAL) The function abs() returns the absolute value of the given numeric davinci object of any numeric type of any three dimensions. If abs() had only accepted integer inputs it would have looked like this: abs(obj = INT) The user may call this function in a couple ways. Explicit inputs may be called by
For all examples, thm.rectify will be used. This is a special type of function where both explicit and non-explicit argument passing can be used. There are several other functions like this special one but each of the individual cases is applicable to davinci functions where they apply. In the explicit definition of inputs, the variable name will appear and be followed by the type of data it accepts. For example: function(obj = VAR, ignore = FLOAT ) dv> a 577x1852x10 array of float, bsq format [42,744,160 bytes] dv> a = thm.rectify(obj = a, ignore = -32768) struct, 4 elements data: 301x1883x10 array of float, bsq format [22,671,320 bytes] leftedge: 1x1883x1 array of int, bsq format [7,532 bytes] width: 577 angle: 3.052882433
For example: where obj is the input data ignore is the ignore value with default -32768
For example: function($1 = VAR, $2 = FLOAT ) dv> a 577x1852x10 array of float, bsq format [42,744,160 bytes] dv> a = thm.rectify(a, -32768) struct, 4 elements data: 301x1883x10 array of float, bsq format [22,671,320 bytes] leftedge: 1x1883x1 array of int, bsq format [7,532 bytes] width: 577 angle: 3.052882433
For example: where $1 is the input data $2 is the ignore value with default -32768
By allowing some inputs to be optional, davinci has the ability to have preset values that the user doesn't need to enter for the function to work. A good example of this usage is assuming an ignore value in functions like thm.deplaid. Optional inputs are enclosed by square brackets ( [ ] ) and defined as ususal. For example: function(obj = VAR, [ ignore = FLOAT ]) function($1 = VAR, [ $2 = FLOAT ])
|
Wiki Navigation Bar Contents
Contact Developers
All other topics
Last Updated: Feb-2011
More News
|