package mpg123

  1. Overview
  2. Docs

Source file mpg123_c_generated_functions.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
module CI = Cstubs_internals

external mpg123_stub_1_mpg123_init : unit -> int
  = "mpg123_stub_1_mpg123_init" 

external mpg123_stub_2_mpg123_exit : unit -> unit
  = "mpg123_stub_2_mpg123_exit" 

external mpg123_stub_3_mpg123_new : _ CI.fatptr -> _ CI.fatptr -> CI.voidp
  = "mpg123_stub_3_mpg123_new" 

external mpg123_stub_4_mpg123_delete : _ CI.fatptr -> unit
  = "mpg123_stub_4_mpg123_delete" 

external mpg123_stub_5_mpg123_plain_strerror : int -> CI.voidp
  = "mpg123_stub_5_mpg123_plain_strerror" 

external mpg123_stub_6_mpg123_strerror : _ CI.fatptr -> CI.voidp
  = "mpg123_stub_6_mpg123_strerror" 

external mpg123_stub_7_mpg123_errcode : _ CI.fatptr -> int
  = "mpg123_stub_7_mpg123_errcode" 

external mpg123_stub_8_mpg123_decoders : unit -> CI.voidp
  = "mpg123_stub_8_mpg123_decoders" 

external mpg123_stub_9_mpg123_supported_decoders : unit -> CI.voidp
  = "mpg123_stub_9_mpg123_supported_decoders" 

external mpg123_stub_10_mpg123_decoder : _ CI.fatptr -> _ CI.fatptr -> int
  = "mpg123_stub_10_mpg123_decoder" 

external mpg123_stub_11_mpg123_current_decoder : _ CI.fatptr -> CI.voidp
  = "mpg123_stub_11_mpg123_current_decoder" 

external mpg123_stub_12_mpg123_open : _ CI.fatptr -> _ CI.fatptr -> int
  = "mpg123_stub_12_mpg123_open" 

external mpg123_stub_13_mpg123_close : _ CI.fatptr -> int
  = "mpg123_stub_13_mpg123_close" 

external mpg123_stub_14_mpg123_read
  : _ CI.fatptr -> _ CI.fatptr -> int -> _ CI.fatptr -> int
  = "mpg123_stub_14_mpg123_read" 

external mpg123_stub_15_mpg123_scan : _ CI.fatptr -> int
  = "mpg123_stub_15_mpg123_scan" 

external mpg123_stub_16_mpg123_meta_check : _ CI.fatptr -> int
  = "mpg123_stub_16_mpg123_meta_check" 

external mpg123_stub_17_mpg123_length : _ CI.fatptr -> int
  = "mpg123_stub_17_mpg123_length" 

external mpg123_stub_18_mpg123_meta_free : _ CI.fatptr -> unit
  = "mpg123_stub_18_mpg123_meta_free" 

external mpg123_stub_19_mpg123_id3
  : _ CI.fatptr -> _ CI.fatptr -> _ CI.fatptr -> int
  = "mpg123_stub_19_mpg123_id3" 

external mpg123_stub_20_mpg123_getformat
  : _ CI.fatptr -> _ CI.fatptr -> _ CI.fatptr -> _ CI.fatptr -> int
  = "mpg123_stub_20_mpg123_getformat" 

external mpg123_stub_21_mpg123_format_none : _ CI.fatptr -> int
  = "mpg123_stub_21_mpg123_format_none" 

external mpg123_stub_22_mpg123_format
  : _ CI.fatptr -> int -> int -> int -> int = "mpg123_stub_22_mpg123_format" 

type 'a result = 'a
type 'a return = 'a
type 'a fn =
 | Returns  : 'a CI.typ   -> 'a return fn
 | Function : 'a CI.typ * 'b fn  -> ('a -> 'b) fn
let map_result f x = f x
let returning t = Returns t
let (@->) f p = Function (f, p)
let foreign : type a b. string -> (a -> b) fn -> (a -> b) =
  fun name t -> match t, name with
| Function
    (CI.Pointer _,
     Function
       (CI.Primitive CI.Int,
        Function
          (CI.Primitive CI.Int,
           Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int))))),
  "mpg123_format" ->
  (fun x1 x3 x4 x5 ->
    let CI.CPointer x2 = x1 in mpg123_stub_22_mpg123_format x2 x3 x4 x5)
| Function (CI.Pointer _, Returns (CI.Primitive CI.Int)),
  "mpg123_format_none" ->
  (fun x6 -> let CI.CPointer x7 = x6 in mpg123_stub_21_mpg123_format_none x7)
| Function
    (CI.Pointer _,
     Function
       (CI.Pointer _,
        Function
          (CI.Pointer _,
           Function (CI.Pointer _, Returns (CI.Primitive CI.Int))))),
  "mpg123_getformat" ->
  (fun x8 x10 x12 x14 ->
    let CI.CPointer x15 = x14 in
    let CI.CPointer x13 = x12 in
    let CI.CPointer x11 = x10 in
    let CI.CPointer x9 = x8 in mpg123_stub_20_mpg123_getformat x9 x11 x13 x15)
| Function
    (CI.Pointer _,
     Function
       (CI.Pointer _, Function (CI.Pointer _, Returns (CI.Primitive CI.Int)))),
  "mpg123_id3" ->
  (fun x16 x18 x20 ->
    let CI.CPointer x21 = x20 in
    let CI.CPointer x19 = x18 in
    let CI.CPointer x17 = x16 in mpg123_stub_19_mpg123_id3 x17 x19 x21)
