File: types.mli

package info (click to toggle)
mlpost 0.8.1-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,776 kB
  • sloc: ml: 17,440; makefile: 469
file content (346 lines) | stat: -rw-r--r-- 9,177 bytes parent folder | download | duplicates (4)
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
(**************************************************************************)
(*                                                                        *)
(*  Copyright (C) Johannes Kanig, Stephane Lescuyer                       *)
(*  Jean-Christophe Filliatre, Romain Bardou and Francois Bobot           *)
(*                                                                        *)
(*  This software is free software; you can redistribute it and/or        *)
(*  modify it under the terms of the GNU Library General Public           *)
(*  License version 2.1, with the special exception on linking            *)
(*  described in file LICENSE.                                            *)
(*                                                                        *)
(*  This software is distributed in the hope that it will be useful,      *)
(*  but WITHOUT ANY WARRANTY; without even the implied warranty of        *)
(*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                  *)
(*                                                                        *)
(**************************************************************************)

val add_set_verbosity : (bool -> unit) -> unit
val set_verbosity : bool -> unit

type color = Concrete_types.color

type name = string

type corner =  [ 
  | `Northwest | `Northeast | `Southwest | `Southeast 
  | `Upleft | `Upright | `Lowleft | `Lowright 
  | `Upperleft | `Upperright | `Lowerleft | `Lowerright 
  | `Topleft | `Topright | `Bottomleft | `Bottomright
]

type corner_red =  [ 
  | `Northwest | `Northeast | `Southwest | `Southeast 
]

type hposition = [
  `Center | `West | `East
  | `Left | `Right
]
type vposition = [
  `Center | `North | `South
  | `Top | `Bot (** deprecated *) | `Bottom
]
type hposition_red = [
  `Center | `West | `East
]
type vposition_red = [
  `Center | `North | `South
]
type position = [ | hposition | vposition | corner ]
type position_red = [ | hposition_red | vposition_red | corner_red ]

open Hashcons

type num_node = private
  | F of float
  | NXPart of point
  | NYPart of point
  | NAdd of num * num
  | NSub of num * num
  | NMult of num * num
  | NDiv of num * num
  | NMax of num * num
  | NMin of num * num
  | NGMean of num * num
  | NLength of path
  | NIfnullthenelse of num * num * num

and num = num_node hash_consed

and point_node = private
  | PTPair of num * num
  | PTPicCorner of commandpic * corner
  | PTPointOf of num * path
  | PTDirectionOf of num * path
  | PTAdd of point * point
  | PTSub of point * point
  | PTMult of num * point
  | PTRotated of float * point
  | PTTransformed of point * transform

and point = point_node hash_consed

and on_off_node = private 
  | On of num 
  | Off of num

and on_off = on_off_node hash_consed 

and direction_node = private
  | Vec of point
  | Curl of float
  | NoDir 

and direction = direction_node hash_consed

and joint_node = private
  | JLine
  | JCurve
  | JCurveNoInflex
  | JTension of float * float
  | JControls of point * point

and joint = joint_node hash_consed

and knot_node = private 
    { knot_in : direction ; knot_p : point ; knot_out : direction }

and knot = knot_node hash_consed

and metapath_node = private
  | MPAConcat of knot * joint * metapath
  | MPAKnot of knot
  | MPAAppend of metapath * joint * metapath
  | MPAofPA of path
  (*| MPATransformed of metapath * transform*)

and metapath = metapath_node hash_consed

and path_node = private
  | PAofMPA of metapath
  | MPACycle of direction * joint * metapath
  | PAFullCircle
  | PAHalfCircle
  | PAQuarterCircle
  | PAUnitSquare
  | PATransformed of path * transform
  | PACutAfter of path * path
  | PACutBefore of path * path
  | PABuildCycle of path list
  | PASub of num * num * path
  | PABBox of commandpic

and path = path_node hash_consed

and matrix = 
    { xx : num; yx : num; 
      xy : num; yy : num; x0 : num; y0 : num; }

and transform_node = private
  | TRRotated of float
  | TRScaled of num
  | TRShifted of point
  | TRSlanted of num
  | TRXscaled of num
  | TRYscaled of num
  | TRZscaled of point
  | TRReflect of point * point
  | TRRotateAround of point * float
  | TRMatrix of matrix

and transform = transform_node hash_consed

and dash_node = private
  | DEvenly
  | DWithdots
  | DScaled of num * dash
  | DShifted of point * dash
  | DPattern of on_off list

and dash = dash_node hash_consed

and pen_node = private
  | PenCircle
  | PenSquare
  | PenFromPath of path
  | PenTransformed of pen * transform

and pen = pen_node hash_consed

and picture_node = private
  | PITex of string
  | PITransformed of commandpic * transform
  | PIClip of commandpic * path

and picture = picture_node hash_consed

and command_node = private
  | CDraw of path * brush
  | CFill of path * color option
  | CLabel of commandpic * position * point
  | CDotLabel of commandpic * position * point
  | CExternalImage of string * spec_image

and commandpic_node = private
  | Picture of picture
  | Command of command
  | Seq of commandpic list

and commandpic = commandpic_node hash_consed

and spec_image =
  [ `None
  | `Width of num (* keep the proportion of the image *)
  | `Height of num
  | `Inside of num * num (* must be inside a box of this height and width *)
  | `Exact of num * num]


