aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source/flatom_part.cpp
blob: 05a3710d02566111ed68b033f9d372ade1dccf10 (plain)
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
/* 

flext - C++ layer for Max/MSP and pd (pure data) externals

Copyright (c) 2001-2003 Thomas Grill (xovo@gmx.net)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.  

*/

/*! \file flatom_part.cpp
    \brief Definitions for handling the t_atom type and lists thereof.
*/
 
#include "flext.h"

int flext::AtomList::Get(t_atom *argv,int mxsz) const
{
	int argc = Count();
	if(mxsz >= 0 && argc > mxsz) argc = mxsz;

	for(int i = 0; i < argc; ++i) SetAtom(argv[i],lst[i]);

	return argc;
}


flext::AtomList flext::AtomList::GetPart(int offs,int len) const
{
	if(offs+len > Count()) {
		len = Count()-offs;
		if(len < 0) len = 0;
	}

	return AtomList(len,Atoms()+offs);
}