Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

sobj_stdenv.c File Reference


Detailed Description

Implementation of the standard environment.

#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <time.h>
#include "sobject_p.h"
#include <sobject/envutil.h>
#include <sobject/iso8601.h>

Include dependency graph for sobj_stdenv.c:

Include dependency graph

Functions

void sobj_stdenv_init_static (void)
 Static initialization function for the standard environment module.
int sobj_stdenv_so_message (void *, int, const char *, struct sobj_dict *, const char *)
 Implementation of the message() method of the standard environment.
char * sobj_stdenv_so_str (void *, struct sobj *)
 Implementation of the str() method of the standard environment.
sobjsobj_stdenv_so_vref (void *, const char *)
 Implementation of the vref() method of the standard environment.
char * sobj_stdenv_so_vref_str (void *, const char *)
 Implementation of the vref_str() method of the standard environment.
sobjsobj_stdenv_class_default_so_pack (void *, struct sobj *, struct sobj_env *)
 Implementation of the pack() method of the standard default class environment.
sobjsobj_stdenv_class_default_so_unpack (void *, struct sobj *, struct sobj_env *)
 Implementation of the unpack() method of the standard default class environment.
sobjsobj_stdenv_class_default_so_call (void *, struct sobj *, struct sobj *, struct sobj *, struct sobj_env *)
 Implementation of the call() method of the standard default class environment.
sobjsobj_stdenv_class_default_so_eval (void *, struct sobj *, struct sobj_env *)
 Implementation of the eval() method of the standard default class environment.
sobjsobj_stdenv_class_time_so_pack (void *, struct sobj *, struct sobj_env *)
 Implementation of the pack() method of the time class environment.
sobjsobj_stdenv_class_time_so_unpack (void *, struct sobj *, struct sobj_env *)
 Implementation of the unpack() method of the time class environment.
sobjsobj_stdenv_class_time_so_call (void *, struct sobj *, struct sobj *, struct sobj *, struct sobj_env *)
 Implementation of the call() method of the time class environment.
sobjsobj_stdenv_class_time_so_eval (void *, struct sobj *, struct sobj_env *)
 Implementation of the eval() method of the time class environment.
int sobj_stdenv_eval_truth_value (const struct sobj *)
 Evaluate the truth value of a simple object.
sobjsobj_stdenv_eval_arith_calc_int (enum sobj_expr_type, struct sobj *, struct sobj *, struct sobj_env *)
 Evaluate a calculation expression operating on integers.
sobjsobj_stdenv_eval_arith_calc_float (enum sobj_expr_type, struct sobj *, struct sobj *, struct sobj_env *)
 Evaluate a calculation expression operating on floating pointer numbers.
sobjsobj_stdenv_eval_arith_calc_array (enum sobj_expr_type, struct sobj *, struct sobj *, struct sobj_env *)
 Evaluate a calculation expression operating on arrays.
sobjsobj_stdenv_eval_add_string (struct sobj *, struct sobj *, struct sobj_env *)
 Perform an addition (concatenation) of two string objects.
sobjsobj_stdenv_eval_arith_calc (enum sobj_expr_type, struct sobj *, struct sobj *, struct sobj_env *)
 Evaluate a calculation expression.
bool sobj_stdenv_eval_test_comparable (enum sobj_expr_type, struct sobj *, struct sobj *)
 Check if two operands are comparable.
sobjsobj_stdenv_eval_compare_ord (enum sobj_expr_type, struct sobj *, struct sobj *, struct sobj_env *)
 Perform an ordered comparison.
sobjsobj_stdenv_eval_compare_eq (enum sobj_expr_type, struct sobj *, struct sobj *, struct sobj_env *)
 Perform an equality comparison.
sobjsobj_stdenv_eval_compare_ord_x (enum sobj_expr_type, struct sobj *, struct sobj *, struct sobj *, struct sobj_env *)
 Perform an approximate ordered comparison.
sobjsobj_stdenv_eval_compare_eq_x (enum sobj_expr_type, struct sobj *, struct sobj *, struct sobj *, struct sobj_env *)
 Perform an approximate equality comparison.
sobjsobj_stdenv_eval_arith_logic (enum sobj_expr_type, struct sobj *, struct sobj *, struct sobj_env *)
 Evaluate a logic expression.
sobjsobj_stdenv_eval_arith (struct sobj_expr *, struct sobj_env *)
 Evaluate a arithmetic expression.
sobjsobj_stdenv_eval_cond (struct sobj_expr *, int, struct sobj_env *)
 Evaluate a conditional expression.
sobjsobj_stdenv_eval_sel (struct sobj_expr *, struct sobj_env *)
 Evaluate a selection expression.
sobjsobj_stdenv_eval_index (struct sobj_expr *, struct sobj_env *)
 Evaluate an index expression.
sobjsobj_stdenv_eval_call (struct sobj_expr *, struct sobj_env *)
 Evaluate a call expression.
int sobj_stdenv_time_to_iso8601_time (struct sobj *, struct iso8601_time *, int, int, bool)
 Convert a simple object instance of class time to a broken down representation.
int sobj_stdenv_parse_delta (const char *, long long *)
 Parse a time delta encoded as a string.
sobjsobj_stdenv_time_eval_calc (enum sobj_expr_type, struct sobj *, struct sobj *, struct sobj_env *)
 Evaluate a time calculation expression.
sobjsobj_stdenv_time_eval_cmp (enum sobj_expr_type, struct sobj *, struct sobj *, struct sobj_env *)
 Evaluate a time comparison expression.
void sobj_stdenv_cleanup (void)
 Static cleanup function for the standard environment module.
sobjsobj_stdenv_class_time_method_fn_create (struct sobj_envutil_method *method, struct sobj_env_class *env_class, struct sobj_env *env, struct sobj *object, struct sobj **args)
 Implementation of the create() method of the time class environment.
sobjsobj_stdenv_class_time_method_fn_split (struct sobj_envutil_method *method, struct sobj_env_class *env_class, struct sobj_env *env, struct sobj *object, struct sobj **args)
 Implementation of the split() method of the time class environment.
sobjsobj_stdenv_class_time_method_fn_encode (struct sobj_envutil_method *method, struct sobj_env_class *env_class, struct sobj_env *env, struct sobj *object, struct sobj **args)
 Implementation of the encode() method of the time class environment.
sobjsobj_stdenv_class_time_method_fn_decode (struct sobj_envutil_method *method, struct sobj_env_class *env_class, struct sobj_env *env, struct sobj *object, struct sobj **args)
 Implementation of the decode() method of the time class environment.
sobj_envsobj_env_STANDARD (void)
 Return a copy of the standard environment.

Function Documentation

struct sobj * sobj_stdenv_class_default_so_call void *  owner,
struct sobj sobj,
struct sobj selector,
struct sobj args,
struct sobj_env env
[static]
 

Implementation of the call() method of the standard default class environment.

The method returns 0 (i.e. no call operation is performed). See sobj_env_class::so_call for a description of the parameters and return value.

struct sobj * sobj_stdenv_class_default_so_eval void *  owner,
struct sobj sobj,
struct sobj_env env
[static]
 

Implementation of the eval() method of the standard default class environment.

This function implements the standard expression semantics defined in the simple objects specification document. See sobj_env_class::so_eval for a description of the parameters and return value.

struct sobj * sobj_stdenv_class_default_so_pack void *  owner,
struct sobj sobj,
struct sobj_env env
[static]
 

Implementation of the pack() method of the standard default class environment.

The method returns the passed object as-is (i.e. no pack operation is performed). See sobj_env_class::so_pack for a description of the parameters and return value.

struct sobj * sobj_stdenv_class_default_so_unpack void *  owner,
struct sobj sobj,
struct sobj_env env
[static]
 

Implementation of the unpack() method of the standard default class environment.

The method returns the passed object as-is (i.e. no unpack operation is performed). See sobj_env_class::so_unpack for a description of the parameters and return value.

