Syntax

From DavinciWiki
Revision as of 17:21, 6 March 2006 by Cedwards (Talk | contribs)

Jump to: navigation, search

Description

Syntax is an important part of using davinci and this page is desined to give the user a better understanding of how to properly input data into various types of functions. There are two main ways to pass information to a function, explicitly or by an ordered list of unnamed arguments or any combination of either.


Input Types:

  • BYTE - values from 0 to 255
  • SHORT - values from -32768 to 32768
  • INT - values from -2,147,483,648 to +2,147,483,647
  • FLOAT - values from -3.402822655e+38 to +3.402822655e+38
  • DOUBLE - values from tiny to huge
  • VAR - any type of davinci variable (including arrays, strings and various other data types)
  • STRUCT - a davinci structure containing the specified elements
  • STRING - a arbitrary length item composed of characters
  • TEXT - an array of strings
  • BOOL - values of either 1 or 0


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