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
Jonathan Wilkes
flext
Commits
dce6f11d
Commit
dce6f11d
authored
Dec 31, 2002
by
thomas
Browse files
no message
git-svn-id:
https://svn.grrrr.org/ext/trunk@457
4d9ac71a-51e6-0310-8455-cad1006bcd31
parent
6ed18aaa
Changes
2
Hide whitespace changes
Inline
Side-by-side
source/flattr.cpp
View file @
dce6f11d
...
...
@@ -24,8 +24,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
flext_base
::
attritem
::
attritem
(
const
t_symbol
*
t
,
metharg
tp
,
methfun
f
,
int
fl
)
:
item
(
t
,
0
,
NULL
),
argtp
(
tp
),
fun
(
f
),
flags
(
fl
)
{
}
{}
flext_base
::
attritem
::~
attritem
()
{
...
...
@@ -94,6 +93,29 @@ void flext_base::AddAttrib(t_class *c,const char *attr,metharg tp,methfun gfun,m
AddAttrib
(
ClAttrs
(
c
),
ClMeths
(
c
),
attr
,
tp
,
gfun
,
sfun
);
}
int
flext_base
::
ListAttr
(
AtomList
&
la
)
const
{
int
cnt
=
attrhead
?
attrhead
->
Count
()
:
0
;
int
ccnt
=
clattrhead
?
clattrhead
->
Count
()
:
0
;
la
(
ccnt
+
cnt
);
int
ix
=
0
;
for
(
int
i
=
0
;
i
<=
1
;
++
i
)
{
itemarr
*
a
=
i
?
attrhead
:
clattrhead
;
if
(
a
)
{
for
(
int
ai
=
0
;
ai
<
a
->
Size
();
++
ai
)
{
for
(
item
*
l
=
a
->
Item
(
ai
);
l
;
l
=
l
->
nxt
)
{
attritem
*
a
=
(
attritem
*
)
l
;
if
(
!
a
->
BothExist
()
||
a
->
IsGet
())
SetSymbol
(
la
[
ix
++
],
a
->
tag
);
}
}
}
}
return
ix
;
}
int
flext_base
::
CheckAttrib
(
int
argc
,
const
t_atom
*
argv
)
{
...
...
@@ -120,42 +142,30 @@ bool flext_base::InitAttrib(int argc,const t_atom *argv)
bool
flext_base
::
ListAttrib
()
{
if
(
outattr
)
{
int
cnt
=
attrhead
?
attrhead
->
Count
()
:
0
;
int
ccnt
=
clattrhead
?
clattrhead
->
Count
()
:
0
;
AtomList
la
(
ccnt
+
cnt
);
int
ix
=
0
;
for
(
int
i
=
0
;
i
<=
1
;
++
i
)
{
itemarr
*
a
=
i
?
attrhead
:
clattrhead
;
if
(
a
)
{
for
(
int
ai
=
0
;
ai
<
a
->
Size
();
++
ai
)
{
for
(
item
*
l
=
a
->
Item
(
ai
);
l
;
l
=
l
->
nxt
)
{
attritem
*
a
=
(
attritem
*
)
l
;
if
(
!
a
->
BothExist
()
||
a
->
IsGet
())
SetSymbol
(
la
[
ix
++
],
a
->
tag
);
}
}
}
}
ToOutAnything
(
outattr
,
MakeSymbol
(
"attributes"
),
ix
,
la
.
Atoms
());
AtomList
la
;
int
c
=
ListAttr
(
la
);
ToOutAnything
(
outattr
,
MakeSymbol
(
"attributes"
),
c
,
la
.
Atoms
());
return
true
;
}
else
return
false
;
}
bool
flext_base
::
Set
Attr
ib
(
const
t_symbol
*
tag
,
int
argc
,
const
t_atom
*
argv
)
flext_base
::
attritem
*
flext_base
::
Find
Attr
(
const
t_symbol
*
tag
,
bool
get
)
const
{
// search for matching attribute
attritem
*
a
=
(
attritem
*
)
attrhead
->
Find
(
tag
);
while
(
a
&&
(
a
->
tag
!=
tag
||
a
->
inlet
!=
0
||
a
->
IsGet
()))
a
=
(
attritem
*
)
a
->
nxt
;
while
(
a
&&
(
a
->
tag
!=
tag
||
a
->
inlet
!=
0
||
(
get
?
a
->
IsSet
()
:
a
->
IsGet
()))
)
a
=
(
attritem
*
)
a
->
nxt
;
if
(
!
a
)
{
a
=
(
attritem
*
)
clattrhead
->
Find
(
tag
);
while
(
a
&&
(
a
->
tag
!=
tag
||
a
->
inlet
!=
0
||
a
->
IsGet
()))
a
=
(
attritem
*
)
a
->
nxt
;
while
(
a
&&
(
a
->
tag
!=
tag
||
a
->
inlet
!=
0
||
(
get
?
a
->
IsSet
()
:
a
->
IsGet
()))
)
a
=
(
attritem
*
)
a
->
nxt
;
}
return
a
;
}
bool
flext_base
::
SetAttrib
(
const
t_symbol
*
tag
,
int
argc
,
const
t_atom
*
argv
)
{
// search for matching attribute
attritem
*
a
=
FindAttr
(
tag
,
false
);
if
(
a
)
return
SetAttrib
(
a
,
argc
,
argv
);
else
{
...
...
source/flclass.h
View file @
dce6f11d
...
...
@@ -587,7 +587,8 @@ protected:
enum
{
afl_getset
=
0x01
,
afl_get
=
0x00
,
afl_set
=
0x01
,
afl_bothexist
=
0x02
afl_bothexist
=
0x02
,
afl_save
=
0x04
};
bool
IsGet
()
const
{
return
(
flags
&
afl_getset
)
==
afl_get
;
}
...
...
@@ -657,6 +658,9 @@ private:
itemarr
*
attrhead
,
*
clattrhead
;
attritem
*
FindAttr
(
const
t_symbol
*
tag
,
bool
get
)
const
;
int
ListAttr
(
AtomList
&
a
)
const
;
static
int
CheckAttrib
(
int
argc
,
const
t_atom
*
argv
);
bool
InitAttrib
(
int
argc
,
const
t_atom
*
argv
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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