Root/meas.h

Source at commit a9ed5b30aa457704a4c0c912367bfe8c57db8d03 created 3 years 4 months ago.
By Werner Almesberger, fped.1: update for new options; fix typo; bump date
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
23typedef int (*lt_op_type)(struct coord a, struct coord b);
24
25struct vec;
26struct obj;
27
28struct frame_qual {
29    const struct frame *frame;
30    struct frame_qual *next;
31};
32
33struct 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
54struct sample {
55    struct coord pos;
56    struct bitset *frame_set;
57    struct sample *next;
58};
59
60
61extern int n_samples;
62
63
64int lt_x(struct coord a, struct coord b);
65int lt_y(struct coord a, struct coord b);
66int lt_xy(struct coord a, struct coord b);
67
68const struct sample *meas_find_min(lt_op_type lt, const struct sample *s,
69    const struct bitset *qual);
70const struct sample *meas_find_next(lt_op_type lt, const struct sample *s,
71    struct coord ref, const struct bitset *qual);
72const struct sample *meas_find_max(lt_op_type lt, const struct sample *s,
73    const struct bitset *qual);
74
75
76void reset_samples(struct sample **samples, int n);
77void meas_start(void);
78void meas_post(const struct vec *vec, struct coord pos,
79    const struct bitset *frame_set);
80int instantiate_meas(int n_frames);
81
82#endif /* !MEAS_H */
83

Archive Download this file

Branches:
master



interactive