package posix-getopt

  1. Overview
  2. Docs

Source file posix_getopt_generated_stubs.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
module CI = Cstubs_internals

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

external posix_getopt_2_has_getopt_long : unit -> bool
  = "posix_getopt_2_has_getopt_long" 

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

external posix_getopt_4_has_getopt_long_only : unit -> bool
  = "posix_getopt_4_has_getopt_long_only" 

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

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

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

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

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

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

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

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 _, Returns (CI.Primitive CI.Int)), "strlen" ->
  (fun x1 -> let CI.CPointer x2 = x1 in posix_getopt_11_strlen x2)
| Function (CI.Void, Returns (CI.Pointer x4)), "getoptreset" ->
  (fun x3 -> CI.make_ptr x4 (posix_getopt_10_getoptreset x3))
| Function (CI.Void, Returns (CI.Pointer x6)), "getoptopt" ->
  (fun x5 -> CI.make_ptr x6 (posix_getopt_9_getoptopt x5))
| Function (CI.Void, Returns (CI.Pointer x8)), "getopterr" ->
  (fun x7 -> CI.make_ptr x8 (posix_getopt_8_getopterr x7))
| Function (CI.Void, Returns (CI.Pointer x10)), "getoptind" ->
  (fun x9 -> CI.make_ptr x10 (posix_getopt_7_getoptind x9))
| Function (CI.Void, Returns (CI.Pointer x12)), "getoptarg" ->
  (fun x11 -> CI.make_ptr x12 (posix_getopt_6_getoptarg x11))
| Function
    (CI.Primitive CI.Int,
     Function
       (CI.Pointer _,
        Function
          (CI.View {CI.ty = CI.Pointer _; write = x17; _},
           Function
             (CI.Pointer _,
              Function (CI.Pointer _, Returns (CI.Primitive CI.Int)))))),
  "getopt_long_only" ->
  (fun x13 x14 x16 x20 x22 ->
    let CI.CPointer x23 = x22 in
    let CI.CPointer x21 = x20 in
    let CI.CPointer x19 = x17 x16 in
    let CI.CPointer x15 = x14 in
    let x18 = x19 in posix_getopt_5_getopt_long_only x13 x15 x18 x21 x23)
| Function (CI.Void, Returns (CI.Primitive CI.Bool)), "has_getopt_long_only" ->
  posix_getopt_4_has_getopt_long_only
| Function
    (CI.Primitive CI.Int,
     Function
       (CI.Pointer _,
        Function
          (CI.View {CI.ty = CI.Pointer _; write = x29; _},
           Function
             (CI.Pointer _,
              Function (CI.Pointer _, Returns (CI.Primitive CI.Int)))))),
  "getopt_long" ->
  (fun x25 x26 x28 x32 x34 ->
    let CI.CPointer x35 = x34 in
    let CI.CPointer x33 = x32 in
    let CI.CPointer x31 = x29 x28 in
    let CI.CPointer x27 = x26 in
    let x30 = x31 in posix_getopt_3_getopt_long x25 x27 x30 x33 x35)
| Function (CI.Void, Returns (CI.Primitive CI.Bool)), "has_getopt_long" ->
  posix_getopt_2_has_getopt_long
| Function
    (CI.Primitive CI.Int,
     Function
       (CI.Pointer _,
        Function
          (CI.View {CI.ty = CI.Pointer _; write = x41; _},
           Returns (CI.Primitive CI.Int)))),
  "getopt" ->
  (fun x37 x38 x40 ->
    let CI.CPointer x43 = x41 x40 in
    let CI.CPointer x39 = x38 in
    let x42 = x43 in posix_getopt_1_getopt x37 x39 x42)
| _, 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.