/*
 *   FreeAdhocUDF - copyright (c) 2004/2007 adhoc dataservice GmbH
 *   Christoph Theuring / Peter Mandrella / Georg Horn
 *   (bug-)reports only to udf@adhoc-data.de
 *      based on FreeUDFLibC - copyright (c) 1999 Gregory Deatz
 *   Declarations script for all FreeAdhocUDF UDFs
 *   length of some cstring = 8190 or 4095 
 *   because so you can use one this UDF 4 (8) times in a piped string
 *   4 x 8190 = 32760 < 32762 (15 bit - 6 byte internal use)
 *   
 */

SET SQL DIALECT 3;

/******************************************************************************/
/****                User Defined Functions - BLOb Functions               ****/
/****            to use with FireBird 2.x - possibility to return     ****/
/******************************************************************************/

DECLARE EXTERNAL FUNCTION F_BLOB2EXCEL
    BLOB
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'excelblob' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BLOBASPCHAR
    BLOB
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'blobaspchar' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BLOBCAT
    BLOB, 
    BLOB, 
    BLOB
    RETURNS PARAMETER 3
    ENTRY_POINT 'blobcat' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BLOBCATSTR
    BLOB, 
    CSTRING(32760), 
    BLOB
    RETURNS PARAMETER 3
    ENTRY_POINT 'blobcatstr' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BLOBLEFT
    BLOB,
    INTEGER
    RETURNS CSTRING(8190) FREE_IT
    ENTRY_POINT 'blobleft' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BLOBLINE
    BLOB, 
    INTEGER
    RETURNS CSTRING(8190) FREE_IT
    ENTRY_POINT 'blobline' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BLOBLINECOUNT
    BLOB
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'bloblinecount' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BLOBMAXSEGMENTLENGTH
    BLOB
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'blobmaxsegmentlength' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BLOBMID
    BLOB,
    INTEGER,
    INTEGER
    RETURNS CSTRING(8190) FREE_IT
    ENTRY_POINT 'blobmid' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BLOBREPLACESTRING
    BLOB,
    CSTRING(254),
    CSTRING(254),
    INTEGER,
    INTEGER,
    BLOB
    RETURNS PARAMETER 6
    ENTRY_POINT 'blobreplacestring' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BLOBRIGHT
    BLOB,
    INTEGER
    RETURNS CSTRING(8190) FREE_IT
    ENTRY_POINT 'blobright' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BLOBSEGMENTCOUNT
    BLOB
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'blobsegmentcount' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BLOBSIZE
    BLOB
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'blobsize' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BLOBSUBSTR
    BLOB,
    CSTRING(254)
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'blobsubstr' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_STRBLOB
    CSTRING(32760),
    BLOB
    RETURNS PARAMETER 2
    ENTRY_POINT 'strblob' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BLOBCOMPARE
    BLOB,
    BLOB
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'blobcompare' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BLOBWORDCOUNT
    BLOB
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'blobwordcount' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_RBLOBMID
    BLOB,
    INTEGER,
    INTEGER
    RETURNS CSTRING(8190) FREE_IT
    ENTRY_POINT 'r_blobmid' MODULE_NAME 'FreeAdhocUDF';

/* adhoc 2007-02-06 */

DECLARE EXTERNAL FUNCTION F_BLOBSTRPOS
    CSTRING(8190),
    BLOB
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'b_strpos' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BLOBTEXTPOS
    CSTRING(8190),
    BLOB
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'b_textpos' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BLOBCMP
    BLOB,
    BLOB
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'b_strcmp' MODULE_NAME 'FreeAdhocUDF';


/* adhoc 2007-07-06 */

/******************************************************************************/
/****              User Defined Functions - constant functions             ****/
/******************************************************************************/

DECLARE EXTERNAL FUNCTION F_PI
    RETURNS DOUBLE PRECISION BY VALUE
ENTRY_POINT 'pi' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_E
    RETURNS DOUBLE PRECISION BY VALUE
ENTRY_POINT 'euler' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C
    RETURNS INTEGER BY VALUE
ENTRY_POINT 'c' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_G
    RETURNS DOUBLE PRECISION BY VALUE
ENTRY_POINT 'g' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_K
    RETURNS DOUBLE PRECISION BY VALUE
ENTRY_POINT 'k' MODULE_NAME 'FreeAdhocUDF';

/* distance */

DECLARE EXTERNAL FUNCTION F_C_IN2M
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'in2m' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_FT2M
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'ft2m' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_YD2M
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'yd2m' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_MILE2KM
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'mile2km' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_SM2KM
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'sm2km' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_FM2M
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'fm2m' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_P2MM
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'p2mm' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_M2IN
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'm2in' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_M2FT
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'm2ft' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_M2YD
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'm2yd' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_KM2MILE
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'km2mile' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_KM2SM
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'km2sm' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_M2FM
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'm2fm' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_MM2P
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'mm2p' MODULE_NAME 'FreeAdhocUDF';

/* area */

DECLARE EXTERNAL FUNCTION F_C_AR2SQM
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'ar2sqm' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_HA2SQM
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'ha2sqm' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_MORGEN2SQM
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'morgen2sqm' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_SQFT2SQM
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'sqft2sqm' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_AC2SQM
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'ac2sqm' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_SQYD2SQM
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'sqyd2sqm' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_SQM2AR
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'sqm2ar' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_SQM2HA
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'sqm2ha' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_SQM2MORGEN
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'sqm2morgen' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_SQM2SQFT
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'sqm2sqft' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_SQM2AC
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'sqm2ac' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_SQM2SQYD
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'sqm2sqyd' MODULE_NAME 'FreeAdhocUDF';

/* volume */

