~kamalmostafa/ubuntu/lucid/pdp/fix-504941-ftbfs

« back to all changes in this revision

Viewing changes to modules/test/pdp_dpd_test.c

  • Committer: Bazaar Package Importer
  • Author(s): Guenter Geiger (Debian/GNU)
  • Date: 2005-03-15 22:21:05 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050315222105-1q287rsihmd9j1tb
Tags: 1:0.12.4-2
* fixed the hardcoded depends
* added 3dp library

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *   Pure Data Packet module.
3
 
 *   Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org>
4
 
 *
5
 
 *   This program is free software; you can redistribute it and/or modify
6
 
 *   it under the terms of the GNU General Public License as published by
7
 
 *   the Free Software Foundation; either version 2 of the License, or
8
 
 *   (at your option) any later version.
9
 
 *
10
 
 *   This program is distributed in the hope that it will be useful,
11
 
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 *   GNU General Public License for more details.
14
 
 *
15
 
 *   You should have received a copy of the GNU General Public License
16
 
 *   along with this program; if not, write to the Free Software
17
 
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
 
 *
19
 
 */
20
 
 
21
 
 
22
 
 
23
 
#include "pdp.h"
24
 
#include "pdp_dpd_base.h"
25
 
 
26
 
typedef struct pdp_dpd_test_struct
27
 
{
28
 
    t_pdp_dpd_base x_base;
29
 
 
30
 
} t_pdp_dpd_test;
31
 
 
32
 
 
33
 
 
34
 
/* outlet methods */
35
 
static void pdp_dpd_test_1(t_pdp_dpd_test *x){post("%x: one", x);}
36
 
static void pdp_dpd_test_2(t_pdp_dpd_test *x){post("%x: two", x);}
37
 
static void pdp_dpd_test_3(t_pdp_dpd_test *x){post("%x: three", x);}
38
 
static void pdp_dpd_test_cleanup(t_pdp_dpd_test *x){post("%x: cleanup", x);}
39
 
static void pdp_dpd_test_inspect(t_pdp_dpd_test *x){post("%x: inspect", x);}
40
 
 
41
 
 
42
 
 
43
 
static void pdp_dpd_test_bang(t_pdp_dpd_test *x)
44
 
{
45
 
    /* store a dummy packet */
46
 
    pdp_dpd_base_set_context_packet(x, pdp_packet_new(PDP_IMAGE, 4096));
47
 
 
48
 
    /* bang base */
49
 
    pdp_dpd_base_bang(x);
50
 
}
51
 
 
52
 
 
53
 
static void pdp_dpd_test_free(t_pdp_dpd_test *x)
54
 
{
55
 
    pdp_dpd_base_free(x);
56
 
 
57
 
}
58
 
 
59
 
t_class *pdp_dpd_test_class;
60
 
 
61
 
 
62
 
void *pdp_dpd_test_new(void)
63
 
{
64
 
    /* allocate */
65
 
    t_pdp_dpd_test *x = (t_pdp_dpd_test *)pd_new(pdp_dpd_test_class);
66
 
 
67
 
    /* init super: this is mandatory */
68
 
    pdp_dpd_base_init(x);
69
 
 
70
 
    /* set the dpd processing methods & outlets */
71
 
    pdp_dpd_base_add_outlet(x, (t_pdp_method)pdp_dpd_test_1);
72
 
    pdp_dpd_base_add_outlet(x, (t_pdp_method)pdp_dpd_test_2);
73
 
    pdp_dpd_base_add_outlet(x, (t_pdp_method)pdp_dpd_test_3);
74
 
 
75
 
    pdp_dpd_base_add_cleanup(x, (t_pdp_method)pdp_dpd_test_cleanup);
76
 
    pdp_dpd_base_add_inspector(x, (t_pdp_method)pdp_dpd_test_inspect);
77
 
 
78
 
    return (void *)x;
79
 
}
80
 
 
81
 
 
82
 
 
83
 
#ifdef __cplusplus
84
 
extern "C"
85
 
{
86
 
#endif
87
 
 
88
 
 
89
 
void pdp_dpd_test_setup(void)
90
 
{
91
 
    /* create a standard pd class */
92
 
    pdp_dpd_test_class = class_new(gensym("pdp_dpd_test"), (t_newmethod)pdp_dpd_test_new,
93
 
        (t_method)pdp_dpd_test_free, sizeof(t_pdp_dpd_test), 0, A_NULL);
94
 
 
95
 
    /* inherit pdp base class methods */
96
 
    pdp_dpd_base_setup(pdp_dpd_test_class);
97
 
 
98
 
    /* add bang method */
99
 
    class_addbang(pdp_dpd_test_class, pdp_dpd_test_bang);
100
 
}
101
 
 
102
 
#ifdef __cplusplus
103
 
}
104
 
#endif