Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
6f6f4a30
Commit
6f6f4a30
authored
Jun 08, 2002
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Just whitespace changes.
parent
a30830a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
45 deletions
+45
-45
src/BTrees/SetOpTemplate.c
src/BTrees/SetOpTemplate.c
+45
-45
No files found.
src/BTrees/SetOpTemplate.c
View file @
6f6f4a30
...
@@ -2,26 +2,26 @@
...
@@ -2,26 +2,26 @@
Copyright (c) 2001, 2002 Zope Corporation and Contributors.
Copyright (c) 2001, 2002 Zope Corporation and Contributors.
All Rights Reserved.
All Rights Reserved.
This software is subject to the provisions of the Zope Public License,
This software is subject to the provisions of the Zope Public License,
Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
FOR A PARTICULAR PURPOSE
FOR A PARTICULAR PURPOSE
****************************************************************************/
****************************************************************************/
/****************************************************************************
/****************************************************************************
Set operations
Set operations
****************************************************************************/
****************************************************************************/
#define SETOPTEMPLATE_C "$Id: SetOpTemplate.c,v 1.2
2 2002/06/07 06:44:01
tim_one Exp $\n"
#define SETOPTEMPLATE_C "$Id: SetOpTemplate.c,v 1.2
3 2002/06/08 02:37:58
tim_one Exp $\n"
#ifdef INTSET_H
#ifdef INTSET_H
static
int
static
int
nextIntSet
(
SetIteration
*
i
)
nextIntSet
(
SetIteration
*
i
)
{
{
if
(
i
->
position
>=
0
)
if
(
i
->
position
>=
0
)
{
{
UNLESS
(
PER_USE
(
INTSET
(
i
->
set
)))
return
-
1
;
UNLESS
(
PER_USE
(
INTSET
(
i
->
set
)))
return
-
1
;
...
@@ -40,16 +40,16 @@ nextIntSet(SetIteration *i)
...
@@ -40,16 +40,16 @@ nextIntSet(SetIteration *i)
PER_ALLOW_DEACTIVATION
(
INTSET
(
i
->
set
));
PER_ALLOW_DEACTIVATION
(
INTSET
(
i
->
set
));
}
}
return
0
;
return
0
;
}
}
#endif
#endif
#ifdef KEY_CHECK
#ifdef KEY_CHECK
static
int
static
int
nextKeyAsSet
(
SetIteration
*
i
)
nextKeyAsSet
(
SetIteration
*
i
)
{
{
i
->
position
=
i
->
position
==
0
?
1
:
-
1
;
i
->
position
=
i
->
position
==
0
?
1
:
-
1
;
return
0
;
return
0
;
}
}
#endif
#endif
...
@@ -90,65 +90,65 @@ initSetIteration(SetIteration *i, PyObject *s, int w, int *merge)
...
@@ -90,65 +90,65 @@ initSetIteration(SetIteration *i, PyObject *s, int w, int *merge)
i
->
set
=
s
;
i
->
set
=
s
;
Py_INCREF
(
s
);
Py_INCREF
(
s
);
if
(
w
>=
0
)
if
(
w
>=
0
)
{
{
*
merge
=
1
;
*
merge
=
1
;
i
->
next
=
nextBucket
;
i
->
next
=
nextBucket
;
}
}
else
else
i
->
next
=
nextSet
;
i
->
next
=
nextSet
;
i
->
hasValue
=
1
;
i
->
hasValue
=
1
;
}
}
else
if
(
ExtensionClassSubclassInstance_Check
(
s
,
&
SetType
))
else
if
(
ExtensionClassSubclassInstance_Check
(
s
,
&
SetType
))
{
{
i
->
set
=
s
;
i
->
set
=
s
;
Py_INCREF
(
s
);
Py_INCREF
(
s
);
i
->
next
=
nextSet
;
i
->
next
=
nextSet
;
i
->
hasValue
=
0
;
i
->
hasValue
=
0
;
}
}
else
if
(
ExtensionClassSubclassInstance_Check
(
s
,
&
BTreeType
))
else
if
(
ExtensionClassSubclassInstance_Check
(
s
,
&
BTreeType
))
{
{
i
->
set
=
BTree_rangeSearch
(
BTREE
(
s
),
NULL
,
'i'
);
i
->
set
=
BTree_rangeSearch
(
BTREE
(
s
),
NULL
,
'i'
);
UNLESS
(
i
->
set
)
return
-
1
;
UNLESS
(
i
->
set
)
return
-
1
;
if
(
w
>=
0
)
if
(
w
>=
0
)
{
{
*
merge
=
1
;
*
merge
=
1
;
i
->
next
=
nextBTreeItems
;
i
->
next
=
nextBTreeItems
;
}
}
else
else
i
->
next
=
nextTreeSetItems
;
i
->
next
=
nextTreeSetItems
;
i
->
hasValue
=
1
;
i
->
hasValue
=
1
;
}
}
else
if
(
ExtensionClassSubclassInstance_Check
(
s
,
&
TreeSetType
))
else
if
(
ExtensionClassSubclassInstance_Check
(
s
,
&
TreeSetType
))
{
{
i
->
set
=
BTree_rangeSearch
(
BTREE
(
s
),
NULL
,
'k'
);
i
->
set
=
BTree_rangeSearch
(
BTREE
(
s
),
NULL
,
'k'
);
UNLESS
(
i
->
set
)
return
-
1
;
UNLESS
(
i
->
set
)
return
-
1
;
i
->
next
=
nextTreeSetItems
;
i
->
next
=
nextTreeSetItems
;
i
->
hasValue
=
0
;
i
->
hasValue
=
0
;
}
}
#ifdef INTSET_H
#ifdef INTSET_H
else
if
(
s
->
ob_type
==
(
PyTypeObject
*
)
intSetType
)
else
if
(
s
->
ob_type
==
(
PyTypeObject
*
)
intSetType
)
{
{
i
->
set
=
s
;
i
->
set
=
s
;
Py_INCREF
(
s
);
Py_INCREF
(
s
);
i
->
next
=
nextIntSet
;
i
->
next
=
nextIntSet
;
i
->
hasValue
=
0
;
i
->
hasValue
=
0
;
}
}
#endif
#endif
#ifdef KEY_CHECK
#ifdef KEY_CHECK
else
if
(
KEY_CHECK
(
s
))
else
if
(
KEY_CHECK
(
s
))
{
{
int
copied
=
1
;
int
copied
=
1
;
i
->
set
=
s
;
i
->
set
=
s
;
Py_INCREF
(
s
);
Py_INCREF
(
s
);
i
->
next
=
nextKeyAsSet
;
i
->
next
=
nextKeyAsSet
;
i
->
hasValue
=
0
;
i
->
hasValue
=
0
;
COPY_KEY_FROM_ARG
(
i
->
key
,
s
,
copied
);
COPY_KEY_FROM_ARG
(
i
->
key
,
s
,
copied
);
UNLESS
(
copied
)
return
-
1
;
UNLESS
(
copied
)
return
-
1
;
}
}
...
@@ -166,7 +166,7 @@ initSetIteration(SetIteration *i, PyObject *s, int w, int *merge)
...
@@ -166,7 +166,7 @@ initSetIteration(SetIteration *i, PyObject *s, int w, int *merge)
#define MERGE_WEIGHT(O, w) (O)
#define MERGE_WEIGHT(O, w) (O)
#endif
#endif
static
int
static
int
copyRemaining
(
Bucket
*
r
,
SetIteration
*
i
,
int
merge
,
int
w
)
copyRemaining
(
Bucket
*
r
,
SetIteration
*
i
,
int
merge
,
int
w
)
{
{
while
(
i
->
position
>=
0
)
while
(
i
->
position
>=
0
)
...
@@ -188,7 +188,7 @@ copyRemaining(Bucket *r, SetIteration *i, int merge, int w)
...
@@ -188,7 +188,7 @@ copyRemaining(Bucket *r, SetIteration *i, int merge, int w)
}
}
static
PyObject
*
static
PyObject
*
set_operation
(
PyObject
*
s1
,
PyObject
*
s2
,
set_operation
(
PyObject
*
s1
,
PyObject
*
s2
,
int
w1
,
int
w2
,
int
w1
,
int
w2
,
int
c1
,
int
c12
,
int
c2
)
int
c1
,
int
c12
,
int
c2
)
{
{
...
@@ -272,7 +272,7 @@ set_operation(PyObject *s1, PyObject *s2,
...
@@ -272,7 +272,7 @@ set_operation(PyObject *s1, PyObject *s2,
#else
#else
COPY_VALUE
(
r
->
values
[
r
->
len
],
i1
.
value
);
COPY_VALUE
(
r
->
values
[
r
->
len
],
i1
.
value
);
INCREF_VALUE
(
r
->
values
[
r
->
len
]);
INCREF_VALUE
(
r
->
values
[
r
->
len
]);
#endif
#endif
}
}
r
->
len
++
;
r
->
len
++
;
}
}
...
@@ -324,14 +324,14 @@ difference_m(PyObject *ignored, PyObject *args)
...
@@ -324,14 +324,14 @@ difference_m(PyObject *ignored, PyObject *args)
UNLESS
(
PyArg_ParseTuple
(
args
,
"OO"
,
&
o1
,
&
o2
))
return
NULL
;
UNLESS
(
PyArg_ParseTuple
(
args
,
"OO"
,
&
o1
,
&
o2
))
return
NULL
;
if
(
o1
==
Py_None
||
o2
==
Py_None
)
if
(
o1
==
Py_None
||
o2
==
Py_None
)
{
{
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
return
Py_None
;
return
Py_None
;
}
}
return
set_operation
(
o1
,
o2
,
1
,
-
1
,
1
,
0
,
0
);
return
set_operation
(
o1
,
o2
,
1
,
-
1
,
1
,
0
,
0
);
}
}
static
PyObject
*
static
PyObject
*
union_m
(
PyObject
*
ignored
,
PyObject
*
args
)
union_m
(
PyObject
*
ignored
,
PyObject
*
args
)
...
@@ -350,9 +350,9 @@ union_m(PyObject *ignored, PyObject *args)
...
@@ -350,9 +350,9 @@ union_m(PyObject *ignored, PyObject *args)
Py_INCREF
(
o1
);
Py_INCREF
(
o1
);
return
o1
;
return
o1
;
}
}
return
set_operation
(
o1
,
o2
,
-
1
,
-
1
,
1
,
1
,
1
);
return
set_operation
(
o1
,
o2
,
-
1
,
-
1
,
1
,
1
,
1
);
}
}
static
PyObject
*
static
PyObject
*
intersection_m
(
PyObject
*
ignored
,
PyObject
*
args
)
intersection_m
(
PyObject
*
ignored
,
PyObject
*
args
)
...
@@ -371,9 +371,9 @@ intersection_m(PyObject *ignored, PyObject *args)
...
@@ -371,9 +371,9 @@ intersection_m(PyObject *ignored, PyObject *args)
Py_INCREF
(
o1
);
Py_INCREF
(
o1
);
return
o1
;
return
o1
;
}
}
return
set_operation
(
o1
,
o2
,
-
1
,
-
1
,
0
,
1
,
0
);
return
set_operation
(
o1
,
o2
,
-
1
,
-
1
,
0
,
1
,
0
);
}
}
#ifdef MERGE
#ifdef MERGE
...
@@ -389,12 +389,12 @@ wunion_m(PyObject *ignored, PyObject *args)
...
@@ -389,12 +389,12 @@ wunion_m(PyObject *ignored, PyObject *args)
return
Py_BuildValue
(
"iO"
,
(
o2
==
Py_None
?
0
:
w2
),
o2
);
return
Py_BuildValue
(
"iO"
,
(
o2
==
Py_None
?
0
:
w2
),
o2
);
else
if
(
o2
==
Py_None
)
else
if
(
o2
==
Py_None
)
return
Py_BuildValue
(
"iO"
,
w1
,
o1
);
return
Py_BuildValue
(
"iO"
,
w1
,
o1
);
o1
=
set_operation
(
o1
,
o2
,
w1
,
w2
,
1
,
1
,
1
);
o1
=
set_operation
(
o1
,
o2
,
w1
,
w2
,
1
,
1
,
1
);
if
(
o1
)
ASSIGN
(
o1
,
Py_BuildValue
(
"iO"
,
1
,
o1
));
if
(
o1
)
ASSIGN
(
o1
,
Py_BuildValue
(
"iO"
,
1
,
o1
));
return
o1
;
return
o1
;
}
}
static
PyObject
*
static
PyObject
*
wintersection_m
(
PyObject
*
ignored
,
PyObject
*
args
)
wintersection_m
(
PyObject
*
ignored
,
PyObject
*
args
)
...
@@ -408,15 +408,15 @@ wintersection_m(PyObject *ignored, PyObject *args)
...
@@ -408,15 +408,15 @@ wintersection_m(PyObject *ignored, PyObject *args)
return
Py_BuildValue
(
"iO"
,
(
o2
==
Py_None
?
0
:
w2
),
o2
);
return
Py_BuildValue
(
"iO"
,
(
o2
==
Py_None
?
0
:
w2
),
o2
);
else
if
(
o2
==
Py_None
)
else
if
(
o2
==
Py_None
)
return
Py_BuildValue
(
"iO"
,
w1
,
o1
);
return
Py_BuildValue
(
"iO"
,
w1
,
o1
);
o1
=
set_operation
(
o1
,
o2
,
w1
,
w2
,
0
,
1
,
0
);
o1
=
set_operation
(
o1
,
o2
,
w1
,
w2
,
0
,
1
,
0
);
if
(
o1
)
if
(
o1
)
ASSIGN
(
o1
,
Py_BuildValue
(
"iO"
,
ASSIGN
(
o1
,
Py_BuildValue
(
"iO"
,
((
o1
->
ob_type
==
(
PyTypeObject
*
)(
&
SetType
))
?
w2
+
w1
:
1
),
((
o1
->
ob_type
==
(
PyTypeObject
*
)(
&
SetType
))
?
w2
+
w1
:
1
),
o1
));
o1
));
return
o1
;
return
o1
;
}
}
#endif
#endif
...
...
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