DECLARE EXTERNAL FUNCTION F_C_BBL2L
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'bbl2l' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_GBFLOZ2ML
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'gbfloz2ml' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_USFLOZ2ML
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'usfloz2ml' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_GBPT2L
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'gbpt2l' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_USPT2L
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'uspt2l' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_GBQT2L
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'gbqt2l' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_USQT2L
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'usqt2l' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_GBGAL2L
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'gbgal2l' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_USGAL2L
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'usgal2l' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_RT2CBM
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'rt2cbm' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_L2BBL
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'l2bbl' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_ML2GBFLOZ
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'ml2gbfloz' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_ML2USFLOZ
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'ml2usfloz' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_L2GBPT
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'l2gbpt' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_L2USPT
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'l2uspt' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_L2GBQT
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'l2gbqt' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_L2USQT
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'l2usqt' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_L2GBGAL
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'l2gbgal' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_L2USGAL
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'l2usgal' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_CBM2RT
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'cbm2rt' MODULE_NAME 'FreeAdhocUDF';

/* weight */

DECLARE EXTERNAL FUNCTION F_C_CT2G
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'ct2g' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_OZ2G
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'oz2g' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_OZTR2G
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'oztr2g' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_LB2KG
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'lb2kg' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_G2CT
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'g2ct' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_G2OZ
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'g2oz' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_G2OZTR 
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'g2oztr' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_KG2LB
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'kg2lb' MODULE_NAME 'FreeAdhocUDF';

/* technical */

DECLARE EXTERNAL FUNCTION F_C_G2T
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'g2t' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_BAR2TORR
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'bar2torr' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_BAR2PA
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'bar2pa' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_PSI2PA
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'psi2pa' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_TORR2PA 
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'torr2pa' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_CAL2J 
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'cal2j' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_PS2KW 
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'ps2kw' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_BHP2KW
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'bhp2kw' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_T2G 
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 't2g' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_TORR2BAR
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'torr2bar' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_PA2BAR 
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'pa2bar' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_PA2PSI
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'pa2psi' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_PA2TORR
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'pa2torr' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_J2CAL
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'j2cal' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_KW2PS 
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'kw2ps' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_KW2BHP 
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'kw2bhp' MODULE_NAME 'FreeAdhocUDF';

/* temperature */

DECLARE EXTERNAL FUNCTION F_C_C2F
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'c2f' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_C_F2C
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'f2c' MODULE_NAME 'FreeAdhocUDF';

/* number system */

DECLARE EXTERNAL FUNCTION F_ROMAN2ARABIC
    CSTRING(50)
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'roman2arabic' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ARABIC2ROMAN
    INTEGER
    RETURNS CSTRING(250) FREE_IT
    ENTRY_POINT 'arabic2roman' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_CONVERTFROM33
    CSTRING(254)
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'convertfrom33' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_CONVERTFROMBASE
    CSTRING(254),
    INTEGER,
    CSTRING(254)
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'convertfrombase' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_CONVERTTO33
    INTEGER
    RETURNS CSTRING(254) FREE_IT
    ENTRY_POINT 'convertto33' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_CONVERTTOBASE
    INTEGER,
    INTEGER,
    CSTRING(254)
    RETURNS CSTRING(254) FREE_IT
    ENTRY_POINT 'converttobase' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_INTTOHEX
    INTEGER,
    INTEGER
    RETURNS CSTRING(254) FREE_IT
    ENTRY_POINT 'inttohex' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_HEXTOINT
    CSTRING(20)
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'hextoint' MODULE_NAME 'FreeAdhocUDF';

/* geometrical */

DECLARE EXTERNAL FUNCTION F_DEGTORAD
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'degtorad' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_RADTODEG
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'radtodeg' MODULE_NAME 'FreeAdhocUDF';

/******************************************************************************/
/****                 User Defined Functions: Date and TIME                ****/
/****       to use ONLY with FireBird 2.x - possibility to return     ****/ 
/******************************************************************************/

