Syntax

From DavinciWiki
Revision as of 12:57, 21 March 2006 by Keith (Talk | contribs)

Jump to: navigation, search

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. These objects are listed below.

Input Types:

  1. BYTE - values from 0 to 255
  2. SHORT - values from -32768 to 32768
  3. INT - values from -2,147,483,648 to +2,147,483,647
  4. FLOAT - values from -3.402822655e+38 to +3.402822655e+38
  5. DOUBLE - values from
  6. VAL - any type of numeric value (types 1 - 5 above)
  7. STRUCT - a davinci structure containing specified elements
  8. STRING - a arbitrary length object composed of characters
  9. TEXT - an array of strings


Definition of Inputs:

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


After the function definition, the meaning each input will be explained.

For example:
where 
obj is the input data
ignore is the ignore value with default -32768


In the non-explicit definition of inputs, the argument number ($1, $2,...,$n) will be shown follwed by the type of data it accepts.

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


After the function definition, the meaning each input will be explained.

For example:
where
$1 is the input data
$2 is the ignore value with default -32768


Optional Inputs:

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


Last Updated: Feb-2011


More News

Personal tools