| Function (CI.Pointer _, Returns CI.Void), "mpg123_meta_free" ->
  (fun x22 ->
    let CI.CPointer x23 = x22 in mpg123_stub_18_mpg123_meta_free x23)
| Function (CI.Pointer _, Returns (CI.Primitive CI.Int)), "mpg123_length" ->
  (fun x24 -> let CI.CPointer x25 = x24 in mpg123_stub_17_mpg123_length x25)
| Function (CI.Pointer _, Returns (CI.Primitive CI.Int)), "mpg123_meta_check" ->
  (fun x26 ->
    let CI.CPointer x27 = x26 in mpg123_stub_16_mpg123_meta_check x27)
| Function (CI.Pointer _, Returns (CI.Primitive CI.Int)), "mpg123_scan" ->
  (fun x28 -> let CI.CPointer x29 = x28 in mpg123_stub_15_mpg123_scan x29)
| Function
    (CI.Pointer _,
     Function
       (CI.Pointer _,
        Function
          (CI.Primitive CI.Int,
           Function (CI.Pointer _, Returns (CI.Primitive CI.Int))))),
  "mpg123_read" ->
  (fun x30 x32 x34 x35 ->
    let CI.CPointer x36 = x35 in
    let CI.CPointer x33 = x32 in
    let CI.CPointer x31 = x30 in mpg123_stub_14_mpg123_read x31 x33 x34 x36)
| Function (CI.Pointer _, Returns (CI.Primitive CI.Int)), "mpg123_close" ->
  (fun x37 -> let CI.CPointer x38 = x37 in mpg123_stub_13_mpg123_close x38)
| Function
    (CI.Pointer _,
     Function
       (CI.View {CI.ty = CI.Pointer _; write = x42; _},
        Returns (CI.Primitive CI.Int))),
  "mpg123_open" ->
  (fun x39 x41 ->
    let CI.CPointer x44 = x42 x41 in
    let CI.CPointer x40 = x39 in
    let x43 = x44 in mpg123_stub_12_mpg123_open x40 x43)
| Function
    (CI.Pointer _, Returns (CI.View {CI.ty = CI.Pointer x47; read = x48; _})),
  "mpg123_current_decoder" ->
  (fun x45 ->
    let CI.CPointer x46 = x45 in
    x48 (CI.make_ptr x47 (mpg123_stub_11_mpg123_current_decoder x46)))
| Function
    (CI.Pointer _,
     Function
       (CI.View {CI.ty = CI.Pointer _; write = x52; _},
        Returns (CI.Primitive CI.Int))),
  "mpg123_decoder" ->
  (fun x49 x51 ->
    let CI.CPointer x54 = x52 x51 in
    let CI.CPointer x50 = x49 in
    let x53 = x54 in mpg123_stub_10_mpg123_decoder x50 x53)
| Function (CI.Void, Returns (CI.Pointer x56)), "mpg123_supported_decoders" ->
  (fun x55 -> CI.make_ptr x56 (mpg123_stub_9_mpg123_supported_decoders x55))
| Function (CI.Void, Returns (CI.Pointer x58)), "mpg123_decoders" ->
  (fun x57 -> CI.make_ptr x58 (mpg123_stub_8_mpg123_decoders x57))
| Function (CI.Pointer _, Returns (CI.Primitive CI.Int)), "mpg123_errcode" ->
  (fun x59 -> let CI.CPointer x60 = x59 in mpg123_stub_7_mpg123_errcode x60)
| Function
    (CI.Pointer _, Returns (CI.View {CI.ty = CI.Pointer x63; read = x64; _})),
  "mpg123_strerror" ->
  (fun x61 ->
    let CI.CPointer x62 = x61 in
    x64 (CI.make_ptr x63 (mpg123_stub_6_mpg123_strerror x62)))
| Function
    (CI.Primitive CI.Int,
     Returns (CI.View {CI.ty = CI.Pointer x66; read = x67; _})),
  "mpg123_plain_strerror" ->
  (fun x65 ->
    x67 (CI.make_ptr x66 (mpg123_stub_5_mpg123_plain_strerror x65)))
| Function (CI.Pointer _, Returns CI.Void), "mpg123_delete" ->
  (fun x68 -> let CI.CPointer x69 = x68 in mpg123_stub_4_mpg123_delete x69)
| Function
    (CI.View {CI.ty = CI.Pointer _; write = x71; _},
     Function (CI.Pointer _, Returns (CI.Pointer x76))),
  "mpg123_new" ->
  (fun x70 x74 ->
    let CI.CPointer x75 = x74 in
    let CI.CPointer x73 = x71 x70 in
    let x72 = x73 in CI.make_ptr x76 (mpg123_stub_3_mpg123_new x72 x75))
| Function (CI.Void, Returns CI.Void), "mpg123_exit" ->
  mpg123_stub_2_mpg123_exit
| Function (CI.Void, Returns (CI.Primitive CI.Int)), "mpg123_init" ->
  mpg123_stub_1_mpg123_init
| _, s ->  Printf.ksprintf failwith "No match for %s" s


let foreign_value : type a. string -> a Ctypes.typ -> a Ctypes.ptr =
  fun name t -> match t, name with
| _, s ->  Printf.ksprintf failwith "No match for %s" s

OCaml

Innovation. Community. Security.