DECLARE EXTERNAL FUNCTION F_ADDDAY
    DATE,
    INTEGER
    RETURNS DATE FREE_IT
    ENTRY_POINT 'addday' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ADDHOUR
    DATE,
    INTEGER
    RETURNS DATE FREE_IT
    ENTRY_POINT 'addhour' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ADDMINUTE
    DATE,
    INTEGER
    RETURNS DATE FREE_IT
    ENTRY_POINT 'addminute' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ADDMONTH
    DATE,
    INTEGER
    RETURNS DATE FREE_IT
    ENTRY_POINT 'addmonth' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ADDSECOND
    DATE,
    INTEGER
    RETURNS DATE FREE_IT
    ENTRY_POINT 'addsecond' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ADDWEEK
    DATE,
    INTEGER
    RETURNS DATE FREE_IT
    ENTRY_POINT 'addweek' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ADDYEAR
    DATE,
    INTEGER
    RETURNS DATE FREE_IT
    ENTRY_POINT 'addyear' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_AGEINDAYS
    DATE,
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'ageindays' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_AGEINDAYSTHRESHOLD
    DATE,
    DATE,
    INTEGER,
    INTEGER,
    INTEGER,
    INTEGER
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'ageindaysthreshold' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_AGEINHOURS
    DATE,
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'ageinhours' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_AGEINHOURSTHRESHOLD
    DATE,
    DATE,
    INTEGER,
    INTEGER,
    INTEGER,
    INTEGER
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'ageinhoursthreshold' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_AGEINMINUTES
    DATE,
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'ageinminutes' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_AGEINMINUTESTHRESHOLD
    DATE,
    DATE,
    INTEGER,
    INTEGER,
    INTEGER,
    INTEGER
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'ageinminutes threshold' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_AGEINMONTHS
    DATE,
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'ageinmonths' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_AGEINMONTHSTHRESHOLD
    DATE,
    DATE,
    INTEGER,
    INTEGER,
    INTEGER,
    INTEGER
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'ageinmonthsthresholdl' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_AGEINSECONDS
    DATE,
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'ageinseconds' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_AGEINSECONDSTHRESHOLD
    DATE,
    DATE,
    INTEGER,
    INTEGER,
    INTEGER,
    INTEGER
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'ageinsecondsthreshold' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_AGEINWEEKS
    DATE,
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'ageinweeks' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_AGEINWEEKSTHRESHOLD
    DATE,
    DATE,
    INTEGER,
    INTEGER,
    INTEGER,
    INTEGER
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'ageinweeksthreshold' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_AGEINYEARS
    DATE,
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'ageinyears' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_AGEINYEARSTHRESHOLD
    DATE,
    DATE,
    INTEGER,
    INTEGER,
    INTEGER,
    INTEGER
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'ageinyearsthreshold' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_CDOWLONG
    DATE
    RETURNS CSTRING(16) FREE_IT
    ENTRY_POINT 'cdowlong' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_CDOWLONGLANG
    DATE,
    CSTRING(2)
    RETURNS CSTRING(16) FREE_IT
    ENTRY_POINT 'cdowlonglang' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_CDOWSHORT
    DATE
    RETURNS CSTRING(4) FREE_IT
    ENTRY_POINT 'cdowshort' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_CDOWSHORTLANG
    DATE,
    CSTRING(2)
    RETURNS CSTRING(16) FREE_IT
    ENTRY_POINT 'cdowshortlang' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_CMONTHLONG
    DATE
    RETURNS CSTRING(16) FREE_IT
    ENTRY_POINT 'cmonthlong' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_CMONTHLONGLANG
    DATE,
    CSTRING(2)
    RETURNS CSTRING(16) FREE_IT
    ENTRY_POINT 'cmonthlonglang' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_CMONTHSHORT
    DATE
    RETURNS CSTRING(4) FREE_IT
    ENTRY_POINT 'cmonthshort' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_CMONTHSHORTLANG
    DATE,
    CSTRING(2)
    RETURNS CSTRING(16) FREE_IT
    ENTRY_POINT 'cmonthshortlang' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_DAYOFMONTH
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'dayofmonth' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_DAYOFWEEK
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'dayofweek' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_DAYOFYEAR
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'dayofyear' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_DAYSBETWEEN
    DATE,
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'daysbetween' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_DAYSOFMONTH
    INTEGER,
    INTEGER
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'daysofmonth' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_DTIME
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'dtime' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ENCODEDATE
    INTEGER,
    INTEGER,
    INTEGER
    RETURNS DATE FREE_IT
    ENTRY_POINT 'encodedate' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ENCODETIME
    INTEGER,
    INTEGER,
    INTEGER
    RETURNS DATE FREE_IT
    ENTRY_POINT 'encodetime' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ENCODETIMESTAMP
    INTEGER,
    INTEGER,
    INTEGER,
    INTEGER,
    INTEGER,
    INTEGER
    RETURNS DATE FREE_IT
    ENTRY_POINT 'encodetimestamp' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_EQUALDATE
    DATE,
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'equaldate' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_EQUALDATETIME
    DATE,
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'equaldatetime' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_GFORMATD
    CSTRING(254),
    DATE
    RETURNS CSTRING(254) FREE_IT
    ENTRY_POINT 'gformatd' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_HOUR
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'hour' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_HOURSBETWEEN
    DATE,
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'hoursbetween' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ISLEAPYEAR
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'isleapyear' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_LASTDAY
    INTEGER,
    INTEGER
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'lastday' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_MAXDATE
    DATE,
    DATE
    RETURNS DATE FREE_IT
    ENTRY_POINT 'maxdate' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_MINDATE
    DATE,
    DATE
    RETURNS DATE FREE_IT
    ENTRY_POINT 'mindate' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_MINUTE
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'minute' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_MINUTESBETWEEN
    DATE,
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'minutesbetween' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_MONTH
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'month' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_MONTHSBETWEEN
    DATE,
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'monthsbetween' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_OSTERDATUM
    INTEGER
    RETURNS DATE FREE_IT
    ENTRY_POINT 'osterdatum' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_QUARTER
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'quarter' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_SECOND
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'second' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_SECONDSBETWEEN
    DATE,
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'secondsbetween' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_STRIPDATE
    DATE
    RETURNS DATE FREE_IT
    ENTRY_POINT 'stripdate' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_STRIPTIME
    DATE
    RETURNS DATE FREE_IT
    ENTRY_POINT 'striptime' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_STRTOTIME
    CSTRING(11)
    RETURNS DATE FREE_IT
    ENTRY_POINT 'strtotime' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_WEEK
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'week' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_WEEKOFYEAR
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'weekofyear' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_WEEKSBETWEEN
    DATE,
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'weeksbetween' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_WOY
    DATE
    RETURNS CSTRING(8) FREE_IT
    ENTRY_POINT 'woy' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_YEAR
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'year' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_YEAROFYEAR
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'yearofyear' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_YEARSBETWEEN
    DATE,
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'yearsbetween' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ZEITDIFFERENZ
    DATE,
    DATE,
    CSTRING(1)
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'zeitdifferenz' MODULE_NAME 'FreeAdhocUDF';

/* adhoc 2006-12-03 */

DECLARE EXTERNAL FUNCTION F_EXTRACTYEARDAY
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'r_yearday' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_EXTRACTWEEKDAY
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'r_weekday' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_DOW
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'r_dow' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_RISLEAPYEAR
    INTEGER
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'r_isleapyear' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_RENCODEDATE
    INTEGER,
    INTEGER,
    INTEGER
    RETURNS DATE FREE_IT
    ENTRY_POINT 'r_encodedate' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_RENCODEDATETIME
    INTEGER,
    INTEGER,
    INTEGER,
    INTEGER,
    INTEGER,
    INTEGER
    RETURNS DATE FREE_IT
    ENTRY_POINT 'r_encodedatetime' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_DATETOSTR
   DATE,
   CSTRING(254)
   RETURNS CSTRING(254) FREE_IT
   ENTRY_POINT 'datetostr' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_FIRSTDAYMONTH
   DATE
   RETURNS DATE FREE_IT
   ENTRY_POINT 'firstdaymonth' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_LASTDAYMONTH
   DATE
   RETURNS DATE FREE_IT
   ENTRY_POINT 'lastdaymonth' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ADDPERIOD
   CSTRING(254),
   CSTRING(254)
   RETURNS CSTRING(254) FREE_IT
   ENTRY_POINT 'addperiod' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_SUBPERIOD
   CSTRING(254),
   CSTRING(254)
   RETURNS CSTRING(254) FREE_IT
   ENTRY_POINT 'subperiod' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_PERIOD2SECONDS
   CSTRING(254)
   RETURNS INTEGER FREE_IT
   ENTRY_POINT 'period2seconds' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_SECONDS2PERIOD
   INTEGER
   RETURNS CSTRING(254) FREE_IT
   ENTRY_POINT 'seconds2period' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_TIMETODOUBLE
    DATE
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'timetodouble' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_DATETODOUBLE
    DATE
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'datetodouble' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_DOUBLETOTIME
    DOUBLE PRECISION
    RETURNS DATE FREE_IT
    ENTRY_POINT 'doubletotime' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_DOUBLETODATE
    DOUBLE PRECISION
    RETURNS DATE FREE_IT
    ENTRY_POINT 'doubletodate' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_MILLISECOND
    DATE
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'millisecond' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_INCDATE
   DATE,
   INTEGER,
   INTEGER,
   INTEGER
   RETURNS DATE FREE_IT
   ENTRY_POINT 'incdate' MODULE_NAME 'FreeAdhocUDF';
   
DECLARE EXTERNAL FUNCTION F_INCDATETIME
   DATE,
   INTEGER,
   INTEGER,
   INTEGER,
   INTEGER,
   INTEGER,
   INTEGER
   RETURNS DATE FREE_IT
   ENTRY_POINT 'incdatetime' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_KALENDERWOCHE
   DATE
   RETURNS INTEGER FREE_IT
   ENTRY_POINT 'kalenderwoche' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_WEIBERFASTNACHT
    INTEGER 
    RETURNS DATE FREE_IT
    ENTRY_POINT 'weiberfastnacht' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ROSENMONTAG
    INTEGER 
    RETURNS DATE FREE_IT
    ENTRY_POINT 'rosenmontag' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_KARNEVALSDIENSTAG
    INTEGER 
    RETURNS DATE FREE_IT
    ENTRY_POINT 'karnevalsdienstag' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ASCHERMITTWOCH
    INTEGER 
    RETURNS DATE FREE_IT
    ENTRY_POINT 'aschermittwoch' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_PALMSONNTAG
    INTEGER 
    RETURNS DATE FREE_IT
    ENTRY_POINT 'palmsonntag' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_GRUENDONNERSTAG
    INTEGER 
    RETURNS DATE FREE_IT
    ENTRY_POINT 'gruendonnerstag' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_KARFREITAG
    INTEGER 
    RETURNS DATE FREE_IT
    ENTRY_POINT 'karfreitag' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_OSTERSAMSTAG
    INTEGER 
    RETURNS DATE FREE_IT
    ENTRY_POINT 'ostersamstag' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_OSTERMONTAG
    INTEGER 
    RETURNS DATE FREE_IT
    ENTRY_POINT 'ostermontag' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_HIMMELFAHRT
    INTEGER 
    RETURNS DATE FREE_IT
    ENTRY_POINT 'himmelfahrt' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_PFINGSTSONNTAG
    INTEGER 
    RETURNS DATE FREE_IT
    ENTRY_POINT 'pfingstsonntag' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_PFINGSTMONTAG
    INTEGER 
    RETURNS DATE FREE_IT
    ENTRY_POINT 'pfingstmontag' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_FRONLEICHNAM
    INTEGER 
    RETURNS DATE FREE_IT
    ENTRY_POINT 'fronleichnam' MODULE_NAME 'FreeAdhocUDF';


/* adhoc 2007-07-09 */


/******************************************************************************/
/****            User Defined Functions - numeric/math functions           ****/
/****       to use ONLY with FireBird 2.x - possibility to return     ****/ 
/******************************************************************************/

DECLARE EXTERNAL FUNCTION F_ABS
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'doubleabs' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_DOLLARVAL
    DOUBLE PRECISION
    RETURNS CSTRING(254) FREE_IT
    ENTRY_POINT 'dollarval' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_DOUBLEABS
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'doubleabs' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_EQUALFLOAT
    DOUBLE PRECISION,
    DOUBLE PRECISION
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'equalfloat' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_EQUALINTEGER
    INTEGER,
    INTEGER
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'equalinteger' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_EUROVAL
    DOUBLE PRECISION
    RETURNS CSTRING(254) FREE_IT
    ENTRY_POINT 'euroval' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_EVEN
    INTEGER
    RETURNS INTEGER FREE_IT
ENTRY_POINT 'evenodd' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_FACT
    INTEGER
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'fact' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_FACTORIAL
    INTEGER
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'fact' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_FIXEDPOINT
    DOUBLE PRECISION,
    INTEGER
    RETURNS CSTRING(254) FREE_IT
    ENTRY_POINT 'fixedpoint' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_FIXEDPOINTLANG
    DOUBLE PRECISION,
    INTEGER,
    CSTRING(1),
    CSTRING(1)
    RETURNS CSTRING(254) FREE_IT
    ENTRY_POINT 'fixedpointlang' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_INTEGERABS
    INTEGER
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'integerabs' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_INTRANDOM
    INTEGER,
    INTEGER
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'intrandom' MODULE_NAME 'FreeAdhocUDF';
    
