Root/
Source at commit ceaa519ccb1b6d400ff57c692a13f183f5f6af61 created 13 years 3 months ago. By Xiangfu Liu, update to r5997 | |
---|---|
1 | /* |
2 | * meas.h - Measurements |
3 | * |
4 | * Written 2009, 2010 by Werner Almesberger |
5 | * Copyright 2009, 2010 by Werner Almesberger |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2 of the License, or |
10 | * (at your option) any later version. |
11 | */ |
12 | |
13 | |
14 | #ifndef MEAS_H |
15 | #define MEAS_H |
16 | |
17 | |
18 | #include "coord.h" |
19 | #include "expr.h" |
20 | #include "bitset.h" |
21 | |
22 | |
23 | typedef int (*lt_op_type)(struct coord a, struct coord b); |
24 | |
25 | struct vec; |
26 | struct obj; |
27 | |
28 | struct frame_qual { |
29 | const struct frame *frame; |
30 | struct frame_qual *next; |
31 | }; |
32 | |
33 | struct meas { |
34 | enum meas_type { |
35 | mt_xy_next, |
36 | mt_x_next, |
37 | mt_y_next, |
38 | mt_xy_max, |
39 | mt_x_max, |
40 | mt_y_max, |
41 | mt_n |
42 | } type; |
43 | char *label; /* or NULL */ |
44 | int inverted; |
45 | /* low is obj->base */ |
46 | struct vec *high; |
47 | struct expr *offset; |
48 | |
49 | /* frame qualifiers */ |
50 | struct frame_qual *low_qual; |
51 | struct frame_qual *high_qual; |
52 | }; |
53 | |
54 | struct sample { |
55 | struct coord pos; |
56 | struct bitset *frame_set; |
57 | struct sample *next; |
58 | }; |
59 | |
60 | |
61 | extern int n_samples; |
62 | |
63 | |
64 | int lt_x(struct coord a, struct coord b); |
65 | int lt_y(struct coord a, struct coord b); |
66 | int lt_xy(struct coord a, struct coord b); |
67 | |
68 | const struct sample *meas_find_min(lt_op_type lt, const struct sample *s, |
69 | const struct bitset *qual); |
70 | const struct sample *meas_find_next(lt_op_type lt, const struct sample *s, |
71 | struct coord ref, const struct bitset *qual); |
72 | const struct sample *meas_find_max(lt_op_type lt, const struct sample *s, |
73 | const struct bitset *qual); |
74 | |
75 | |
76 | void reset_samples(struct sample **samples, int n); |
77 | void meas_start(void); |
78 | void meas_post(const struct vec *vec, struct coord pos, |
79 | const struct bitset *frame_set); |
80 | int instantiate_meas(int n_frames); |
81 | |
82 | #endif /* !MEAS_H */ |
83 |
Branches:
master