1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283openBaseopenPrintfletmeth_of_constr=sprintf"c_%s"letself_arg_name="fself"letself_typ_param_name="self"letgcata_name_for_typname=Printf.sprintf"gcata_%s"nameletclass_name_for_typname=Printf.sprintf"%s_t"namelettrait_class_name_for_typ~traitname=class_name_for_typ(ifString.equaltrait""thennameelsePrintf.sprintf"%s_%s"traitname)letmeth_name_for_constructor=meth_of_constrletfix_name~plugin_name=sprintf"%s_fix"(* 1st structure is planned to contain transformation function *)lettyp1_for_class_arg~plugin=sprintf"%s_t_%s_1"pluginlettrf_field~plugin=sprintf"%s_%s_trf"plugin(* Should contain object for transforming mutally declared type *)(* let typ2_for_class_arg ~plugin_name = sprintf "%s_t_%s_2" plugin_name *)letmut_ofield~plugin=sprintf"%s_o%s_func"plugin(* Largest. Containt not fully initialized stib class *)lettyp3_for_class_arg~plugin_name=sprintf"%s_t_%s_3"plugin_nameletmut_oclass_field~plugin=sprintf"%s_%s_func"pluginletextra_param_name="extra"letself_arg_name="fself"letall_trfs_together="all_trfs_together"letmake_extra_param=sprintf"%s_%s"extra_param_nameopenPpxlibletmeth_name_for_recordtdecl=sprintf"do_%s"tdecl.ptype_name.txtletfix_result_recordtraittdecls=assert(List.lengthtdecls>0);letname=(List.hd_exntdecls).ptype_name.txtinString.concat~sep:"_"[trait;"fix";name]lettrf_functiontraits=Printf.sprintf"%s_%s"traitsletmake_stub_class_name~plugintname=sprintf"%s_%s_t_stub"plugintnameletstub_class_name~plugintdecl=make_stub_class_name~plugintdecl.ptype_name.txtletinit_trf_functiontraits=trf_functiontraits^"_0"letmake_fix_nametdecls=(* Let's use only first type for fix function definition *)assert(List.lengthtdecls>0);letname=(List.hd_exntdecls).ptype_name.txtinString.concat~sep:"_"["fix";name]letname_fix_generated_object~plugintdecl=sprintf"%s_o_%s"plugintdecl.ptype_name.txtletprereq_name~plugintail=sprintf"%s_%s_prereq"plugintailletmut_arg_composite=(* "mut_trfs_here" *)"call"letmut_arg_name~plugin=sprintf"for_%s_%s"plugin(* let mut_class_stubname ~plugin tdecl =
* sprintf "%s_%s_stub" plugin_name tdecl.ptype_name.txt *)letfix_resulttdecl=sprintf"fix_result_%s"tdecl.ptype_name.txtletcname_indextypname=String.capitalizetypnameletmutuals_pack="_mutuals_pack"lethack_index_nametdeclss=assert(List.lengthtdecls>0);sprintf"%s_%s"s(List.hd_exntdecls).ptype_name.txtletfix_func_name?for_trait=matchfor_with|None->sprintf"%s_fix"trait|Somes->sprintf"%s_%s_fix"traitsletfix_func_name_tdeclstraittdecls=assert(List.lengthtdecls>0);fix_func_name~for_:(List.hd_exntdecls).ptype_name.txttraitletfor_traits=sprintf"%s_%s"traits