DECLARE EXTERNAL FUNCTION F_ISDIVISIBLEBY
    INTEGER,
    INTEGER
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'isdivisibleby' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_MAX
    DOUBLE PRECISION,
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'maxnum' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_MAXNUM
    DOUBLE PRECISION,
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'maxnum' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_MIN
    DOUBLE PRECISION,
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'minnum' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_MINNUM
    DOUBLE PRECISION,
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'minnum' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_MODULO
    INTEGER,
    INTEGER
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'modulo' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_PROZENTE
    DOUBLE PRECISION,
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'prozente' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ROUND
    DOUBLE PRECISION
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'f_round' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ROUNDFLOAT
    DOUBLE PRECISION,
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'roundfloat' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_TRUNCATE
    DOUBLE PRECISION
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'f_truncate' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ZAHLRUNDEN
    DOUBLE PRECISION,
    INTEGER
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'zahlrunden' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ROUNDCOMMON
    DOUBLE PRECISION,
    INTEGER
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'zahlrunden' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_SOFTROUND
    DOUBLE PRECISION,
    INTEGER
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'softround' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_SIN
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'sin_rad' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_COS
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'cos_rad' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_TAN
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'tan_rad' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_COT
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'cot_rad' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ASIN
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'arcsin_rad' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ACOS
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'arccos_rad' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ATAN
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'arctan_rad' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ATAN2
    DOUBLE PRECISION,
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'arctan2_rad' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ACOT
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'arccot_rad' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_SIND
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'sin_deg' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_COSD
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'cos_deg' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_TAND
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'tan_deg' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_COTD
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'cot_deg' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ARCSIND
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'arcsin_deg' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ARCCOSD
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'arccos_deg' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ARCTAND
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'arctan_deg' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ARCCOTD
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'arccot_deg' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_SINH
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'sinhyp' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_COSH
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'coshyp' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_TANH
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'tanhyp' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_COTH
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'cothyp' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ARSINH
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'arsinh' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ARCOSH
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'arcosh' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ARTANH
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'artanh' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ARCOTH
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'arcoth' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_RAND
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'f_rand' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_DOUBLERANDOM
    INTEGER,
    INTEGER
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'doublerandom' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_SIGN
    DOUBLE PRECISION
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'f_sign' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_SQRT
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'f_sqrt' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_LN
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'f_ln' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_LOG
    DOUBLE PRECISION,
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'f_log' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_LOG10
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'f_log10' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_FLOOR
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'f_floor' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_FRAC
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'f_frac' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_CEILING
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'f_ceiling' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_POWER
    DOUBLE PRECISION,
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'f_power' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_EXP
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'f_exp' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BIN_AND
    INTEGER,
    INTEGER
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'f_bin_and' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BIN_OR
    INTEGER,
    INTEGER
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'f_bin_or' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BIN_XOR
    INTEGER,
    INTEGER
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'f_bin_xor' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BIN_NOT
    INTEGER
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'f_bin_not' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BIN_SHL
    INTEGER,
    INTEGER
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'f_bin_shl' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BIN_SHR
    INTEGER,
    INTEGER
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'f_bin_shr' MODULE_NAME 'FreeAdhocUDF';

/* adhoc 2006-12-20 */

DECLARE EXTERNAL FUNCTION F_ROUNDTOEVEN
    DOUBLE PRECISION,
    INTEGER 
    RETURNS DOUBLE PRECISION FREE_IT
    ENTRY_POINT 'roundtoeven' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_NUMINWORDS
    DOUBLE PRECISION,
    SMALLINT,
    CSTRING(2)
    RETURNS CSTRING(254) FREE_IT
    ENTRY_POINT 'numinwords' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_DIV
    INTEGER,
    INTEGER
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'r_div' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_Z
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
   ENTRY_POINT 'r_z'  MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_DZERO
   DOUBLE PRECISION, 
   DOUBLE PRECISION, 
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
   ENTRY_POINT 'r_dividezero'  MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_GETRANDOM
   INTEGER
   RETURNS INTEGER FREE_IT
   ENTRY_POINT 'getrandom'  MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BIN_GET
   INTEGER,
   INTEGER
   RETURNS INTEGER FREE_IT
   ENTRY_POINT 'r_getbit'  MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BIN_SET
   INTEGER,
   INTEGER,
   INTEGER
   RETURNS INTEGER FREE_IT
   ENTRY_POINT 'r_setbit'  MODULE_NAME 'FreeAdhocUDF';

/******************************************************************************/
/****                   User Defined Functions - other functions           ****/
/******************************************************************************/

DECLARE EXTERNAL FUNCTION F_IF
    CSTRING(32),
    CSTRING(8),
    CSTRING(32),
    CSTRING(8190),
    CSTRING(8190)
    RETURNS CSTRING(8190) FREE_IT
    ENTRY_POINT 'aif' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_VERSION
    RETURNS CSTRING(254) FREE_IT
    ENTRY_POINT 'version' MODULE_NAME 'FreeAdhocUDF';

/******************************************************************************/
/****              User Defined Functions - string functions               ****/
/****       to use ONLY with FireBird 2.x - possibility to return     ****/ 
/******************************************************************************/

DECLARE EXTERNAL FUNCTION F_ANSILOWERCASE
    CSTRING(32760)
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'lower' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ANSIUPPERCASE
    CSTRING(32760)
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'upper' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BIGLEFT
    CSTRING(32760),
    INTEGER
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'left' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BIGLRTRIM
    CSTRING(32760)
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'lrtrim' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BIGLTRIM
    CSTRING(32760)
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'ltrim' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BIGMID
    CSTRING(32760),
    INTEGER,
    INTEGER
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'mid' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BIGREPLACE
    CSTRING(32760),
    CSTRING(254),
    CSTRING(254)
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'replace' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BIGREPLACESTRING
    CSTRING(32760),
    CSTRING(254),
    CSTRING(254),
    INTEGER,
    INTEGER
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'replacestring' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BIGRIGHT
    CSTRING(32760),
    INTEGER
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'right' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BIGRTRIM
    CSTRING(32760)
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'rtrim' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BIGSTRINGLENGTH
    CSTRING(32760)
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'stringlength' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BIGSTRIPSTRING
    CSTRING(32760),
    CSTRING(254)
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'stripstring' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_BIGSTRIPSTRINGHOLD
    CSTRING(32760),
    CSTRING(254)
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'stripstringhold' MODULE_NAME 'FreeAdhocUDF';

/* Version compatible with Delphi FreeUDFLib
*  to use please uncomment it and comment the following version
* 
*DECLARE EXTERNAL FUNCTION F_BIGSUBSTR
*    CSTRING(254),
*    CSTRING(32760)
*    RETURNS INTEGER FREE_IT
*    ENTRY_POINT 'strsub' MODULE_NAME 'FreeAdhocUDF';
*/ 

