12345678910111213141516171819202122232425262728293031(* Claude Code
*
* Copyright (C) 2026 Yoann Padioleau
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License
* (LGPL) as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*)(* See Control.mli *)typet=Knoboffloat*float|Switch|Selectorofstringlistleton(x:float):bool=x>=0.5letof_bool(b:bool):float=ifbthen1.else0.letindex(x:float):int=int_of_float(Float.roundx)letto_string(c:t)(x:float):string=matchcwith|Knob_->Printf.sprintf"%.3f"x|Switch->ifonxthen"on"else"off"|Selectorlabels->List.nthlabels(indexx)letof_string(c:t)(s:string):floatoption=matchcwith|Knob(lo,hi)->Option.map(funx->Float.minhi(Float.maxlox))(float_of_string_opts)|Switch->(matchswith"on"->Some1.|"off"->Some0.|_->None)|Selectorlabels->letrecfindi=function[]->None|l::rest->ifl=sthenSome(float_of_inti)elsefind(i+1)restinfind0labels