struct sobj* sobj_stdenv_class_time_method_fn_create struct sobj_envutil_method method,
struct sobj_env_class env_class,
struct sobj_env env,
struct sobj object,
struct sobj **  args
[static]
 

Implementation of the create() method of the time class environment.

See sobj_envutil_method_fn for a description of the parameters and return value.

The called object is discarded by the function (and is typically {time}nil). The method takes a time array tm as its only parameter. The tm array must contain a valid and complete date specification consisting of one of the following combinations:

  • year, month, and mday
  • year and yday.
  • year, week, and wday
The time of day is specified as hour, min (minutes), sec, and msec (milliseconds). The time zone is specified as tz (hours) and (optionally) tzmin (minutes). If the time zone parameter tz is omitted, local time is assumed.

The method returns a simple object instance of class time representing the specified date and time of day.

struct sobj* sobj_stdenv_class_time_method_fn_decode struct sobj_envutil_method method,
struct sobj_env_class env_class,
struct sobj_env env,
struct sobj object,
struct sobj **  args
[static]
 

Implementation of the decode() method of the time class environment.

See the simple objects description document for a definition of this method.

See sobj_envutil_method_fn for a description of the parameters and return value.

struct sobj* sobj_stdenv_class_time_method_fn_encode struct sobj_envutil_method method,
struct sobj_env_class env_class,
struct sobj_env env,
struct sobj object,
struct sobj **  args
[static]
 

Implementation of the encode() method of the time class environment.

See the simple objects description document for a definition of this method.

See sobj_envutil_method_fn for a description of the parameters and return value.

struct sobj* sobj_stdenv_class_time_method_fn_split struct sobj_envutil_method method,
struct sobj_env_class env_class,
struct sobj_env env,
struct sobj object,
struct sobj **  args
[static]
 

Implementation of the split() method of the time class environment.

See the simple objects description document for a definition of this method.

See sobj_envutil_method_fn for a description of the parameters and return value.

struct sobj * sobj_stdenv_class_time_so_call void *  owner,
struct sobj sobj,
struct sobj selector,
struct sobj args,
struct sobj_env env
[static]
 

Implementation of the call() method of the time class environment.

The function uses the envutil functions (defined in "#sobj_envutil.c") to dispatch the methods defined for the time class environment.

See sobj_env_class::so_call for a description of the parameters and return value.

struct sobj * sobj_stdenv_class_time_so_eval void *  owner,
struct sobj sobj,
struct sobj_env env
[static]
 

Implementation of the eval() method of the time class environment.

struct sobj * sobj_stdenv_class_time_so_pack void *  owner,
struct sobj object,
struct sobj_env env
[static]
 

Implementation of the pack() method of the time class environment.

The function converts simple object instances of class time from epoch representation to string representation. If the called object is already specified in string representation, the time zone is converted to UTC.

In case of an error, a warning message is issued and the object is replaced by the special value {time}nil.

Parameters:
owner The owner of the class environment.
object The object to be serialized.
env The environment object.
Returns:
The function returns the object to be serialized.

struct sobj * sobj_stdenv_class_time_so_unpack void *  owner,
struct sobj object,
struct sobj_env env
[static]
 

Implementation of the unpack() method of the time class environment.

The function converts simple object instances of class time from ISO 8601 representation to epoch representation. If the called object is already specified in epoch representation, it is passed through as is.

In case of an error, a warning message is issued and the object is replaced by the special value {time}nil.

Parameters:
owner The owner of the class environment.
object The object to be serialized.
env The environment object.
Returns:
The function returns the unpacked object.

void sobj_stdenv_cleanup void   ) 
 

Static cleanup function for the standard environment module.

This function is called with the first call to sobj_env_STANDARD()<c/sobj_env_STANDARD.

struct sobj * sobj_stdenv_eval_add_string struct sobj op1,
struct sobj op2,
struct sobj_env env
[static]
 

Perform an addition (concatenation) of two string objects.

Parameters:
op1 The first operand. Must be of type string.
op2 The second operand. Must be of type string.
env The environment object. This may not be a null-pointer.
Returns:
The function returns the result of the evaluation. The function never returns a null-pointer.

