package rdbg

  1. Overview
  2. Docs

Source file event.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
(* Time-stamp: <modified the 16/02/2018 (at 15:11) by Erwan Jahier> *)

type var = Data.ident * Data.t


(* Source info related to the current control point. Its content
   depends on the plugin it comes from. *)
type src_info_atom = { 
  str  : string ; 
  file : string ; 
  line : int * int ; (* line nb begin/end in file *)
  char : int * int ; (* char nb begin/end in file *)
  stack: src_info_atom option; 
}

type src_info = {
  expr : Expr.t ;    (* holds info about the current control point *)
  atoms: src_info_atom list; 
  more : (unit -> Expr.t) option;  (* more (costly) info *)
  in_subst  : (var * var) list; (* relate input  args and parameters *)
  out_subst : (var * var) list; (* relate output args and parameters *)
}

(* a.k.a. ports in the Prolog Byrd's box model *)
type kind = Ltop | Call | Exit 
  | MicroStep of string (* holds info related to the sub-lang micro-step *)

type t = { 
  nb    : int;
  step  : int;
  depth : int;
  data  : Data.subst list;  
  next  : unit -> t;
  terminate: unit -> unit;
  kind  : kind;
  name : string;
  lang : string; 
  inputs  : var list; 
  outputs : var list;
  locals  : var list;
  sinfo : (unit -> src_info) option
} 

(* raised by next  when there is no next event. Holds the event number.*)
exception End of int 
exception Error of string * t 

let set_nb e i = { e with nb = i }

let incr_event_nb ctx = { ctx with nb = ctx.nb+1 }
let decr_event_depth ctx = { ctx with depth = ctx.depth-1 }
let incr_event_depth ctx = { ctx with depth = ctx.depth+1 }
                             
(****************************************************************)
(* printers (for toplevel) *)
let (print_expr : Format.formatter -> Expr.t -> unit) =
  fun ff e ->
  Format.fprintf ff "%s" (Expr.to_string e);
                             
  (* let (print_src_info : Format.formatter -> src_info -> unit) = *)
  (*   fun ff si -> *)
  (*   Format.fprintf ff "%s" (Expr.to_string si.expr) *)
OCaml

Innovation. Community. Security.