File: asmrules.h

package info (click to toggle)
gst-plugins-ugly0.10 0.10.8-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 6,920 kB
  • ctags: 3,310
  • sloc: ansic: 35,465; sh: 9,814; perl: 1,476; xml: 845; cpp: 641; makefile: 535; python: 465; sed: 16
file content (115 lines) | stat: -rw-r--r-- 2,863 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
/* GStreamer
 * Copyright (C) <2007> Wim Taymans <wim.taymans@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef __GST_ASM_RULES_H__
#define __GST_ASM_RULES_H__

#include <gst/gst.h>

G_BEGIN_DECLS

#define MAX_RULEMATCHES 16

typedef struct _GstASMNode GstASMNode;
typedef struct _GstASMRule GstASMRule;
typedef struct _GstASMRuleBook GstASMRuleBook;

typedef enum {
  GST_ASM_TOKEN_NONE,
  GST_ASM_TOKEN_EOF,

  GST_ASM_TOKEN_INT,
  GST_ASM_TOKEN_FLOAT,
  GST_ASM_TOKEN_IDENTIFIER,
  GST_ASM_TOKEN_STRING,
  
  GST_ASM_TOKEN_HASH,
  GST_ASM_TOKEN_SEMICOLON,
  GST_ASM_TOKEN_COMMA,
  GST_ASM_TOKEN_DOLLAR,

  GST_ASM_TOKEN_LPAREN,
  GST_ASM_TOKEN_RPAREN,

  GST_ASM_TOKEN_GREATER,
  GST_ASM_TOKEN_LESS,
  GST_ASM_TOKEN_GREATEREQUAL,
  GST_ASM_TOKEN_LESSEQUAL,
  GST_ASM_TOKEN_EQUAL,
  GST_ASM_TOKEN_NOTEQUAL,

  GST_ASM_TOKEN_AND,
  GST_ASM_TOKEN_OR
} GstASMToken;

typedef enum {
  GST_ASM_NODE_UNKNOWN,
  GST_ASM_NODE_VARIABLE,
  GST_ASM_NODE_INTEGER,
  GST_ASM_NODE_FLOAT,
  GST_ASM_NODE_OPERATOR
} GstASMNodeType;

typedef enum {
  GST_ASM_OP_GREATER      = GST_ASM_TOKEN_GREATER,
  GST_ASM_OP_LESS         = GST_ASM_TOKEN_LESS,
  GST_ASM_OP_GREATEREQUAL = GST_ASM_TOKEN_GREATEREQUAL,
  GST_ASM_OP_LESSEQUAL    = GST_ASM_TOKEN_LESSEQUAL,
  GST_ASM_OP_EQUAL        = GST_ASM_TOKEN_EQUAL,
  GST_ASM_OP_NOTEQUAL     = GST_ASM_TOKEN_NOTEQUAL,

  GST_ASM_OP_AND          = GST_ASM_TOKEN_AND,
  GST_ASM_OP_OR           = GST_ASM_TOKEN_OR
} GstASMOp;

struct _GstASMNode {
  GstASMNodeType  type;

  union {
    gchar   *varname;
    gint     intval;
    gfloat   floatval;
    GstASMOp optype;
  } data;

  GstASMNode     *left;
  GstASMNode     *right;
};

struct _GstASMRule {
  GstASMNode *root;
  GHashTable *props;
};

struct _GstASMRuleBook {
  const gchar *rulebook;

  guint        n_rules;
  GList       *rules;
};

G_END_DECLS

GstASMRuleBook*   gst_asm_rule_book_new     (const gchar *rulebook);
void              gst_asm_rule_book_free    (GstASMRuleBook *book);

gint              gst_asm_rule_book_match   (GstASMRuleBook *book, GHashTable *vars, 
		                             gint *rulematches);

#endif /* __GST_ASM_RULES_H__ */