struct sobj * sobj_stdenv_eval_arith struct sobj_expr expr,
struct sobj_env env
[static]
 

Evaluate a arithmetic expression.

The function evaluates an arithmetic expression (positive, negative, logical NOT, plus, minus, mul, div, mod, comparison, approximate comparison, logical AND, logical OR). The evaluation depends on the operand types. If no evaluation is performed, a null-pointer is returned.

The function performs a recursive evaluation of all operands but the first (the first operand is evaluated recursively by sobj_eval() itself).

Parameters:
expr The expression. This must be an arithmetic expression.
env The environment object. This may not be a null-pointer.
Returns:
The function returns the result of the evaluation. If no evaluation is performed, the function never returns a null-pointer.

struct sobj * sobj_stdenv_eval_arith_calc enum sobj_expr_type  expr_type,
struct sobj op1,
struct sobj op2,
struct sobj_env env
[static]
 

Evaluate a calculation expression.

The function evaluates a calculation expression (plus, minus, mul, div, mod). The evaluation depends on the operand types. If no evaluation is performed, a null-pointer is returned.

Parameters:
expr_type The expression type. This must be one of SOBJ_EXPR_PLUS, SOBJ_EXPR_MINUS, SOBJ_EXPR_MUL, SOBJ_EXPR_DIV, SOBJ_EXPR_MOD.
op1 The first operand.
op2 The second operand.
env The environment object. This may not be a null-pointer.
Returns:
The function returns the result of the evaluation. If no evaluation is performed, the function never returns a null-pointer.

struct sobj * sobj_stdenv_eval_arith_calc_array enum sobj_expr_type  expr_type,
struct sobj op1,
struct sobj op2,
struct sobj_env env
[static]
 

Evaluate a calculation expression operating on arrays.

The function evaluates a calculation expression (plus, minus, mul, div, mod) with at least one array operand. It is a fatal runtime error if none of the operands is an array.

The operation depends on the operand types:

  • Only the first operand is of type array: The result is an array constructed from the evaluated combination of all array element values with the second operand.
  • Only the second operand is of type array: Similar to the first case, but the operand orders are reversed.
  • Both operands are of type array. If both array have equal length, the result is an array with the evaluated expressions constructed from positionally matchin pairs of element values. The element keys are taken from the first operand. If the array have different length, no evaluation is performed.

Parameters:
expr_type The expression type. This must be one of SOBJ_EXPR_PLUS, SOBJ_EXPR_MINUS, SOBJ_EXPR_MUL, SOBJ_EXPR_DIV, SOBJ_EXPR_MOD.
op1 The first operand.
op2 The second operand.
env The environment object. This may not be a null-pointer.
Returns:
The function returns the result of the evaluation. If the evaluation is not performed (i.e. the operands are arrays of different length), a null-pointer is returned.

struct sobj * sobj_stdenv_eval_arith_calc_float enum sobj_expr_type  expr_type,
struct sobj op1,
struct sobj op2,
struct sobj_env env
[static]
 

Evaluate a calculation expression operating on floating pointer numbers.

The function evaluates a calculation expression (plus, minus, mul, div, mod) with integer or floating point operands.

Parameters:
expr_type The expression type. This must be one of SOBJ_EXPR_PLUS, SOBJ_EXPR_MINUS, SOBJ_EXPR_MUL, SOBJ_EXPR_DIV, SOBJ_EXPR_MOD.
op1 The first operand. This must be a an object of type SOBJ_TYPE_INT or SOBJ_TYPE_FLOAT.
op2 The second operand. This must be a an object of type SOBJ_TYPE_INT or SOBJ_TYPE_FLOAT.
env The environment object. This may not be a null-pointer.
Returns:
The function returns the result of the evaluation, which is always of type SOBJ_TYPE_FLOAT. The function never returns a null-pointer.

struct sobj * sobj_stdenv_eval_arith_calc_int enum sobj_expr_type  expr_type,
struct sobj op1,
struct sobj op2,
struct sobj_env env
[static]
 

