File: meas.h

package info (click to toggle)
fped 0.1%2B201210-1.2
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye
  • size: 968 kB
  • sloc: ansic: 12,651; yacc: 1,112; sh: 974; lex: 204; makefile: 140; awk: 75
file content (82 lines) | stat: -rw-r--r-- 1,765 bytes parent folder | download | duplicates (3)
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
/*
 * meas.h - Measurements
 *
 * Written 2009, 2010 by Werner Almesberger
 * Copyright 2009, 2010 by Werner Almesberger
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */


#ifndef MEAS_H
#define MEAS_H


#include "coord.h"
#include "expr.h"
#include "bitset.h"


typedef int (*lt_op_type)(struct coord a, struct coord b);

struct vec;
struct obj;

struct frame_qual {
	const struct frame *frame;
	struct frame_qual *next;
};

struct meas {
	enum meas_type {
		mt_xy_next,
		mt_x_next,
		mt_y_next,
		mt_xy_max,
		mt_x_max,
		mt_y_max,
		mt_n
	} type;
	char *label; /* or NULL */
	int inverted;
	/* low is obj->base */
	struct vec *high;
	struct expr *offset;

	/* frame qualifiers */
	struct frame_qual *low_qual;
	struct frame_qual *high_qual;
};

struct sample {
	struct coord pos;
	struct bitset *frame_set;
	struct sample *next;
};


extern int n_samples;


int lt_x(struct coord a, struct coord b);
int lt_y(struct coord a, struct coord b);
int lt_xy(struct coord a, struct coord b);

const struct sample *meas_find_min(lt_op_type lt, const struct sample *s,
    const struct bitset *qual);
const struct sample *meas_find_next(lt_op_type lt, const struct sample *s,
    struct coord ref, const struct bitset *qual);
const struct sample *meas_find_max(lt_op_type lt, const struct sample *s,
    const struct bitset *qual);


void reset_samples(struct sample **samples, int n);
void meas_start(void);
void meas_post(const struct vec *vec, struct coord pos,
    const struct bitset *frame_set);
int instantiate_meas(int n_frames);

#endif /* !MEAS_H */