|
@@ -0,0 +1,175 @@
|
|
|
+(* Auto-generated from "settings.atd" *)
|
|
|
+
|
|
|
+
|
|
|
+type rc_file = Settings_t.rc_file = {
|
|
|
+ progs: string list;
|
|
|
+ settings: string list
|
|
|
+}
|
|
|
+
|
|
|
+let write__1 = (
|
|
|
+ Ag_oj_run.write_list (
|
|
|
+ Yojson.Safe.write_string
|
|
|
+ )
|
|
|
+)
|
|
|
+let string_of__1 ?(len = 1024) x =
|
|
|
+ let ob = Bi_outbuf.create len in
|
|
|
+ write__1 ob x;
|
|
|
+ Bi_outbuf.contents ob
|
|
|
+let read__1 = (
|
|
|
+ Ag_oj_run.read_list (
|
|
|
+ Ag_oj_run.read_string
|
|
|
+ )
|
|
|
+)
|
|
|
+let _1_of_string s =
|
|
|
+ read__1 (Yojson.Safe.init_lexer ()) (Lexing.from_string s)
|
|
|
+let write_rc_file : _ -> rc_file -> _ = (
|
|
|
+ fun ob x ->
|
|
|
+ Bi_outbuf.add_char ob '{';
|
|
|
+ let is_first = ref true in
|
|
|
+ if !is_first then
|
|
|
+ is_first := false
|
|
|
+ else
|
|
|
+ Bi_outbuf.add_char ob ',';
|
|
|
+ Bi_outbuf.add_string ob "\"progs\":";
|
|
|
+ (
|
|
|
+ write__1
|
|
|
+ )
|
|
|
+ ob x.progs;
|
|
|
+ if !is_first then
|
|
|
+ is_first := false
|
|
|
+ else
|
|
|
+ Bi_outbuf.add_char ob ',';
|
|
|
+ Bi_outbuf.add_string ob "\"settings\":";
|
|
|
+ (
|
|
|
+ write__1
|
|
|
+ )
|
|
|
+ ob x.settings;
|
|
|
+ Bi_outbuf.add_char ob '}';
|
|
|
+)
|
|
|
+let string_of_rc_file ?(len = 1024) x =
|
|
|
+ let ob = Bi_outbuf.create len in
|
|
|
+ write_rc_file ob x;
|
|
|
+ Bi_outbuf.contents ob
|
|
|
+let read_rc_file = (
|
|
|
+ fun p lb ->
|
|
|
+ Yojson.Safe.read_space p lb;
|
|
|
+ Yojson.Safe.read_lcurl p lb;
|
|
|
+ let field_progs = ref (Obj.magic 0.0) in
|
|
|
+ let field_settings = ref (Obj.magic 0.0) in
|
|
|
+ let bits0 = ref 0 in
|
|
|
+ try
|
|
|
+ Yojson.Safe.read_space p lb;
|
|
|
+ Yojson.Safe.read_object_end lb;
|
|
|
+ Yojson.Safe.read_space p lb;
|
|
|
+ let f =
|
|
|
+ fun s pos len ->
|
|
|
+ if pos < 0 || len < 0 || pos + len > String.length s then
|
|
|
+ invalid_arg "out-of-bounds substring position or length";
|
|
|
+ match len with
|
|
|
+ | 5 -> (
|
|
|
+ if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 's' then (
|
|
|
+ 0
|
|
|
+ )
|
|
|
+ else (
|
|
|
+ -1
|
|
|
+ )
|
|
|
+ )
|
|
|
+ | 8 -> (
|
|
|
+ if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'g' && String.unsafe_get s (pos+7) = 's' then (
|
|
|
+ 1
|
|
|
+ )
|
|
|
+ else (
|
|
|
+ -1
|
|
|
+ )
|
|
|
+ )
|
|
|
+ | _ -> (
|
|
|
+ -1
|
|
|
+ )
|
|
|
+ in
|
|
|
+ let i = Yojson.Safe.map_ident p f lb in
|
|
|
+ Ag_oj_run.read_until_field_value p lb;
|
|
|
+ (
|
|
|
+ match i with
|
|
|
+ | 0 ->
|
|
|
+ field_progs := (
|
|
|
+ (
|
|
|
+ read__1
|
|
|
+ ) p lb
|
|
|
+ );
|
|
|
+ bits0 := !bits0 lor 0x1;
|
|
|
+ | 1 ->
|
|
|
+ field_settings := (
|
|
|
+ (
|
|
|
+ read__1
|
|
|
+ ) p lb
|
|
|
+ );
|
|
|
+ bits0 := !bits0 lor 0x2;
|
|
|
+ | _ -> (
|
|
|
+ Yojson.Safe.skip_json p lb
|
|
|
+ )
|
|
|
+ );
|
|
|
+ while true do
|
|
|
+ Yojson.Safe.read_space p lb;
|
|
|
+ Yojson.Safe.read_object_sep p lb;
|
|
|
+ Yojson.Safe.read_space p lb;
|
|
|
+ let f =
|
|
|
+ fun s pos len ->
|
|
|
+ if pos < 0 || len < 0 || pos + len > String.length s then
|
|
|
+ invalid_arg "out-of-bounds substring position or length";
|
|
|
+ match len with
|
|
|
+ | 5 -> (
|
|
|
+ if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 's' then (
|
|
|
+ 0
|
|
|
+ )
|
|
|
+ else (
|
|
|
+ -1
|
|
|
+ )
|
|
|
+ )
|
|
|
+ | 8 -> (
|
|
|
+ if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'g' && String.unsafe_get s (pos+7) = 's' then (
|
|
|
+ 1
|
|
|
+ )
|
|
|
+ else (
|
|
|
+ -1
|
|
|
+ )
|
|
|
+ )
|
|
|
+ | _ -> (
|
|
|
+ -1
|
|
|
+ )
|
|
|
+ in
|
|
|
+ let i = Yojson.Safe.map_ident p f lb in
|
|
|
+ Ag_oj_run.read_until_field_value p lb;
|
|
|
+ (
|
|
|
+ match i with
|
|
|
+ | 0 ->
|
|
|
+ field_progs := (
|
|
|
+ (
|
|
|
+ read__1
|
|
|
+ ) p lb
|
|
|
+ );
|
|
|
+ bits0 := !bits0 lor 0x1;
|
|
|
+ | 1 ->
|
|
|
+ field_settings := (
|
|
|
+ (
|
|
|
+ read__1
|
|
|
+ ) p lb
|
|
|
+ );
|
|
|
+ bits0 := !bits0 lor 0x2;
|
|
|
+ | _ -> (
|
|
|
+ Yojson.Safe.skip_json p lb
|
|
|
+ )
|
|
|
+ );
|
|
|
+ done;
|
|
|
+ assert false;
|
|
|
+ with Yojson.End_of_object -> (
|
|
|
+ if !bits0 <> 0x3 then Ag_oj_run.missing_fields p [| !bits0 |] [| "progs"; "settings" |];
|
|
|
+ (
|
|
|
+ {
|
|
|
+ progs = !field_progs;
|
|
|
+ settings = !field_settings;
|
|
|
+ }
|
|
|
+ : rc_file)
|
|
|
+ )
|
|
|
+)
|
|
|
+let rc_file_of_string s =
|
|
|
+ read_rc_file (Yojson.Safe.init_lexer ()) (Lexing.from_string s)
|