Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Jonathan Wilkes
purr-data
Commits
fb67c5b5
Commit
fb67c5b5
authored
Dec 11, 2017
by
Jonathan Wilkes
Browse files
Merge branch 'list-store'
parents
606d4482
88cb3664
Changes
9
Show whitespace changes
Inline
Side-by-side
packages/linux_make/Makefile
View file @
fb67c5b5
...
...
@@ -12,18 +12,16 @@ BUILDLAYOUT_DIR = $(cvs_root_dir)/packages
include
$(BUILDLAYOUT_DIR)/Makefile.buildlayout
# if machine has dpkg-deb, build a Debian package
#
ifeq ($(shell test -x /usr/bin/dpkg-deb && echo YES),YES)
#
PACKAGE_TYPE = deb
#
else
#
PACKAGE_TYPE = tarbz2
#
endif
ifeq
($(shell test -x /usr/bin/dpkg-deb && echo YES),YES)
PACKAGE_TYPE
=
deb
else
PACKAGE_TYPE
=
tarbz2
endif
# for command-line UNIX versions, you need to install Pd into the same
# directory as $(prefix) otherwise Pd won't be able to find extra, doc, etc.
ifeq
($(PACKAGE_TYPE),deb)
prefix
=
/usr
# generates the dependencies for all externals and pd itself
PACKAGE_DEPENDS
:=
$(
shell
find
$(DESTDIR)
\(
-name
"*.pd_linux"
-or
-name
pd-gui
-or
-wholename
\*
bin/pd
\)
-print0
| xargs
-0
dpkg-shlibdeps
-O
|
sed
's|shlibs:Depends=|, |'
)
else
prefix
=
/usr/local
endif
...
...
@@ -160,6 +158,9 @@ deb: debstage
cp
$(packages_src)/linux_make/debian/control
$(DESTDIR)/DEBIAN
cp
$(packages_src)/linux_make/debian/pd-l2ork.postrm
$(DESTDIR)/DEBIAN
cp
$(packages_src)/linux_make/debian/pd-l2ork.postinst
$(DESTDIR)/DEBIAN
# generate the dependencies for all externals and pd itself
$(eval PACKAGE_DEPENDS
:
= $(shell find $(DESTDIR)
\(
-name "*.pd_linux" -or -name pd-gui -or -wholename
\*
bin/pd
\)
-print0 | xargs -0 dpkg-shlibdeps -O | sed 's|shlibs:Depends=|
,
|' ))
# set build architecture and version for the package
sed -i 's|^Version
:
.*|Version: $(DEB_PD_VERSION)|'
\
$(DESTDIR)/DEBIAN/control
...
...
@@ -279,7 +280,7 @@ test_locations:
@
echo
"EXAMPLESDIR
$(examplesdir)
"
@
echo
--------------------------------------------------
# @echo "PACKAGE_DEPENDS $(PACKAGE_DEPENDS)"
#
@echo --------------------------------------------------
@echo
--------------------------------------------------
autoconf
--version
@echo
--------------------------------------------------
make
--version
...
...
packages/linux_make/debian/control
View file @
fb67c5b5
...
...
@@ -6,7 +6,7 @@ Maintainer: Ivica Ico Bukvic <ico@vt.edu>
Homepage: http://l2ork.music.vt.edu
Package: pd-l2ork
Architecture: i386
Depends:
libc6, xterm | x-terminal-emulator, libasound2, libjack-jackd2-0, libbluetooth3, libgl1-mesa-glx, libgl1-mesa-dri, libglu1-mesa, libftgl2, libgmerlin0, libgmerlin-avdec1, libavifile-0.7c2, libmpeg3-1 | libmpeg3-2, libquicktime2, libv4l-0, libraw1394-11, libdc1394-22, libfftw3-3, libvorbis0a, libmp3lame0, libspeex1, libgsl0ldbl | libgsl2, python, libsmpeg0, libjpeg62, libflite1, libgsm1, libxv1
, fluid-soundfont-gm
, byacc
Depends:
python
, fluid-soundfont-gm
Provides: pd-l2ork
Installed-Size: 90624
Recommends: xdg-utils, pulseaudio-utils, tap-plugins, ladspa-foo-plugins, invada-studio-plugins-ladspa, blepvco, swh-plugins, mcp-plugins, cmt, blop, slv2-jack, omins, ubuntustudio-audio-plugins, rev-plugins, dssi-utils, vco-plugins, wah-plugins, fil-plugins, mda-lv2
...
...
packages/linux_make/debian/control.desktop
View file @
fb67c5b5
...
...
@@ -6,7 +6,7 @@ Maintainer: Ivica Ico Bukvic <ico@vt.edu>
Homepage: http://l2ork.music.vt.edu
Package: pd-l2ork
Architecture: i386
Depends:
libc6, xterm | x-terminal-emulator, libasound2, libjack-jackd2-0, libbluetooth3, libgl1-mesa-glx, libgl1-mesa-dri, libglu1-mesa, libftgl2, libgmerlin0, libgmerlin-avdec1, libavifile-0.7c2, libmpeg3-1 | libmpeg3-2, libquicktime2, libv4l-0, libraw1394-11, libdc1394-22, libfftw3-3, libvorbis0a, libmp3lame0, libspeex1, libgsl0ldbl | libgsl2, python, libsmpeg0, libjpeg62, libflite1, libgsm1, libxv1
, fluid-soundfont-gm
, byacc
Depends:
python
, fluid-soundfont-gm
Provides: pd-l2ork
Installed-Size: 90624
Recommends: xdg-utils, pulseaudio-utils, tap-plugins, ladspa-foo-plugins, invada-studio-plugins-ladspa, blepvco, swh-plugins, mcp-plugins, cmt, blop, slv2-jack, omins, ubuntustudio-audio-plugins, rev-plugins, dssi-utils, vco-plugins, wah-plugins, fil-plugins, mda-lv2
...
...
packages/linux_make/debian/control.raspbian
View file @
fb67c5b5
...
...
@@ -6,7 +6,7 @@ Maintainer: Ivica Ico Bukvic <ico@vt.edu>
Homepage: http://l2ork.music.vt.edu
Package: pd-l2ork
Architecture: i386
Depends:
xterm | x-terminal-emulator, libasound2, libjack-jackd2-0, libbluetooth3, libgl1-mesa-glx, libglu1-mesa, libftgl2, libgmerlin0, libgmerlin-avdec1, libavifile-0.7c2, libmpeg3-1 | libmpeg3-2, libquicktime2, libv4l-0, libraw1394-11, libdc1394-22, libfftw3-3, libvorbis0a, libmp3lame0, libspeex1, libgsl0ldbl, python, libsmpeg0, libjpeg62, tkpng, libflite1, libgsm1, libxv1
, fluid-soundfont-gm
, byacc
Depends:
python
, fluid-soundfont-gm
Provides: pd-l2ork
Installed-Size: 90624
Recommends: xdg-utils, pulseaudio-utils, tap-plugins, ladspa-foo-plugins, invada-studio-plugins-ladspa, blepvco, swh-plugins, mcp-plugins, cmt, blop, slv2-jack, omins, ubuntustudio-audio-plugins, rev-plugins, dssi-utils, vco-plugins, wah-plugins, fil-plugins, mda-lv2
...
...
packages/linux_make/debian/control.ubuntu
View file @
fb67c5b5
...
...
@@ -6,7 +6,7 @@ Maintainer: Ivica Ico Bukvic <ico@vt.edu>
Homepage: http://l2ork.music.vt.edu
Package: pd-l2ork
Architecture: i386
Depends:
xterm | x-terminal-emulator, libc6 (>= 2.1.5), libasound2, libjack-jackd2-0, libbluetooth3, libgl1-mesa-glx, libgl1-mesa-dri, libglu1-mesa, libglew1.5, libmagick++4, libftgl2, libgmerlin0, libgmerlin-avdec1, libavifile-0.7c2, libmpeg3-1, libquicktime2, libv4l-0, libraw1394-11, libdc1394-22, libfftw3-3, libvorbis0a, libmp3lame0, libspeex1, libgsl0ldbl, python, libsmpeg0, libjpeg62, libflite1, libgsm1
Depends:
python, fluid-soundfont-gm
Provides: pd-l2ork
Installed-Size: 90624
Recommends: xdg-utils, pulseaudio-utils, tap-plugins, ladspa-foo-plugins, invada-studio-plugins-ladspa, blepvco, swh-plugins, mcp-plugins, cmt, blop, slv2-jack, omins, ubuntustudio-audio-plugins, rev-plugins, dssi-utils, vco-plugins, wah-plugins, fil-plugins, mda-lv2
...
...
pd/src/s_file.c
View file @
fb67c5b5
...
...
@@ -46,7 +46,7 @@ void sys_doflags( void);
#ifdef UNIX
#define USER_CONFIG_DIR ".p
d-l2ork
"
#define USER_CONFIG_DIR ".p
urr-data
"
static
char
*
sys_prefbuf
;
...
...
pd/src/s_stuff.h.in
View file @
fb67c5b5
...
...
@@ -440,7 +440,7 @@ EXTERN void alist_init(t_alist *x);
EXTERN void alist_clear(t_alist *x);
EXTERN void alist_list(t_alist *x, t_symbol *s, int argc, t_atom *argv);
EXTERN void alist_anything(t_alist *x, t_symbol *s, int argc, t_atom *argv);
EXTERN void alist_toatoms(t_alist *x, t_atom *to);
EXTERN void alist_clone(t_alist *x, t_alist *y);
EXTERN void alist_toatoms(t_alist *x, t_atom *to
, int onset, int count
);
EXTERN void alist_clone(t_alist *x, t_alist *y
, int onset, int count
);
#endif /* __s_stuff_h_ */
pd/src/x_list.c
View file @
fb67c5b5
...
...
@@ -79,8 +79,6 @@ void alist_init(t_alist *x)
void
alist_clear
(
t_alist
*
x
)
{
if
(
x
->
l_n
)
{
int
i
;
for
(
i
=
0
;
i
<
x
->
l_n
;
i
++
)
{
...
...
@@ -89,11 +87,25 @@ void alist_clear(t_alist *x)
}
if
(
x
->
l_vec
)
freebytes
(
x
->
l_vec
,
x
->
l_n
*
sizeof
(
*
x
->
l_vec
));
}
static
void
alist_copyin
(
t_alist
*
x
,
t_symbol
*
s
,
int
argc
,
t_atom
*
argv
,
int
where
)
{
int
i
,
j
;
for
(
i
=
0
,
j
=
where
;
i
<
argc
;
i
++
,
j
++
)
{
x
->
l_vec
[
j
].
l_a
=
argv
[
i
];
if
(
x
->
l_vec
[
j
].
l_a
.
a_type
==
A_POINTER
)
{
x
->
l_npointer
++
;
gpointer_copy
(
x
->
l_vec
[
j
].
l_a
.
a_w
.
w_gpointer
,
&
x
->
l_vec
[
j
].
l_p
);
x
->
l_vec
[
j
].
l_a
.
a_w
.
w_gpointer
=
&
x
->
l_vec
[
j
].
l_p
;
}
}
x
->
l_n
=
0
;
x
->
l_npointer
=
0
;
}
/* set contents to a list */
void
alist_list
(
t_alist
*
x
,
t_symbol
*
s
,
int
argc
,
t_atom
*
argv
)
{
int
i
;
...
...
@@ -118,6 +130,7 @@ void alist_list(t_alist *x, t_symbol *s, int argc, t_atom *argv)
}
}
/* set contents to an arbitrary non-list message */
void
alist_anything
(
t_alist
*
x
,
t_symbol
*
s
,
int
argc
,
t_atom
*
argv
)
{
int
i
;
...
...
@@ -143,32 +156,32 @@ void alist_anything(t_alist *x, t_symbol *s, int argc, t_atom *argv)
}
}
void
alist_toatoms
(
t_alist
*
x
,
t_atom
*
to
)
void
alist_toatoms
(
t_alist
*
x
,
t_atom
*
to
,
int
onset
,
int
count
)
{
int
i
;
for
(
i
=
0
;
i
<
x
->
l_n
;
i
++
)
to
[
i
]
=
x
->
l_vec
[
i
].
l_a
;
for
(
i
=
0
;
i
<
count
;
i
++
)
to
[
i
]
=
x
->
l_vec
[
onset
+
i
].
l_a
;
}
void
alist_clone
(
t_alist
*
x
,
t_alist
*
y
)
void
alist_clone
(
t_alist
*
x
,
t_alist
*
y
,
int
onset
,
int
count
)
{
int
i
;
y
->
l_pd
=
alist_class
;
y
->
l_n
=
x
->
l_n
;
y
->
l_npointer
=
x
->
l_npointer
;
y
->
l_n
=
count
;
y
->
l_npointer
=
0
;
if
(
!
(
y
->
l_vec
=
(
t_listelem
*
)
getbytes
(
y
->
l_n
*
sizeof
(
*
y
->
l_vec
))))
{
y
->
l_n
=
0
;
error
(
"list_alloc: out of memory"
);
}
else
for
(
i
=
0
;
i
<
x
->
l_n
;
i
++
)
else
for
(
i
=
0
;
i
<
count
;
i
++
)
{
y
->
l_vec
[
i
].
l_a
=
x
->
l_vec
[
i
].
l_a
;
y
->
l_vec
[
i
].
l_a
=
x
->
l_vec
[
onset
+
i
].
l_a
;
if
(
y
->
l_vec
[
i
].
l_a
.
a_type
==
A_POINTER
)
{
gpointer_copy
(
y
->
l_vec
[
i
].
l_a
.
a_w
.
w_gpointer
,
&
y
->
l_vec
[
i
].
l_p
);
y
->
l_vec
[
i
].
l_a
.
a_w
.
w_gpointer
=
&
y
->
l_vec
[
i
].
l_p
;
y
->
l_npointer
++
;
}
}
}
...
...
@@ -205,20 +218,22 @@ static void list_append_list(t_list_append *x, t_symbol *s,
int
argc
,
t_atom
*
argv
)
{
t_atom
*
outv
;
int
outc
=
x
->
x_alist
.
l_n
+
argc
;
int
n
,
outc
;
n
=
x
->
x_alist
.
l_n
;
outc
=
n
+
argc
;
XL_ATOMS_ALLOCA
(
outv
,
outc
);
atoms_copy
(
argc
,
argv
,
outv
);
if
(
x
->
x_alist
.
l_npointer
)
{
t_alist
y
;
alist_clone
(
&
x
->
x_alist
,
&
y
);
alist_toatoms
(
&
y
,
outv
+
argc
);
alist_clone
(
&
x
->
x_alist
,
&
y
,
0
,
n
);
alist_toatoms
(
&
y
,
outv
+
argc
,
0
,
n
);
outlet_list
(
x
->
x_obj
.
ob_outlet
,
&
s_list
,
outc
,
outv
);
alist_clear
(
&
y
);
}
else
{
alist_toatoms
(
&
x
->
x_alist
,
outv
+
argc
);
alist_toatoms
(
&
x
->
x_alist
,
outv
+
argc
,
0
,
n
);
outlet_list
(
x
->
x_obj
.
ob_outlet
,
&
s_list
,
outc
,
outv
);
}
XL_ATOMS_FREEA
(
outv
,
outc
);
...
...
@@ -228,21 +243,23 @@ static void list_append_anything(t_list_append *x, t_symbol *s,
int
argc
,
t_atom
*
argv
)
{
t_atom
*
outv
;
int
outc
=
x
->
x_alist
.
l_n
+
argc
+
1
;
int
n
,
outc
;
n
=
x
->
x_alist
.
l_n
;
outc
=
n
+
argc
+
1
;
XL_ATOMS_ALLOCA
(
outv
,
outc
);
SETSYMBOL
(
outv
,
s
);
atoms_copy
(
argc
,
argv
,
outv
+
1
);
if
(
x
->
x_alist
.
l_npointer
)
{
t_alist
y
;
alist_clone
(
&
x
->
x_alist
,
&
y
);
alist_toatoms
(
&
y
,
outv
+
1
+
argc
);
alist_clone
(
&
x
->
x_alist
,
&
y
,
0
,
n
);
alist_toatoms
(
&
y
,
outv
+
1
+
argc
,
0
,
n
);
outlet_list
(
x
->
x_obj
.
ob_outlet
,
&
s_list
,
outc
,
outv
);
alist_clear
(
&
y
);
}
else
{
alist_toatoms
(
&
x
->
x_alist
,
outv
+
1
+
argc
);
alist_toatoms
(
&
x
->
x_alist
,
outv
+
1
+
argc
,
0
,
n
);
outlet_list
(
x
->
x_obj
.
ob_outlet
,
&
s_list
,
outc
,
outv
);
}
XL_ATOMS_FREEA
(
outv
,
outc
);
...
...
@@ -309,20 +326,22 @@ static void list_cat_list(t_list_cat *x, t_symbol *s,
int
argc
,
t_atom
*
argv
)
{
t_atom
*
outv
;
int
outc
=
x
->
x_alist
.
l_n
+
argc
;
int
n
,
outc
;
n
=
x
->
x_alist
.
l_n
;
outc
=
n
+
argc
;
XL_ATOMS_ALLOCA
(
outv
,
outc
);
atoms_copy
(
argc
,
argv
,
outv
+
x
->
x_alist
.
l_n
);
if
(
x
->
x_alist
.
l_npointer
)
{
t_alist
y
;
alist_clone
(
&
x
->
x_alist
,
&
y
);
alist_toatoms
(
&
y
,
outv
);
alist_clone
(
&
x
->
x_alist
,
&
y
,
0
,
n
);
alist_toatoms
(
&
y
,
outv
,
0
,
n
);
outlet_list
(
x
->
x_obj
.
ob_outlet
,
&
s_list
,
outc
,
outv
);
alist_clear
(
&
y
);
}
else
{
alist_toatoms
(
&
x
->
x_alist
,
outv
);
alist_toatoms
(
&
x
->
x_alist
,
outv
,
0
,
n
);
outlet_list
(
x
->
x_obj
.
ob_outlet
,
&
s_list
,
outc
,
outv
);
}
alist_list
(
&
x
->
x_alist
,
s
,
outc
,
outv
);
...
...
@@ -333,21 +352,23 @@ static void list_cat_anything(t_list_cat *x, t_symbol *s,
int
argc
,
t_atom
*
argv
)
{
t_atom
*
outv
;
int
outc
=
x
->
x_alist
.
l_n
+
argc
+
1
;
int
n
,
outc
;
n
=
x
->
x_alist
.
l_n
;
outc
=
n
+
argc
+
1
;
XL_ATOMS_ALLOCA
(
outv
,
outc
);
SETSYMBOL
(
outv
+
x
->
x_alist
.
l_n
,
s
);
atoms_copy
(
argc
,
argv
,
outv
+
x
->
x_alist
.
l_n
+
1
);
if
(
x
->
x_alist
.
l_npointer
)
{
t_alist
y
;
alist_clone
(
&
x
->
x_alist
,
&
y
);
alist_toatoms
(
&
y
,
outv
);
alist_clone
(
&
x
->
x_alist
,
&
y
,
0
,
n
);
alist_toatoms
(
&
y
,
outv
,
0
,
n
);
outlet_list
(
x
->
x_obj
.
ob_outlet
,
&
s_list
,
outc
,
outv
);
alist_clear
(
&
y
);
}
else
{
alist_toatoms
(
&
x
->
x_alist
,
outv
);
alist_toatoms
(
&
x
->
x_alist
,
outv
,
0
,
n
);
outlet_list
(
x
->
x_obj
.
ob_outlet
,
&
s_list
,
outc
,
outv
);
}
if
(
x
->
x_alist
.
l_n
<=
1
)
...
...
@@ -406,20 +427,22 @@ static void list_prepend_list(t_list_prepend *x, t_symbol *s,
int
argc
,
t_atom
*
argv
)
{
t_atom
*
outv
;
int
outc
=
x
->
x_alist
.
l_n
+
argc
;
int
n
,
outc
;
n
=
x
->
x_alist
.
l_n
;
outc
=
n
+
argc
;
XL_ATOMS_ALLOCA
(
outv
,
outc
);
atoms_copy
(
argc
,
argv
,
outv
+
x
->
x_alist
.
l_
n
);
atoms_copy
(
argc
,
argv
,
outv
+
n
);
if
(
x
->
x_alist
.
l_npointer
)
{
t_alist
y
;
alist_clone
(
&
x
->
x_alist
,
&
y
);
alist_toatoms
(
&
y
,
outv
);
alist_clone
(
&
x
->
x_alist
,
&
y
,
0
,
n
);
alist_toatoms
(
&
y
,
outv
,
0
,
n
);
outlet_list
(
x
->
x_obj
.
ob_outlet
,
&
s_list
,
outc
,
outv
);
alist_clear
(
&
y
);
}
else
{
alist_toatoms
(
&
x
->
x_alist
,
outv
);
alist_toatoms
(
&
x
->
x_alist
,
outv
,
0
,
n
);
outlet_list
(
x
->
x_obj
.
ob_outlet
,
&
s_list
,
outc
,
outv
);
}
XL_ATOMS_FREEA
(
outv
,
outc
);
...
...
@@ -431,21 +454,23 @@ static void list_prepend_anything(t_list_prepend *x, t_symbol *s,
int
argc
,
t_atom
*
argv
)
{
t_atom
*
outv
;
int
outc
=
x
->
x_alist
.
l_n
+
argc
+
1
;
int
n
,
outc
;
n
=
x
->
x_alist
.
l_n
;
outc
=
n
+
argc
+
1
;
XL_ATOMS_ALLOCA
(
outv
,
outc
);
SETSYMBOL
(
outv
+
x
->
x_alist
.
l_
n
,
s
);
atoms_copy
(
argc
,
argv
,
outv
+
x
->
x_alist
.
l_
n
+
1
);
SETSYMBOL
(
outv
+
n
,
s
);
atoms_copy
(
argc
,
argv
,
outv
+
n
+
1
);
if
(
x
->
x_alist
.
l_npointer
)
{
t_alist
y
;
alist_clone
(
&
x
->
x_alist
,
&
y
);
alist_toatoms
(
&
y
,
outv
);
alist_clone
(
&
x
->
x_alist
,
&
y
,
0
,
n
);
alist_toatoms
(
&
y
,
outv
,
0
,
n
);
outlet_list
(
x
->
x_obj
.
ob_outlet
,
&
s_list
,
outc
,
outv
);
alist_clear
(
&
y
);
}
else
{
alist_toatoms
(
&
x
->
x_alist
,
outv
);
alist_toatoms
(
&
x
->
x_alist
,
outv
,
0
,
n
);
outlet_list
(
x
->
x_obj
.
ob_outlet
,
&
s_list
,
outc
,
outv
);
}
XL_ATOMS_FREEA
(
outv
,
outc
);
...
...
@@ -468,6 +493,162 @@ static void list_prepend_setup(void)
}
/* ------------- list store --------------------- */
t_class
*
list_store_class
;
typedef
struct
_list_store
{
t_object
x_obj
;
t_alist
x_alist
;
t_outlet
*
x_out1
;
t_outlet
*
x_out2
;
}
t_list_store
;
static
void
*
list_store_new
(
t_symbol
*
s
,
int
argc
,
t_atom
*
argv
)
{
t_list_store
*
x
=
(
t_list_store
*
)
pd_new
(
list_store_class
);
alist_init
(
&
x
->
x_alist
);
alist_list
(
&
x
->
x_alist
,
0
,
argc
,
argv
);
x
->
x_out1
=
outlet_new
(
&
x
->
x_obj
,
&
s_list
);
x
->
x_out2
=
outlet_new
(
&
x
->
x_obj
,
&
s_bang
);
inlet_new
(
&
x
->
x_obj
,
&
x
->
x_alist
.
l_pd
,
0
,
0
);
return
(
x
);
}
static
void
list_store_list
(
t_list_store
*
x
,
t_symbol
*
s
,
int
argc
,
t_atom
*
argv
)
{
t_atom
*
outv
;
int
n
,
outc
;
n
=
x
->
x_alist
.
l_n
;
outc
=
n
+
argc
;
ATOMS_ALLOCA
(
outv
,
outc
);
atoms_copy
(
argc
,
argv
,
outv
);
if
(
x
->
x_alist
.
l_npointer
)
{
t_alist
y
;
alist_clone
(
&
x
->
x_alist
,
&
y
,
0
,
n
);
alist_toatoms
(
&
y
,
outv
+
argc
,
0
,
n
);
outlet_list
(
x
->
x_out1
,
&
s_list
,
outc
,
outv
);
alist_clear
(
&
y
);
}
else
{
alist_toatoms
(
&
x
->
x_alist
,
outv
+
argc
,
0
,
n
);
outlet_list
(
x
->
x_out1
,
&
s_list
,
outc
,
outv
);
}
ATOMS_FREEA
(
outv
,
outc
);
}
/* function to restore gpointers after the list has moved in memory */
static
void
list_store_restore_gpointers
(
t_list_store
*
x
,
int
offset
,
int
count
)
{
t_listelem
*
vec
=
x
->
x_alist
.
l_vec
+
offset
;
while
(
count
--
)
{
if
(
vec
->
l_a
.
a_type
==
A_POINTER
)
vec
->
l_a
.
a_w
.
w_gpointer
=
&
vec
->
l_p
;
vec
++
;
}
}
static
void
list_store_append
(
t_list_store
*
x
,
t_symbol
*
s
,
int
argc
,
t_atom
*
argv
)
{
t_listelem
*
oldptr
=
x
->
x_alist
.
l_vec
;
if
(
!
(
x
->
x_alist
.
l_vec
=
(
t_listelem
*
)
resizebytes
(
x
->
x_alist
.
l_vec
,
(
x
->
x_alist
.
l_n
)
*
sizeof
(
*
x
->
x_alist
.
l_vec
),
(
x
->
x_alist
.
l_n
+
argc
)
*
sizeof
(
*
x
->
x_alist
.
l_vec
))))
{
x
->
x_alist
.
l_n
=
0
;
error
(
"list: out of memory"
);
return
;
}
/* fix gpointers if resizebytes() has moved the alist in memory */
if
(
x
->
x_alist
.
l_vec
!=
oldptr
&&
x
->
x_alist
.
l_npointer
)
list_store_restore_gpointers
(
x
,
0
,
x
->
x_alist
.
l_n
);
alist_copyin
(
&
x
->
x_alist
,
s
,
argc
,
argv
,
x
->
x_alist
.
l_n
);
x
->
x_alist
.
l_n
+=
argc
;
}
static
void
list_store_prepend
(
t_list_store
*
x
,
t_symbol
*
s
,
int
argc
,
t_atom
*
argv
)
{
if
(
!
(
x
->
x_alist
.
l_vec
=
(
t_listelem
*
)
resizebytes
(
x
->
x_alist
.
l_vec
,
(
x
->
x_alist
.
l_n
)
*
sizeof
(
*
x
->
x_alist
.
l_vec
),
(
x
->
x_alist
.
l_n
+
argc
)
*
sizeof
(
*
x
->
x_alist
.
l_vec
))))
{
x
->
x_alist
.
l_n
=
0
;
error
(
"list: out of memory"
);
return
;
}
memmove
(
x
->
x_alist
.
l_vec
+
argc
,
x
->
x_alist
.
l_vec
,
x
->
x_alist
.
l_n
*
sizeof
(
*
x
->
x_alist
.
l_vec
));
/* we always have to fix gpointers because of memmove() */
if
(
x
->
x_alist
.
l_npointer
)
list_store_restore_gpointers
(
x
,
argc
,
x
->
x_alist
.
l_n
);
alist_copyin
(
&
x
->
x_alist
,
s
,
argc
,
argv
,
0
);
x
->
x_alist
.
l_n
+=
argc
;
}
static
void
list_store_get
(
t_list_store
*
x
,
float
f1
,
float
f2
)
{
t_atom
*
outv
;
int
onset
=
f1
,
outc
=
f2
;
if
(
onset
<
0
||
outc
<
0
)
{
pd_error
(
x
,
"list_store_get: negative range (%d %d)"
,
onset
,
outc
);
return
;
}
if
(
onset
+
outc
>
x
->
x_alist
.
l_n
)
{
outlet_bang
(
x
->
x_out2
);
return
;
}
ATOMS_ALLOCA
(
outv
,
outc
);
if
(
x
->
x_alist
.
l_npointer
)
{
t_alist
y
;
alist_clone
(
&
x
->
x_alist
,
&
y
,
onset
,
outc
);
alist_toatoms
(
&
y
,
outv
,
0
,
outc
);
outlet_list
(
x
->
x_out1
,
&
s_list
,
outc
,
outv
);
alist_clear
(
&
y
);
}
else
{
alist_toatoms
(
&
x
->
x_alist
,
outv
,
onset
,
outc
);
outlet_list
(
x
->
x_out1
,
&
s_list
,
outc
,
outv
);
}
ATOMS_FREEA
(
outv
,
outc
);
}
static
void
list_store_free
(
t_list_store
*
x
)
{
alist_clear
(
&
x
->
x_alist
);
}
static
void
list_store_setup
(
void
)
{
list_store_class
=
class_new
(
gensym
(
"list store"
),
(
t_newmethod
)
list_store_new
,
(
t_method
)
list_store_free
,
sizeof
(
t_list_store
),
0
,
A_GIMME
,
0
);
class_addlist
(
list_store_class
,
list_store_list
);
class_addmethod
(
list_store_class
,
(
t_method
)
list_store_append
,
gensym
(
"append"
),
A_GIMME
,
0
);
class_addmethod
(
list_store_class
,
(
t_method
)
list_store_prepend
,
gensym
(
"prepend"
),
A_GIMME
,
0
);
class_addmethod
(
list_store_class
,
(
t_method
)
list_store_get
,
gensym
(
"get"
),
A_FLOAT
,
A_FLOAT
,
0
);
class_sethelpsymbol
(
list_store_class
,
&
s_list
);
}
/* ------------- list split --------------------- */
t_class
*
list_split_class
;
...
...
@@ -709,6 +890,8 @@ static void *list_new(t_pd *dummy, t_symbol *s, int argc, t_atom *argv)
newest
=
list_fromsymbol_new
();
else
if
(
s2
==
gensym
(
"tosymbol"
))
newest
=
list_tosymbol_new
();
else
if
(
s2
==
gensym
(
"store"
))
newest
=
list_store_new
(
s
,
argc
-
1
,
argv
+
1
);
else
{
error
(
"list %s: unknown function"
,
s2
->
s_name
);
...
...
@@ -724,6 +907,7 @@ void x_list_setup(void)
list_append_setup
();
list_cat_setup
();
list_prepend_setup
();
list_store_setup
();
list_split_setup
();
list_trim_setup
();
list_length_setup
();
...
...
pd/src/x_preset.c
View file @
fb67c5b5
...
...
@@ -614,9 +614,9 @@ void preset_node_set_and_output_value(t_preset_node *x, t_alist val)
if
(
val
.
l_n
>
0
)
{
alist_clear
(
&
x
->
pn_val
);
alist_clone
(
&
val
,
&
x
->
pn_val
);
alist_clone
(
&
val
,
&
x
->
pn_val
,
0
,
val
.
l_n
);
XL_ATOMS_ALLOCA
(
outv
,
x
->
pn_val
.
l_n
);
alist_toatoms
(
&
x
->
pn_val
,
outv
);
alist_toatoms
(
&
x
->
pn_val
,
outv
,
0
,
x
->
pn_val
.
l_n
);
outlet_list
(
x
->
pn_outlet
,
&
s_list
,
x
->
pn_val
.
l_n
,
outv
);
if
(
PH_DEBUG
)
{
...
...
@@ -1199,7 +1199,8 @@ void preset_hub_store(t_preset_hub *h, t_float f)
}
}
alist_clear
(
&
np2
->
np_val
);
alist_clone
(
&
hd1
->
phd_node
->
pn_val
,
&
np2
->
np_val
);
alist_clone
(
&
hd1
->
phd_node
->
pn_val
,
&
np2
->
np_val
,
0
,
hd1
->
phd_node
->
pn_val
.
l_n
);
if
(
PH_DEBUG
)
{
fprintf
(
stderr
,
" node data len = %d, "
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment