Commit 39ba0d1b authored by Erwan Jahier's avatar Erwan Jahier
Browse files

Fix pbs in the Alices<->Lurette interface.

parent 3e2e5006
......@@ -18,6 +18,7 @@ open LucProg
type gen_mode = Lustre | Scade | Alices | Luciole | Nop
type step_mode = Inside | Edges | Vertices
let step_mode_to_str = function
Inside -> "step_inside"
| Edges -> "step_edges"
......@@ -520,7 +521,7 @@ launch the lutin interpreter and init socket stuff
dbg_printf(\"Binding %s:%d...\\n\",sock_addr,portno);
sprintf(portno_str, \"%d\", portno);
printf(msg,\" Waiting for lurette to connect on %s:%s\\n\", sock_addr, portno_str);
printf(\" Waiting for lurette to connect on %s:%s\\n\", sock_addr, portno_str);
//raise_info(msg);
dbg_printf(\"Waiting for lurette to connect\\n\");
......@@ -542,7 +543,6 @@ Step procedure
void " ^ fn ^ "_step(" ^ fn ^ "_ctx* ctx){
int rc;
int i;
" ^
let cpt = ref 0 in
let decl_char acc var =
......@@ -581,15 +581,30 @@ let all_vars = in_vars @ out_vars in
List.fold_left
(fun acc var -> acc ^ (var_to_format_print var) ^ " ")
""
all_vars) ^"\\n\", "
in_vars) ^"\\n\", "
^
(List.fold_left
(fun acc var -> acc ^ ", "^ (var_to_adress var))
(var_to_adress (List.hd all_vars))
((List.tl all_vars)))
(var_to_adress (List.hd in_vars))
((List.tl in_vars)))
^
");
dbg_printf(\"\\n\\n ---- Sending the 'cliché': '%s'\\n\",ctx->buff);
dbg_printf(\"\\n\\n ---- Sending the 'cliché' (Alices output part): '%s'\\n\",ctx->buff);
send(ctx->sock, ctx->buff, (int) strlen(ctx->buff),0);
sprintf(ctx->buff, \""^(
List.fold_left
(fun acc var -> acc ^ (var_to_format_print var) ^ " ")
""
out_vars) ^"\\n\", "
^
(List.fold_left
(fun acc var -> acc ^ ", "^ (var_to_adress var))
(var_to_adress (List.hd out_vars))
((List.tl out_vars)))
^
");
dbg_printf(\"\\n\\n ---- Sending the 'cliché' (Alices input part): '%s'\\n\",ctx->buff);
send(ctx->sock, ctx->buff, (int) strlen(ctx->buff),0);
};
......@@ -611,8 +626,6 @@ let all_vars = in_vars @ out_vars in
^
");
dbg_printf(\"\\n\\n ---- A new Step begins. Sending to sock: '%s'\\n\",ctx->buff);
send(ctx->sock, ctx->buff, (int) strlen(ctx->buff),0);
")^
(if option.boot then "} " else "") ^ "
......@@ -624,8 +637,13 @@ let all_vars = in_vars @ out_vars in
printf(\"Error: cannot read on socket\\n\");
raise_error(\"" ^ fn ^ ": cannot read on socket\");
};
dbg_printf(\"reading '%s'\\n\",ctx->buff);
sscanf(ctx->buff, \"" ^
if (strcmp(ctx->buff, \"#quit\") == 0) {
sprintf(ctx->buff, \"quitting...\\n\");
send(ctx->sock, ctx->buff, (int) strlen(ctx->buff), 0);
raise_error(ctx->buff);
};
dbg_printf(\"reading '%s'\\n\",ctx->buff);
sscanf(ctx->buff, \"" ^
let cpt = ref 0 in
let var_to_adress var =
if (Var.typ var= Type.BoolT) then (
......@@ -640,7 +658,7 @@ let all_vars = in_vars @ out_vars in
out_vars)
in
scan_format
^ "\", &i,"
^ "\","
^
(List.fold_left
(fun acc var -> acc^", "^(var_to_adress var))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment