/* This file was generated by lus2lic version master.668 (35901e970a0c377cc36d6437dcbc61beb8001b54). */ /* lus2lic -2c convertible.lus -n main */ /* on ovaz the 27/10/2016 at 11:39:07 */ #include "convertible_main.h" //// Defining step functions // Memory initialisation for Lustre_arrow_4_ctx void Lustre_arrow_4_ctx_reset(Lustre_arrow_4_ctx_type* ctx){ int _i; ctx->_memory = _true; } // Memory allocation for Lustre_arrow_4_ctx Lustre_arrow_4_ctx_type* Lustre_arrow_4_ctx_new_ctx(){ Lustre_arrow_4_ctx_type* ctx = (Lustre_arrow_4_ctx_type*)calloc(1, sizeof(Lustre_arrow_4_ctx_type)); // ctx->client_data = cdata; Lustre_arrow_4_ctx_reset(ctx); return ctx; } // Step function(s) for Lustre_arrow_4_ctx void Lustre_arrow_4_step(_integer x,_integer y,_integer *z,Lustre_arrow_4_ctx_type* ctx){ *z = ((ctx->_memory)? x : y); ctx->_memory = _false; } // End of Lustre_arrow_4_step // Memory initialisation for Lustre_arrow_3_ctx void Lustre_arrow_3_ctx_reset(Lustre_arrow_3_ctx_type* ctx){ int _i; ctx->_memory = _true; } // Memory allocation for Lustre_arrow_3_ctx Lustre_arrow_3_ctx_type* Lustre_arrow_3_ctx_new_ctx(){ Lustre_arrow_3_ctx_type* ctx = (Lustre_arrow_3_ctx_type*)calloc(1, sizeof(Lustre_arrow_3_ctx_type)); // ctx->client_data = cdata; Lustre_arrow_3_ctx_reset(ctx); return ctx; } // Step function(s) for Lustre_arrow_3_ctx void Lustre_arrow_3_step(_real x,_real y,_real *z,Lustre_arrow_3_ctx_type* ctx){ *z = ((ctx->_memory)? x : y); ctx->_memory = _false; } // End of Lustre_arrow_3_step // Memory initialisation for Lustre_arrow_2_ctx void Lustre_arrow_2_ctx_reset(Lustre_arrow_2_ctx_type* ctx){ int _i; ctx->_memory = _true; } // Memory allocation for Lustre_arrow_2_ctx Lustre_arrow_2_ctx_type* Lustre_arrow_2_ctx_new_ctx(){ Lustre_arrow_2_ctx_type* ctx = (Lustre_arrow_2_ctx_type*)calloc(1, sizeof(Lustre_arrow_2_ctx_type)); // ctx->client_data = cdata; Lustre_arrow_2_ctx_reset(ctx); return ctx; } // Step function(s) for Lustre_arrow_2_ctx void Lustre_arrow_2_step(convertible_hood_speed_state x,convertible_hood_speed_state y,convertible_hood_speed_state *z,Lustre_arrow_2_ctx_type* ctx){ *z = ((ctx->_memory)? x : y); ctx->_memory = _false; } // End of Lustre_arrow_2_step // Memory initialisation for Lustre_arrow_ctx void Lustre_arrow_ctx_reset(Lustre_arrow_ctx_type* ctx){ int _i; ctx->_memory = _true; } // Memory allocation for Lustre_arrow_ctx Lustre_arrow_ctx_type* Lustre_arrow_ctx_new_ctx(){ Lustre_arrow_ctx_type* ctx = (Lustre_arrow_ctx_type*)calloc(1, sizeof(Lustre_arrow_ctx_type)); // ctx->client_data = cdata; Lustre_arrow_ctx_reset(ctx); return ctx; } // Step function(s) for Lustre_arrow_ctx void Lustre_arrow_step(convertible_hood_state x,convertible_hood_state y,convertible_hood_state *z,Lustre_arrow_ctx_type* ctx){ *z = ((ctx->_memory)? x : y); ctx->_memory = _false; } // End of Lustre_arrow_step // Memory initialisation for Lustre_arrow_6_ctx void Lustre_arrow_6_ctx_reset(Lustre_arrow_6_ctx_type* ctx){ int _i; ctx->_memory = _true; } // Memory allocation for Lustre_arrow_6_ctx Lustre_arrow_6_ctx_type* Lustre_arrow_6_ctx_new_ctx(){ Lustre_arrow_6_ctx_type* ctx = (Lustre_arrow_6_ctx_type*)calloc(1, sizeof(Lustre_arrow_6_ctx_type)); // ctx->client_data = cdata; Lustre_arrow_6_ctx_reset(ctx); return ctx; } // Step function(s) for Lustre_arrow_6_ctx void Lustre_arrow_6_step(convertible_vehicle_state x,convertible_vehicle_state y,convertible_vehicle_state *z,Lustre_arrow_6_ctx_type* ctx){ *z = ((ctx->_memory)? x : y); ctx->_memory = _false; } // End of Lustre_arrow_6_step // Memory initialisation for Lustre_arrow_5_ctx void Lustre_arrow_5_ctx_reset(Lustre_arrow_5_ctx_type* ctx){ int _i; ctx->_memory = _true; } // Memory allocation for Lustre_arrow_5_ctx Lustre_arrow_5_ctx_type* Lustre_arrow_5_ctx_new_ctx(){ Lustre_arrow_5_ctx_type* ctx = (Lustre_arrow_5_ctx_type*)calloc(1, sizeof(Lustre_arrow_5_ctx_type)); // ctx->client_data = cdata; Lustre_arrow_5_ctx_reset(ctx); return ctx; } // Step function(s) for Lustre_arrow_5_ctx void Lustre_arrow_5_step(_real x[50],_real y[50],_real z[50]/*out*/,Lustre_arrow_5_ctx_type* ctx){ _assign_rp50(z, ((ctx->_memory)? x : y), sizeof(_real [50])); ctx->_memory = _false; } // End of Lustre_arrow_5_step // Step function(s) for Lustre_eq_ctx void Lustre_eq_step(_integer x,_integer y,_boolean *z){ *z = (x == y); } // End of Lustre_eq_step // Step function(s) for Lustre_eq_2_ctx void Lustre_eq_2_step(_real x,_real y,_boolean *z){ *z = (x == y); } // End of Lustre_eq_2_step // Step function(s) for Lustre_eq_3_ctx void Lustre_eq_3_step(convertible_hood_state x,convertible_hood_state y,_boolean *z){ *z = (x == y); } // End of Lustre_eq_3_step // Step function(s) for Lustre_hat_ctx void Lustre_hat_step(_real x,_real z[50]/*out*/){ z[0] = x; z[1] = x; z[2] = x; z[3] = x; z[4] = x; z[5] = x; z[6] = x; z[7] = x; z[8] = x; z[9] = x; z[10] = x; z[11] = x; z[12] = x; z[13] = x; z[14] = x; z[15] = x; z[16] = x; z[17] = x; z[18] = x; z[19] = x; z[20] = x; z[21] = x; z[22] = x; z[23] = x; z[24] = x; z[25] = x; z[26] = x; z[27] = x; z[28] = x; z[29] = x; z[30] = x; z[31] = x; z[32] = x; z[33] = x; z[34] = x; z[35] = x; z[36] = x; z[37] = x; z[38] = x; z[39] = x; z[40] = x; z[41] = x; z[42] = x; z[43] = x; z[44] = x; z[45] = x; z[46] = x; z[47] = x; z[48] = x; z[49] = x; } // End of Lustre_hat_step // Memory initialisation for Lustre_pre_4_ctx void Lustre_pre_4_ctx_reset(Lustre_pre_4_ctx_type* ctx){ int _i; } // Memory allocation for Lustre_pre_4_ctx Lustre_pre_4_ctx_type* Lustre_pre_4_ctx_new_ctx(){ Lustre_pre_4_ctx_type* ctx = (Lustre_pre_4_ctx_type*)calloc(1, sizeof(Lustre_pre_4_ctx_type)); // ctx->client_data = cdata; Lustre_pre_4_ctx_reset(ctx); return ctx; } // Step function(s) for Lustre_pre_4_ctx void Lustre_pre_4_get(_integer *z,Lustre_pre_4_ctx_type* ctx){ *z = ctx->_memory; } // End of Lustre_pre_4_get void Lustre_pre_4_set(_integer x,Lustre_pre_4_ctx_type* ctx){ ctx->_memory = x; } // End of Lustre_pre_4_set // Memory initialisation for Lustre_pre_3_ctx void Lustre_pre_3_ctx_reset(Lustre_pre_3_ctx_type* ctx){ int _i; } // Memory allocation for Lustre_pre_3_ctx Lustre_pre_3_ctx_type* Lustre_pre_3_ctx_new_ctx(){ Lustre_pre_3_ctx_type* ctx = (Lustre_pre_3_ctx_type*)calloc(1, sizeof(Lustre_pre_3_ctx_type)); // ctx->client_data = cdata; Lustre_pre_3_ctx_reset(ctx); return ctx; } // Step function(s) for Lustre_pre_3_ctx void Lustre_pre_3_get(_real *z,Lustre_pre_3_ctx_type* ctx){ *z = ctx->_memory; } // End of Lustre_pre_3_get void Lustre_pre_3_set(_real x,Lustre_pre_3_ctx_type* ctx){ ctx->_memory = x; } // End of Lustre_pre_3_set // Memory initialisation for Lustre_pre_2_ctx void Lustre_pre_2_ctx_reset(Lustre_pre_2_ctx_type* ctx){ int _i; } // Memory allocation for Lustre_pre_2_ctx Lustre_pre_2_ctx_type* Lustre_pre_2_ctx_new_ctx(){ Lustre_pre_2_ctx_type* ctx = (Lustre_pre_2_ctx_type*)calloc(1, sizeof(Lustre_pre_2_ctx_type)); // ctx->client_data = cdata; Lustre_pre_2_ctx_reset(ctx); return ctx; } // Step function(s) for Lustre_pre_2_ctx void Lustre_pre_2_get(convertible_hood_speed_state *z,Lustre_pre_2_ctx_type* ctx){ *z = ctx->_memory; } // End of Lustre_pre_2_get void Lustre_pre_2_set(convertible_hood_speed_state x,Lustre_pre_2_ctx_type* ctx){ ctx->_memory = x; } // End of Lustre_pre_2_set // Memory initialisation for Lustre_pre_ctx void Lustre_pre_ctx_reset(Lustre_pre_ctx_type* ctx){ int _i; } // Memory allocation for Lustre_pre_ctx Lustre_pre_ctx_type* Lustre_pre_ctx_new_ctx(){ Lustre_pre_ctx_type* ctx = (Lustre_pre_ctx_type*)calloc(1, sizeof(Lustre_pre_ctx_type)); // ctx->client_data = cdata; Lustre_pre_ctx_reset(ctx); return ctx; } // Step function(s) for Lustre_pre_ctx void Lustre_pre_get(convertible_hood_state *z,Lustre_pre_ctx_type* ctx){ *z = ctx->_memory; } // End of Lustre_pre_get void Lustre_pre_set(convertible_hood_state x,Lustre_pre_ctx_type* ctx){ ctx->_memory = x; } // End of Lustre_pre_set // Memory initialisation for Lustre_pre_6_ctx void Lustre_pre_6_ctx_reset(Lustre_pre_6_ctx_type* ctx){ int _i; } // Memory allocation for Lustre_pre_6_ctx Lustre_pre_6_ctx_type* Lustre_pre_6_ctx_new_ctx(){ Lustre_pre_6_ctx_type* ctx = (Lustre_pre_6_ctx_type*)calloc(1, sizeof(Lustre_pre_6_ctx_type)); // ctx->client_data = cdata; Lustre_pre_6_ctx_reset(ctx); return ctx; } // Step function(s) for Lustre_pre_6_ctx void Lustre_pre_6_get(convertible_vehicle_state *z,Lustre_pre_6_ctx_type* ctx){ *z = ctx->_memory; } // End of Lustre_pre_6_get void Lustre_pre_6_set(convertible_vehicle_state x,Lustre_pre_6_ctx_type* ctx){ ctx->_memory = x; } // End of Lustre_pre_6_set // Memory initialisation for Lustre_pre_5_ctx void Lustre_pre_5_ctx_reset(Lustre_pre_5_ctx_type* ctx){ int _i; } // Memory allocation for Lustre_pre_5_ctx Lustre_pre_5_ctx_type* Lustre_pre_5_ctx_new_ctx(){ Lustre_pre_5_ctx_type* ctx = (Lustre_pre_5_ctx_type*)calloc(1, sizeof(Lustre_pre_5_ctx_type)); // ctx->client_data = cdata; Lustre_pre_5_ctx_reset(ctx); return ctx; } // Step function(s) for Lustre_pre_5_ctx void Lustre_pre_5_get(_real z[50]/*out*/,Lustre_pre_5_ctx_type* ctx){ _assign_rp50(z, ctx->_memory, sizeof(_real [50])); } // End of Lustre_pre_5_get void Lustre_pre_5_set(_real x[50],Lustre_pre_5_ctx_type* ctx){ _assign_rp50(ctx->_memory, x, sizeof(_real [50])); } // End of Lustre_pre_5_set // Step function(s) for Lustre_slash_ctx void Lustre_slash_step(_real x,_real y,_real *z){ *z = (x / y); } // End of Lustre_slash_step // Step function(s) for assign_50_ctx void assign_50_step(_real v,_integer jv,_real t[50],_real nt[50]/*out*/){ convertible_update_acc _v_3; convertible_update_acc dummy; _v_3.i = 0; _v_3.j = jv; _v_3.v = v; fillred_update_cell_do_50_step(_v_3,t,&dummy,nt); } // End of assign_50_step // Step function(s) for convertible_abs_ctx void convertible_abs_step(_real x,_real *y){ _real _v_2; _boolean _v_1; _v_2 = - x; _v_1 = x >= 0.0; if (_v_1 == _true) { *y = x; } else { *y = _v_2; } } // End of convertible_abs_step // Step function(s) for convertible_braking_time_ctx void convertible_braking_time_step(_real Speed,_real *res){ _real _v_4; _v_4 = Speed * Speed; Lustre_slash_step(_v_4,5500.0,res); } // End of convertible_braking_time_step // Memory initialisation for convertible_hood_ctx void convertible_hood_ctx_reset(convertible_hood_ctx_type* ctx){ int _i; convertible_hood_speed_ctx_reset(&ctx->convertible_hood_speed_ctx_tab[0]); Lustre_pre_ctx_reset(&ctx->Lustre_pre_ctx_tab[0]); Lustre_arrow_ctx_reset(&ctx->Lustre_arrow_ctx_tab[0]); } // Memory allocation for convertible_hood_ctx convertible_hood_ctx_type* convertible_hood_ctx_new_ctx(){ convertible_hood_ctx_type* ctx = (convertible_hood_ctx_type*)calloc(1, sizeof(convertible_hood_ctx_type)); // ctx->client_data = cdata; convertible_hood_ctx_reset(ctx); return ctx; } // Step function(s) for convertible_hood_ctx void convertible_hood_step(_boolean Tic,_boolean Parked,_boolean OnOff,_boolean Done,_boolean *Locked,_real *Hood_Speed,convertible_hood_ctx_type* ctx){ _real _v_12; _real _v_11; convertible_hood_state _v_10; _boolean _v_9; convertible_hood_state _v_8; _boolean _v_7; _boolean _v_6; convertible_hood_state _v_5; convertible_hood_state pst; convertible_hood_state st; _boolean Tic_on_in_motion; Lustre_pre_get(&_v_5,&ctx->Lustre_pre_ctx_tab[0]); Lustre_arrow_step(convertible_locked,_v_5,&pst,&ctx->Lustre_arrow_ctx_tab[0]); switch (pst){ case convertible_in_motion: _v_9 = Done; if (_v_9 == _true) { _v_10 = convertible_locked; } else { _v_10 = convertible_in_motion; } st = _v_10; break; } _v_6 = OnOff & Parked; switch (pst){ case convertible_locked: _v_7 = _v_6; if (_v_7 == _true) { _v_8 = convertible_in_motion; } else { _v_8 = convertible_locked; } st = _v_8; break; } Lustre_pre_set(st,&ctx->Lustre_pre_ctx_tab[0]); Lustre_eq_3_step(st,convertible_locked,Locked); switch (st){ case convertible_in_motion: Tic_on_in_motion = Tic; convertible_hood_speed_step(Tic_on_in_motion,&_v_12,&ctx->convertible_hood_speed_ctx_tab[0]); *Hood_Speed = _v_12; break; case convertible_locked: _v_11 = 0.0; *Hood_Speed = _v_11; break; } } // End of convertible_hood_step // Memory initialisation for convertible_hood_speed_ctx void convertible_hood_speed_ctx_reset(convertible_hood_speed_ctx_type* ctx){ int _i; Lustre_pre_2_ctx_reset(&ctx->Lustre_pre_2_ctx_tab[0]); Lustre_pre_3_ctx_reset(&ctx->Lustre_pre_3_ctx_tab[0]); Lustre_pre_3_ctx_reset(&ctx->Lustre_pre_3_ctx_tab[1]); Lustre_arrow_2_ctx_reset(&ctx->Lustre_arrow_2_ctx_tab[0]); Lustre_arrow_3_ctx_reset(&ctx->Lustre_arrow_3_ctx_tab[0]); Lustre_arrow_3_ctx_reset(&ctx->Lustre_arrow_3_ctx_tab[1]); } // Memory allocation for convertible_hood_speed_ctx convertible_hood_speed_ctx_type* convertible_hood_speed_ctx_new_ctx(){ convertible_hood_speed_ctx_type* ctx = (convertible_hood_speed_ctx_type*)calloc(1, sizeof(convertible_hood_speed_ctx_type)); // ctx->client_data = cdata; convertible_hood_speed_ctx_reset(ctx); return ctx; } // Step function(s) for convertible_hood_speed_ctx void convertible_hood_speed_step(_boolean Tic,_real *Hood_Speed,convertible_hood_speed_ctx_type* ctx){ _real _v_35; _real _v_34; _real _v_33; _real _v_32; _real _v_31; _real _v_30; _real _v_29; _real _v_28; _real _v_27; _real _v_26; _real _v_25; _real _v_24; _real _v_23; _real _v_22; _real _v_21; _real _v_20; convertible_hood_speed_state _v_19; _boolean _v_18; _real _v_17; convertible_hood_speed_state _v_16; _boolean _v_15; _real _v_14; convertible_hood_speed_state _v_13; convertible_hood_speed_state pst; convertible_hood_speed_state st; _real kh; _real Hood_Percent; _real pHood_Percent; _real slow_it_down; _real pHood_Speed; switch (Tic){ case _true: Lustre_pre_2_get(&_v_13,&ctx->Lustre_pre_2_ctx_tab[0]); Lustre_arrow_2_step(convertible_wait,_v_13,&pst,&ctx->Lustre_arrow_2_ctx_tab[0]); Lustre_pre_3_get(&_v_20,&ctx->Lustre_pre_3_ctx_tab[0]); Lustre_arrow_3_step(0.0,_v_20,&pHood_Percent,&ctx->Lustre_arrow_3_ctx_tab[0]); switch (pst){ case convertible_fast: _v_14 = pHood_Percent; _v_15 = _v_14 < 85.0; if (_v_15 == _true) { _v_16 = convertible_fast; } else { _v_16 = convertible_slow; } st = _v_16; break; case convertible_slow: _v_17 = pHood_Percent; _v_18 = _v_17 < 100.0; if (_v_18 == _true) { _v_19 = convertible_slow; } else { _v_19 = convertible_wait; } st = _v_19; break; case convertible_wait: st = convertible_fast; break; } Lustre_pre_2_set(st,&ctx->Lustre_pre_2_ctx_tab[0]); Lustre_slash_step(5.,0.1,&_v_25); Lustre_slash_step(100.,_v_25,&kh); _v_30 = kh + pHood_Percent; switch (st){ case convertible_fast: _v_31 = _v_30; Hood_Percent = _v_31; break; case convertible_slow: _v_34 = pHood_Percent; _v_21 = pHood_Percent; _v_22 = 100.0 - _v_21; Lustre_slash_step(_v_22,5.0,&_v_23); convertible_sqrt_step(_v_23,&_v_24); convertible_sqrt_step(_v_24,&slow_it_down); _v_32 = kh; _v_33 = slow_it_down * _v_32; _v_35 = _v_33 + _v_34; Hood_Percent = _v_35; break; case convertible_wait: Hood_Percent = 0.0; Hood_Percent = 0.0; break; } Lustre_pre_3_set(Hood_Percent,&ctx->Lustre_pre_3_ctx_tab[0]); break; } Lustre_pre_3_get(&_v_26,&ctx->Lustre_pre_3_ctx_tab[1]); Lustre_arrow_3_step(0.0,_v_26,&pHood_Speed,&ctx->Lustre_arrow_3_ctx_tab[1]); switch (Tic){ case _false: _v_27 = pHood_Speed; *Hood_Speed = _v_27; break; case _true: switch (st){ case convertible_fast: _v_29 = 10.0; _v_29 = 10.0; break; case convertible_slow: _v_28 = 10.0 * slow_it_down; _v_29 = _v_28; break; case convertible_wait: _v_29 = 0.0; _v_29 = 0.0; break; } *Hood_Speed = _v_29; break; } Lustre_pre_3_set(*Hood_Speed,&ctx->Lustre_pre_3_ctx_tab[1]); } // End of convertible_hood_speed_step // Memory initialisation for convertible_main_ctx void convertible_main_ctx_reset(convertible_main_ctx_type* ctx){ int _i; convertible_vehicle_ctx_reset(&ctx->convertible_vehicle_ctx_tab[0]); convertible_speed_kmh_ctx_reset(&ctx->convertible_speed_kmh_ctx_tab[0]); convertible_may_collide_ctx_reset(&ctx->convertible_may_collide_ctx_tab[0]); convertible_hood_ctx_reset(&ctx->convertible_hood_ctx_tab[0]); } // Memory allocation for convertible_main_ctx convertible_main_ctx_type* convertible_main_ctx_new_ctx(){ convertible_main_ctx_type* ctx = (convertible_main_ctx_type*)calloc(1, sizeof(convertible_main_ctx_type)); // ctx->client_data = cdata; convertible_main_ctx_reset(ctx); return ctx; } // Step function(s) for convertible_main_ctx void convertible_main_step(_boolean Start,_boolean Parked,_boolean Rot,_boolean Tic,_boolean OnOff,_boolean Done,_real Distance,_boolean *Danger,_boolean *Locked,_real *Speed,_real *Hood_Speed,convertible_main_ctx_type* ctx){ _boolean _v_38; _real _v_37; _real _v_36; convertible_vehicle_state St; _boolean _v_39; _boolean _v_40; _v_39 = OnOff & Start; _v_40 = ! _v_39; convertible_hood_step(Tic,Parked,OnOff,Done,Locked,Hood_Speed,&ctx->convertible_hood_ctx_tab[0]); convertible_speed_kmh_step(Rot,Tic,Speed,&ctx->convertible_speed_kmh_ctx_tab[0]); convertible_vehicle_step(Start,*Locked,*Speed,Distance,&St,&ctx->convertible_vehicle_ctx_tab[0]); switch (St){ case convertible_anti_col: _v_37 = Distance; _v_36 = *Speed; convertible_may_collide_step(_v_36,_v_37,&_v_38,&ctx->convertible_may_collide_ctx_tab[0]); *Danger = _v_38; break; case convertible_run: *Danger = _false; *Danger = _false; break; case convertible_stationnary: *Danger = _false; *Danger = _false; break; } } // End of convertible_main_step // Step function(s) for convertible_maxr_ctx void convertible_maxr_step(_real x,_real y,_real *res){ _boolean _v_41; _v_41 = x < y; if (_v_41 == _true) { *res = y; } else { *res = x; } } // End of convertible_maxr_step // Memory initialisation for convertible_may_collide_ctx void convertible_may_collide_ctx_reset(convertible_may_collide_ctx_type* ctx){ int _i; Lustre_pre_3_ctx_reset(&ctx->Lustre_pre_3_ctx_tab[0]); Lustre_arrow_3_ctx_reset(&ctx->Lustre_arrow_3_ctx_tab[0]); } // Memory allocation for convertible_may_collide_ctx convertible_may_collide_ctx_type* convertible_may_collide_ctx_new_ctx(){ convertible_may_collide_ctx_type* ctx = (convertible_may_collide_ctx_type*)calloc(1, sizeof(convertible_may_collide_ctx_type)); // ctx->client_data = cdata; convertible_may_collide_ctx_reset(ctx); return ctx; } // Step function(s) for convertible_may_collide_ctx void convertible_may_collide_step(_real Speed,_real Distance,_boolean *Res,convertible_may_collide_ctx_type* ctx){ _real _v_47; _real _v_46; _real _v_45; _real _v_44; _real _v_43; _real _v_42; _real Accel; _real tChoc; _real tBrake; Lustre_pre_3_get(&_v_42,&ctx->Lustre_pre_3_ctx_tab[0]); _v_43 = Speed - _v_42; Lustre_slash_step(_v_43,0.1,&_v_44); Lustre_pre_3_set(Speed,&ctx->Lustre_pre_3_ctx_tab[0]); Lustre_arrow_3_step(0.0,_v_44,&Accel,&ctx->Lustre_arrow_3_ctx_tab[0]); convertible_braking_time_step(Speed,&tBrake); _v_46 = -2.0 * Distance; _v_45 = 2.0 * Speed; convertible_solve_eq_d2_step(Accel,_v_45,_v_46,&tChoc); _v_47 = 2.0 + tBrake; *Res = tChoc < _v_47; } // End of convertible_may_collide_step // Step function(s) for convertible_ms_to_kmh_ctx void convertible_ms_to_kmh_step(_real x,_real *res){ *res = x * 3.6; } // End of convertible_ms_to_kmh_step // Step function(s) for convertible_solve_eq_d2_ctx void convertible_solve_eq_d2_step(_real a,_real b,_real c,_real *res){ _real _v_75; _real _v_74; _real _v_73; _real _v_72; _real _v_71; _real _v_70; _real _v_69; _real _v_68; _real _v_67; _real _v_66; _real _v_65; _real _v_64; _real _v_63; _real _v_62; _real _v_61; _real _v_60; _real _v_59; _real _v_58; convertible_eq_case _v_57; convertible_eq_case _v_56; _boolean _v_55; _boolean _v_54; convertible_eq_case _v_53; _boolean _v_52; _boolean _v_51; _real _v_50; _real _v_49; _real _v_48; _real delta; convertible_eq_case sol_nb; _real a2; _real b2; _real delta_pos; _v_49 = 4.0 * a; _v_50 = _v_49 * c; _v_48 = b * b; delta = _v_48 - _v_50; Lustre_eq_2_step(delta,0.0,&_v_55); if (_v_55 == _true) { _v_56 = convertible_one_sol; } else { _v_56 = convertible_two_sol; } _v_54 = delta < 0.0; if (_v_54 == _true) { _v_57 = convertible_no_sol; } else { _v_57 = _v_56; } Lustre_eq_2_step(b,0.0,&_v_52); if (_v_52 == _true) { _v_53 = convertible_no_sol; } else { _v_53 = convertible_deg1; } Lustre_eq_2_step(a,0.0,&_v_51); if (_v_51 == _true) { sol_nb = _v_53; } else { sol_nb = _v_57; } switch (sol_nb){ case convertible_two_sol: delta_pos = delta; a2 = a; b2 = b; convertible_sqrt_step(delta_pos,&_v_66); _v_67 = 2.0 * a2; Lustre_slash_step(_v_66,_v_67,&_v_68); _v_65 = - b2; _v_69 = _v_65 + _v_68; convertible_sqrt_step(delta_pos,&_v_71); _v_72 = 2.0 * a2; Lustre_slash_step(_v_71,_v_72,&_v_73); _v_70 = - b2; _v_74 = _v_70 - _v_73; convertible_maxr_step(_v_69,_v_74,&_v_75); break; } _v_61 = - b; _v_62 = 2.0 * a; Lustre_slash_step(_v_61,_v_62,&_v_63); switch (sol_nb){ case convertible_one_sol: _v_64 = _v_63; break; } _v_58 = - c; Lustre_slash_step(_v_58,b,&_v_59); switch (sol_nb){ case convertible_deg1: _v_60 = _v_59; *res = _v_60; break; case convertible_two_sol: *res = _v_75; break; case convertible_one_sol: *res = _v_64; break; case convertible_no_sol: *res = -1.0; *res = -1.0; break; } } // End of convertible_solve_eq_d2_step // Memory initialisation for convertible_speed_kmh_ctx void convertible_speed_kmh_ctx_reset(convertible_speed_kmh_ctx_type* ctx){ int _i; sum_50_0d1_ctx_reset(&ctx->sum_50_0d1_ctx_tab[0]); sum_50_0d0_ctx_reset(&ctx->sum_50_0d0_ctx_tab[0]); Lustre_pre_3_ctx_reset(&ctx->Lustre_pre_3_ctx_tab[0]); Lustre_pre_3_ctx_reset(&ctx->Lustre_pre_3_ctx_tab[1]); Lustre_pre_3_ctx_reset(&ctx->Lustre_pre_3_ctx_tab[2]); Lustre_arrow_3_ctx_reset(&ctx->Lustre_arrow_3_ctx_tab[0]); Lustre_arrow_3_ctx_reset(&ctx->Lustre_arrow_3_ctx_tab[1]); Lustre_arrow_3_ctx_reset(&ctx->Lustre_arrow_3_ctx_tab[2]); } // Memory allocation for convertible_speed_kmh_ctx convertible_speed_kmh_ctx_type* convertible_speed_kmh_ctx_new_ctx(){ convertible_speed_kmh_ctx_type* ctx = (convertible_speed_kmh_ctx_type*)calloc(1, sizeof(convertible_speed_kmh_ctx_type)); // ctx->client_data = cdata; convertible_speed_kmh_ctx_reset(ctx); return ctx; } // Step function(s) for convertible_speed_kmh_ctx void convertible_speed_kmh_step(_boolean Rot,_boolean Tic,_real *Speed,convertible_speed_kmh_ctx_type* ctx){ _real _v_87, _v_86, _v_85, _v_84, _v_83, _v_82, _v_81, _v_80; _real _v_79, _v_78, _v_77, _v_76, d, t, pd, pt, dx, tx; _boolean TicOrRot; if (Rot == _true) { dx = 1.4; } else { dx = 0.0; } if (Tic == _true) { tx = 0.1; } else { tx = 0.0; } TicOrRot = Tic | Rot; Lustre_pre_3_get(&_v_76,&ctx->Lustre_pre_3_ctx_tab[0]); Lustre_arrow_3_step(0.0,_v_76,&pd,&ctx->Lustre_arrow_3_ctx_tab[0]); switch (TicOrRot){ case _false: _v_78 = pd; d = _v_78; break; case _true: _v_79 = dx; sum_50_0d0_step(_v_79,&_v_80,&ctx->sum_50_0d0_ctx_tab[0]); d = _v_80; break; } Lustre_pre_3_set(d,&ctx->Lustre_pre_3_ctx_tab[0]); Lustre_pre_3_get(&_v_77,&ctx->Lustre_pre_3_ctx_tab[1]); Lustre_arrow_3_step(0.0,_v_77,&pt,&ctx->Lustre_arrow_3_ctx_tab[1]); switch (TicOrRot){ case _false: _v_83 = pt; _v_84 = _v_83; break; case _true: _v_81 = tx; sum_50_0d1_step(_v_81,&_v_82,&ctx->sum_50_0d1_ctx_tab[0]); _v_84 = _v_82; break; } convertible_maxr_step(0.1,_v_84,&t); Lustre_pre_3_set(t,&ctx->Lustre_pre_3_ctx_tab[1]); Lustre_pre_3_get(&_v_87,&ctx->Lustre_pre_3_ctx_tab[2]); Lustre_slash_step(d,t,&_v_85); convertible_ms_to_kmh_step(_v_85,&_v_86); Lustre_pre_3_set(_v_86,&ctx->Lustre_pre_3_ctx_tab[2]); Lustre_arrow_3_step(0.0,_v_87,Speed,&ctx->Lustre_arrow_3_ctx_tab[2]); } // End of convertible_speed_kmh_step // Step function(s) for convertible_sqrt_ctx void convertible_sqrt_step(_real R,_real *Sqrt){ squareR_5_step(R,1.0,Sqrt); } // End of convertible_sqrt_step // Memory initialisation for convertible_vehicle_ctx void convertible_vehicle_ctx_reset(convertible_vehicle_ctx_type* ctx){ int _i; Lustre_pre_6_ctx_reset(&ctx->Lustre_pre_6_ctx_tab[0]); Lustre_arrow_6_ctx_reset(&ctx->Lustre_arrow_6_ctx_tab[0]); } // Memory allocation for convertible_vehicle_ctx convertible_vehicle_ctx_type* convertible_vehicle_ctx_new_ctx(){ convertible_vehicle_ctx_type* ctx = (convertible_vehicle_ctx_type*)calloc(1, sizeof(convertible_vehicle_ctx_type)); // ctx->client_data = cdata; convertible_vehicle_ctx_reset(ctx); return ctx; } // Step function(s) for convertible_vehicle_ctx void convertible_vehicle_step(_boolean Start,_boolean Locked,_real Speed,_real Distance,convertible_vehicle_state *st,convertible_vehicle_ctx_type* ctx){ convertible_vehicle_state _v_153; _boolean _v_152; _boolean _v_151; convertible_vehicle_state _v_150; convertible_vehicle_state _v_149; _boolean _v_148; _boolean _v_147; _boolean _v_146; convertible_vehicle_state _v_145; _boolean _v_144; _boolean _v_143; convertible_vehicle_state _v_142; convertible_vehicle_state pst; _boolean ac_cond; Lustre_pre_6_get(&_v_142,&ctx->Lustre_pre_6_ctx_tab[0]); Lustre_arrow_6_step(convertible_stationnary,_v_142,&pst,&ctx->Lustre_arrow_6_ctx_tab[0]); ac_cond = Speed >= 110.0; switch (pst){ case convertible_anti_col: _v_151 = ac_cond; _v_152 = ! _v_151; if (_v_152 == _true) { _v_153 = convertible_run; } else { _v_153 = convertible_anti_col; } *st = _v_153; break; } Lustre_eq_2_step(Speed,0.0,&_v_147); switch (pst){ case convertible_run: _v_148 = _v_147; if (_v_148 == _true) { _v_149 = convertible_stationnary; } else { _v_149 = convertible_run; } _v_146 = ac_cond; if (_v_146 == _true) { _v_150 = convertible_anti_col; } else { _v_150 = _v_149; } *st = _v_150; break; } _v_143 = Start & Locked; switch (pst){ case convertible_stationnary: _v_144 = _v_143; if (_v_144 == _true) { _v_145 = convertible_run; } else { _v_145 = convertible_stationnary; } *st = _v_145; break; } Lustre_pre_6_set(*st,&ctx->Lustre_pre_6_ctx_tab[0]); } // End of convertible_vehicle_step // Step function(s) for fillred_update_cell_do_50_ctx void fillred_update_cell_do_50_step(convertible_update_acc acc,_real cell[50],convertible_update_acc *nacc,_real ncell[50]/*out*/){ int _i; for (_i=0 ; _i<49 ; _i+=2){ update_cell_do_50_step(acc,cell[_i],&acc,&ncell[_i]); update_cell_do_50_step(acc,cell[_i+1],&acc,&ncell[_i+1]); } *nacc = acc; } // End of fillred_update_cell_do_50_step // Step function(s) for red_rplus_50_real_ctx void red_rplus_50_real_step(_real i1,_real i2[50],_real *o){ int _i; for (_i=0 ; _i<49 ; _i+=2){ i1 = i1 + i2[_i]; i1 = i1 + i2[_i+1]; } *o = i1; } // End of red_rplus_50_real_step // Step function(s) for squareR_1_ctx void squareR_1_step(_real x,_real presqrt,_real *Sqrt){ _real _v_91; _real _v_90; _real _v_89; _real _v_88; _real sqrt; _boolean ecart; Lustre_slash_step(x,presqrt,&_v_90); _v_91 = presqrt + _v_90; sqrt = 0.5 * _v_91; _v_88 = presqrt - sqrt; convertible_abs_step(_v_88,&_v_89); ecart = _v_89 < 0.0005; *Sqrt = sqrt; } // End of squareR_1_step // Step function(s) for squareR_2_ctx void squareR_2_step(_real x,_real presqrt,_real *Sqrt){ _real _v_99; _real _v_98; _real _v_97; _real _v_96; _real _v_95; _real _v_94; _real _v_93; _real _v_92; _real sqrt; _boolean ecart; Lustre_slash_step(x,presqrt,&_v_94); _v_95 = presqrt + _v_94; sqrt = 0.5 * _v_95; _v_92 = presqrt - sqrt; convertible_abs_step(_v_92,&_v_93); ecart = _v_93 < 0.0005; switch (ecart){ case _true: _v_99 = sqrt; *Sqrt = _v_99; break; case _false: _v_97 = sqrt; _v_96 = x; squareR_1_step(_v_96,_v_97,&_v_98); *Sqrt = _v_98; break; } } // End of squareR_2_step // Step function(s) for squareR_3_ctx void squareR_3_step(_real x,_real presqrt,_real *Sqrt){ _real _v_107; _real _v_106; _real _v_105; _real _v_104; _real _v_103; _real _v_102; _real _v_101; _real _v_100; _real sqrt; _boolean ecart; Lustre_slash_step(x,presqrt,&_v_102); _v_103 = presqrt + _v_102; sqrt = 0.5 * _v_103; _v_100 = presqrt - sqrt; convertible_abs_step(_v_100,&_v_101); ecart = _v_101 < 0.0005; switch (ecart){ case _true: _v_107 = sqrt; *Sqrt = _v_107; break; case _false: _v_105 = sqrt; _v_104 = x; squareR_2_step(_v_104,_v_105,&_v_106); *Sqrt = _v_106; break; } } // End of squareR_3_step // Step function(s) for squareR_4_ctx void squareR_4_step(_real x,_real presqrt,_real *Sqrt){ _real _v_115; _real _v_114; _real _v_113; _real _v_112; _real _v_111; _real _v_110; _real _v_109; _real _v_108; _real sqrt; _boolean ecart; Lustre_slash_step(x,presqrt,&_v_110); _v_111 = presqrt + _v_110; sqrt = 0.5 * _v_111; _v_108 = presqrt - sqrt; convertible_abs_step(_v_108,&_v_109); ecart = _v_109 < 0.0005; switch (ecart){ case _true: _v_115 = sqrt; *Sqrt = _v_115; break; case _false: _v_113 = sqrt; _v_112 = x; squareR_3_step(_v_112,_v_113,&_v_114); *Sqrt = _v_114; break; } } // End of squareR_4_step // Step function(s) for squareR_5_ctx void squareR_5_step(_real x,_real presqrt,_real *Sqrt){ _real _v_123; _real _v_122; _real _v_121; _real _v_120; _real _v_119; _real _v_118; _real _v_117; _real _v_116; _real sqrt; _boolean ecart; Lustre_slash_step(x,presqrt,&_v_118); _v_119 = presqrt + _v_118; sqrt = 0.5 * _v_119; _v_116 = presqrt - sqrt; convertible_abs_step(_v_116,&_v_117); ecart = _v_117 < 0.0005; switch (ecart){ case _true: _v_123 = sqrt; *Sqrt = _v_123; break; case _false: _v_121 = sqrt; _v_120 = x; squareR_4_step(_v_120,_v_121,&_v_122); *Sqrt = _v_122; break; } } // End of squareR_5_step // Memory initialisation for sum_50_0d0_ctx void sum_50_0d0_ctx_reset(sum_50_0d0_ctx_type* ctx){ int _i; Lustre_pre_5_ctx_reset(&ctx->Lustre_pre_5_ctx_tab[0]); Lustre_pre_4_ctx_reset(&ctx->Lustre_pre_4_ctx_tab[0]); Lustre_arrow_5_ctx_reset(&ctx->Lustre_arrow_5_ctx_tab[0]); Lustre_arrow_4_ctx_reset(&ctx->Lustre_arrow_4_ctx_tab[0]); } // Memory allocation for sum_50_0d0_ctx sum_50_0d0_ctx_type* sum_50_0d0_ctx_new_ctx(){ sum_50_0d0_ctx_type* ctx = (sum_50_0d0_ctx_type*)calloc(1, sizeof(sum_50_0d0_ctx_type)); // ctx->client_data = cdata; sum_50_0d0_ctx_reset(ctx); return ctx; } // Step function(s) for sum_50_0d0_ctx void sum_50_0d0_step(_real s,_real *res,sum_50_0d0_ctx_type* ctx){ _integer _v_128; _real _v_127[50]; _real _v_126[50]; _integer _v_125; _integer _v_124; _real a[50]; _real pre_a[50]; _integer i; Lustre_pre_4_get(&_v_124,&ctx->Lustre_pre_4_ctx_tab[0]); Lustre_arrow_4_step(0,_v_124,&_v_125,&ctx->Lustre_arrow_4_ctx_tab[0]); i = _v_125 + 1; Lustre_pre_4_set(i,&ctx->Lustre_pre_4_ctx_tab[0]); Lustre_pre_5_get(_v_127,&ctx->Lustre_pre_5_ctx_tab[0]); Lustre_hat_step(0.0,_v_126); Lustre_arrow_5_step(_v_126,_v_127,pre_a,&ctx->Lustre_arrow_5_ctx_tab[0]); _v_128 = i % 50; assign_50_step(s,_v_128,pre_a,a); Lustre_pre_5_set(a,&ctx->Lustre_pre_5_ctx_tab[0]); red_rplus_50_real_step(0.0,a,res); } // End of sum_50_0d0_step // Memory initialisation for sum_50_0d1_ctx void sum_50_0d1_ctx_reset(sum_50_0d1_ctx_type* ctx){ int _i; Lustre_pre_5_ctx_reset(&ctx->Lustre_pre_5_ctx_tab[0]); Lustre_pre_4_ctx_reset(&ctx->Lustre_pre_4_ctx_tab[0]); Lustre_arrow_5_ctx_reset(&ctx->Lustre_arrow_5_ctx_tab[0]); Lustre_arrow_4_ctx_reset(&ctx->Lustre_arrow_4_ctx_tab[0]); } // Memory allocation for sum_50_0d1_ctx sum_50_0d1_ctx_type* sum_50_0d1_ctx_new_ctx(){ sum_50_0d1_ctx_type* ctx = (sum_50_0d1_ctx_type*)calloc(1, sizeof(sum_50_0d1_ctx_type)); // ctx->client_data = cdata; sum_50_0d1_ctx_reset(ctx); return ctx; } // Step function(s) for sum_50_0d1_ctx void sum_50_0d1_step(_real s,_real *res,sum_50_0d1_ctx_type* ctx){ _integer _v_133; _real _v_132[50]; _real _v_131[50]; _integer _v_130; _integer _v_129; _real a[50]; _real pre_a[50]; _integer i; Lustre_pre_4_get(&_v_129,&ctx->Lustre_pre_4_ctx_tab[0]); Lustre_arrow_4_step(0,_v_129,&_v_130,&ctx->Lustre_arrow_4_ctx_tab[0]); i = _v_130 + 1; Lustre_pre_4_set(i,&ctx->Lustre_pre_4_ctx_tab[0]); Lustre_pre_5_get(_v_132,&ctx->Lustre_pre_5_ctx_tab[0]); Lustre_hat_step(0.1,_v_131); Lustre_arrow_5_step(_v_131,_v_132,pre_a,&ctx->Lustre_arrow_5_ctx_tab[0]); _v_133 = i % 50; assign_50_step(s,_v_133,pre_a,a); Lustre_pre_5_set(a,&ctx->Lustre_pre_5_ctx_tab[0]); red_rplus_50_real_step(0.0,a,res); } // End of sum_50_0d1_step // Step function(s) for update_cell_do_50_ctx void update_cell_do_50_step(convertible_update_acc acc,_real cell,convertible_update_acc *nacc,_real *ncell){ _integer _v_139; _integer _v_138; _integer _v_140; _real _v_141; _real _v_137; _boolean _v_136; _integer _v_135; _integer _v_134; _v_137 = acc.v; _v_134 = acc.i; _v_135 = acc.j; Lustre_eq_step(_v_134,_v_135,&_v_136); if (_v_136 == _true) { *ncell = _v_137; } else { *ncell = cell; } _v_138 = acc.i; _v_139 = _v_138 + 1; _v_140 = acc.j; _v_141 = acc.v; nacc->i = _v_139; nacc->j = _v_140; nacc->v = _v_141; } // End of update_cell_do_50_step