(***********************************************************************)
(*                                                                     *)
(*                                 GALAX                               *)
(*                              XQuery Engine                          *)
(*                                                                     *)
(*  Copyright 2001-2003, Lucent Technologies.                          *)
(*  Distributed only by permission.                                    *)
(*                                                                     *)
(***********************************************************************)

(* $Id: dynamic_context.mli,v 1.3 2003/05/28 14:47:38 simeon Exp $ *)

(* Module Dynamic_context
   Description:
     This module implements the XQuery dynamic context.
*)

open Datamodel
open Sym
open Xquery_ast


(*******************)
(* Dynamic context *)
(*******************)

type dynamic_context 

(* Build a dynamic context *)

val build_dynamic_context :
    Static_context.static_context -> cfunction_def list -> Finfo.finfo -> dynamic_context
val copy_dynamic_context :
    dynamic_context -> Static_context.static_context -> dynamic_context

(* Extracts the static context from the dynamic context *)

val static_context_from_dynamic_context :
    dynamic_context -> Static_context.static_context 

(* Add a variable and its value/extended value to dynamic context *)

val add_var_value_to_dynamic_context   : dynamic_context -> (vname * _Value)          -> dynamic_context
val add_var_exvalue_to_dynamic_context : dynamic_context -> (vname * _Extended_Value) -> dynamic_context

(* Lookup a variable's value/extended value in dynamic context *)

val var_value_from_dynamic_context   : dynamic_context -> vname -> _Value
val var_exvalue_from_dynamic_context : dynamic_context -> vname -> _Extended_Value

(* Add one function to dynamic context *)

val add_funs_to_dynamic_context : dynamic_context -> cfunction_def list -> Finfo.finfo -> dynamic_context

(* Lookup a function's body in dynamic context *)

val body_from_dynamic_context   : dynamic_context -> (rfname * int) -> cfunction_body

(* Add a key and its value to dynamic context *)

val add_key_to_dynamic_context  : dynamic_context -> (string * string) -> _Value -> dynamic_context

(* Lookup a key's value in dynamic context *)

val key_from_dynamic_context    : dynamic_context -> (string * string) -> _Value