/* Version compatible with FreeUDFLibC */
DECLARE EXTERNAL FUNCTION F_BIGSUBSTR
    CSTRING(32760),
    CSTRING(254)
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'substr' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_CHARACTER
    INTEGER
    RETURNS CSTRING(1) FREE_IT
    ENTRY_POINT 'character' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_CHR
    INTEGER
    RETURNS CSTRING(1) FREE_IT
    ENTRY_POINT 'character' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_COLLATEBR
    CSTRING(32760)
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'collatebr' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_COPY
    CSTRING(8190),
    INTEGER,
    INTEGER
    RETURNS CSTRING(8190) FREE_IT
    ENTRY_POINT 'mid1' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_CRLF
    RETURNS CSTRING(3) FREE_IT
    ENTRY_POINT 'crlf' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_DIGITS
    CSTRING(32760)
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'digits' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_DQM
    RETURNS CSTRING(2) FREE_IT
    ENTRY_POINT 'dqm' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ENCRYPTMD5
    CSTRING(128)
    RETURNS CSTRING(33) FREE_IT
    ENTRY_POINT 'encryptmd5' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_EQUALSTRING
    CSTRING(8190),
    CSTRING(8190)
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'equalstring' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_FINDNTHWORD
    CSTRING(32760),
    INTEGER
    RETURNS CSTRING(254) FREE_IT
    ENTRY_POINT 'findnthword' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_FINDWORD
    CSTRING(32760),
    INTEGER
    RETURNS CSTRING(254) FREE_IT
    ENTRY_POINT 'findword' MODULE_NAME 'FreeAdhocUDF';

/* version which returns -1 if not found */
DECLARE EXTERNAL FUNCTION F_FINDWORDINDEX
    CSTRING(32760),
    INTEGER
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'findwordindex' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_GENERATESNDXINDEX
    CSTRING(8190)
    RETURNS CSTRING(6) FREE_IT
    ENTRY_POINT 'soundex' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_GSOUNDEX
    CSTRING(8190)
    RETURNS CSTRING(8190) FREE_IT
    ENTRY_POINT 'gsoundex' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_HOLDSTRING
    CSTRING(32760),
    CSTRING(254)
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'stripstringhold' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_LEFT
    CSTRING(254),
    INTEGER
    RETURNS CSTRING(254) FREE_IT
    ENTRY_POINT 'left' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_LEFT4
    CSTRING(4095),
    INTEGER
    RETURNS CSTRING(4095) FREE_IT
    ENTRY_POINT 'left' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_LEFT8
    CSTRING(8190),
    INTEGER
    RETURNS CSTRING(8190) FREE_IT
    ENTRY_POINT 'left' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_LF
    RETURNS CSTRING(2) FREE_IT
    ENTRY_POINT 'lf' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_LINEWRAP
    CSTRING(32760),
    INTEGER,
    INTEGER
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'linewrap' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_LOWER
    CSTRING(32760)
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'lower' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_LRTRIM
    CSTRING(254)
    RETURNS CSTRING(254) FREE_IT
    ENTRY_POINT 'lrtrim' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_LRTRIM4
    CSTRING(4095)
    RETURNS CSTRING(4095) FREE_IT
    ENTRY_POINT 'lrtrim' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_LRTRIM8
    CSTRING(8190)
    RETURNS CSTRING(8190) FREE_IT
    ENTRY_POINT 'lrtrim' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_LTRIM
    CSTRING(254)
    RETURNS CSTRING(254) FREE_IT
    ENTRY_POINT 'ltrim' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_LTRIM4
    CSTRING(4095)
    RETURNS CSTRING(4095) FREE_IT
    ENTRY_POINT 'lrtrim' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_LTRIM8
    CSTRING(8190)
    RETURNS CSTRING(8190) FREE_IT
    ENTRY_POINT 'lrtrim' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_MID
    CSTRING(254),
    INTEGER,
    INTEGER
    RETURNS CSTRING(254) FREE_IT
    ENTRY_POINT 'mid' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_MID4
    CSTRING(4095),
    INTEGER,
    INTEGER
    RETURNS CSTRING(4095) FREE_IT
    ENTRY_POINT 'mid' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_MID8
    CSTRING(8190),
    INTEGER,
    INTEGER
    RETURNS CSTRING(8190) FREE_IT
    ENTRY_POINT 'mid' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_NBSP
    RETURNS CSTRING(2) FREE_IT
    ENTRY_POINT 'nbsp' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_ORD
    CSTRING(1)
    RETURNS SMALLINT FREE_IT
    ENTRY_POINT 'ord' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_PADCENTER
    CSTRING(4095),
    CSTRING(16),
    INTEGER
    RETURNS CSTRING(4095) FREE_IT
    ENTRY_POINT 'padcenter' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_PADLEFT
    CSTRING(4095),
    CSTRING(16),
    INTEGER
    RETURNS CSTRING(4095) FREE_IT
    ENTRY_POINT 'padleft' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_PADRIGHT
    CSTRING(4095),
    CSTRING(16),
    INTEGER
    RETURNS CSTRING(4095) FREE_IT
    ENTRY_POINT 'padright' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_PRED
    CSTRING(1),
    INTEGER
    RETURNS CSTRING(1) FREE_IT
    ENTRY_POINT 'predecessor' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_PROPERCASE
    CSTRING(32760)
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'propercase' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_REPLACE
    CSTRING(254),
    CSTRING(254),
    CSTRING(254)
    RETURNS CSTRING(254) FREE_IT
    ENTRY_POINT 'replace' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_REPLACE4
    CSTRING(4095),
    CSTRING(254),
    CSTRING(254)
    RETURNS CSTRING(4095) FREE_IT
    ENTRY_POINT 'replace' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_REPLACE8
    CSTRING(8190),
    CSTRING(254),
    CSTRING(254)
    RETURNS CSTRING(8190) FREE_IT
    ENTRY_POINT 'replace' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_REPLACESTRING
    CSTRING(254),
    CSTRING(254),
    CSTRING(254),
    INTEGER,
    INTEGER
    RETURNS CSTRING(254) FREE_IT
    ENTRY_POINT 'replacestring' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_REPLACESTRING4
    CSTRING(4095),
    CSTRING(254),
    CSTRING(254),
    INTEGER,
    INTEGER
    RETURNS CSTRING(4095) FREE_IT
    ENTRY_POINT 'replacestring' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_REPLACESTRING8
    CSTRING(8190),
    CSTRING(254),
    CSTRING(254),
    INTEGER,
    INTEGER
    RETURNS CSTRING(8190) FREE_IT
    ENTRY_POINT 'replacestring' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_REVERSE
    CSTRING(254)
    RETURNS CSTRING(254) FREE_IT
    ENTRY_POINT 'reverse' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_RIGHT
    CSTRING(254),
    INTEGER
    RETURNS CSTRING(254) FREE_IT
    ENTRY_POINT 'right' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_RIGHT4
    CSTRING(4095),
    INTEGER
    RETURNS CSTRING(4095) FREE_IT
    ENTRY_POINT 'right' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_RIGHT8
    CSTRING(8190),
    INTEGER
    RETURNS CSTRING(8190) FREE_IT
    ENTRY_POINT 'right' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_RTRIM
    CSTRING(254)
    RETURNS CSTRING(254) FREE_IT
    ENTRY_POINT 'rtrim' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_RTRIM4
    CSTRING(4095)
    RETURNS CSTRING(4095) FREE_IT
    ENTRY_POINT 'lrtrim' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_RTRIM8
    CSTRING(8190)
    RETURNS CSTRING(8190) FREE_IT
    ENTRY_POINT 'lrtrim' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_SOUNDEX
    CSTRING(8190)
    RETURNS CSTRING(6) FREE_IT
    ENTRY_POINT 'soundex' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_SPACE
    INTEGER
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'space' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_SQM
    RETURNS CSTRING(2) FREE_IT
    ENTRY_POINT 'sqm' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_STR2EXCEL
    CSTRING(32760)
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'excelstring' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_STRCOPY
    CSTRING(8190),
    INTEGER,
    INTEGER
    RETURNS CSTRING(8190) FREE_IT
    ENTRY_POINT 'strcopy' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_STRINGCOUNT
    CSTRING(32760), 
    CSTRING(254)
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'stringcount' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_STRINGLENGTH
    CSTRING(254)
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'stringlength' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_STRINGLENGTH4
    CSTRING(4095)
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'stringlength' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_STRINGLENGTH8
    CSTRING(8190)
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'stringlength' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_STRINGLISTITEM
    CSTRING(32760),
    CSTRING(254)
    RETURNS CSTRING(1024) FREE_IT
    ENTRY_POINT 'stringlistitem' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_STRIPSTRING
    CSTRING(254),
    CSTRING(254)
    RETURNS CSTRING(254) FREE_IT
    ENTRY_POINT 'stripstring' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_STRIPSTRING4
    CSTRING(4095),
    CSTRING(254)
    RETURNS CSTRING(4095) FREE_IT
    ENTRY_POINT 'stripstring' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_STRIPSTRING8
    CSTRING(8190),
    CSTRING(254)
    RETURNS CSTRING(8190) FREE_IT
    ENTRY_POINT 'stripstring' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_STRIPSTRINGHOLD
    CSTRING(254),
    CSTRING(254)
    RETURNS CSTRING(254) FREE_IT
    ENTRY_POINT 'stripstringhold' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_STRIPSTRINGHOLD4
    CSTRING(4095),
    CSTRING(254)
    RETURNS CSTRING(4095) FREE_IT
    ENTRY_POINT 'stripstringhold' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_STRIPSTRINGHOLD8
    CSTRING(8190),
    CSTRING(254)
    RETURNS CSTRING(8190) FREE_IT
    ENTRY_POINT 'stripstringhold' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_STROFCHAR
    CSTRING(1),
    INTEGER
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'strofchar' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_STRRM
    CSTRING(8190),
    INTEGER
    RETURNS CSTRING(8190) FREE_IT
    ENTRY_POINT 'strrm' MODULE_NAME 'FreeAdhocUDF';

