~ubuntu-branches/ubuntu/maverick/zapping/maverick

« back to all changes in this revision

Viewing changes to plugins/teletext/page_num.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2005-03-08 23:19:08 UTC
  • mfrom: (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050308231908-oip7rfv6lcmo8c0e
Tags: 0.9.2-2ubuntu1
Rebuilt for Python transition (2.3 -> 2.4)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  Zapping TV viewer
 
3
 *
 
4
 *  Copyright (C) 2000, 2001, 2002 I�aki Garc�a Etxebarria
 
5
 *  Copyright (C) 2000, 2001, 2002, 2003, 2004 Michael H. Schimek
 
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
 *  This program is distributed in the hope that it will be useful,
 
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 *  GNU General Public License for more details.
 
16
 *
 
17
 *  You should have received a copy of the GNU General Public License
 
18
 *  along with this program; if not, write to the Free Software
 
19
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
20
 */
 
21
 
 
22
/* $Id: page_num.h,v 1.1 2004/11/03 06:46:08 mschimek Exp $ */
 
23
 
 
24
#ifndef PAGE_NUM_H
 
25
#define PAGE_NUM_H
 
26
 
 
27
#include <assert.h>
 
28
#include "libvbi/bcd.h"         /* vbi3_pgno, vbi3_subno */
 
29
#include "libvbi/network.h"     /* vbi3_network */
 
30
 
 
31
typedef struct {
 
32
  vbi3_network          network;
 
33
  vbi3_pgno             pgno;
 
34
  vbi3_subno            subno;
 
35
} page_num;
 
36
 
 
37
vbi3_inline void
 
38
network_set                     (vbi3_network *         dst,
 
39
                                 const vbi3_network *   src)
 
40
{
 
41
  vbi3_bool success;
 
42
  
 
43
  success = vbi3_network_set (dst, src);
 
44
  assert (success);
 
45
}
 
46
 
 
47
vbi3_inline vbi3_bool
 
48
page_num_equal                  (const page_num *       ad1,
 
49
                                 const page_num *       ad2)
 
50
{
 
51
  return (vbi3_network_equal (&ad1->network, &ad2->network)
 
52
          && ad1->pgno == ad2->pgno
 
53
          && (ad1->subno == ad2->subno
 
54
              || VBI3_ANY_SUBNO == ad1->subno
 
55
              || VBI3_ANY_SUBNO == ad2->subno));
 
56
}
 
57
 
 
58
vbi3_inline vbi3_bool
 
59
page_num_equal2                 (const page_num *       ad1,
 
60
                                 const vbi3_network *   nk2,
 
61
                                 vbi3_pgno              pgno2,
 
62
                                 vbi3_subno             subno2)
 
63
{
 
64
  return (vbi3_network_equal (&ad1->network, nk2)
 
65
          && ad1->pgno == pgno2
 
66
          && (ad1->subno == subno2
 
67
              || VBI3_ANY_SUBNO == ad1->subno
 
68
              || VBI3_ANY_SUBNO == subno2));
 
69
}
 
70
 
 
71
vbi3_inline void
 
72
page_num_destroy                (page_num *             pn)
 
73
{
 
74
  vbi3_network_destroy (&pn->network);
 
75
}
 
76
 
 
77
vbi3_inline void
 
78
page_num_set                    (page_num *             pn,
 
79
                                 const vbi3_network *   nk,
 
80
                                 vbi3_pgno              pgno,
 
81
                                 vbi3_subno             subno)
 
82
{
 
83
  network_set (&pn->network, nk);
 
84
  pn->pgno = pgno;
 
85
  pn->subno = subno;
 
86
}
 
87
 
 
88
#endif /* PAGE_NUM_H */