Evaluate a calculation expression operating on integers.

The function evaluates a calculation expression (plus, minus, mul, div, mod) with integer operands.

Parameters:
expr_type The expression type. This must be one of SOBJ_EXPR_PLUS, SOBJ_EXPR_MINUS, SOBJ_EXPR_MUL, SOBJ_EXPR_DIV, SOBJ_EXPR_MOD.
op1 The first operand. This must be a an object of type SOBJ_TYPE_INT.
op2 The second operand. This must be a an object of type SOBJ_TYPE_INT.
env The environment object. This may not be a null-pointer.
Returns:
The function returns the result of the evaluation. The function never returns a null-pointer.

struct sobj * sobj_stdenv_eval_arith_logic enum sobj_expr_type  expr_type,
struct sobj op1,
struct sobj op2,
struct sobj_env env
[static]
 

Evaluate a logic expression.

The function evaluates a logic expression (logical AND, logical OR). The evaluation depends on the operand types. If no evaluation is performed, a null-pointer is returned.

Parameters:
expr_type The expression type. This must be SOBJ_EXPR_AND or SOBJ_EXPR_OR.
op1 The first operand.
op2 The second operand.
env The environment object. This may not be a null-pointer.
Returns:
The function returns the result of the evaluation. If no evaluation is performed, the function never returns a null-pointer.

struct sobj * sobj_stdenv_eval_call struct sobj_expr expr,
struct sobj_env env
[static]
 

Evaluate a call expression.

Parameters:
expr The expression. This must be an expression of type SOBJ_EXPR_CALL
env The environment object. This may not be a null-pointer.
Returns:
The function returns the result of the evaluation. If no evaluation is performed, the function never returns a null-pointer.

struct sobj * sobj_stdenv_eval_compare_eq enum sobj_expr_type  expr_type,
struct sobj op1,
struct sobj op2,
struct sobj_env env
[static]
 

Perform an equality comparison.

Parameters:
expr_type The comparison expression type. This must be SOBJ_EXPR_EQ or SOBJ_EXPR_NE.
op1 The first operand of the comparison.
op2 The second operand of the comparison.
env The environment object (may not be a null-pointer).
Returns:
The result of the evaluation. The function never returns null.
Note:
The function will not perform approximate comparisons.
See also:
sobj_stdenv_eval_compare_eq_x().

struct sobj * sobj_stdenv_eval_compare_eq_x enum sobj_expr_type  expr_type,
struct sobj op1,
struct sobj op2,
struct sobj op3,
struct sobj_env env
[static]
 

Perform an approximate equality comparison.

Parameters:
expr_type The comparison expression type. This must be SOBJ_EXPR_EQ_APPROX or SOBJ_EXPR_NE_APPROX.
op1 The first operand of the comparison.
op2 The second operand of the comparison.
op3 The third operand of the comparison (the fuzz value). If this is not of type SOBJ_TYPE_INT or SOBJ_TYPE_FLOAT, no evaluation is performed (i.e. null is returned).
env The environment object (may not be a null-pointer).
Returns:
The result of the evaluation, or null if the expression is not evaluated.

struct sobj * sobj_stdenv_eval_compare_ord enum sobj_expr_type  expr_type,
struct sobj op1,
struct sobj op2,
struct sobj_env env
[static]
 

Perform an ordered comparison.

Parameters:
expr_type The comparison expression type. This must be one of SOBJ_EXPR_LS, SOBJ_EXPR_LE, SOBJ_EXPR_GT, or SOBJ_EXPR_GE.
op1 The first operand of the comparison.
op2 The second operand of the comparison.
env The environment object (may not be a null-pointer).
Returns:
The result of the evaluation, or null if the expression is not evaluated.
Note:
The function will not perform approximate comparisons.
See also:
sobj_stdenv_eval_compare_ord_x().

struct sobj * sobj_stdenv_eval_compare_ord_x enum sobj_expr_type  expr_type,
struct sobj op1,
struct sobj op2,
struct sobj op3,
struct sobj_env env
[static]
 

