package daypack-lib

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file time_j.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
(* Auto-generated from "time.atd" *)
[@@@ocaml.warning "-27-32-33-35-39"]

type weekday = Time_t.weekday

type month = Time_t.month

let write_weekday = (
  fun ob x ->
    match x with
      | `Sun -> Buffer.add_string ob "\"Sun\""
      | `Mon -> Buffer.add_string ob "\"Mon\""
      | `Tue -> Buffer.add_string ob "\"Tue\""
      | `Wed -> Buffer.add_string ob "\"Wed\""
      | `Thu -> Buffer.add_string ob "\"Thu\""
      | `Fri -> Buffer.add_string ob "\"Fri\""
      | `Sat -> Buffer.add_string ob "\"Sat\""
)
let string_of_weekday ?(len = 1024) x =
  let ob = Buffer.create len in
  write_weekday ob x;
  Buffer.contents ob
let read_weekday = (
  fun p lb ->
    Yojson.Safe.read_space p lb;
    match Yojson.Safe.start_any_variant p lb with
      | `Edgy_bracket -> (
          match Yojson.Safe.read_ident p lb with
            | "Sun" ->
              Yojson.Safe.read_space p lb;
              Yojson.Safe.read_gt p lb;
              `Sun
            | "Mon" ->
              Yojson.Safe.read_space p lb;
              Yojson.Safe.read_gt p lb;
              `Mon
            | "Tue" ->
              Yojson.Safe.read_space p lb;
              Yojson.Safe.read_gt p lb;
              `Tue
            | "Wed" ->
              Yojson.Safe.read_space p lb;
              Yojson.Safe.read_gt p lb;
              `Wed
            | "Thu" ->
              Yojson.Safe.read_space p lb;
              Yojson.Safe.read_gt p lb;
              `Thu
            | "Fri" ->
              Yojson.Safe.read_space p lb;
              Yojson.Safe.read_gt p lb;
              `Fri
            | "Sat" ->
              Yojson.Safe.read_space p lb;
              Yojson.Safe.read_gt p lb;
              `Sat
            | x ->
              Atdgen_runtime.Oj_run.invalid_variant_tag p x
        )
      | `Double_quote -> (
          match Yojson.Safe.finish_string p lb with
            | "Sun" ->
              `Sun
            | "Mon" ->
              `Mon
            | "Tue" ->
              `Tue
            | "Wed" ->
              `Wed
            | "Thu" ->
              `Thu
            | "Fri" ->
              `Fri
            | "Sat" ->
              `Sat
            | x ->
              Atdgen_runtime.Oj_run.invalid_variant_tag p x
        )
      | `Square_bracket -> (
          match Atdgen_runtime.Oj_run.read_string p lb with
            | x ->
              Atdgen_runtime.Oj_run.invalid_variant_tag p x
        )
)
let weekday_of_string s =
  read_weekday (Yojson.Safe.init_lexer ()) (Lexing.from_string s)
let write_month = (
  fun ob x ->
    match x with
      | `Jan -> Buffer.add_string ob "\"Jan\""
      | `Feb -> Buffer.add_string ob "\"Feb\""
      | `Mar -> Buffer.add_string ob "\"Mar\""
      | `Apr -> Buffer.add_string ob "\"Apr\""
      | `May -> Buffer.add_string ob "\"May\""
      | `Jun -> Buffer.add_string ob "\"Jun\""
      | `Jul -> Buffer.add_string ob "\"Jul\""
      | `Aug -> Buffer.add_string ob "\"Aug\""
      | `Sep -> Buffer.add_string ob "\"Sep\""
      | `Oct -> Buffer.add_string ob "\"Oct\""
      | `Nov -> Buffer.add_string ob "\"Nov\""
      | `Dec -> Buffer.add_string ob "\"Dec\""
)
let string_of_month ?(len = 1024) x =
  let ob = Buffer.create len in
  write_month ob x;
  Buffer.contents ob
let read_month = (
  fun p lb ->
    Yojson.Safe.read_space p lb;
    match Yojson.Safe.start_any_variant p lb with
      | `Edgy_bracket -> (
          match Yojson.Safe.read_ident p lb with
            | "Jan" ->
              Yojson.Safe.read_space p lb;
              Yojson.Safe.read_gt p lb;
              `Jan
            | "Feb" ->
              Yojson.Safe.read_space p lb;
              Yojson.Safe.read_gt p lb;
              `Feb
            | "Mar" ->
              Yojson.Safe.read_space p lb;
              Yojson.Safe.read_gt p lb;
              `Mar
            | "Apr" ->
              Yojson.Safe.read_space p lb;
              Yojson.Safe.read_gt p lb;
              `Apr
            | "May" ->
              Yojson.Safe.read_space p lb;
              Yojson.Safe.read_gt p lb;
              `May
            | "Jun" ->
              Yojson.Safe.read_space p lb;
              Yojson.Safe.read_gt p lb;
              `Jun
            | "Jul" ->
              Yojson.Safe.read_space p lb;
              Yojson.Safe.read_gt p lb;
              `Jul
            | "Aug" ->
              Yojson.Safe.read_space p lb;
              Yojson.Safe.read_gt p lb;
              `Aug
            | "Sep" ->
              Yojson.Safe.read_space p lb;
              Yojson.Safe.read_gt p lb;
              `Sep
            | "Oct" ->
              Yojson.Safe.read_space p lb;
              Yojson.Safe.read_gt p lb;
              `Oct
            | "Nov" ->
              Yojson.Safe.read_space p lb;
              Yojson.Safe.read_gt p lb;
              `Nov
            | "Dec" ->
              Yojson.Safe.read_space p lb;
              Yojson.Safe.read_gt p lb;
              `Dec
            | x ->
              Atdgen_runtime.Oj_run.invalid_variant_tag p x
        )
      | `Double_quote -> (
          match Yojson.Safe.finish_string p lb with
            | "Jan" ->
              `Jan
            | "Feb" ->
              `Feb
            | "Mar" ->
              `Mar
            | "Apr" ->
              `Apr
            | "May" ->
              `May
            | "Jun" ->
              `Jun
            | "Jul" ->
              `Jul
            | "Aug" ->
              `Aug
            | "Sep" ->
              `Sep
            | "Oct" ->
              `Oct
            | "Nov" ->
              `Nov
            | "Dec" ->
              `Dec
            | x ->
              Atdgen_runtime.Oj_run.invalid_variant_tag p x
        )
      | `Square_bracket -> (
          match Atdgen_runtime.Oj_run.read_string p lb with
            | x ->
              Atdgen_runtime.Oj_run.invalid_variant_tag p x
        )
)
let month_of_string s =
  read_month (Yojson.Safe.init_lexer ()) (Lexing.from_string s)
OCaml

Innovation. Community. Security.