/* Version compatible with Delphi FreeUDFLib
*  to use please uncomment it and comment the following version
* 
*DECLARE EXTERNAL FUNCTION F_SUBSTR
*    CSTRING(254),
*    CSTRING(254)
*    RETURNS INTEGER FREE_IT
*    ENTRY_POINT 'strsub' MODULE_NAME 'FreeAdhocUDF';
*/

/* Version compatible with FreeUDFLibC */
DECLARE EXTERNAL FUNCTION F_SUBSTR
    CSTRING(254),
    CSTRING(254)
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'substr' MODULE_NAME 'FreeAdhocUDF';

/* Version compatible with FreeUDFLibC */
DECLARE EXTERNAL FUNCTION F_SUBSTR4
    CSTRING(4095),
    CSTRING(254)
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'substr' MODULE_NAME 'FreeAdhocUDF';

/* Version compatible with FreeUDFLibC */
DECLARE EXTERNAL FUNCTION F_SUBSTR8
    CSTRING(8190),
    CSTRING(254)
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'substr' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_SUCC
    CSTRING(1),
    INTEGER
    RETURNS CSTRING(1) FREE_IT
    ENTRY_POINT 'successor' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_TAB
    RETURNS CSTRING(2) FREE_IT
    ENTRY_POINT 'tab' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_TELEFONNR
    CSTRING(32760),
    INTEGER
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'telefonnr' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_UPPER
    CSTRING(32760)
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'upper' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_WORDCOUNT
    CSTRING(32760)
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'wordcount' MODULE_NAME 'FreeAdhocUDF';

/* adhoc 2007-04-19 */

