/* ............................................................ */
/* SR UDFs Lib. (srudfs.dll)                                    */
/* Version 1.0.2.32 - Free Edition - Windows Platform           */
/* -------------------------------------------------------------*/
/* Written by Safa Rimeh                         	        */
/* ICQ# 88929552					        */
/* E-mail: srudf@yahoo.com  	                                */
/* Create date: 10.Sep.2002                                     */
/* Last update: 07.Nov.2002                                     */
/* .............................................................*/


/****************************************************************/
/*                     Conversion  Functions                    */
/****************************************************************/

/* The SR_C_TO_F function converts Celsius to Farenhait */

DECLARE EXTERNAL FUNCTION SR_C_TO_F
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_c_to_f"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* The SR_F_TO_C function converts Farenhait to Celsius */

DECLARE EXTERNAL FUNCTION SR_F_TO_C
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_f_to_c"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* The SR_METER_TO_FEET function converts Meter to Feet */

DECLARE EXTERNAL FUNCTION SR_METER_TO_FEET
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_meter_to_feet"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* The SR_FEET_TO_METER function converts Feet to Meter */

DECLARE EXTERNAL FUNCTION SR_FEET_TO_METER
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_feet_to_meter"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* The SR_CM_TO_INCH function converts CM to Inch */

DECLARE EXTERNAL FUNCTION SR_CM_TO_INCH
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_cm_to_inch"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* The SR_INCH_TO_CM function converts Inch to CM */

DECLARE EXTERNAL FUNCTION SR_INCH_TO_CM
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_inch_to_cm"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* The SR_METER_TO_YARD function converts Meter to Yard */

DECLARE EXTERNAL FUNCTION SR_METER_TO_YARD
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_meter_to_yard"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* The SR_YARD_TO_METER function converts Yard to Meter */

DECLARE EXTERNAL FUNCTION SR_YARD_TO_METER
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_yard_to_meter"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* The SR_KM_TO_MILE function converts KM to Mile */

DECLARE EXTERNAL FUNCTION SR_KM_TO_MILE
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_km_to_mile"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* The SR_MILE_TO_KM function converts Mile to KM */

DECLARE EXTERNAL FUNCTION SR_MILE_TO_KM
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_mile_to_km"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* The SR_SEAMILE_TO_KM function converts SeaMile to KM */

DECLARE EXTERNAL FUNCTION SR_SEAMILE_TO_KM
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_seamile_to_km"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* The SR_SEAMILE_TO_KM function converts KM to SeaMile*/

DECLARE EXTERNAL FUNCTION SR_KM_TO_SEAMILE
    DOUBLE PRECISION
    RETURNS DOUBLE PRECISION BY VALUE
    ENTRY_POINT 'sr_km_to_seamile' MODULE_NAME 'srudfs.dll';
/*--------------------------------------------------------------*/

/****************************************************************/
/*                       Math Functions                         */
/****************************************************************/
/* Returns an absolute value. */

DECLARE EXTERNAL FUNCTION SR_ABS
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_abs"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* Returns the inverse cosine of X. X must be between -1 and 1. 
   The return value will be in the range [0..Pi], in radians. */

DECLARE EXTERNAL FUNCTION SR_ARCCOS
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_arccos"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* Returns the inverse hyperbolic cosine of X.  
   The value of X must be greater than or equal to 1. */

DECLARE EXTERNAL FUNCTION SR_ARCCOSH
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_arccosh"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* Function returns the inverse sine of X. X must be between -1 and 1. 
   The return value will be in the range [-Pi/2..Pi/2], in radians. */

DECLARE EXTERNAL FUNCTION SR_ARCSIN
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_arcsin"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* Calculates the inverse hyperbolic sine of a given number */

DECLARE EXTERNAL FUNCTION SR_ARCSINH
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_arcsinh"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* The SR_FRAC function returns the fractional part of the argument X.
   SR_Frac(123.456)= 0.456   */

DECLARE EXTERNAL FUNCTION SR_FRAC
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_frac"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* The SR_Int function returns the integer part of a real number.
   SR_Int(123.456)=123.0,  SR_Int(-123.456)=-123.0  */

DECLARE EXTERNAL FUNCTION SR_INT
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_int"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* The SR_TRUNC function truncates a real number to an integer. 
   SR_Trunc(1.4)= 1, SR_Trunc(-1.4)=-1 */

DECLARE EXTERNAL FUNCTION SR_TRUNC
   DOUBLE PRECISION
   RETURNS INTEGER BY VALUE
  ENTRY_POINT "sr_trunc"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* The SR_FLOOR function rounds toward negative infinity. 
   For example: SR_FLOOR(-2.8) = -3, SR_FLOOR(2.8) = 2 */

DECLARE EXTERNAL FUNCTION SR_FLOOR
   DOUBLE PRECISION
   RETURNS INTEGER BY VALUE
  ENTRY_POINT "sr_floor"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* The SR_INTPOWER function raises Base to an integral power.*/

DECLARE EXTERNAL FUNCTION SR_INTPOWER
   DOUBLE PRECISION, INTEGER
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_intpower"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* The SR_POWER function raises Base to any power. 
  BaseExponent. For fractional exponents or exponents greater than MaxInt, 
  Base must be greater than 0. */

DECLARE EXTERNAL FUNCTION SR_POWER
   DOUBLE PRECISION, DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_power"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* The SR_SQR function returns the square of the argument. 
  X is a floating-point expression. The result, of the same 
  type as X, is the square of X, or X*X*.
  Example: SR_sqr(5)=25 */

DECLARE EXTERNAL FUNCTION SR_SQR
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_sqr"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* The SR_LNXP1 returns the natural log of (X+1)
   { SR_Ln(X + 1), accurate for X near zero } */

DECLARE EXTERNAL FUNCTION SR_LNXP1
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_lnxp1"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* The SR_LN function returns the natural logarithm (SR_Ln(e) = 1) 
   of the real-type expression X.*/

DECLARE EXTERNAL FUNCTION SR_LN
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_ln"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* The SR_LOG10 function returns the log base 10 of X.*/

DECLARE EXTERNAL FUNCTION SR_LOG10
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_log10"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* The SR_LOG2 function returns the log base 2 of X.*/

DECLARE EXTERNAL FUNCTION SR_LOG2
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_log2"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* The SR_LOGN function returns the SR_logn base N of X.*/

DECLARE EXTERNAL FUNCTION SR_LOGN
   DOUBLE PRECISION, DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_logn"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* The SR_EXP returns the value of e raised to the power of X, 
   where e is the base of the natural logarithms. */

DECLARE EXTERNAL FUNCTION SR_EXP
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_exp"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* SR_GETPERCENT returns the % value */

DECLARE EXTERNAL FUNCTION SR_GETPERCENT
   DOUBLE PRECISION, DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_getpercent"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* Calculates the arctangent angle and quadrant of a given number */

DECLARE EXTERNAL FUNCTION SR_ARCTAN2
   DOUBLE PRECISION, DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_arctan2"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* Calculates the inverse hyperbolic tangent of a given number */

DECLARE EXTERNAL FUNCTION SR_ARCTANH
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_arctanh"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* Rounds variables up toward positive infinity */

DECLARE EXTERNAL FUNCTION SR_CEIL
   DOUBLE PRECISION
   RETURNS INTEGER BY VALUE
  ENTRY_POINT "sr_ceil"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* Calculates the hyperbolic cosine of an angle */

DECLARE EXTERNAL FUNCTION SR_COSH
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_cosh"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* Calculates the cotangent of an angle */

DECLARE EXTERNAL FUNCTION SR_COTAN
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_cotan"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* Converts an angle measurement from cycles to radians */

DECLARE EXTERNAL FUNCTION SR_CYCLETORAD
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_cycletorad"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* Returns the value of a degree measurement expressed in radians */

DECLARE EXTERNAL FUNCTION SR_DEGTORAD
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_degtorad"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* Converts grad measurements to radians */

