text
stringlengths
0
601k
let has_pforms t = Option . is_none ( text_only t )
let encode t = match text_only t with | Some s -> Dune_lang . atom_or_quoted_string s | None -> Dune_lang . Template { loc = t . loc ; quoted = t . quoted ; parts = List . map t . parts ~ f ( : function | Text s -> Dune_lang . Template . Text s | Error ( _ , msg ) -> raise ( User_error . E msg ) | Pform ( source , pfor...
let to_dyn t = Dune_lang . to_dyn ( encode t )
let remove_locs { quoted ; loc = _ ; parts } = { quoted ; loc = Loc . none ; parts = List . map parts ~ f ( : function | Text _ as p -> p | Error ( source , msg ) -> Error ( { source with loc = Loc . none } , { msg with loc = None } ) | Pform ( source , p ) -> Pform ( { source with loc = Loc . none } , p ) ) }
let ant = function | x -> x
let literal : Astf . literal -> Astfn . literal = function | ` Chr ( _a0 , _a1 ) -> ` Chr _a1 | ` Int ( _a0 , _a1 ) -> ` Int _a1 | ` Int32 ( _a0 , _a1 ) -> ` Int32 _a1 | ` Int64 ( _a0 , _a1 ) -> ` Int64 _a1 | ` Flo ( _a0 , _a1 ) -> ` Flo _a1 | ` Nativeint ( _a0 , _a1 ) -> ` Nativeint _a1 | ` Str ( _a0 , _a1 ) -> ` Str ...
let flag : Astf . flag -> Astfn . flag = function | ` Positive _a0 -> ` Positive | ` Negative _a0 -> ` Negative | # ant as _a0 -> ( ant _a0 :> Astfn . flag )
let position_flag : Astf . position_flag -> Astfn . position_flag = function | ` Positive _a0 -> ` Positive | ` Negative _a0 -> ` Negative | ` Normal _a0 -> ` Normal | # ant as _a0 -> ( ant _a0 :> Astfn . position_flag )
let rec strings : Astf . strings -> Astfn . strings = function | ` App ( _a0 , _a1 , _a2 ) -> let _a1 = strings _a1 in let _a2 = strings _a2 in ` App ( _a1 , _a2 ) | ` Str ( _a0 , _a1 ) -> ` Str _a1 | # ant as _a0 -> ( ant _a0 :> Astfn . strings )
let lident : Astf . lident -> Astfn . lident = function | ` Lid ( _a0 , _a1 ) -> ` Lid _a1
let alident : Astf . alident -> Astfn . alident = function | ` Lid ( _a0 , _a1 ) -> ` Lid _a1 | # ant as _a0 -> ( ant _a0 :> Astfn . alident )
let auident : Astf . auident -> Astfn . auident = function | ` Uid ( _a0 , _a1 ) -> ` Uid _a1 | # ant as _a0 -> ( ant _a0 :> Astfn . auident )
let aident : Astf . aident -> Astfn . aident = function | # alident as _a0 -> ( alident _a0 :> Astfn . aident ) | # auident as _a0 -> ( auident _a0 :> Astfn . aident )
let astring : Astf . astring -> Astfn . astring = function | ` C ( _a0 , _a1 ) -> ` C _a1 | # ant as _a0 -> ( ant _a0 :> Astfn . astring )
let rec uident : Astf . uident -> Astfn . uident = function | ` Dot ( _a0 , _a1 , _a2 ) -> let _a1 = uident _a1 in let _a2 = uident _a2 in ` Dot ( _a1 , _a2 ) | ` App ( _a0 , _a1 , _a2 ) -> let _a1 = uident _a1 in let _a2 = uident _a2 in ` App ( _a1 , _a2 ) | # auident as _a0 -> ( auident _a0 :> Astfn . uident )
let rec ident : Astf . ident -> Astfn . ident = function | ` Dot ( _a0 , _a1 , _a2 ) -> let _a1 = ident _a1 in let _a2 = ident _a2 in ` Dot ( _a1 , _a2 ) | ` Apply ( _a0 , _a1 , _a2 ) -> let _a1 = ident _a1 in let _a2 = ident _a2 in ` Apply ( _a1 , _a2 ) | # alident as _a0 -> ( alident _a0 :> Astfn . ident ) | # auiden...
let ident ' : Astf . ident ' -> Astfn . ident ' = function | ` Dot ( _a0 , _a1 , _a2 ) -> let _a1 = ident _a1 in let _a2 = ident _a2 in ` Dot ( _a1 , _a2 ) | ` Apply ( _a0 , _a1 , _a2 ) -> let _a1 = ident _a1 in let _a2 = ident _a2 in ` Apply ( _a1 , _a2 ) | ` Lid ( _a0 , _a1 ) -> ` Lid _a1 | ` Uid ( _a0 , _a1 ) -> ` U...
let rec vid : Astf . vid -> Astfn . vid = function | ` Dot ( _a0 , _a1 , _a2 ) -> let _a1 = vid _a1 in let _a2 = vid _a2 in ` Dot ( _a1 , _a2 ) | ` Lid ( _a0 , _a1 ) -> ` Lid _a1 | ` Uid ( _a0 , _a1 ) -> ` Uid _a1 | # ant as _a0 -> ( ant _a0 :> Astfn . vid )
let vid ' : Astf . vid ' -> Astfn . vid ' = function | ` Dot ( _a0 , _a1 , _a2 ) -> let _a1 = vid _a1 in let _a2 = vid _a2 in ` Dot ( _a1 , _a2 ) | ` Lid ( _a0 , _a1 ) -> ` Lid _a1 | ` Uid ( _a0 , _a1 ) -> ` Uid _a1
let rec dupath : Astf . dupath -> Astfn . dupath = function | ` Dot ( _a0 , _a1 , _a2 ) -> let _a1 = dupath _a1 in let _a2 = dupath _a2 in ` Dot ( _a1 , _a2 ) | # auident as _a0 -> ( auident _a0 :> Astfn . dupath )
let dlpath : Astf . dlpath -> Astfn . dlpath = function | ` Dot ( _a0 , _a1 , _a2 ) -> let _a1 = dupath _a1 in let _a2 = alident _a2 in ` Dot ( _a1 , _a2 ) | # alident as _a0 -> ( alident _a0 :> Astfn . dlpath )
let any : Astf . any -> Astfn . any = function | ` Any _a0 -> ` Any
let rec ctyp : Astf . ctyp -> Astfn . ctyp = function | ` Alias ( _a0 , _a1 , _a2 ) -> let _a1 = ctyp _a1 in let _a2 = alident _a2 in ` Alias ( _a1 , _a2 ) | # any as _a0 -> ( any _a0 :> Astfn . ctyp ) | ` App ( _a0 , _a1 , _a2 ) -> let _a1 = ctyp _a1 in let _a2 = ctyp _a2 in ` App ( _a1 , _a2 ) | ` Arrow ( _a0 , _a1 ,...
let rec ep : Astf . ep -> Astfn . ep = function | # vid as _a0 -> ( vid _a0 :> Astfn . ep ) | ` App ( _a0 , _a1 , _a2 ) -> let _a1 = ep _a1 in let _a2 = ep _a2 in ` App ( _a1 , _a2 ) | ` Vrn ( _a0 , _a1 ) -> ` Vrn _a1 | ` Com ( _a0 , _a1 , _a2 ) -> let _a1 = ep _a1 in let _a2 = ep _a2 in ` Com ( _a1 , _a2 ) | ` Sem ( _...
let stripdebug infile outfile = let ic = open_in_bin infile in Bytesections . read_toc ic ; let toc = Bytesections . toc ( ) in let pos_first_section = Bytesections . pos_first_section ic in let oc = open_out_gen [ Open_wronly ; Open_creat ; Open_trunc ; Open_binary ] 0o777 outfile in seek_in ic pos_first_section ; Byt...
let _ = if Array . length Sys . argv = 3 then stripdebug Sys . argv . ( 1 ) Sys . argv . ( 2 ) else begin eprintf " Usage : stripdebug < source file > < destination file >\ n " ; exit 2 end
type t = { authed_headers : Cohttp . Header . t ; end_point : string ; }
type currency = [ ` AUD | ` CAD | ` USD | ` DKK | ` NOK | ` SEK | ` EUR | ` GBP ]
let string_of_currency ( c : currency ) = match c with | ` AUD -> " aud " | ` CAD -> " cad " | ` USD -> " usd " | ` DKK -> " dkk " | ` NOK -> " nok " | ` SEK -> " sek " | ` EUR -> " eur " | ` GBP -> " gbp "
let make ~ a_key = let auth_me k = let starter = Cohttp . Header . init ( ) in Cohttp . Auth . credential_of_string ( " Bearer " ^ k ) |> Cohttp . Header . add_authorization starter in match a_key with | Some key -> { authed_headers = auth_me key ; end_point = " https :// api . stripe . com / v1 " } / | None -> { authe...
module Charges = struct type charge_t = [ ` Customer_id of string | ` Source_token of string ] type charge_val_t = [ ` Int of int | ` Float of float ] let customize = function | h -> { h with end_point = h . end_point ^ " charges " } let create ? description amount currency c_id handle = let specialized = customize han...
module Refunds = struct let customize = function | h -> { h with end_point = h . end_point ^ " refunds " } end
module Customers = struct let customize = function | h -> { h with end_point = h . end_point ^ " customers " } let list_all ? limit handle = let specialized = customize handle in ( match limit with | None -> Uri . of_string specialized . end_point | Some k -> assert ( k > 0 ) ; Uri . of_string specialized . end_point |...
module Cards = struct let customize = function | h -> { h with end_point = h . end_point ^ " cards " } end
module Subscriptions = struct let customize = function | h -> { h with end_point = h . end_point ^ " subscriptions " } end
module Plans = struct let customize = function | h -> { h with end_point = h . end_point ^ " plans " } end
module Coupons = struct let customize = function | h -> { h with end_point = h . end_point ^ " plans " } end
module Discounts = struct let customize = function | h -> { h with end_point = h . end_point ^ " discounts " } end
module Invoices = struct let customize = function | h -> { h with end_point = h . end_point ^ " invoices " } end
module Invoice_items = struct let customize = function | h -> { h with end_point = h . end_point ^ " invoiceitems " } end
module Disputes = struct let customize = function | h -> { h with end_point = h . end_point ^ " disputes " } end
module Transfers = struct let customize = function | h -> { h with end_point = h . end_point ^ " transfers " } end
type t = { size : int64 ; stripes : Location . t array ;
let marshal t = Printf . sprintf " % d % Ld % s " ( Array . length t . stripes ) t . size ( String . concat " " ( Array . ( to_list ( map Location . marshal t . stripes ) ) ) )
let unmarshal x = try match Stringext . split ~ max : 3 x ~ on ' : ' with | [ length ; size ; stripes ] -> let rec loop remaining = match Stringext . split ~ max : 3 remaining ~ on ' : ' with | [ ] -> [ ] | a :: b :: rest -> let this = match Location . unmarshal ( a ^ " " ^ b ) with | ` Ok x -> x | ` Error x -> failwit...
let ( ^^ ) a b = Re . seq [ a ; b ]
let standardise_filesep = let re = Re . compile ( Re . str Filename . dir_sep ) in Re . replace_string ~ all : true re ~ by " " :/
let build_context_replace = let open Re in let lterm , rterm = ( group ( alt [ char ' ` ' ; str " ( absent " = ] ) , group ( alt [ char ' ' ' ; \ char ' ) ' ] ) ) in let dir_sep = alt [ str Filename . dir_sep ; char ' ' / ] in let t = seq [ lterm ; rep any ; str " _build " ; dir_sep ; str " _tests " ; opt dir_sep ; gro...
let uuid_replace = let open Re in let t = seq [ str " ID ` " ; repn ( alt [ rg ' A ' ' Z ' ; digit ] ) 8 ( Some 8 ) ; char ' ' ' \ ] in let re = compile t in fun s -> replace_string ~ all : true re ~ by " : ID ` < uuid ' " > s
let time_replace = let open Re in let float = rep1 digit ^^ char ' . ' ^^ rep1 digit in let t = alt [ group ( alt [ opt cntrl ^^ str " Test Successful " ^^ opt cntrl ^^ str " in " ; rep1 digit ^^ str " failure ! in " ; rep1 digit ^^ str " failures ! in " ; str " " \ time " \: " ; ] ) ^^ float ^^ group ( opt ( char ' s ...
let stacktrace_replace = let open Re in let stack_trace_line verb = str verb ^^ opt ( rep1 print ^^ str " in " ) ^^ str " file " " \ ^^ rep1 print ^^ str " " " \ ^^ opt ( str " ( inlined ) " ) ^^ str " , line " ^^ rep1 digit ^^ str " , characters " ^^ rep1 digit ^^ str " " - ^^ rep1 digit |> compile in let raised_at = ...
let executable_name_normalization = let open Re in let t = alt [ str " . exe " ; str " . bc . js " ] in let re = compile t in replace_string ~ all : true re ~ by " . :< ext " >
let ( ) = let in_channel = open_in Sys . argv . ( 1 ) in let ( >>| ) x f = match x with None -> None | Some x -> Some ( f x ) in let ( >>= ) x f = match x with None -> None | Some x -> f x in try let rec loop ( ) = let sanitized_line = Some ( input_line in_channel ) >>| uuid_replace >>| build_context_replace >>| time_r...
module type I = sig val string_block_length : Cmm . expression -> Cmm . expression val transl_switch : Location . t -> Cmm . expression -> int -> int -> ( int * Cmm . expression ) list -> Cmm . expression -> Cmm . expression end
module Make ( I : I ) = struct let dbg = false let mask = let open Nativeint in sub ( shift_left one 8 ) one let pat_as_string p = let rec digits k n p = if n <= 0 then k else let d = Nativeint . to_int ( Nativeint . logand mask p ) in let d = Char . escaped ( Char . chr d ) in digits ( d :: k ) ( n - 1 ) ( Nativeint ....
type t = | PT | STROKE | END
let a_data = [ ( 0 , 0 , PT ) ; ( 0 , 9 , PT ) ; ( 1 , 10 , PT ) ; ( 4 , 10 , PT ) ; ( 5 , 9 , PT ) ; ( 5 , 0 , STROKE ) ; ( 0 , 5 , PT ) ; ( 5 , 5 , END ) ]
let e_data = [ ( 5 , 0 , PT ) ; ( 0 , 0 , PT ) ; ( 0 , 10 , PT ) ; ( 5 , 10 , STROKE ) ; ( 0 , 5 , PT ) ; ( 4 , 5 , END ) ]
let p_data = [ ( 0 , 0 , PT ) ; ( 0 , 10 , PT ) ; ( 4 , 10 , PT ) ; ( 5 , 9 , PT ) ; ( 5 , 6 , PT ) ; ( 4 , 5 , PT ) ; ( 0 , 5 , END ) ]
let r_data = [ ( 0 , 0 , PT ) ; ( 0 , 10 , PT ) ; ( 4 , 10 , PT ) ; ( 5 , 9 , PT ) ; ( 5 , 6 , PT ) ; ( 4 , 5 , PT ) ; ( 0 , 5 , STROKE ) ; ( 3 , 5 , PT ) ; ( 5 , 0 , END ) ]
let s_data = [ ( 0 , 1 , PT ) ; ( 1 , 0 , PT ) ; ( 4 , 0 , PT ) ; ( 5 , 1 , PT ) ; ( 5 , 4 , PT ) ; ( 4 , 5 , PT ) ; ( 1 , 5 , PT ) ; ( 0 , 6 , PT ) ; ( 0 , 9 , PT ) ; ( 1 , 10 , PT ) ; ( 4 , 10 , PT ) ; ( 5 , 9 , END ) ]
let drawLetter li = glBegin GL_LINE_STRIP ; List . iter ( function | ( x , y , PT ) -> let x , y = float x , float y in glVertex2 ~ x ~ y ; | ( x , y , STROKE ) -> let x , y = float x , float y in glVertex2 ~ x ~ y ; glEnd ( ) ; glBegin GL_LINE_STRIP ; | ( x , y , END ) -> let x , y = float x , float y in glVertex2 ~ x...
let myinit ( ) = glShadeModel GL_FLAT ; let base = glGenLists 128 in glListBase base ; glNewList ( base + Char . code ' A ' ) GL_COMPILE ; drawLetter a_data ; glEndList ( ) ; glNewList ( base + Char . code ' E ' ) GL_COMPILE ; drawLetter e_data ; glEndList ( ) ; glNewList ( base + Char . code ' P ' ) GL_COMPILE ; drawL...
let test1 = " A SPARE SERAPE APPEARS AS "
let test2 = " APES PREPARE RARE PEPPERS "
let explode s = Array . init ( String . length s ) ( fun i -> s . [ i ] )
let printStrokedString s = glCallLists ( Array . map Char . code ( explode s ) ) ; ; ;
let display ( ) = glClear [ GL_COLOR_BUFFER_BIT ] ; glColor3 1 . 0 1 . 0 1 . 0 ; glPushMatrix ( ) ; glScale 2 . 0 2 . 0 2 . 0 ; glTranslate 10 . 0 30 . 0 0 . 0 ; printStrokedString test1 ; glPopMatrix ( ) ; glPushMatrix ( ) ; glScale 2 . 0 2 . 0 2 . 0 ; glTranslate 10 . 0 13 . 0 0 . 0 ; printStrokedString test2 ; glPop...
let reshape ~ width : w ~ height : h = glViewport 0 0 w h ; glMatrixMode GL_PROJECTION ; glLoadIdentity ( ) ; glOrtho 0 . 0 ( float w ) 0 . 0 ( float h ) ( - 1 . 0 ) ( 1 . 0 ) ; glMatrixMode GL_MODELVIEW ; glLoadIdentity ( ) ; ; ;
let keyboard ~ key ~ x ~ y = begin match key with | ' \ 027 ' -> exit ( 0 ) ; | _ -> ( ) end ; glutPostRedisplay ( ) ; ; ;
let ( ) = let _ = glutInit Sys . argv in glutInitDisplayMode [ GLUT_SINGLE ; GLUT_RGB ] ; glutInitWindowSize 440 120 ; let _ = glutCreateWindow Sys . argv . ( 0 ) in myinit ( ) ; glutDisplayFunc ~ display ; glutReshapeFunc ~ reshape ; glutKeyboardFunc ~ keyboard ; glutMainLoop ( ) ; ; ;
module type LAWS = sig include Profunctor . LAWS val fst_define_snd : string * ( ( ' a , ' b ) t -> ( ' a * ' c , ' b * ' c ) t pair ) val snd_define_fst : string * ( ( ' a , ' b ) t -> ( ' c * ' a , ' c * ' b ) t pair ) val contramap_fst : string * ( ( ' a , ' b ) t -> ( ' a * ' c , ' b ) t pair ) val contramap_snd : ...
module Laws ( S : Preface_specs . STRONG ) = struct include Profunctor . Laws ( S ) let fst_define_snd = let lhs x = S . fst x in let rhs x = S . dimap P . swap P . swap ( S . snd x ) in ( " fst = dimap Pair . swap Pair . swap % snd " , fun x -> ( lhs x , rhs x ) ) ; ; let snd_define_fst = let lhs x = S . snd x in let ...
module Kosaraju : sig type component_graph = { sorted_connected_components : int list array ; component_edges : int list array ; } val component_graph : int list array -> component_graph let transpose graph = let size = Array . length graph in let transposed = Array . make size [ ] in let add src dst = transposed . ( s...
module type S = sig module Id : Identifiable . S type directed_graph = Id . Set . t Id . Map . t type component = | Has_loop of Id . t list | No_loop of Id . t val connected_components_sorted_from_roots_to_leaf : directed_graph -> component array val component_graph : directed_graph -> ( component * int list ) array en...
module Make ( Id : Identifiable . S ) = struct type directed_graph = Id . Set . t Id . Map . t type component = | Has_loop of Id . t list | No_loop of Id . t let _check dependencies = Id . Map . iter ( fun id set -> Id . Set . iter ( fun v -> if not ( Id . Map . mem v dependencies ) then Misc . fatal_errorf " Strongly_...
let usage ( ) = print_string " Usage : strstr2 < pat > < str >\ n \ returns the index of the first occurrence of < pat > in string < str >\ n " ; exit 2 ; ;
let main ( ) = let args = Sys . argv in if Array . length args < 2 then usage ( ) else let p = Sys . argv . ( 1 ) and s = Sys . argv . ( 2 ) in find_pat p s ; ;
let find_pat p s = try let i = find_sub_string p s in print_string " Match found at character " ; print_int i ; print_newline ( ) ; exit 0 with Not_found -> print_string " Pattern " ; print_string p ; print_string " does not match string " ; print_string s ; print_newline ( ) ; exit 2 ; ;
let find_sub_string p s = let plen = String . length p in if plen = 0 then 0 else let slen = String . length s in if slen = 0 then raise Not_found else let rec find c i = if i >= slen then raise Not_found else if s . [ i ] = c then find_rest c 1 ( i + 1 ) else find c ( i + 1 ) and find_rest c j i = if j >= plen then ( ...
module Make ( S : sig val section : Section . t end ) = struct type t = string array let empty = [ ] || let print oc strs = let print_str i str = Printf . fprintf oc " % 4d : % s \ n " i str in Array . iteri print_str strs let read index ic = try let ( offset , length ) = try Index . find_section index S . section with...
module type S = sig val fields : Field . t list end
module Ext = struct type t = private int let badd ( t : t ) i : t = Obj . magic ( Obj . magic t + i ) let bsub ( t : t ) i : t = Obj . magic ( Obj . magic t - i ) let get_float64 ( t : t ) boffset = Array . unsafe_get ( Obj . magic ( badd t boffset ) : float array ) 0 let set_float64 ( t : t ) boffset v = Array . unsaf...
module Mem = struct module T = struct type t = { refcount : int ; data : Ext . t ; capacity : int ; mutable nmemb : int ; size : int ; nfields : int ; } let to_string t = Printf . sprintf " % d % s % d % d % d % d " t . refcount ( Ext . to_string t . data ) t . capacity t . nmemb t . size t . nfields end type t = { ops...
module Ptr = struct type t = { ops : Ext . t ; mutable ptr : Ext . t ; mutable mem : Mem . T . t ; mutable pos : int ; } external create : Mem . t -> int -> t = " hdf5_caml_struct_ptr_create " let unsafe_next t bsize = t . ptr <- Ext . badd t . ptr bsize ; t . pos <- t . pos + 1 let unsafe_prev t bsize = t . ptr <- Ext...
module Make ( S : S ) = struct include S let afields = Array . of_list S . fields let nfields = Array . length afields let type_bsize = List . fold_left ( fun s ( Field . T field ) -> s + ( Type . Unpacked . size field . type_ + 7 ) / 8 * 8 / 2 ) 0 S . fields let type_size = 2 * type_bsize let field_names = Array . map...
let ( ) = initialize ( ) module Foo = struct include Make ( struct let fields = [ Field . create " id " Int None ; Field . create " name " ( String 10 ) None ; ] end ) let id t = get_int t 0 let name t = get_string t 4 10 let set t ~ id ~ name = set_int t 0 id ; set_string t 4 10 name end let % test_unit _ = let v = Fo...
let is_dependent_field name fields = List . exists ( fun f -> Lexpr . is_dependent name f . field_typ ) fields
let remove_dependent_fields fields = list_filter ( fun f -> not ( is_dependent_field f . field_name fields || is_ignored f . field_typ ) ) fields
let rec is_float_field f = match scrape_type f . field_typ with Type_float -> true | Type_double -> true | _ -> false
let all_float_fields fl = List . for_all is_float_field fl
let struct_ml_to_c ml_to_c oc onstack pref sd v c = let pref ' = Prefix . enter_struct pref sd c in match remove_dependent_fields sd . sd_fields with [ f ] -> ml_to_c oc onstack pref ' f . field_typ v ( sprintf " % s . % s " c f . field_name ) ; List . iter ( fun f -> if is_ignored f . field_typ then iprintf oc " % s ....
let struct_c_to_ml c_to_ml oc pref sd c v = let pref ' = Prefix . enter_struct pref sd c in match remove_dependent_fields sd . sd_fields with [ f ] -> c_to_ml oc pref ' f . field_typ ( sprintf " % s . % s " c f . field_name ) v | fields -> let nfields = List . length fields in if all_float_fields sd . sd_fields then be...
let ml_declaration oc sd = if sd . sd_name = " " then fprintf oc " struct_ % d = " sd . sd_stamp else fprintf oc " % s = " ( String . uncapitalize_ascii sd . sd_name ) ; match remove_dependent_fields sd . sd_fields with [ f ] -> fprintf oc " % a \ n " out_ml_type f . field_typ | fields -> fprintf oc " { \ n " ; List . ...
let c_declaration oc sd = if sd . sd_fields = [ ] then fprintf oc " struct % s ; \ n " sd . sd_name else begin out_struct oc sd ; fprintf oc " ; \ n \ n " end
let declare_transl oc sd = fprintf oc " extern void camlidl_ml2c_ % s_struct_ % s ( value , struct % s , * camlidl_ctx _ctx ) ; \ n " sd . sd_mod sd . sd_name sd . sd_name ; fprintf oc " extern value camlidl_c2ml_ % s_struct_ % s ( struct % s , * camlidl_ctx _ctx ) ; \ n \ n " sd . sd_mod sd . sd_name sd . sd_name
let transl_ml_to_c oc sd = current_function := sprintf " struct % s " sd . sd_name ; let v = new_var " _v " in let c = new_var " _c " in fprintf oc " void camlidl_ml2c_ % s_struct_ % s ( value % s , struct % s * % s , camlidl_ctx _ctx ) \ n " sd . sd_mod sd . sd_name v sd . sd_name c ; fprintf oc " { \ n " ; let pc = d...
let transl_c_to_ml oc sd = current_function := sprintf " struct % s " sd . sd_name ; let c = new_var " _c " in fprintf oc " value camlidl_c2ml_ % s_struct_ % s ( struct % s * % s , camlidl_ctx _ctx ) \ n " sd . sd_mod sd . sd_name sd . sd_name c ; fprintf oc " { \ n " ; let pc = divert_output ( ) in increase_indent ( )...
let emit_transl oc sd = transl_ml_to_c oc sd ; transl_c_to_ml oc sd
module type S = sig include Lattice . S type value type field val create : ( field -> value ) -> compinfo -> t val get : t -> field -> value val replace : t -> field -> value -> t val fold : ( field -> value -> ' a -> ' a ) -> t -> ' a -> ' a val map : ( value -> value ) -> t -> t val keys : t -> field list val widen_w...