Good evening,
Attached you will find an example of the kind of documentation that be obtained with NaturalDocs on DB Pro code. Unzip the file in any folder.
As it was said previously, NaturalDocs, has not been written for DB Pro but can be customized in order to be used with DB Pro.
However, the code must be explicitly commented in order to generate the documentation, but I think that good comment practices are essential to coding activity, so extra cost due to specific comments would not be unaffordable.
In order to show the usage of NaturalDocs this is a code I wrote and which has been modified in order to update the comments to the NaturalDocs tag system
remstart
***************************************************************************************
Title: _Matrices
To provide some functions in order to compute matrix operations such as rotation, translation, scales and so on.
Author: Mika
History:
25/10/2005 - v1.0 creation of the gathered functions library.
Implementation is pure software and not based on DX capabilities.
Some dependencies on '_Utilities' library and 'ConstantDefinitions' file.
***************************************************************************************
remend
remstart
***************************************************************************************
Function: _printMatrix
Print the content of a memblock based matrix if matrix exist.
Parameters:
- mat, integer. ID number of the matrix to be displayed.
- xSize, integer. Number of columns of the matrix.
- ySize, integer. Number of rows of the matrix. in a column of the matrix
- matType, integer. Type of matrix (i.e. memblock) to be displayed, with the following constraints:
1 - '1' : BYTE oriented matrix (i.e.memblock).
2 - '2' : WORD oriented matrix (i.e.memblock).
3 - '3' : DWORD oriented matrix (i.e.memblock).
4 - '4' : FLOAT oriented matrix (i.e.memblock).
Returns:
matrix ID number if display ok else _NULL.
Global variable used:
None
Constant used:
_NULL, _WORD_SIZE, _DWORD_SIZE, _FLOAT_SIZE
Third party function call:
None
Type:
function
Author:
Mika
History:
14/10/2005 - v1.0 creation
***************************************************************************************
remend
function _printMatrix(mat as integer, xSize as integer, ySize as integer, matType as integer)
`Variables: m, n, resu
`Local variables
local m, n, resu as integer
`Check of matrix consitency
if (mat < 1)
`matrix is not consistent
resu = _NULL
else
`Check of matrix existence
if (memblock exist(mat) <> 1)
`Failure : matrix does not exist.
resu = _NULL
else
select matType
case 1
for n = 0 to (ySize - 1)
for m = 0 to (xSize - 1)
print str$(memblock byte(mat, m + (n * xSize))); " ";
next m
print
next n
resu = mat
endcase
case 2
for n = 0 to (ySize - 1)
for m = 0 to (xSize - 1)
print str$(memblock word(mat, (m + (n * xSize)) * _WORD_SIZE)); " ";
next m
print
next n
resu = mat
endcase
case 3
for n = 0 to (ySize - 1)
for m = 0 to (xSize - 1)
print str$(memblock dword(mat, (m + (n * xSize)) * _DWORD_SIZE)); " ";
next m
print
next n
resu = mat
endcase
case 4
for n = 0 to (ySize - 1)
for m = 0 to (xSize - 1)
print str$(memblock float(mat, (m + (n * xSize)) * _FLOAT_SIZE)); " ";
next m
print
next n
resu = mat
endcase
case default
print
print "!!! Warning !!!"
print "_printMatrix() function --> Matrix type "; str$(mat); " is not supported"
print
resu = _NULL
endcase
endselect
endif
endif
endfunction resu
remstart
***************************************************************************************
Function: _createBlankMatrix
Create a blank mathematical matrix instance.
Parameters:
- xSize, integer. Number of elements in a row of the matrix
- ySize, integer. Number of elements in a column of the matrix.
- eSize, integer. Size of element to be stored in the matrix.
Returns:
Integer. ID number of the matrix created else _NULL if creation failed.
Globbal variable used:
None
Constant used:
_NULL, _RESOURCE_MEMBLOCK
Third party function call:
None
Type:
function
Author:
Mika
History:
13/10/2005 - v1.0 creation
14/10/2005 - v1.1 modification in order to call _initMatrix() function.
***************************************************************************************
remend
function _createBlankMatrix(xSize as integer, ySize as integer, eSize as integer)
`Variables: resu
`Local variables
local resu as integer
`ExtDBProFunctionCall: _getFreeResource()
`Call external DB Pro function in order to look for available resource
resu = _getFreeResource(1, _RESOURCE_MEMBLOCK)
if (resu <> -1)
`if memblock available then create it
make memblock resu, (xSize * ySize * eSize)
`Check of memblock availability
if (resu <> 0)
`Memblock has been correctly created
`Blank initialisation of the complete memblock
resu = _initMatrix(resu)
else
`Failure during memblock creation
resu = _NULL
endif
else
resu = _NULL
endif
endfunction resu
remstart
***************************************************************************************
Function: _createTransformationMatrix
Create a blank transformation matrix instance.
Parameters:
- None
Returns:
Integer. ID number of the matrix created else _NULL if creation failed.
Global variable used:
None
Constant used:
_FLOAT_SIZE
Third party function call:
None
Type:
function
Author:
Mika
History
13/10/2005 - v1.0 creation
***************************************************************************************
remend
function _createTransformationMatrix()
`Variables: resu
`Local variables
local resu as integer
resu = _createBlankMatrix(4, 4, _FLOAT_SIZE)
endfunction resu
remstart
***************************************************************************************
Function: _initMatrix
Initialise a matrix, i.e. setting up all the elements to 0
Parameters:
- mat, integer. ID number of the matrix to be initialised.
Returns:
Integer. ID number of the matrix that has been initialised else _NULL in case of failure.
Global variable used:
None
Constant used:
_NULL
Third party function call:
None
Type:
function
Author:
Mika
History:
14/10/2005 - v1.0 creation
15/10/2005 - v1.1 add of security regaring matrix usage in order to avoid application crash.
***************************************************************************************
remend
function _initMatrix(mat as integer)
`Variables: resu, l
`Local variables
local resu, l as integer
`Check of matrix consitency
if (mat < 1)
`matrix is not consistent
resu = _NULL
else
`Check of matrix existence
if (memblock exist(mat) <> 1)
`Failure : matrix does not exist.
resu = _NULL
else
`Matrix ID is consistent : all the elements are set to 0
for l = 0 to (get memblock size(mat) - 1)
write memblock byte mat, l , 0
next l
resu = mat
endif
endif
endfunction resu
remstart
***************************************************************************************
Function: _freeMatrix
Delete a matrix instance and free associated memory.
Parameters:
- mat, integer. ID number of the matrix to be freed.
Returns:
Integer. ID number of the matrix that has been freed else _NULL in case of failure.
Global variable used:
None
Constant used:
_NULL
Third party function call:
None
Type:
function
Author:
Mika
History:
14/10/2005 - v1.0 creation
15/10/2005 - v1.1 add of security regarding matrix ID in order to avoid application crash.
***************************************************************************************
remend
function _freeMatrix(mat as integer)
`Variables: resu
`Local variables
local resu as integer
`Check the matrix ID consistency
if (mat < 1)
`Matrix ID is inconsistent
resu = _NULL
else
`Check of matrix existence
if (memblock exist(mat) <> 1)
`Failure : matrix does not esist
resu = _NULL
else
`Matrix ID exists : the matrix is freed.
delete memblock mat
resu = mat
endif
endif
endfunction resu
remstart
***************************************************************************************
Function: _setTransformationMatrix
Setup a transformation matrix.
Parameters:
- mat, integer. ID number of the matrix to be setuped.
Caution, the mat parameter must be generated by the _createTransformationMatrix() function in order to have a stable and consistent behavior.
- tType, integer. Type of the transformation matrix to be setuped with the following constraints:
1 - 1, to setup a translation matrix
2 - 2, to setup a rotation matrix around OX axis
3 - 3, to setup a rotation matrix around OY axis
4 - 4, to setup a rotation matrix around OZ axis
5 - 5, to setup a scale matrix
- parX, float. x parameter for the matrix
- parY, float. y parameter for the matrix
- parz, float. z parameter for the matrix
Caution, depending on the transformation type parX, parY and parZ can be as well angles than vector coordinates.
In case of rotation transformation only the parX parameter will be used.
Returns:
Integer. ID number of the matrix that has been setuped else _NULL in case of failure.
Global variable used:
None
Constant used:
_NULL, _FLOAT_SIZE, _TRANSLATION_MATRIX, _ROTATION_OX_MATRIX, _ROTATION_OY_MATRIX, _ROTATION_OZ_MATRIX, _SCALE_MATRIX
Third party function call:
None
Type:
function
Author:
Mika
History:
13/10/2005 - v1.0 creation
15/10/2005 - v1.1 add of security regarding matrix management in order to avoid application crash
***************************************************************************************
remend
function _setTransformationMatrix(mat as integer, tType as integer, parX# as float, parY# as float, parZ# as float)
`Variables: resu, xl, yl
`Local variables
local resu, xl, yl as integer
`Check the matrix ID consistency
if (mat < 1)
`Matrix ID is inconsistent
resu = _NULL
else
`Check of matrix existence
if (memblock exist(mat) <> 1)
`Failure : matrix does not esist
resu = _NULL
else
select tType
`Setup of a translation matrix
` 1 0 0 Tx
` 0 1 0 Ty
` 0 0 1 Tz
` 0 0 0 1
case 1
for xl = 0 to 3
write memblock float mat, 5 * xl * _FLOAT_SIZE,1.0
next xl
write memblock float mat, 3 * _FLOAT_SIZE, parX#
write memblock float mat, 7 * _FLOAT_SIZE, parY#
write memblock float mat, 11 * _FLOAT_SIZE, parZ#
endcase
`Setup of a rotation around OX axis matrix
` 1 0 0 0
` 0 cos(a) -sin(a) 0
` 0 sin(a) cos(a) 0
` 0 0 0 1
case 2
write memblock float mat, 0 , 1.0
write memblock float mat, 5 * _FLOAT_SIZE, cos(parX#)
write memblock float mat, 6 * _FLOAT_SIZE, -sin(parX#)
write memblock float mat, 9 * _FLOAT_SIZE, sin(parX#)
write memblock float mat, 10 * _FLOAT_SIZE, cos(parX#)
write memblock float mat, 15 * _FLOAT_SIZE, 1.0
endcase
`Setup of a rotation around OY axis matrix
` cos(a) 0 -sin(a) 0
` 0 1 0 0
` sin(a) 0 cos(a) 0
`0 0 0 1
case 3
write memblock float mat, 0 , cos(parX#)
write memblock float mat, 2 * _FLOAT_SIZE, -sin(parX#)
write memblock float mat, 5 * _FLOAT_SIZE, 1.0
write memblock float mat, 8 * _FLOAT_SIZE, sin(parX#)
write memblock float mat, 10 * _FLOAT_SIZE, cos(parX#)
write memblock float mat, 15 * _FLOAT_SIZE, 1.0
endcase
`Setup of a rotation around OZ axis matrix
` cos(a) -sin(a) 0 0
` sin(a) cos(a) 0 0
` 0 0 1 0
` 0 0 0 1
case 4
write memblock float mat, 0 , cos(parX#)
write memblock float mat, _FLOAT_SIZE , -sin(parX#)
write memblock float mat, 4 * _FLOAT_SIZE, sin(parX#)
write memblock float mat, 5 * _FLOAT_SIZE, cos(parX#)
write memblock float mat, 10 * _FLOAT_SIZE, 1.0
write memblock float mat, 15 * _FLOAT_SIZE, 1.0
endcase
`Setup of a scale matrix
` Sx 0 0 0
` 0 Sy 0 0
` 0 0 Sz 0
` 0 0 0 1
case 5
write memblock float mat, 0 , parX#
write memblock float mat, 5 * _FLOAT_SIZE , parY#
write memblock float mat, 10 * _FLOAT_SIZE, parZ#
write memblock float mat, 15 * _FLOAT_SIZE, 1.0
endcase
case default
resu = _NULL
endcase
endselect
endif
endif
endfunction resu
remstart
***************************************************************************************
Function: _multiplyTransformationMatrix
Performs a multiplication between 2 transformation matrixes, and returns a new matrix as result of this multiplication.
Parameters:
- mat1, integer. ID number of the 1st matrix to be multiplicated.
Caution, the mat1 parameter must be generated by the _createTransformationMatrix() function in order to have a stable and consistent behavior.
- mat2, integer. ID number of the 1st matrix to be multiplicated.
Caution, the mat1 parameter must be generated by the _createTransformationMatrix() function in order to have a stable and consistent behavior.
Returns:
Integer. ID number of the matrix that is the result of multiplication else _NULL in case of failure.
Global variable used:
None
Constant used:
_NULL
Third party function call:
None
Type:
function
Author:
Mika
History:
15/10/2005 - v1.0 creation
***************************************************************************************
remend
function _multiplyTransformationMatrix(mat1 as integer, mat2 as integer)
`Variables: resu
`Local variables
local resu as integer
`Check of parameters consistency
if ((mat1 < 1) or (mat2 < 1))
`mat1 or mat2 is inconsitent
resu = _NULL
else
`Check of matrix existence
if ((memblock exist(mat1) <> 1) or (memblock exist(mat2) <> 1))
`Failure : mat1 or mat2 does not exist.
resu = _NULL
else
`mat1 and mat2 exist
`Perform the matrices product
resu =_multiplyMatrix(mat1, mat2, 4, 4, 4, 4, 4)
endif
endif
endfunction resu
remstart
***************************************************************************************
Function: _multiplyMatrix
Performs a multiplication between 2 matrixes, and returns a new matrix as result of this multiplication.
Caution, elements stored in the 2 matrixes must have the same size.
Parameters:
- mat1, integer. ID number of the 1st matrix to be multiplicated.
- mat2, integer. ID number of the 2nd matrix to be multiplicated.
- mat1NbColumn, integer. Nb of columns in 1st matrix.
- mat1NbRow, integer. Nb of rows in 1st matrix.
- mat2NbColumn, integer. Nb of columns in 2nd matrix.
- mat2NbRow, integer. Nb of rows in 2nd matrix.
- matType, integer. Type of matrix (memblock)to be created with the following values:
1 - 1 : BYTE memblock
2 - 2 : WORD memblock
3 - 3 : DWORD memblock
4 - 4 : FLOAT memblock
Returns:
Integer. ID number of the matrix that is the result of multiplication else _NULL in case of failure.
Global variable used:
None
Constant used:
_NULL
Third party function call:
None
Type:
function
Author:
Mika
History:
14/10/2005 - v1.0 creation
15/10/2005 - v1.1 - add of security regarding matrix management in order to avoid application crash
***************************************************************************************
remend
function _multiplyMatrix(mat1 as integer, mat2 as integer, mat1NbColumn as integer, mat1NbRow as integer, mat2NbColumn as integer, mat2NbRow as integer, matType as integer)
`Variables: resu, i, j, k
`Local variables : result of the matrices product (i.e. a new matrix) and local loop counters.
local resu, i, j, k as integer
`Check of parameters consistency
if ((mat1 < 1) or (mat2 < 1))
`mat1 or mat2 is inconsitent
resu = _NULL
else
if ((memblock exist(mat1) <> 1) or (memblock exist(mat2) <> 1))
`mat1 or mat2 does not exist
resu = _NULL
else
`mat1 and mat2 exist
`Check of consistency between nb of columns in mat1 and nb of rows in mat2
if (mat1NbColumn <> mat2NbRow)
`mat1NbColumn and mat2NbRow are inconsistent
resu = _NULL
else
`mat1NbColumn and mat2NbRow are consistent
`Selection of the matrix type
`then creation of the blank matrix
select matType
`Creation of a BYTE blank memblock matrix
case 1
resu = _createBlankMatrix(mat2NbColumn, mat1NbRow, _BYTE_SIZE)
`Check of matrix creation
if (resu <> _NULL)
`Setup of BYTE memblock matrix
local temp as byte
for i = 0 to (mat1NbColumn - 1)
for j = 0 to (mat2NbColumn - 1)
for k = 0 to (mat1NbColumn - 1)
temp = memblock byte(resu, j + (i * mat2NbColumn))
temp = temp + (memblock byte(mat1, k + (i * mat1NbColumn)) * memblock byte(mat2, j + (k * mat2NbColumn)))
write memblock byte resu, j + (i * mat2NbColumn), temp
next k
next j
next i
endif
endcase
`Creation of a WORD blank memblock matrix
case 2
resu = _createBlankMatrix(mat2NbColumn, mat1NbRow, _WORD_SIZE)
`Check of matrix creation
if (resu <> _NULL)
`Setup of WORD memblock matrix
local temp as word
for i = 0 to (mat1NbColumn - 1)
for j = 0 to (mat2NbColumn - 1)
for k = 0 to (mat1NbColumn - 1)
temp = memblock word(resu, (j + (i * mat2NbColumn)) * _WORD_SIZE)
temp = temp + (memblock word(mat1, (k + (i * mat1NbColumn)) * _WORD_SIZE) * memblock word(mat2, (j + (k * mat2NbColumn)) * _WORD_SIZE))
write memblock word resu, (j + (i * mat2NbColumn)) * _WORD_SIZE, temp
next k
next j
next i
endif
endcase
`Creation of a DWORD blank memblock matrix
case 3
resu = _createBlankMatrix(mat2NbColumn, mat1NbRow, _DWORD_SIZE)
`Check of matrix creation
if (resu <> _NULL)
`Setup of DWORD memblock matrix
local temp as dword
for i = 0 to (mat1NbColumn - 1)
for j = 0 to (mat2NbColumn - 1)
for k = 0 to (mat1NbColumn - 1)
temp = memblock dword(resu, (j + (i * mat2NbColumn)) * _DWORD_SIZE)
temp = temp + (memblock dword(mat1, (k + (i * mat1NbColumn)) * _DWORD_SIZE) * memblock dword(mat2, (j + (k * mat2NbColumn)) * _DWORD_SIZE))
write memblock dword resu, (j + (i * mat2NbColumn)) * _DWORD_SIZE, temp
next k
next j
next i
endif
endcase
`Creation of a FLOAT blank memblock matrix
case 4
resu = _createBlankMatrix(mat2NbColumn, mat1NbRow, _FLOAT_SIZE)
`Check of matrix creation
if (resu <> _NULL)
`Setup of FLOAT memblock matrix
local temp# as float
temp# = 0.0
for i = 0 to (mat2NbRow - 1)
for j = 0 to (mat2NbColumn - 1)
for k = 0 to (mat1NbColumn - 1)
temp# = memblock float(resu, (j + (i * mat2NbColumn)) * _FLOAT_SIZE)
temp# = temp# + (memblock float(mat1, (k + (i * mat1NbColumn)) * _FLOAT_SIZE) * memblock float(mat2, (j + (k * mat2NbColumn)) * _FLOAT_SIZE))
write memblock float resu, (j + (i * mat2NbColumn)) * _FLOAT_SIZE, temp#
next k
temp# = 0.0
next j
next i
endif
endcase
`Default case : not supported
case default
resu = _NULL
endcase
endselect
endif
endif
endif
endfunction resu
remstart
***************************************************************************************
Function: _addMatrix
Performs an addition between 2 matrixes, and returns a new matrix as result of this addition.
Caution, elements stored in the 2 matrixes and the 2 matrixes must have the same size.
Parameters:
- mat1, integer. ID number of the 1st matrix to be multiplicated.
- mat2, integer. ID number of the 2nd matrix to be multiplicated.
- mat1NbColumn, integer. Nb of columns in 1st matrix.
- mat1NbRow, integer. Nb of rows in 1st matrix.
- mat2NbColumn, integer. Nb of columns in 2nd matrix.
- mat2NbRow, integer. Nb of roms in 2nd matrix.
- matType, integer. Type of matrix (memblock)to be created with the following values:
1 - 1 : BYTE memblock
2 - 2 : WORD memblock
3 - 3 : DWORD memblock
4 - 4 : FLOAT memblock
Returns:
Integer. ID number of the matrix that is the result of the addition else _NULL in case of failure.
Global variable used:
None
Constant used:
_NULL, _BYTE_SIZE, _WORD_SIZE, _DWORD_SIZE, _FLOAT_SIZE
Third party function call:
None
Type:
function
Author
Mika
History:
14/10/2005 - v1.0 creation
15/10/2005 - v1.1 - add of security regarding matrix management in order to avoid application crash
***************************************************************************************
remend
function _addMatrix(mat1 as integer, mat2 as integer, mat1NbColumn as integer, mat1NbRow as integer, mat2NbColumn as integer, mat2NbRow as integer, matType as integer)
`Variables: resu, i, j
`Local variables Result of the matrix addition (i.e. a new matrix) and local loop counters.
local resu, i, j as integer
`Check of parameters consistency
if ((mat1 < 1) or (mat2 < 1))
`mat1 or mat2 is inconsitent
resu = _NULL
else
`Check of matrices existence
if ((memblock exist(mat1) <> 1) or (memblock exist(mat2) <> 1))
`mat1 or mat2 does not exist
resu = _NULL
else
`mat1 and mat2 exist
`Check of consistency between nb of columns/rows in mat1 and nb of columns/rows in mat2
if ((mat1NbColumn <> mat2NbColumn) or (mat1NbRow <> mat2NbRow))
`mat1 columns/rows and mat2 columns/rows are inconsistent
resu = _NULL
else
`mat1 columns/rows and mat2 columns/rows are consistent
`Selection of the matrix type
`then creation of the blank matrix
select matType
`Creation of a BYTE blank memblock matrix
case 1
resu = _createBlankMatrix(mat1NbColumn, mat1NbRow, _BYTE_SIZE)
`Check of matrix creation
if (resu <> _NULL)
`Setup of the BYTE memblock matrix
local temp as byte
for i = 0 to (mat1NbColumn - 1)
for j = 0 to (mat1NbRow - 1)
temp = memblock byte(resu, i + (j * mat1NbColumn))
temp = temp + memblock byte(mat1, i + (j * mat1NbColumn))
temp = temp + memblock byte(mat2, i + (j * mat2NbColumn))
write memblock byte resu, i + (j * mat1NbColumn), temp
next j
next i
endif
endcase
`Creation of a WORD blank memblock matrix
case 2
resu = _createBlankMatrix(mat1NbColumn, mat1NbRow, _WORD_SIZE)
`Check of matrix creation
if (resu <> _NULL)
`Setup of the WORD memblock matrix
local temp as word
for i = 0 to (mat1NbColumn - 1)
for j = 0 to (mat1NbRow - 1)
temp = memblock word(resu, (i + (j * mat1NbColumn)) * _WORD_SIZE)
temp = temp + memblock word(mat1, (i + (j * mat1NbColumn)) * _WORD_SIZE)
temp = temp + memblock word(mat2, (i + (j * mat2NbColumn)) * _WORD_SIZE)
write memblock word resu, (i + (j * mat1NbColumn)) * _WORD_SIZE, temp
next j
next i
endif
endcase
`Creation of a DWORD blank memblock matrix
case 3
resu = _createBlankMatrix(mat1NbColumn, mat1NbRow, _DWORD_SIZE)
`Check of matrix creation
if (resu <> _NULL)
`Setup of the DWORD memblock matrix
local temp as dword
for i = 0 to (mat1NbColumn - 1)
for j = 0 to (mat1NbRow - 1)
temp = memblock dword(resu, (i + (j * mat1NbColumn)) * _DWORD_SIZE)
temp = temp + memblock dword(mat1, (i + (j * mat1NbColumn)) * _DWORD_SIZE)
temp = temp + memblock dword(mat2, (i + (j * mat2NbColumn)) * _DWORD_SIZE)
write memblock dword resu, (i + (j * mat1NbColumn)) * _DWORD_SIZE, temp
next j
next i
endif
endcase
`Creation of a FLOAT blank memblock matrix
case 4
resu = _createBlankMatrix(mat1NbColumn, mat1NbRow, _FLOAT_SIZE)
`Check of matrix creation
if (resu <> _NULL)
`Setup of the DWORD memblock matrix
local temp as float
for i = 0 to (mat1NbColumn - 1)
for j = 0 to (mat1NbRow - 1)
temp = memblock float(resu, (i + (j * mat1NbColumn)) * _FLOAT_SIZE)
temp = temp + memblock float(mat1, (i + (j * mat1NbColumn)) * _FLOAT_SIZE)
temp = temp + memblock float(mat2, (i + (j * mat2NbColumn)) * _FLOAT_SIZE)
write memblock float resu, (i + (j * mat1NbColumn)) * _FLOAT_SIZE, temp
next j
next i
endif
endcase
`Default case : not supported
case default
resu = _NULL
endcase
endselect
endif
endif
endif
endfunction resu
remstart
***************************************************************************************
Function: _addTransformationMatrix
Performs an addition between 2 transformation matrixes, and returns a new matrix as result of this addition.
Parameters:
- mat1, integer. ID number of the 1st matrix to be added.
Caution, the mat1 parameter must be generated by the _createTransformationMatrix() function in order to have a stable and consistent behavior.
- mat2, integer. ID number of the 1st matrix to be added.
Caution, the mat1 parameter must be generated by the _createTransformationMatrix() function in order to have a stable and consistent behavior.
Returns:
Integer. ID number of the matrix that is the result of addition else _NULL in case of failure.
Global variable used:
None
Constant used:
_NULL
Third party function call:
None
Type:
function
Author:
Mika
History:
15/10/2005 - v1.0 creation
***************************************************************************************
remend
function _addTransformationMatrix(mat1 as integer, mat2 as integer)
`Variables: resu
`Local variables: result of the matrices addition (i.e. a new matrix)
local resu as integer
`Check of parameters consistency
if ((mat1 < 1) or (mat2 < 1))
`mat1 or mat2 is inconsitent
resu = _NULL
else
`Check of matrix existence
if ((memblock exist(mat1) <> 1) or (memblock exist(mat2) <> 1))
`Failure : mat1 or mat2 does not exist.
resu = _NULL
else
`mat1 and mat2 exist
`Perform the matrices product
resu =_addMatrix(mat1, mat2, 4, 4, 4, 4, 4)
endif
endif
endfunction resu
remstart
***************************************************************************************
Function: _applyTransformationMatrixTo3DVector
Apply a transformation to a vector representing 3D coordinates in homogeneous coordinates system (i.e. 3D coordinates are represented in a vector of 4 elements).
Parameters:
- mat, integer. ID number of the transformation matrix.
Caution, the mat parameter must be generated by the _createTransformationMatrix() function in order to have a stable and consistent behavior.
- vec, integer. ID number of the vector4 instance to be transformed.
Returns:
Integer. ID number of the updated vector4 that is the result of the multiplication between matrix and vector (i.e. m * v) else _NULL in case of failure.
Global variable used:
None
Constant used:
_NULL, _FLOAT_SIZE
Third party function call:
None
Type:
function
Author:
Mika
History:
16/10/2005 - v1.0 creation
***************************************************************************************
remend
function _applyTransformationMatrixTo3DVector(mat as integer, vec as integer)
`Variables: resu
`Local variables : result of the matrix application to the vector (i.e. updated vector).
local resu as integer
`Variables: x#, y#, z#, w#
`Local variables : temp variables used for vector construction.
local x# as float
local y# as float
local z# as float
local w# as float
`Check of parameters consistency
if ((mat < 1) or (vec < 0))
`mat or vec is inconsitent
resu = _NULL
else
`Check of matrix existence
if (memblock exist(mat) <> 1)
`Failure : mat does not exist.
resu = _NULL
else
`mat and vec exist
`Perform the vector transformation
x# = (x vector4(vec) * memblock float(mat, 0 )) + (y vector4(vec) * memblock float(mat, _FLOAT_SIZE)) + (z vector4(vec) * memblock float(mat, 2 * _FLOAT_SIZE)) + (w vector4(vec) * memblock float(mat, 3 * _FLOAT_SIZE))
y# = (x vector4(vec) * memblock float(mat, 4 * _FLOAT_SIZE)) + (y vector4(vec) * memblock float(mat, 5 * _FLOAT_SIZE)) + (z vector4(vec) * memblock float(mat, 6 * _FLOAT_SIZE)) + (w vector4(vec) * memblock float(mat, 7 * _FLOAT_SIZE))
z# = (x vector4(vec) * memblock float(mat, 8 * _FLOAT_SIZE)) + (y vector4(vec) * memblock float(mat, 9 * _FLOAT_SIZE)) + (z vector4(vec) * memblock float(mat, 10 * _FLOAT_SIZE)) + (w vector4(vec) * memblock float(mat, 11 * _FLOAT_SIZE))
w# = (x vector4(vec) * memblock float(mat, 12 * _FLOAT_SIZE)) + (y vector4(vec) * memblock float(mat, 13 * _FLOAT_SIZE)) + (z vector4(vec) * memblock float(mat, 14 * _FLOAT_SIZE)) + (w vector4(vec) * memblock float(mat, 15 * _FLOAT_SIZE))
set vector4 vec, x#, y#, z#, w#
resu = vec
endif
endif
endfunction resu
Moreover, NaturalDocs have to be customized in order to recognize DB Pro, so this is the content of adapted NaturalDocs 'Languages.txt':
Format: 1.35
# This is the main Natural Docs languages file. If you change anything here,
# it will apply to EVERY PROJECT you use Natural Docs on. If you'd like to
# change something for just one project, edit the Languages.txt in its project
# directory instead.
#-------------------------------------------------------------------------------
# SYNTAX:
#
# Unlike other Natural Docs configuration files, in this file all comments
# MUST be alone on a line. Some languages deal with the # character, so you
# cannot put comments on the same line as content.
#
# Also, all lists are separated with spaces, not commas, again because some
# languages may need to use them.
#
# Language: [name]
# Defines a new language. Its name can use any characters.
#
# The language Shebang Script is special. It's entry is only used for
# extensions, and files with those extensions have their shebang (#!) lines
# read to determine the real language of the file. Extensionless files are
# always treated this way.
#
# The language Text File is also special. It's treated as one big comment
# so you can put Natural Docs content in them without special symbols. Also,
# if you don't specify a package separator, ignored prefixes, or enum value
# behavior, it will copy those settings from the language that is used most
# in the source tree.
#
# Extensions: [extension] [extension] ...
# Defines the file extensions of the language's source files. You can use *
# to mean any undefined extension.
#
# Shebang Strings: [string] [string] ...
# Defines a list of strings that can appear in the shebang (#!) line to
# designate that it's part of the language.
#
# Ignore Prefixes in Index: [prefix] [prefix] ...
# Ignore [Topic Type] Prefixes in Index: [prefix] [prefix] ...
# Specifies prefixes that should be ignored when sorting symbols in an
# index. Can be specified in general or for a specific topic type.
#
#------------------------------------------------------------------------------
# For basic language support only:
#
# Line Comments: [symbol] [symbol] ...
# Defines a space-separated list of symbols that are used for line comments,
# if any.
#
# Block Comments: [opening sym] [closing sym] [opening sym] [closing sym] ...
# Defines a space-separated list of symbol pairs that are used for block
# comments, if any.
#
# Package Separator: [symbol]
# Defines the default package separator symbol. The default is a dot.
#
# [Topic Type] Prototype Enders: [symbol] [symbol] ...
# When defined, Natural Docs will attempt to get a prototype from the code
# immediately following the topic type. It stops when it reaches one of
# these symbols. Use \n for line breaks.
#
# Line Extender: [symbol]
# Defines the symbol that allows a prototype to span multiple lines if
# normally a line break would end it.
#
# Enum Values: [global|under type|under parent]
# Defines how enum values are referenced. The default is global.
# global - Values are always global, referenced as 'value'.
# under type - Values are under the enum type, referenced as
# 'package.enum.value'.
# under parent - Values are under the enum's parent, referenced as
# 'package.value'.
#
# Perl Package: [perl package]
# Specifies the Perl package used to fine-tune the language behavior in ways
# too complex to do in this file.
#
#------------------------------------------------------------------------------
# For full language support only:
#
# Full Language Support: [perl package]
# Specifies the Perl package that has the parsing routines necessary for full
# language support.
#
#-------------------------------------------------------------------------------
# The following languages MUST be defined in this file:
#
# Text File, Shebang Script
# If you add a language that you think would be useful to other developers
# and should be included in Natural Docs by default, please e-mail it to
# languages [at] naturaldocs [dot] org.
Language: Text File
Extension: txt
Language: Shebang Script
Extension: cgi
Language: C/C++
Extensions: c cpp h hpp cxx hxx
Ignore Function Prefix in Index: ~
Line Comment: //
Block Comment: /* */
Package Separator: ::
Enum Values: Global
Function Prototype Enders: ; {
Variable Prototype Enders: ; =
Language: C#
Extension: cs
Ignore Prefix in Index: @
Full Language Support: NaturalDocs::Languages::CSharp
Language: Java
Extension: java
Line Comment: //
Block Comment: /* */
Enum Values: Local
Function Prototype Ender: {
Variable Prototype Enders: ; =
Language: JavaScript
Extension: js
Line Comment: //
Block Comment: /* */
Enum Values: Local
Function Prototype Ender: {
Variable Prototype Enders: ; =
Language: Perl
Extensions: pl pm
Shebang String: perl
Ignore Variable Prefixes in Index: $ @ % *
Full Language Support: NaturalDocs::Languages::Perl
Language: Python
Extension: py
Shebang String: python
Line Comment: #
Function Prototype Ender: :
Variable Prototype Ender: =
Line Extender: \
Language: PHP
Extensions: inc php php3 php4 phtml
Shebang String: php
Ignore Variable Prefix in Index: $
Line Comments: // #
Block Comment: /* */
Function Prototype Enders: ; {
Variable Prototype Enders: ; =
Language: SQL
Extension: sql
Line Comment: --
Block Comment: /* */
Enum Values: Global
Function Prototype Enders: , ; ) as As AS is Is IS
Variable Prototype Enders: , ; ) := default Default DEFAULT
Database Index Prototype Enders: , ; )
Database Trigger Prototype Enders: begin Begin BEGIN as As AS
Perl Package: NaturalDocs::Languages::PLSQL
Language: Visual Basic
Extensions: vb vbs bas cls frm
Line Comment: '
Enum Values: Local
Function Prototype Ender: \n
Variable Prototype Enders: \n =
Line Extender: _
Language: Pascal
Extension: pas
Line Comment: //
Block Comments: { } (* *)
Function Prototype Ender: ;
Variable Prototype Enders: ; =
Perl Package: NaturalDocs::Languages::Pascal
Language: Assembly
Extension: asm
Line Comment: ;
Variable Prototype Ender: \n
Line Extender: \
Language: Ada
Extensions: ada ads adb
Line Comment: --
Function Prototype Enders: ; is Is IS
Variable Prototype Enders: ; :=
Perl Package: NaturalDocs::Languages::Ada
Language: Tcl
Extensions: tcl exp
Shebang Strings: tclsh wish expect
Line Comment: #
Package Separator: ::
Function Prototype Enders: ; {
Variable Prototype Enders: ; \n
Line Extender: \
Perl Package: NaturalDocs::Languages::Tcl
Language: Ruby
Extension: rb
Shebang String: ruby
Ignore Variable Prefixes in Index: $ @ @@
Line Comment: #
Enum Values: Parent
Function Prototype Enders: ; \n
Variable Prototype Enders: ; \n =
Line Extender: \
Language: Makefile
Extensions: mk mak make
Line Comment: #
Language: ActionScript
Extension: as
Full Language Support: NaturalDocs::Languages::ActionScript
Language: ColdFusion
Extensions: cfm cfml cfc
Line Comment: //
Block Comments: <!--- ---> /* */
Function Prototype Enders: { <
Language: R
Extension: r
Line Comment: #
Function Prototype Enders: { ;
Variable Prototype Enders: <- = ; \n
Language: Fortran
Extensions: f90 f95 f03
Line Comment: !
Function Prototype Ender: \n
Variable Prototype Enders: \n = =>
Line Extender: &
Language: DarkBasic Pro
Extension: dba
Line Comment: `
Block Comment: remstart remend
Function Prototype Ender: \n
Variable Prototype Ender: \n
Line Extender: _
And the content of the NaturalDocs 'Topics.txt' files:
Format: 1.35
# This is the main Natural Docs topics file. If you change anything here, it
# will apply to EVERY PROJECT you use Natural Docs on. If you'd like to
# change something for just one project, edit the Topics.txt in its project
# directory instead.
#-------------------------------------------------------------------------------
# SYNTAX:
#
# Topic Type: [name]
# Creates a new topic type. Each type gets its own index and behavior
# settings. Its name can have letters, numbers, spaces, and these
# charaters: - / . '
#
# The Enumeration type is special. It's indexed with Types but its members
# are indexed with Constants according to the rules in Languages.txt.
#
# Plural: [name]
# Sets the plural name of the topic type, if different.
#
# Keywords:
# [keyword]
# [keyword], [plural keyword]
# ...
# Defines a list of keywords for the topic type. They may only contain
# letters, numbers, and spaces and are not case sensitive. Plural keywords
# are used for list topics.
#
# Index: [yes|no]
# Whether the topics get their own index. Defaults to yes. Everything is
# included in the general index regardless of this setting.
#
# Scope: [normal|start|end|always global]
# How the topics affects scope. Defaults to normal.
# normal - Topics stay within the current scope.
# start - Topics start a new scope for all the topics beneath it,
# like class topics.
# end - Topics reset the scope back to global for all the topics
# beneath it.
# always global - Topics are defined as global, but do not change the scope
# for any other topics.
#
# Class Hierarchy: [yes|no]
# Whether the topics are part of the class hierarchy. Defaults to no.
#
# Variable Type: [yes|no]
# Whether the topics can be a variable type. Defaults to no.
#
# Page Title If First: [yes|no]
# Whether the topic's title becomes the page title if it's the first one in
# a file. Defaults to no.
#
# Break Lists: [yes|no]
# Whether list topics should be broken into individual topics in the output.
# Defaults to no.
#
# Can Group With: [type], [type], ...
# Defines a list of topic types that this one can possibly be grouped with.
# Defaults to none.
#-------------------------------------------------------------------------------
# The following topics MUST be defined in this file:
#
# Generic, Class, Interface, Section, File, Group, Function, Variable,
# Property, Type, Constant, Enumeration, Event, Delegate
# If you add something that you think would be useful to other developers
# and should be included in Natural Docs by default, please e-mail it to
# topics [at] naturaldocs [dot] org.
Topic Type: Generic
Index: No
Keywords:
topic, topics
about, list
note
notes
Topic Type: Class
Plural: Classes
Scope: Start
Class Hierarchy: Yes
Page Title If First: Yes
Can Group With: Interfaces
Keywords:
class, classes
structure, structures
struct, structs
package, packages
namespace, namespaces
Topic Type: Interface
Plural: Interfaces
Scope: Start
Class Hierarchy: Yes
Page Title If First: Yes
Can Group With: Classes
Keywords:
interface, interfaces
Topic Type: Section
Plural: Sections
Index: No
Scope: End
Page Title If First: Yes
Keywords:
section
title
Topic Type: File
Plural: Files
Scope: Always global
Page Title If First: Yes
Keywords:
file, files
program, programs
script, scripts
document, documents
doc, docs
header, headers
Topic Type: Group
Plural: Groups
Index: No
Keywords:
group
Topic Type: Function
Plural: Functions
Break Lists: Yes
Can Group With: Properties
Keywords:
function, functions
func, funcs
procedure, procedures
proc, procs
routine, routines
subroutine, subroutines
sub, subs
method, methods
callback, callbacks
constructor, constructors
destructor, destructors
Topic Type: Variable
Plural: Variables
Can Group With: Types, Constants, Macros, Enumerations
Keywords:
variable, variables
var, vars
integer, integers
int, ints
uint, uints
long, longs
ulong, ulongs
short, shorts
ushort, ushorts
byte, bytes
ubyte, ubytes
sbyte, sbytes
float, floats
double, doubles
real, reals
decimal, decimals
scalar, scalars
array, arrays
arrayref, arrayrefs
hash, hashes
hashref, hashrefs
bool, bools
boolean, booleans
flag, flags
bit, bits
bitfield, bitfields
field, fields
pointer, pointers
ptr, ptrs
reference, references
ref, refs
object, objects
obj, objs
character, characters
wcharacter, wcharacters
char, chars
wchar, wchars
string, strings
wstring, wstrings
str, strs
wstr, wstrs
handle, handles
local, locals
global, globals
Topic Type: Property
Plural: Properties
Can Group With: Functions
Keywords:
property, properties
prop, props
Topic Type: Type
Plural: Types
Can Group With: Variables, Constants, Macros, Enumerations
Keywords:
type, types
typedef, typedefs
Topic Type: Constant
Plural: Constants
Can Group With: Variables, Types, Macros, Enumerations
Keywords:
constant, constants
const, consts
Topic Type: Enumeration
Plural: Enumerations
Index: No
Can Group With: Variables, Types, Macros, Constants
Keywords:
enum, enums
enumeration, enumerations
Topic Type: Event
Plural: Events
Keywords:
event, events
Topic Type: Delegate
Plural: Delegates
Keywords:
delegate, delegates
Topic Type: Macro
Plural: Macros
Can Group With: Variables, Types, Constants
Keywords:
define, defines
def, defs
macro, macros
Topic Type: Database
Plural: Databases
Page Title If First: Yes
Keywords:
database, databases
db, dbs
Topic Type: Database Table
Plural: Database Tables
Scope: Start
Page Title If First: Yes
Keywords:
table, tables
database table, database tables
databasetable, databasetables
db table, db tables
dbtable, dbtables
Topic Type: Database View
Plural: Database Views
Scope: Start
Page Title If First: Yes
Keywords:
view, views
database view, database views
databaseview, databaseviews
db view, db views
dbview, dbviews
Topic Type: Database Index
Plural: Database Indexes
Keywords:
index, indexes
index, indices
database index, database indexes
database index, database indices
databaseindex, databaseindexes
databaseindex, databaseindices
db index, db indexes
db index, db indices
dbindex, dbindexes
dbindex, dbindices
key, keys
database key, database keys
databasekey, databasekeys
db key, db keys
dbkey, dbkeys
primary key, primary keys
primarykey, primarykeys
database primary key, database primary keys
databaseprimarykey, databaseprimarykeys
db primary key, db primary keys
dbprimarykey, dbprimarykeys
Topic Type: Database Cursor
Plural: Database Cursors
Keywords:
cursor, cursors
database cursor, database cursors
databasecursor, databasecursors
db cursor, db cursors
dbcursor, dbcursors
Topic Type: Database Trigger
Plural: Database Triggers
Keywords:
trigger, triggers
database trigger, database triggers
databasetrigger, databasetriggers
db trigger, db triggers
dbtrigger, dbtriggers
Topic Type: Cookie
Plural: Cookies
Scope: Always global
Keywords:
cookie, cookies
Topic Type: Build Target
Plural: Build Targets
Keywords:
target, targets
build target, build targets
buildtarget, buildtargets
Topic Type: External DB Pro Function
Plural: External DB Pro Functions
Keywords:
ExtDBProFunctionCall, ExtDBProFunctionCalls
At the end, as NaturalDocs is developped in perl, I believe that a parsing package can be developped in order to fully support DB Pro language.
Michel