DECLARE EXTERNAL FUNCTION SR_GRADTORAD
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_gradtorad"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* Calculates the length of the hypotenuse */

DECLARE EXTERNAL FUNCTION SR_HYPOT
   DOUBLE PRECISION, DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_hypot"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* Returns the greater of two numeric values */

DECLARE EXTERNAL FUNCTION SR_MAX
   DOUBLE PRECISION, DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_max"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* Returns the lesser of two numeric values */

DECLARE EXTERNAL FUNCTION SR_MIN
   DOUBLE PRECISION, DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_min"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* Converts radians to cycles */

DECLARE EXTERNAL FUNCTION SR_RADTOCYCLE
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_radtocycle"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* Converts radians to degrees */

DECLARE EXTERNAL FUNCTION SR_RADTODEG
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_radtodeg"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* Converts radians to grads */

DECLARE EXTERNAL FUNCTION SR_RADTOGRAD
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_radtograd"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* Returns the hyperbolic sine of an angle */

DECLARE EXTERNAL FUNCTION SR_SINH
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_sinh"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* Returns the tangent of X */

DECLARE EXTERNAL FUNCTION SR_TAN
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_tan"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* Returns the hyperbolic tangent of X */

DECLARE EXTERNAL FUNCTION SR_TANH
   DOUBLE PRECISION
   RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT "sr_tanh"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* SR_INC increments an ordinal value x by n */

DECLARE EXTERNAL FUNCTION SR_INC
   INTEGER, INTEGER
   RETURNS INTEGER BY VALUE
  ENTRY_POINT "sr_inc"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* SR_DEC decrements a variable x by n */

DECLARE EXTERNAL FUNCTION SR_DEC
   INTEGER, INTEGER
   RETURNS INTEGER BY VALUE
  ENTRY_POINT "sr_dec"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* SR_ODD returns 0 if x is an odd number, -1 if x is even */

DECLARE EXTERNAL FUNCTION SR_ODD
   INTEGER
   RETURNS INTEGER BY VALUE
  ENTRY_POINT "sr_odd"  MODULE_NAME "srudfs.dll";

/*--------------------------------------------------------------*/
/* Returns the quotient part of the division of the two input parameters. */

DECLARE EXTERNAL FUNCTION SR_DIV 
   INTEGER, INTEGER
   RETURNS DOUBLE PRECISION BY VALUE
 ENTRY_POINT 'sr_div' MODULE_NAME 'srudfs.dll';

/*--------------------------------------------------------------*/
/* Returns the remainder part of the division of the two input parameters. */

DECLARE EXTERNAL FUNCTION SR_MOD 
   INTEGER, INTEGER
   RETURNS DOUBLE PRECISION BY VALUE
 ENTRY_POINT 'sr_mod' MODULE_NAME 'srudfs.dll';

/*--------------------------------------------------------------*/
/* Returns the result of a binary AND operation performed on the two numbers. */

DECLARE EXTERNAL FUNCTION SR_AND
	INTEGER, INTEGER
   RETURNS INTEGER BY VALUE
ENTRY_POINT 'sr_and' MODULE_NAME 'srudfs.dll';

/*--------------------------------------------------------------*/
/* Returns the result of a binary OR operation performed on the two numbers. */

DECLARE EXTERNAL FUNCTION SR_OR
	INTEGER, INTEGER
   RETURNS INTEGER BY VALUE
ENTRY_POINT 'sr_or' MODULE_NAME 'srudfs.dll';

/*--------------------------------------------------------------*/
/* Returns the result of a binary XOR operation performed on the two numbers. */

DECLARE EXTERNAL FUNCTION SR_XOR
   INTEGER, INTEGER
   RETURNS INTEGER BY VALUE
ENTRY_POINT 'sr_xor' MODULE_NAME 'srudfs.dll';

/*--------------------------------------------------------------*/
/* Returns the result of a binary SHL operation performed on the two numbers.
   shift the value of x to the left by y bits. */