Perform an approximate ordered comparison.

Parameters:
expr_type The comparison expression type. This must be one of SOBJ_EXPR_LS_APPROX, SOBJ_EXPR_LE_APPROX, SOBJ_EXPR_GT_APPROX, or SOBJ_EXPR_GE_APPROX.
op1 The first operand of the comparison.
op2 The second operand of the comparison.
op3 The third operand of the comparison (the fuzz value). If this is not of type SOBJ_TYPE_INT or SOBJ_TYPE_FLOAT, no evaluation is performed (i.e. null is returned).
env The environment object (may not be a null-pointer).
Returns:
The result of the evaluation, or null if the expression is not evaluated.

struct sobj * sobj_stdenv_eval_cond struct sobj_expr expr,
int  expr_id,
struct sobj_env env
[static]
 

Evaluate a conditional expression.

Parameters:
expr The expression. This must be an expression of type SOBJ_EXPR_COND.
expr_id The class ID of the expression.
env The environment object. This may not be a null-pointer.
Returns:
The function returns the result of the evaluation. If no evaluation is performed, the function never returns a null-pointer.

struct sobj * sobj_stdenv_eval_index struct sobj_expr expr,
struct sobj_env env
[static]
 

Evaluate an index expression.

Parameters:
expr The expression. This must be an expression of type SOBJ_EXPR_INDEX
env The environment object. This may not be a null-pointer.
Returns:
The function returns the result of the evaluation. If no evaluation is performed, the function never returns a null-pointer.

struct sobj * sobj_stdenv_eval_sel struct sobj_expr expr,
struct sobj_env env
[static]
 

Evaluate a selection expression.

Parameters:
expr The expression. This must be an expression of type SOBJ_EXPR_SEL
env The environment object. This may not be a null-pointer.
Returns:
The function returns the result of the evaluation. If no evaluation is performed, the function never returns a null-pointer.

bool sobj_stdenv_eval_test_comparable enum sobj_expr_type  expr_type,
struct sobj op1,
struct sobj op2
[static]
 

Check if two operands are comparable.

Parameters:
expr_type The comparison expression to be applied. If the specified operation is not a comparison operation, the result will be undefined.
op1 The first operand.
op2 The second operand.
Returns:
The function returns true if the operands are comparable and false if the operands are not comparable.

int sobj_stdenv_eval_truth_value const struct sobj sobj  )  [static]
 

Evaluate the truth value of a simple object.

Parameters:
sobj The object to be evaluated.
Return values:
0 The truth value of the object is false.
1 The truth value of the object is true.
-1 The truth value of the object is undefined. This is the case for objects of type expr and type vref.

void sobj_stdenv_init_static void   )  [static]
 

Static initialization function for the standard environment module.

This function is called with the first call to sobj_env_STANDARD()<c/sobj_env_STANDARD.

int sobj_stdenv_parse_delta const char *  delta_spec,
long long *  delta
[static]
 

Parse a time delta encoded as a string.

The function parses a time delta specification string with the following syntax:

A time delta is specified as a (possibly empty) list of time elements, separated by whitespace and/or commas. A time element is an integer number encoded in C notation followed (without separating whitespace) by a unit specifier. Unit specifiers are recognized case insensitive, i.e. "s" and "S" are equivalent. The following unit specifiers are recognized:

  • ms. The delta is specified in milliseconds.
  • s. The delta is specified in seconds.
  • m. The delta is specified in minutes.
  • h. The delta is specified in hours.
  • d. The delta is specified in days.
If a unit specifier is omitted, seconds are assumed. Example for a specification string representing 1 hour, 12 minutes, and 44 seconds: "1h, 12m, 44".

Parameters:
delta_spec The delta specification string.
delta Pointer to a long long variable receiving the delta in milliseconds.
Returns:
The function returns 0 on success and -1 if the delta string containes errors.

int sobj_stdenv_so_message void *  owner,
int  type,
const char *  id,
struct sobj_dict args,
const char *  message
[static]
 

Implementation of the message() method of the standard environment.

