diff --git a/sw/lib/ocaml/expr_syntax.ml b/sw/lib/ocaml/expr_syntax.ml index 269f959b85..f600a9cb2d 100644 --- a/sw/lib/ocaml/expr_syntax.ml +++ b/sw/lib/ocaml/expr_syntax.ml @@ -55,7 +55,7 @@ let sprint = fun ?call_assoc expr -> sprintf "%s(%s)" op (eval e1) | CallOperator (_,_) -> failwith "Operator should be binary or unary" | Call (i, [Ident s]) when Some i = n -> - let index = try List.assoc s l with Not_found -> failwith (sprintf "Unknown block: '%s'" s) in + let index = try List.assoc s l with Not_found -> failwith (sprintf "Expr_syntax call_assoc not found: '%s'" s) in sprintf "%d" index | Call (i, es) -> let ses = List.map eval es in diff --git a/sw/lib/ocaml/fp_proc.ml b/sw/lib/ocaml/fp_proc.ml index be245bc784..1d7b7be09c 100644 --- a/sw/lib/ocaml/fp_proc.ml +++ b/sw/lib/ocaml/fp_proc.ml @@ -43,18 +43,19 @@ let parse_expression = fun s -> s (Lexing.lexeme_char lexbuf 0); exit 1 | Parsing.Parse_error -> - fprintf stderr "Parsing error in '%s', token '%s' ?\n" + fprintf stderr "Fp_proc: Parsing error in '%s', token '%s' ?\n" s (Lexing.lexeme lexbuf); exit 1 open Latlong -let subst_expression = fun env e -> +let subst_expression = fun (name, env) e -> let rec sub = fun e -> match e with Ident i -> Ident (try List.assoc i env with Not_found -> i) | Int _ | Float _ | Field _ -> e + | Call ("IndexOfBlock", [Ident s]) -> Call ("IndexOfBlock", [ Ident ("'"^name^"."^s^"'") ]) (* prefix block name *) | Call (i, es) -> Call (i, List.map sub es) | CallOperator (i, es) -> CallOperator (i, List.map sub es) | Index (i,e) -> Index (i,sub e) @@ -230,8 +231,8 @@ let parse_include = fun dir flight_plan include_xml -> and sectors = get_children "sectors" proc and header = get_pc_data "header" proc in - let exceptions = List.map (transform_exception prefix reroutes env) exceptions - and blocks = List.map (transform_block prefix reroutes env) blocks in + let exceptions = List.map (transform_exception prefix reroutes (proc_name, env)) exceptions + and blocks = List.map (transform_block prefix reroutes (proc_name, env)) blocks in List.fold_right append_children