DECLARE EXTERNAL FUNCTION SR_SHL
   INTEGER, INTEGER
   RETURNS INTEGER BY VALUE
ENTRY_POINT 'sr_shl' MODULE_NAME 'srudfs.dll';

/*--------------------------------------------------------------*/
/* Returns the result of a binary SHR operation performed on the two numbers.
   shift the value of x to the right by y bits. */

DECLARE EXTERNAL FUNCTION SR_SHR
   INTEGER, INTEGER
   RETURNS INTEGER BY VALUE
ENTRY_POINT 'sr_shr' MODULE_NAME 'srudfs.dll';

/*--------------------------------------------------------------*/
/* Returns the valie of PI = 3.1495 */

DECLARE EXTERNAL FUNCTION SR_PI 
    RETURNS DOUBLE PRECISION BY VALUE
  ENTRY_POINT 'sr_pi' MODULE_NAME 'srudfs.dll';

/*--------------------------------------------------------------*/
/* Returns unique integer value dependens on the milliseconds of the current DateTime. */

DECLARE EXTERNAL FUNCTION SR_RANDINT 
    RETURNS INTEGER BY VALUE
  ENTRY_POINT 'sr_randint' MODULE_NAME 'srudfs.dll';
/*--------------------------------------------------------------*/

/****************************************************************/
/*                     File  Functions                          */
/****************************************************************/
/* Function deletes an existing file(s).  
   If the function succeeds, the return value is 1, in other case the return value is -1 */

DECLARE EXTERNAL FUNCTION SR_DELETEFILE
    CSTRING(255)
    RETURNS INTEGER BY VALUE
  ENTRY_POINT 'sr_deletefile' MODULE_NAME 'srudfs.dll';
/*--------------------------------------------------------------*/
/* Function retrieves the size, in bytes, of the specified file. */

DECLARE EXTERNAL FUNCTION SR_GETFILESIZE
    CSTRING(255)
    RETURNS INTEGER BY VALUE
  ENTRY_POINT 'sr_getfilesize' MODULE_NAME 'srudfs.dll';
/*--------------------------------------------------------------*/
/* Returns the system directory */

DECLARE EXTERNAL FUNCTION SR_GETSYSTEMDIR
    RETURNS CSTRING(255) FREE_IT
  ENTRY_POINT 'sr_getsystemdir' MODULE_NAME 'srudfs.dll';
/*--------------------------------------------------------------*/

/****************************************************************/
/*                     DateTime  Functions                      */
/****************************************************************/
/* Functions adds n days to the value specified as date and returns the new date*/

DECLARE EXTERNAL FUNCTION SR_ADDDAYS
    DATE,
    INTEGER
    RETURNS DATE
    ENTRY_POINT 'sr_adddays' MODULE_NAME 'srudfs.dll';
/*--------------------------------------------------------------*/
/* Functions adds n months to the value specified as date and returns the new date*/

DECLARE EXTERNAL FUNCTION SR_ADDMONTHS
    DATE,
    INTEGER
    RETURNS DATE
    ENTRY_POINT 'sr_addmonths' MODULE_NAME 'srudfs.dll';
/*--------------------------------------------------------------*/
/* Functions adds n years to the value specified as date and returns the new date*/

DECLARE EXTERNAL FUNCTION SR_ADDYEARS
    DATE,
    INTEGER
    RETURNS DATE
    ENTRY_POINT 'sr_addyears' MODULE_NAME 'srudfs.dll';
/*--------------------------------------------------------------*/
/* Function calculates your age and returns a result as the following format (n year(s), n month(s), n day(s)).
   This function has two parameters, first parameter is your birthday date and the second parameter is the actual date.
   Example: SR_CALC_AGE('1.10.1977','6.12.2002') = 25 year(s), 2 month(s), 5 day(s) */

DECLARE EXTERNAL FUNCTION SR_CALC_AGE
    DATE,
    DATE
    RETURNS CSTRING(100) FREE_IT
    ENTRY_POINT 'sr_calc_age' MODULE_NAME 'srudfs.dll';