and command = command_node hash_consed

and brush_node = {pen : pen option;
                  dash : dash option;
                  color : color option}

and brush = brush_node hash_consed
(* smart constructors *)

(* num *)

val mkF: float -> num
val mkNAdd : num -> num -> num
val mkNSub : num -> num -> num
val mkNMult : num -> num -> num
val mkNDiv : num -> num -> num
val mkNMax : num -> num -> num
val mkNMin : num -> num -> num
val mkNGMean : num -> num -> num
val mkNXPart : point -> num
val mkNYPart : point -> num
val mkNLength : path -> num
val mkNIfnullthenelse : num -> num -> num -> num

(* point *)
val mkPTPair : num -> num -> point
val mkPTAdd : point -> point -> point
val mkPTSub : point -> point -> point
val mkPTMult : num -> point -> point
val mkPTRotated : float -> point -> point
val mkPTTransformed : point -> transform -> point
val mkPTPointOf : num -> path -> point
val mkPTDirectionOf : num -> path -> point
val mkPTPicCorner : commandpic -> corner -> point

(* transform *)

val mkTRScaled :  num -> transform
val mkTRXscaled :  num -> transform
val mkTRYscaled :  num -> transform
val mkTRZscaled :  point -> transform
val mkTRRotated : float -> transform
val mkTRShifted : point -> transform
val mkTRSlanted : num -> transform
val mkTRReflect : point -> point -> transform
val mkTRRotateAround : point -> float -> transform
val mkTRMatrix : matrix -> transform


(* knot *)
val mkKnot : direction -> point -> direction -> knot

(* metapath *)

val mkMPAKnot : knot -> metapath
val mkMPAConcat : knot -> joint -> metapath -> metapath
val mkMPAAppend : metapath -> joint -> metapath -> metapath
val mkMPAofPA : path -> metapath
(*val mkMPATransformed : path -> transform -> path*)

(* path *)

val mkPAofMPA : metapath -> path
val mkPAKnot : knot -> path
val mkPAConcat : knot -> joint -> path -> path
val mkPACycle : direction -> joint -> path -> path
val mkMPACycle : direction -> joint -> metapath -> path
val mkPAAppend : path -> joint -> path -> path
val mkPAFullCircle : path
val mkPAHalfCircle : path
val mkPAQuarterCircle : path
val mkPAUnitSquare : path
val mkPATransformed : path -> transform -> path
val mkPACutAfter : path -> path -> path
val mkPACutBefore : path -> path -> path
val mkPABuildCycle : path list -> path
val mkPASub : num -> num -> path -> path
val mkPABBox : commandpic -> path

(* joint *)
val mkJCurve : joint
val mkJLine : joint
val mkJCurveNoInflex : joint
val mkJTension: float -> float -> joint
val mkJControls: point -> point -> joint


(* direction *)

val mkNoDir : direction
val mkVec : point -> direction
val mkCurl : float -> direction

(* picture *)

val mkPITex : string -> picture
val mkPITransformed : commandpic -> transform -> picture
val mkPIClip : commandpic -> path -> picture

(* command *)

val mkCDraw: path -> brush -> command
val mkCFill: path -> color option -> command
val mkCLabel: commandpic -> position -> point -> command
val mkCDotLabel: commandpic -> position -> point -> command
val mkCExternalImage : string -> spec_image -> command

(* commandpic *)
val mkPicture : picture -> commandpic
val mkCommand : command -> commandpic
val mkSeq : commandpic list -> commandpic

(* dash *)

val mkDEvenly: dash
val mkDWithdots: dash
val mkDScaled: num -> dash -> dash
val mkDShifted: point -> dash -> dash
val mkDPattern: on_off list -> dash

(* pen *)

val mkPenCircle: pen
val mkPenSquare: pen
val mkPenFromPath: path -> pen
val mkPenTransformed: pen -> transform -> pen

(* brush *)
val mkBrush: color option -> pen option -> dash option -> brush
val mkBrushOpt : brush option -> color option -> pen option -> dash option 
  -> brush

(* on_off *)

val mkOn : num -> on_off
val mkOff : num -> on_off

val pos_reduce :
  position -> position_red

val corner_reduce :
  corner -> corner_red

val vreduce : vposition -> vposition_red
val hreduce : hposition -> hposition_red

val opposite_position : position -> position_red