Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Rishabh Gupta
purr-data
Commits
0e83b4c1
Commit
0e83b4c1
authored
Jun 23, 2016
by
Jonathan Wilkes
Browse files
remove more binaries accidentally committed to flext
parent
bec8b2ec
Changes
59
Expand all
Hide whitespace changes
Inline
Side-by-side
externals/grill/trunk/flext/libbuild/include/flext/flatom.cpp
deleted
100755 → 0
View file @
bec8b2ec
/*
flext - C++ layer for Max and Pure Data externals
Copyright (c) 2001-2015 Thomas Grill (gr@grrrr.org)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
*/
/*! \file flatom.cpp
\brief Definitions for handling the t_atom type and lists thereof.
*/
#ifndef __FLEXT_ATOM_CPP
#define __FLEXT_ATOM_CPP
#include "flext.h"
#include <cstring> // for memcpy
#include "flpushns.h"
#if FLEXT_SYS != FLEXT_SYS_JMAX
FLEXT_TEMPIMPL
(
int
FLEXT_CLASSDEF
(
flext
))
::
CmpAtom
(
const
t_atom
&
a
,
const
t_atom
&
b
)
{
if
(
GetType
(
a
)
==
GetType
(
b
))
{
switch
(
GetType
(
a
))
{
case
A_FLOAT
:
return
GetFloat
(
a
)
==
GetFloat
(
b
)
?
0
:
(
GetFloat
(
a
)
<
GetFloat
(
b
)
?-
1
:
1
);
#if FLEXT_SYS == FLEXT_SYS_MAX
case
A_INT
:
return
GetInt
(
a
)
==
GetInt
(
b
)
?
0
:
(
GetInt
(
a
)
<
GetInt
(
b
)
?-
1
:
1
);
#endif
case
A_SYMBOL
:
return
GetSymbol
(
a
)
==
GetSymbol
(
b
)
?
0
:
strcmp
(
GetString
(
a
),
GetString
(
b
));
#if FLEXT_SYS == FLEXT_SYS_PD
case
A_POINTER
:
return
GetPointer
(
a
)
==
GetPointer
(
b
)
?
0
:
(
GetPointer
(
a
)
<
GetPointer
(
b
)
?-
1
:
1
);
#endif
default:
// can't be compared.....
FLEXT_ASSERT
(
false
);
return
0
;
}
}
else
return
GetType
(
a
)
<
GetType
(
b
)
?-
1
:
1
;
}
#else
#error Not implemented
#endif
FLEXT_TEMPIMPL
(
t_atom
*
FLEXT_CLASSDEF
(
flext
))
::
CopyList
(
int
argc
,
const
t_atom
*
argv
)
{
t_atom
*
dst
=
new
t_atom
[
argc
];
memcpy
(
dst
,
argv
,
argc
*
sizeof
(
t_atom
));
return
dst
;
}
FLEXT_TEMPIMPL
(
void
FLEXT_CLASSDEF
(
flext
))
::
CopyAtoms
(
int
cnt
,
t_atom
*
dst
,
const
t_atom
*
src
)
{
if
(
dst
<
src
)
// forward
memcpy
(
dst
,
src
,
cnt
*
sizeof
(
t_atom
));
else
// backwards
while
(
cnt
--
)
dst
[
cnt
]
=
src
[
cnt
];
}
FLEXT_TEMPIMPL
(
void
FLEXT_CLASSDEF
(
flext
))
::
AtomList
::
Alloc
(
int
sz
,
int
keepix
,
int
keeplen
,
int
keepto
)
{
if
(
lst
)
{
if
(
cnt
==
sz
)
{
if
(
keepix
>=
0
&&
keepix
!=
keepto
)
{
int
c
=
keeplen
>=
0
?
keeplen
:
cnt
;
FLEXT_ASSERT
(
c
+
keepto
<=
cnt
);
FLEXT_ASSERT
(
c
+
keepix
<=
cnt
);
CopyAtoms
(
c
,
lst
+
keepto
,
lst
+
keepix
);
}
return
;
// no change
}
t_atom
*
l
;
if
(
sz
)
{
l
=
new
t_atom
[
sz
];
if
(
keepix
>=
0
)
{
// keep contents
int
c
=
keeplen
>=
0
?
keeplen
:
(
cnt
>
sz
?
sz
:
cnt
);
FLEXT_ASSERT
(
c
+
keepto
<=
sz
);
FLEXT_ASSERT
(
c
+
keepix
<=
cnt
);
CopyAtoms
(
c
,
l
+
keepto
,
lst
+
keepix
);
}
}
else
l
=
NULL
;
Free
();
lst
=
l
,
cnt
=
sz
;
}
else
{
FLEXT_ASSERT
(
cnt
==
0
);
if
(
sz
)
lst
=
new
t_atom
[
cnt
=
sz
];
}
}
FLEXT_TEMPIMPL
(
FLEXT_CLASSDEF
(
flext
))
::
AtomList
::~
AtomList
()
{
Free
();
}
FLEXT_TEMPIMPL
(
void
FLEXT_CLASSDEF
(
flext
))
::
AtomList
::
Free
()
{
if
(
lst
)
{
delete
[]
lst
;
lst
=
NULL
;
cnt
=
0
;
}
else
FLEXT_ASSERT
(
cnt
==
0
);
}
FLEXT_TEMPIMPL
(
FLEXT_TEMPSUB
(
FLEXT_CLASSDEF
(
flext
))
::
AtomList
&
FLEXT_CLASSDEF
(
flext
))
::
AtomList
::
Set
(
int
argc
,
const
t_atom
*
argv
,
int
offs
,
bool
resize
)
{
int
ncnt
=
argc
+
offs
;
if
(
resize
)
Alloc
(
ncnt
);
// argv can be NULL independently from argc
if
(
argv
)
CopyAtoms
(
argc
,
lst
+
offs
,
argv
);
return
*
this
;
}
FLEXT_TEMPIMPL
(
int
FLEXT_CLASSDEF
(
flext
))
::
AtomList
::
Compare
(
const
AtomList
&
a
)
const
{
if
(
Count
()
==
a
.
Count
())
{
for
(
int
i
=
0
;
i
<
Count
();
++
i
)
{
int
cmp
=
CmpAtom
(
lst
[
i
],
a
[
i
]);
if
(
cmp
)
return
cmp
;
}
return
0
;
}
else
return
Count
()
<
a
.
Count
()
?-
1
:
1
;
}
FLEXT_TEMPIMPL
(
FLEXT_CLASSDEF
(
flext
))
::
AtomListStaticBase
::~
AtomListStaticBase
()
{
Free
();
}
FLEXT_TEMPIMPL
(
void
FLEXT_CLASSDEF
(
flext
))
::
AtomListStaticBase
::
Alloc
(
int
sz
,
int
keepix
,
int
keeplen
,
int
keepto
)
{
if
(
sz
<=
precnt
)
{
// small enough for pre-allocated space
if
(
AtomList
::
lst
!=
predata
&&
AtomList
::
lst
)
{
// currently allocated memory is larger than what we need
if
(
keepix
>=
0
)
{
// keep contents
int
c
=
keeplen
>=
0
?
keeplen
:
(
AtomList
::
cnt
>
sz
?
sz
:
AtomList
::
cnt
);
FLEXT_ASSERT
(
c
+
keepto
<=
precnt
);
FLEXT_ASSERT
(
c
+
keepix
<=
AtomList
::
cnt
);
CopyAtoms
(
c
,
predata
+
keepto
,
AtomList
::
lst
+
keepix
);
}
// free allocated memory
AtomList
::
Free
();
}
AtomList
::
lst
=
predata
;
AtomList
::
cnt
=
sz
;
}
else
AtomList
::
Alloc
(
sz
,
keepix
,
keeplen
,
keepto
);
}
FLEXT_TEMPIMPL
(
void
FLEXT_CLASSDEF
(
flext
))
::
AtomListStaticBase
::
Free
()
{
if
(
AtomList
::
lst
!=
predata
)
AtomList
::
Free
();
else
{
AtomList
::
lst
=
NULL
;
AtomList
::
cnt
=
0
;
}
}
#include "flpopns.h"
#endif // __FLEXT_ATOM_CPP
externals/grill/trunk/flext/libbuild/include/flext/flatom_part.cpp
deleted
100755 → 0
View file @
bec8b2ec
/*
flext - C++ layer for Max and Pure Data externals
Copyright (c) 2001-2015 Thomas Grill (gr@grrrr.org)
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.
*/
#ifndef __FLEXT_ATOM_PART_CPP
#define __FLEXT_ATOM_PART_CPP
#include "flext.h"
#include "flpushns.h"
FLEXT_TEMPIMPL
(
int
FLEXT_CLASSDEF
(
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_TEMPIMPL
(
void
FLEXT_CLASSDEF
(
flext
))
::
AtomList
::
GetPart
(
int
offs
,
int
len
,
AtomList
&
ret
)
const
{
if
(
offs
+
len
>
Count
())
{
len
=
Count
()
-
offs
;
if
(
len
<
0
)
len
=
0
;
}
ret
(
len
,
Atoms
()
+
offs
);
}
#include "flpopns.h"
#endif // __FLEXT_ATOM_PART_CPP
externals/grill/trunk/flext/libbuild/include/flext/flatom_pr.cpp
deleted
100755 → 0
View file @
bec8b2ec
/*
flext - C++ layer for Max and Pure Data externals
Copyright (c) 2001-2015 Thomas Grill (gr@grrrr.org)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
*/
/*! \file flatom_pr.cpp
\brief Definitions for printing and scanning the t_atom type.
*/
#ifndef __FLEXT_ATOM_PR_CPP
#define __FLEXT_ATOM_PR_CPP
#include "flext.h"
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include "flpushns.h"
#ifdef _MSC_VER
#define snprintf _snprintf
#endif
FLEXT_TEMPIMPL
(
bool
FLEXT_CLASSDEF
(
flext
))
::
PrintAtom
(
const
t_atom
&
a
,
char
*
buf
,
size_t
bufsz
)
{
bool
ok
=
true
;
if
(
IsFloat
(
a
))
{
ok
=
STD
::
snprintf
(
buf
,
bufsz
,
"%g"
,
GetFloat
(
a
))
>
0
;
}
else
if
(
IsInt
(
a
))
{
ok
=
STD
::
snprintf
(
buf
,
bufsz
,
"%i"
,
GetInt
(
a
))
>
0
;
}
else
if
(
IsSymbol
(
a
))
{
const
char
*
c
=
GetString
(
a
);
size_t
len
=
strlen
(
c
);
if
(
len
<
bufsz
)
{
memcpy
(
buf
,
c
,
len
);
buf
[
len
]
=
0
;
ok
=
true
;
}
else
ok
=
false
;
}
#if FLEXT_SYS == FLEXT_SYS_PD
#ifndef FLEXT_COMPATIBLE
else
if
(
IsPointer
(
a
))
{
ok
=
STD
::
snprintf
(
buf
,
bufsz
,
"%p"
,
GetPointer
(
a
))
>
0
;
}
#endif
else
if
(
a
.
a_type
==
A_DOLLAR
)
{
ok
=
STD
::
snprintf
(
buf
,
bufsz
,
"$%d"
,
a
.
a_w
.
w_index
)
>
0
;
}
else
if
(
a
.
a_type
==
A_DOLLSYM
)
{
ok
=
STD
::
snprintf
(
buf
,
bufsz
,
"$%s"
,
GetString
(
a
))
>
0
;
}
#elif FLEXT_SYS == FLEXT_SYS_MAX
else
if
(
a
.
a_type
==
A_DOLLAR
)
{
ok
=
STD
::
snprintf
(
buf
,
bufsz
,
"$%ld"
,
a
.
a_w
.
w_long
)
>
0
;
}
#else
//#pragma message("Not implemented")
#endif
else
{
error
(
"flext: atom type unknown"
);
ok
=
false
;
}
return
ok
;
}
FLEXT_TEMPIMPL
(
bool
FLEXT_CLASSDEF
(
flext
))
::
PrintList
(
int
argc
,
const
t_atom
*
argv
,
char
*
buf
,
size_t
bufsz
)
{
bool
ok
=
true
;
for
(
int
i
=
0
;
ok
&&
i
<
argc
&&
bufsz
>
0
;
++
i
)
{
if
(
i
)
{
*
(
buf
++
)
=
' '
;
--
bufsz
;
}
// prepend space
if
(
PrintAtom
(
argv
[
i
],
buf
,
bufsz
))
{
size_t
len
=
strlen
(
buf
);
buf
+=
len
,
bufsz
-=
len
;
}
else
ok
=
false
;
}
*
buf
=
0
;
return
ok
;
}
FLEXT_TEMPIMPL
(
const
char
*
FLEXT_CLASSDEF
(
flext
))
::
ScanAtom
(
t_atom
&
a
,
const
char
*
c
)
{
// skip leading whitespace
while
(
*
c
&&
isspace
(
*
c
))
++
c
;
if
(
!*
c
)
return
NULL
;
// go to next space and save character
char
*
end
=
const_cast
<
char
*>
(
c
);
while
(
*
end
&&
!
isspace
(
*
end
))
++
end
;
char
sv
=
*
end
;
float
fres
;
// first try float
char
*
endp
;
// see if it's a float - thanks to Frank Barknecht
fres
=
(
float
)
strtod
(
c
,
&
endp
);
if
(
*
c
&&
endp
!=
c
)
{
int
ires
=
(
int
)
fres
;
// try a cast
if
(
fres
==
ires
)
SetInt
(
a
,
ires
);
else
SetFloat
(
a
,
fres
);
}
// no, it's a symbol
else
SetString
(
a
,
c
);
*
end
=
sv
;
return
end
;
}
FLEXT_TEMPIMPL
(
int
FLEXT_CLASSDEF
(
flext
))
::
ScanList
(
int
argc
,
t_atom
*
argv
,
const
char
*
buf
)
{
int
read
;
for
(
read
=
0
;
read
<
argc
;
++
read
)
{
buf
=
ScanAtom
(
argv
[
read
],
buf
);
if
(
!
buf
)
break
;
}
return
read
;
}
#include "flpopns.h"
#endif // __FLEXT_ATOM_PR_CPP
externals/grill/trunk/flext/libbuild/include/flext/flattr.cpp
deleted
100755 → 0
View file @
bec8b2ec
/*
flext - C++ layer for Max and Pure Data externals
Copyright (c) 2001-2015 Thomas Grill (gr@grrrr.org)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
*/
/*! \file flattr.cpp
\brief Attribute handling for the flext base class
*/
#ifndef __FLEXT_ATTR_CPP
#define __FLEXT_ATTR_CPP
#include "flext.h"
#include <cstring>
#include <cctype>
#include <set>
#include "flpushns.h"
#ifdef __MWERKS__
#define STD std
#else
#define STD
#endif
FLEXT_TEMPIMPL
(
FLEXT_CLASSDEF
(
flext_base
))
::
AttrItem
::
AttrItem
(
const
t_symbol
*
t
,
metharg
tp
,
methfun
f
,
int
fl
)
:
Item
(
NULL
),
index
(
0
),
flags
(
fl
|
afl_shown
),
argtp
(
tp
),
fun
(
f
),
counter
(
NULL
),
tag
(
t
)
{}
/*
FLEXT_CLASSDEF(flext_base)::AttrDataCont::AttrDataCont() {}
FLEXT_CLASSDEF(flext_base)::AttrDataCont::~AttrDataCont()
{
for(iterator it = begin(); it != end(); ++it)
if(it.data()) delete it.data();
}
*/
FLEXT_TEMPIMPL
(
FLEXT_CLASSDEF
(
flext_base
))
::
AttrDataCont
::~
AttrDataCont
()
{
clear
();
}
FLEXT_TEMPIMPL
(
void
FLEXT_CLASSDEF
(
flext_base
))
::
AttrDataCont
::
clear
()
{
for
(
FLEXT_TEMP_TYPENAME
AttrDataCont
::
iterator
it
(
*
this
);
it
;
++
it
)
delete
it
.
data
();
TablePtrMap
<
const
t_symbol
*
,
AttrData
*
,
8
>::
clear
();
}
//! Add get and set attributes
FLEXT_TEMPIMPL
(
void
FLEXT_CLASSDEF
(
flext_base
))
::
AddAttrib
(
ItemCont
*
aa
,
ItemCont
*
ma
,
const
t_symbol
*
asym
,
metharg
tp
,
methfun
gfun
,
methfun
sfun
)
{
AttrItem
*
a
,
*
b
;
FLEXT_ASSERT
(
asym
!=
sym__
&&
asym
!=
sym_list
&&
asym
!=
sym_float
&&
asym
!=
sym_symbol
&&
asym
!=
sym_anything
);
if
(
sfun
)
// if commented out, there will be a warning at run-time (more user-friendly)
{
a
=
new
AttrItem
(
asym
,
tp
,
sfun
,
AttrItem
::
afl_set
);
a
->
index
=
aa
->
Members
();
aa
->
Add
(
a
,
asym
);
// bind attribute to a method
MethItem
*
mi
=
new
MethItem
(
a
);
mi
->
SetArgs
(
sfun
,
1
,
new
metharg
(
tp
));
ma
->
Add
(
mi
,
asym
);
}
else
a
=
NULL
;
if
(
gfun
)
// if commented out, there will be a warning at run-time (more user-friendly)
{
b
=
new
AttrItem
(
asym
,
tp
,
gfun
,
AttrItem
::
afl_get
);
b
->
index
=
aa
->
Members
();
aa
->
Add
(
b
,
asym
);
static
char
tmp
[
256
]
=
"get"
;
strcpy
(
tmp
+
3
,
GetString
(
asym
));
// bind attribute to a method
MethItem
*
mi
=
new
MethItem
(
b
);
mi
->
SetArgs
(
gfun
,
0
,
NULL
);
ma
->
Add
(
mi
,
MakeSymbol
(
tmp
));
}
else
b
=
NULL
;
if
(
a
&&
b
)
{
a
->
counter
=
b
;
b
->
counter
=
a
;
}
}
FLEXT_TEMPIMPL
(
void
FLEXT_CLASSDEF
(
flext_base
))
::
AddAttrib
(
const
t_symbol
*
attr
,
metharg
tp
,
methfun
gfun
,
methfun
sfun
)
{
if
(
HasAttributes
())
AddAttrib
(
ThAttrs
(),
ThMeths
(),
attr
,
tp
,
gfun
,
sfun
);
else
error
(
"%s - attribute procession is not enabled!"
,
thisName
());
}
FLEXT_TEMPIMPL
(
void
FLEXT_CLASSDEF
(
flext_base
))
::
AddAttrib
(
t_classid
c
,
const
t_symbol
*
attr
,
metharg
tp
,
methfun
gfun
,
methfun
sfun
)
{
AddAttrib
(
ClAttrs
(
c
),
ClMeths
(
c
),
attr
,
tp
,
gfun
,
sfun
);
}
FLEXT_TEMPIMPL
(
void
FLEXT_CLASSDEF
(
flext_base
))
::
ListAttrib
(
AtomList
&
la
)
const
{
typedef
TablePtrMap
<
int
,
const
t_symbol
*
,
32
>
AttrList
;
AttrList
list
[
2
];
ItemCont
*
clattrhead
=
ClAttrs
(
thisClassId
());
int
i
;
for
(
i
=
0
;
i
<=
1
;
++
i
)
{
ItemCont
*
a
=
i
?
attrhead
:
clattrhead
;
if
(
a
&&
a
->
Contained
(
0
))
{
ItemSet
&
ai
=
a
->
GetInlet
();
for
(
FLEXT_TEMP_TYPENAME
ItemSet
::
iterator
as
(
ai
);
as
;
++
as
)
{
for
(
Item
*
al
=
as
.
data
();
al
;
al
=
al
->
nxt
)
{
AttrItem
*
aa
=
(
AttrItem
*
)
al
;
list
[
i
].
insert
(
aa
->
index
,
as
.
key
());
break
;
}
}
}
}
la
((
int
)(
list
[
0
].
size
()
+
list
[
1
].
size
()));
int
ix
=
0
;
for
(
i
=
0
;
i
<=
1
;
++
i
)
for
(
AttrList
::
iterator
it
(
list
[
i
]);
it
;
++
it
)
SetSymbol
(
la
[
ix
++
],
it
.
data
());
}
FLEXT_TEMPIMPL
(
int
FLEXT_CLASSDEF
(
flext_base
))
::
CheckAttrib
(
int
argc
,
const
t_atom
*
argv
)
{
int
offs
=
0
;
for
(;
offs
<
argc
;
++
offs
)
if
(
IsString
(
argv
[
offs
])
&&
*
GetString
(
argv
[
offs
])
==
'@'
)
break
;
return
offs
;
}
FLEXT_TEMPIMPL
(
bool
FLEXT_CLASSDEF
(
flext_base
))
::
InitAttrib
(
int
argc
,
const
t_atom
*
argv
)
{
int
cur
,
nxt
;
for
(
cur
=
0
;
cur
<
argc
;
cur
=
nxt
)
{
// find next @symbol
for
(
nxt
=
cur
+
1
;
nxt
<
argc
;
++
nxt
)
if
(
IsString
(
argv
[
nxt
])
&&
*
GetString
(
argv
[
nxt
])
==
'@'
)
break
;
const
t_symbol
*
tag
=
MakeSymbol
(
GetString
(
argv
[
cur
])
+
1
);
// find puttable attribute
AttrItem
*
attr
=
FindAttrib
(
tag
,
false
,
true
);
if
(
attr
)
{
// make an entry (there are none beforehand...)
/*
AttrDataCont::iterator it = attrdata->find(tag);
if(it == attrdata->end()) {
AttrDataCont::pair pair;
pair.key() = tag;
pair.data() = new AttrData;
it = attrdata->insert(attrdata->begin(),pair);
}
AttrData &a = *it.data();
a.SetInit(true);
a.SetInitValue(nxt-cur-1,argv+cur+1);
// pass value to object
SetAttrib(tag,attr,a.GetInitValue());
*/
AttrData
*
a
=
attrdata
->
find
(
tag
);
if
(
!
a
)
{
AttrData
*
old
=
attrdata
->
insert
(
tag
,
a
=
new
AttrData
);
FLEXT_ASSERT
(
!
old
);
}
a
->
SetInit
(
true
);
a
->
SetInitValue
(
nxt
-
cur
-
1
,
argv
+
cur
+
1
);
// pass value to object
SetAttrib
(
tag
,
attr
,
a
->
GetInitValue
());
}
}
return
true
;
}
FLEXT_TEMPIMPL
(
bool
FLEXT_CLASSDEF
(
flext_base
))
::
ListAttrib
()
const
{
if
(
HasAttributes
())
{
// defined in flsupport.cpp
AtomListStatic
<
32
>
la
;
ListAttrib
(
la
);
ToOutAnything
(
GetOutAttr
(),
sym_attributes
,
la
.
Count
(),
la
.
Atoms
());
return
true
;
}
else
return
false
;
}
FLEXT_TEMPIMPL
(
FLEXT_TEMPSUB
(
FLEXT_CLASSDEF
(
flext_base
))
::
AttrItem
*
FLEXT_CLASSDEF
(
flext_base
))
::
FindAttrib
(
const
t_symbol
*
tag
,
bool
get
,
bool
msg
)
const
{
ItemCont
*
clattrhead
=
ClAttrs
(
thisClassId
());
// first search within object scope
AttrItem
*
a
=
NULL
;
{