DECLARE EXTERNAL FUNCTION F_KEYUP
    CSTRING(32760),
    SMALLINT    
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'keyup' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_RPADLEFT
    CSTRING(4095),
    INTEGER,
    CSTRING(16)
    RETURNS CSTRING(4095) FREE_IT
    ENTRY_POINT 'r_padleft' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_RPADRIGHT
    CSTRING(4095),
    INTEGER,
    CSTRING(16)
    RETURNS CSTRING(4095) FREE_IT
    ENTRY_POINT 'r_padright' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_STRPOS
    CSTRING(254),
    CSTRING(8190)
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'strpos' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_STRCMP
    CSTRING(8190),
    CSTRING(8190)
    RETURNS INT FREE_IT
    ENTRY_POINT 'r_strcmp' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_RSTRINGCOUNT
    CSTRING(254), 
    CSTRING(32760)
    RETURNS INTEGER FREE_IT
    ENTRY_POINT 'r_stringcount' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_RWORDCOUNT
   CSTRING(32760),
   CSTRING(31),
   SMALLINT
   RETURNS INTEGER FREE_IT
   ENTRY_POINT 'r_wordcount'  MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_WORDNUM
   CSTRING(32760),
   INTEGER,
   CSTRING(31),
   SMALLINT
   RETURNS CSTRING(254) FREE_IT
   ENTRY_POINT 'wordnum'  MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_RC
   CSTRING(254)
   RETURNS CSTRING(254) FREE_IT
   ENTRY_POINT 'r_c'  MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_CONVERTSYMBOLS
   CSTRING(32760),
   CSTRING(254),
   CSTRING(254)
   RETURNS CSTRING(32760) FREE_IT
   ENTRY_POINT 'convertsymbols'  MODULE_NAME 'FreeAdhocUDF';

/* adhoc 2007-04-19 */

DECLARE EXTERNAL FUNCTION F_REPEATTRIM
   CSTRING(8190),
   CSTRING(1)
   RETURNS CSTRING(8190) FREE_IT
   ENTRY_POINT 'repeattrim'  MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_STRREPEAT
   CSTRING(254),
   SMALLINT
   RETURNS CSTRING(8190) FREE_IT
   ENTRY_POINT 'strrepeat'  MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_STRSTUFF
   CSTRING(8190),
   SMALLINT,
   SMALLINT,
   CSTRING(254)
   RETURNS CSTRING(8190) FREE_IT
   ENTRY_POINT 'strstuff'  MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_FLOATTOSTR
   DOUBLE PRECISION,
   CSTRING(254)
   RETURNS CSTRING(254) FREE_IT
   ENTRY_POINT 'floattostr' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_INTTOSTR
   INTEGER,
   CSTRING(254)
   RETURNS CSTRING(254) FREE_IT
   ENTRY_POINT 'inttostr' MODULE_NAME 'FreeAdhocUDF';

/* adhoc 2007-07-04 */

DECLARE EXTERNAL FUNCTION F_RUPPER
    CSTRING(32760)
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'rupper' MODULE_NAME 'FreeAdhocUDF';
    
DECLARE EXTERNAL FUNCTION F_RLOWER
    CSTRING(32760)
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'rlower' MODULE_NAME 'FreeAdhocUDF';

DECLARE EXTERNAL FUNCTION F_RLATIN
    CSTRING(32760)
    RETURNS CSTRING(32760) FREE_IT
    ENTRY_POINT 'rlatin' MODULE_NAME 'FreeAdhocUDF';

/* adhoc 2007-11-28 */

/******************************************************************************/
/****                User Defined Functions: UUID Functions                ****/
/****       to use ONLY with FireBird 2.x - possibility to return     ****/ 
/******************************************************************************/

DECLARE EXTERNAL FUNCTION F_UUID1COMPRTIMESTAMP
    CSTRING(254)
    RETURNS DATE FREE_IT
    ENTRY_POINT 'uuid1comprtimestamp' MODULE_NAME 'FreeAdhocUDF';


DECLARE EXTERNAL FUNCTION F_UUID1MAC
    RETURNS CSTRING(36) FREE_IT
    ENTRY_POINT 'uuid1mac' MODULE_NAME 'FreeAdhocUDF';


DECLARE EXTERNAL FUNCTION F_UUID1MACCOMPR
    RETURNS CSTRING(22) FREE_IT
    ENTRY_POINT 'uuid1maccompr' MODULE_NAME 'FreeAdhocUDF';


DECLARE EXTERNAL FUNCTION F_UUID1MACCOMPRMAC
    CSTRING(254)
    RETURNS CSTRING(18) FREE_IT
    ENTRY_POINT 'uuid1maccomprmac' MODULE_NAME 'FreeAdhocUDF';


DECLARE EXTERNAL FUNCTION F_UUID1MACMAC
    CSTRING(254)
    RETURNS CSTRING(18) FREE_IT
    ENTRY_POINT 'uuid1macmac' MODULE_NAME 'FreeAdhocUDF';


DECLARE EXTERNAL FUNCTION F_UUID1RAND
    RETURNS CSTRING(36) FREE_IT
    ENTRY_POINT 'uuid1rand' MODULE_NAME 'FreeAdhocUDF';


DECLARE EXTERNAL FUNCTION F_UUID1RANDCOMPR
    RETURNS CSTRING(22) FREE_IT
    ENTRY_POINT 'uuid1randcompr' MODULE_NAME 'FreeAdhocUDF';


DECLARE EXTERNAL FUNCTION F_UUID1TIMESTAMP
    CSTRING(254)
    RETURNS DATE FREE_IT
    ENTRY_POINT 'uuid1timestamp' MODULE_NAME 'FreeAdhocUDF';


DECLARE EXTERNAL FUNCTION F_UUID2UUIDCOMPR
    CSTRING(254)
    RETURNS CSTRING(22) FREE_IT
    ENTRY_POINT 'compressuuid' MODULE_NAME 'FreeAdhocUDF';


DECLARE EXTERNAL FUNCTION F_UUID4
    RETURNS CSTRING(36) FREE_IT
    ENTRY_POINT 'uuid4' MODULE_NAME 'FreeAdhocUDF';


DECLARE EXTERNAL FUNCTION F_UUID4COMPR
    RETURNS CSTRING(22) FREE_IT
    ENTRY_POINT 'uuid4compr' MODULE_NAME 'FreeAdhocUDF';


DECLARE EXTERNAL FUNCTION F_UUIDCOMPR2UUID
    CSTRING(254)
    RETURNS CSTRING(36) FREE_IT
    ENTRY_POINT 'expanduuidcompr' MODULE_NAME 'FreeAdhocUDF';


DECLARE EXTERNAL FUNCTION F_UUIDVERSION
    CSTRING(254)
    RETURNS CSTRING(254) FREE_IT
    ENTRY_POINT 'uuidversion' MODULE_NAME 'FreeAdhocUDF';

/* adhoc 2007-04-19 */
