~ubuntu-branches/ubuntu/natty/pd-zexy/natty

« back to all changes in this revision

Viewing changes to src/unpack.c

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard, IOhannes m zmölnig, Jonas Smedegaard
  • Date: 2010-08-20 12:17:41 UTC
  • mfrom: (2.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100820121741-4kxozn8b9rhee9fr
Tags: 2.2.3-1
* New upstream version

[ IOhannes m zmölnig ]
* Adopt package, on behalf of Multimedia Team.
  Closes: #546964
* Simply debian/rules with CDBS, and don't unconditionally strip
  binaries.
  Closes: #437763
* Install into /usr/lib/pd/extra/zexy/. Document usage in REAME.Debian
  and warn about change in NEWS.
* git'ify package. Add Vcs-* stanzas to control file.
* Use dpkg source format 3.0 (quilt). Drop build-dependency on quilt.

[ Jonas Smedegaard ]
* Enable CDBS copyright-check routine.
* Add copyright and licensing header to debian/rules.
* Add myself as uploader.
* Rewrite debian/copyright using rev. 135 of draft DEP5 format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/******************************************************
 
2
 *
 
3
 * zexy - implementation file
 
4
 *
 
5
 * copyleft (c) IOhannes m zm�lnig
 
6
 *
 
7
 *   1999:forum::f�r::uml�ute:2004
 
8
 *
 
9
 *   institute of electronic music and acoustics (iem)
 
10
 *
 
11
 ******************************************************
 
12
 *
 
13
 * license: GNU General Public License v.2
 
14
 *
 
15
 ******************************************************/
 
16
 
 
17
 
 
18
/* 2305:forum::f�r::uml�ute:2001 */
 
19
 
 
20
#include "zexy.h"
 
21
 
 
22
/* ------------------------- zunpack ------------------------------- */
 
23
 
 
24
/* like pack, but does no type-checking */
 
25
 
 
26
static t_class *zunpack_class;
 
27
 
 
28
typedef struct _zunpack
 
29
{
 
30
  t_object x_obj;
 
31
  t_outlet**x_out;
 
32
  t_int x_numouts;
 
33
} t_zunpack;
 
34
 
 
35
static void zunpack_list(t_zunpack *x, t_symbol *s, int argc, t_atom *argv)
 
36
{
 
37
  int count=(argc<(x->x_numouts))?argc:x->x_numouts;
 
38
 
 
39
  while(count--) {
 
40
    outlet_list(x->x_out[count], gensym("list"), 1, argv+count);
 
41
  }
 
42
}
 
43
 
 
44
static void zunpack_bang(t_zunpack *x)
 
45
{
 
46
  outlet_bang(x->x_out[0]);
 
47
}
 
48
 
 
49
static void zunpack_free(t_zunpack *x)
 
50
{
 
51
  int i=0;
 
52
  for(i=0; i<x->x_numouts; i++) {
 
53
    outlet_free(x->x_out[i]);
 
54
  }
 
55
  freebytes(x->x_out, x->x_numouts*sizeof(t_outlet*));
 
56
 
 
57
  x->x_numouts=0;
 
58
  x->x_out=0;  
 
59
}
 
60
 
 
61
static void *zunpack_new(t_symbol*s, int argc, t_atom*argv)
 
62
{
 
63
  t_zunpack *x = (t_zunpack *)pd_new(zunpack_class);
 
64
  int count=(argc>0)?argc:2;
 
65
  int i=0;
 
66
  
 
67
  x->x_numouts=count;
 
68
  x->x_out=(t_outlet**)getbytes(count*sizeof(t_outlet*));
 
69
 
 
70
  for(i=0; i<count; i++) {
 
71
    x->x_out[i]  =outlet_new(&x->x_obj, 0);
 
72
  } 
 
73
 
 
74
  return (x);
 
75
}
 
76
 
 
77
void zunpack_setup(void)
 
78
{
 
79
  
 
80
  zunpack_class = class_new(gensym("zexy/unpack"), 
 
81
                            (t_newmethod)zunpack_new, (t_method)zunpack_free, sizeof(t_zunpack), 
 
82
                            0,  A_GIMME, 0);
 
83
#if 0
 
84
  /* oops Pd-0.42 allows us to override built-ins
 
85
   * this is bad as long as the 2 objects are not compatible */
 
86
  class_addcreator((t_newmethod)zunpack_new, gensym("unpack"), A_GIMME, 0);
 
87
#endif
 
88
 
 
89
  class_addbang(zunpack_class, zunpack_bang);
 
90
  class_addlist(zunpack_class, zunpack_list);
 
91
 
 
92
  zexy_register("unpack");
 
93
}
 
94
 
 
95
void unpack_setup(void)
 
96
{
 
97
  zunpack_setup();
 
98
}