/*--------------------------------------------------------------*/
/* Function returns a date value from the values specified as the Day, Month and Year parameters. */

DECLARE EXTERNAL FUNCTION SR_ENCODEDATE
    INTEGER,
    INTEGER,
    INTEGER
    RETURNS DATE
    ENTRY_POINT 'sr_encodedate' MODULE_NAME 'srudfs.dll';
/*--------------------------------------------------------------*/
/* Function returns a day value from the value specified as date */

DECLARE EXTERNAL FUNCTION SR_EXTRACTDAY
    DATE
    RETURNS INTEGER BY VALUE
    ENTRY_POINT 'sr_extractday' MODULE_NAME 'srudfs.dll';
/*--------------------------------------------------------------*/
/* Function returns a month value from the value specified as date */

DECLARE EXTERNAL FUNCTION SR_EXTRACTMONTH
    DATE
    RETURNS INTEGER BY VALUE
    ENTRY_POINT 'sr_extractmonth' MODULE_NAME 'srudfs.dll';
/*--------------------------------------------------------------*/
/* Function returns a year value from the value specified as date */

DECLARE EXTERNAL FUNCTION SR_EXTRACTYEAR
    DATE
    RETURNS INTEGER BY VALUE
    ENTRY_POINT 'sr_extractyear' MODULE_NAME 'srudfs.dll';
/*--------------------------------------------------------------*/
/* Function extracts a day of week from the value specified as date */

DECLARE EXTERNAL FUNCTION SR_GETDAYOFWEEK
    DATE
    RETURNS INTEGER BY VALUE
    ENTRY_POINT 'sr_getdayofweek' MODULE_NAME 'srudfs.dll';
/*--------------------------------------------------------------*/
/* Function extracts a day of year from the value specified as date */

DECLARE EXTERNAL FUNCTION SR_GETDAYOFYEAR
    DATE
    RETURNS INTEGER BY VALUE
    ENTRY_POINT 'sr_getdayofyear' MODULE_NAME 'srudfs.dll';
/*--------------------------------------------------------------*/
/* Functions adds n days, n months, n years to the value specified as date and returns the new date*/

DECLARE EXTERNAL FUNCTION SR_INCDATE
    DATE,
    INTEGER,
    INTEGER,
    INTEGER
    RETURNS DATE
    ENTRY_POINT 'sr_incdate' MODULE_NAME 'srudfs.dll';
/*--------------------------------------------------------------*/
/* Function indicates whether a specified year is a leap year. */

DECLARE EXTERNAL FUNCTION SR_ISLEAPYEAR
    DATE
    RETURNS INTEGER BY VALUE
    ENTRY_POINT 'sr_isleapyear' MODULE_NAME 'srudfs.dll';
/*--------------------------------------------------------------*/
/* Returns the current date */

DECLARE EXTERNAL FUNCTION SR_SYSDATE
    RETURNS DATE
    ENTRY_POINT 'sr_sysdate' MODULE_NAME 'srudfs.dll';
/*--------------------------------------------------------------*/
/* Returns the current DateTime */

DECLARE EXTERNAL FUNCTION SR_SYSDATETIME

    RETURNS DATE
    ENTRY_POINT 'sr_sysdatetime' MODULE_NAME 'srudfs.dll';
/*--------------------------------------------------------------*/
/* Returns a day's name from the value specified as date */

DECLARE EXTERNAL FUNCTION SR_GETNAMEDAY
    DATE
    RETURNS CSTRING(15) FREE_IT
    ENTRY_POINT 'sr_getnameday' MODULE_NAME 'srudfs.dll';
/*--------------------------------------------------------------*/
/* Returns a day's name from the value specified as date (WIN1251 users only) */

DECLARE EXTERNAL FUNCTION SR_GETNAMEDAY_CYR
    DATE
    RETURNS CSTRING(15) FREE_IT
    ENTRY_POINT 'sr_getnameday_cyr' MODULE_NAME 'srudfs.dll';
/*--------------------------------------------------------------*/