This function returns -1 unconditionally, indicating that the default message handling should be performed. See sobj_env::so_message for a description of the parameters and return value.

char * sobj_stdenv_so_str void *  owner,
struct sobj sobj
[static]
 

Implementation of the str() method of the standard environment.

This function returns 0 unconditionally, indicating that the default string representation should be created. See sobj_env::so_str for a description of the parameters and return value.

struct sobj * sobj_stdenv_so_vref void *  owner,
const char *  ref
[static]
 

Implementation of the vref() method of the standard environment.

This function returns 0 unconditionally, indicating that the reference string should not be resolved. See sobj_env::so_vref for a description of the parameters and return value.

char * sobj_stdenv_so_vref_str void *  owner,
const char *  ref
[static]
 

Implementation of the vref_str() method of the standard environment.

This function returns 0 unconditionally, indicating that the default vref resolver should be used (i.e. vref() and str(). See sobj_env::so_vref for a description of the parameters and return value.

struct sobj * sobj_stdenv_time_eval_calc enum sobj_expr_type  expr_type,
struct sobj op1,
struct sobj op2,
struct sobj_env env
[static]
 

Evaluate a time calculation expression.

The function evaluates a time calculation expression where the first operand is of class {time}. Valid calculation expressions are of type SOBJ_EXPR_PLUS or SOBJ_EXPR_MINUS.

  • SOBJ_EXPR_PLUS: A (positive or negative) time delta is added to the time object. If the delta operand is an integer or floating point number, it is interpreted as a number of seconds (up to a precision of milliseconds for floating point numbers). If the delta operand is a string, it is interpreted as a delta specification (parsed using the sobj_stdenv_parse_delta() function). For all other operand types the expression is not evaluated.
  • SOBJ_EXPR_MINUS: If the second operand is a valid delta specification (as defined for the SOBJ_EXPR_PLUS case), that delta is subtracted from the time object. If the second operand is itself of class {time}, the time difference is returned a floating point number of class {time delta} (up to a precision of milliseconds). For all other operands the expression is not evaluated.

Parameters:
expr_type The expression type. This must be SOBJ_EXPR_PLUS or SOBJ_EXPR_MINUS.
op1 The time operand. Must be of class {time}.
op2 The delta or second time operand.
env The environment object. This may not be a null-pointer.
Returns:
The function returns the evaluated object or null if the expression is not evaluated.

struct sobj * sobj_stdenv_time_eval_cmp enum sobj_expr_type  expr_type,
struct sobj op1,
struct sobj op2,
struct sobj_env env
[static]
 

Evaluate a time comparison expression.

The function evaluates a time comparison expression where the first operand is of class {time}. Approximate comparison expressions are not valid time comparison expressions.

If the second operand is of class {time}, the time values are compared in the natural order. If the second operand is a classless string, it is interpreted as an ISO 8601 encoded time. Note that in this case it is not an error if the string is not a correct ISO 8601 encoding -- the expression will not be evaluated in this case.

Parameters:
expr_type The expression type. This must be a non-approximate comparison expression type.
op1 The time operand. Must be of class {time}.
op2 The second time operand.
env The environment object. This may not be a null-pointer.
Returns:
The function returns the evaluated object or null if the expression is not evaluated.

int sobj_stdenv_time_to_iso8601_time struct sobj object,
struct iso8601_time iso8601_time,
int  tz,
int  tzmin,
bool  weekdate
[static]
 

Convert a simple object instance of class time to a broken down representation.

Parameters:
object The simple object of class time.
iso8601_time Pointer to an iso8601_time buffer receiving the broken down time.
tz The timezone (hours). The special value ISO8601_TZ_LOCALTIME represents local time.
tzmin The minute offset of the timezone.
weekdate Flag indicating if the time object should be converted to a weekdate. Note that week dates and calendar dates may differ in the year number for the same date, if a week wraps around a year boundary.
Returns:
The function returns 0 on success and -1 on error.


Generated on Sat Jul 23 16:05:36 2005 for sobject by  doxygen 1.3.9.1