Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
34c24bee
Commit
34c24bee
authored
Sep 26, 1997
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added sequence and mapping behavior.
parent
a1b0d8d4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
876 additions
and
268 deletions
+876
-268
lib/Components/ExtensionClass/Record.c
lib/Components/ExtensionClass/Record.c
+219
-67
lib/Components/ExtensionClass/src/Record.c
lib/Components/ExtensionClass/src/Record.c
+219
-67
lib/python/Shared/DC/Record/Record.c
lib/python/Shared/DC/Record/Record.c
+219
-67
lib/python/Shared/DC/ZRDB/Record.c
lib/python/Shared/DC/ZRDB/Record.c
+219
-67
No files found.
lib/Components/ExtensionClass/Record.c
View file @
34c24bee
...
@@ -3,57 +3,14 @@
...
@@ -3,57 +3,14 @@
Copyright 1997 Digital Creations, L.L.C., 910 Princess Anne
Copyright 1997 Digital Creations, L.L.C., 910 Princess Anne
Street, Suite 300, Fredericksburg, Virginia 22401 U.S.A. All
Street, Suite 300, Fredericksburg, Virginia 22401 U.S.A. All
rights reserved. Copyright in this software is owned by DCLC,
rights reserved.
unless otherwise indicated. Permission to use, copy and
distribute this software is hereby granted, provided that the
above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear. Note that
any product, process or technology described in this software
may be the subject of other Intellectual Property rights
reserved by Digital Creations, L.C. and are not licensed
hereunder.
Trademarks
Digital Creations & DCLC, are trademarks of Digital Creations, L.C..
All other trademarks are owned by their respective companies.
No Warranty
The software is provided "as is" without warranty of any kind,
either express or implied, including, but not limited to, the
implied warranties of merchantability, fitness for a particular
purpose, or non-infringement. This software could include
technical inaccuracies or typographical errors. Changes are
periodically made to the software; these changes will be
incorporated in new editions of the software. DCLC may make
improvements and/or changes in this software at any time
without notice.
Limitation Of Liability
In no event will DCLC be liable for direct, indirect, special,
incidental, economic, cover, or consequential damages arising
out of the use of or inability to use this software even if
advised of the possibility of such damages. Some states do not
allow the exclusion or limitation of implied warranties or
limitation of liability for incidental or consequential
damages, so the above limitation or exclusion may not apply to
you.
If you have questions regarding this software,
contact:
Digital Creations L.L.C.
info@digicool.com
(540) 371-6909
******************************************************************/
******************************************************************/
static
char
Record_module_documentation
[]
=
static
char
Record_module_documentation
[]
=
""
""
"
\n
$Id: Record.c,v 1.
1 1997/09/25 22:12:28
jim Exp $"
"
\n
$Id: Record.c,v 1.
2 1997/09/26 15:05:17
jim Exp $"
;
;
#ifdef PERSISTENCE
#ifdef PERSISTENCE
...
@@ -82,14 +39,14 @@ typedef struct {
...
@@ -82,14 +39,14 @@ typedef struct {
#endif
#endif
PyObject
**
data
;
PyObject
**
data
;
PyObject
*
schema
;
PyObject
*
schema
;
}
Record
object
;
}
Record
;
staticforward
PyExtensionClass
RecordType
;
staticforward
PyExtensionClass
RecordType
;
/* ---------------------------------------------------------------- */
/* ---------------------------------------------------------------- */
static
int
static
int
Record_init
(
Record
object
*
self
)
Record_init
(
Record
*
self
)
{
{
int
l
;
int
l
;
...
@@ -111,7 +68,7 @@ Record_init(Recordobject *self)
...
@@ -111,7 +68,7 @@ Record_init(Recordobject *self)
}
}
static
PyObject
*
static
PyObject
*
Record___setstate__
(
Record
object
*
self
,
PyObject
*
args
)
Record___setstate__
(
Record
*
self
,
PyObject
*
args
)
{
{
PyObject
*
state
=
0
,
**
d
;
PyObject
*
state
=
0
,
**
d
;
int
l
,
ls
,
i
;
int
l
,
ls
,
i
;
...
@@ -145,7 +102,7 @@ Record___setstate__(Recordobject *self, PyObject *args)
...
@@ -145,7 +102,7 @@ Record___setstate__(Recordobject *self, PyObject *args)
}
}
static
PyObject
*
static
PyObject
*
Record___getstate__
(
Record
object
*
self
,
PyObject
*
args
)
Record___getstate__
(
Record
*
self
,
PyObject
*
args
)
{
{
PyObject
*
r
,
**
d
,
*
v
;
PyObject
*
r
,
**
d
,
*
v
;
int
i
,
l
;
int
i
,
l
;
...
@@ -165,7 +122,7 @@ Record___getstate__( Recordobject *self, PyObject *args)
...
@@ -165,7 +122,7 @@ Record___getstate__( Recordobject *self, PyObject *args)
}
}
static
void
static
void
Record_deal
(
Record
object
*
self
)
Record_deal
(
Record
*
self
)
{
{
int
l
;
int
l
;
PyObject
**
d
;
PyObject
**
d
;
...
@@ -184,7 +141,7 @@ Record_deal(Recordobject *self)
...
@@ -184,7 +141,7 @@ Record_deal(Recordobject *self)
#ifdef PERSISTENCE
#ifdef PERSISTENCE
static
PyObject
*
static
PyObject
*
Record__p___reinit__
(
Record
object
*
self
,
PyObject
*
args
)
Record__p___reinit__
(
Record
*
self
,
PyObject
*
args
)
{
{
Record_deal
(
self
);
Record_deal
(
self
);
self
->
schema
=
NULL
;
self
->
schema
=
NULL
;
...
@@ -216,21 +173,31 @@ static struct PyMethodDef Record_methods[] = {
...
@@ -216,21 +173,31 @@ static struct PyMethodDef Record_methods[] = {
/* ---------- */
/* ---------- */
static
void
static
void
Record_dealloc
(
Record
object
*
self
)
Record_dealloc
(
Record
*
self
)
{
{
Record_deal
(
self
);
Record_deal
(
self
);
PyMem_DEL
(
self
);
PyMem_DEL
(
self
);
}
}
static
PyObject
*
static
PyObject
*
Record_getattr
(
Record
object
*
self
,
PyObject
*
name
)
Record_getattr
(
Record
*
self
,
PyObject
*
name
)
{
{
int
l
,
i
;
int
l
,
i
;
PyObject
*
io
;
PyObject
*
io
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
NULL
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
NULL
;
if
(
io
=
Py_FindAttr
((
PyObject
*
)
self
,
name
))
return
io
;
PyErr_Clear
();
if
(
io
=
PyObject_GetItem
(
self
->
schema
,
name
))
if
(
io
=
PyObject_GetItem
(
self
->
schema
,
name
))
{
{
UNLESS
(
PyInt_Check
(
io
))
{
PyErr_SetString
(
PyExc_TypeError
,
"invalid record schema"
);
return
NULL
;
}
i
=
PyInt_AsLong
(
io
);
i
=
PyInt_AsLong
(
io
);
if
(
i
>=
0
&&
i
<
l
)
if
(
i
>=
0
&&
i
<
l
)
{
{
...
@@ -241,13 +208,14 @@ Record_getattr(Recordobject *self, PyObject *name)
...
@@ -241,13 +208,14 @@ Record_getattr(Recordobject *self, PyObject *name)
Py_INCREF
(
io
);
Py_INCREF
(
io
);
return
io
;
return
io
;
}
}
PyErr_Clear
();
PyErr_SetObject
(
PyExc_AttributeError
,
name
);
return
Py_FindAttr
((
PyObject
*
)
self
,
name
);
return
NULL
;
}
}
static
int
static
int
Record_setattr
(
Record
object
*
self
,
PyObject
*
name
,
PyObject
*
v
)
Record_setattr
(
Record
*
self
,
PyObject
*
name
,
PyObject
*
v
)
{
{
int
l
,
i
;
int
l
,
i
;
PyObject
*
io
;
PyObject
*
io
;
...
@@ -255,24 +223,28 @@ Record_setattr(Recordobject *self, PyObject *name, PyObject *v)
...
@@ -255,24 +223,28 @@ Record_setattr(Recordobject *self, PyObject *name, PyObject *v)
if
((
l
=
Record_init
(
self
))
<
0
)
return
-
1
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
-
1
;
if
(
io
=
PyObject_GetItem
(
self
->
schema
,
name
))
if
(
io
=
PyObject_GetItem
(
self
->
schema
,
name
))
{
{
UNLESS
(
PyInt_Check
(
io
))
{
PyErr_SetString
(
PyExc_TypeError
,
"invalid record schema"
);
return
-
1
;
}
i
=
PyInt_AsLong
(
io
);
i
=
PyInt_AsLong
(
io
);
Py_DECREF
(
io
);
Py_DECREF
(
io
);
if
(
i
>=
0
&&
i
<
l
)
if
(
i
>=
0
&&
i
<
l
)
{
{
Py_INCREF
(
v
);
Py_
X
INCREF
(
v
);
ASSIGN
(
self
->
data
[
i
],
v
);
ASSIGN
(
self
->
data
[
i
],
v
);
return
0
;
return
0
;
}
}
}
}
else
PyErr_Clear
();
PyErr_SetObject
(
PyExc_AttributeError
,
name
);
PyErr_SetObject
(
PyExc_AttributeError
,
name
);
return
-
1
;
return
-
1
;
}
}
#ifdef PERSISTENCE
#ifdef PERSISTENCE
static
PyObject
*
static
PyObject
*
pRecord_getattr
(
Record
object
*
self
,
PyObject
*
name
)
pRecord_getattr
(
Record
*
self
,
PyObject
*
name
)
{
{
char
*
c
;
char
*
c
;
UNLESS
(
c
=
PyString_AsString
(
name
))
return
NULL
;
UNLESS
(
c
=
PyString_AsString
(
name
))
return
NULL
;
...
@@ -281,7 +253,7 @@ pRecord_getattr(Recordobject *self, PyObject *name)
...
@@ -281,7 +253,7 @@ pRecord_getattr(Recordobject *self, PyObject *name)
}
}
static
int
static
int
pRecord_setattr
(
Record
object
*
self
,
PyObject
*
name
,
PyObject
*
v
)
pRecord_setattr
(
Record
*
self
,
PyObject
*
name
,
PyObject
*
v
)
{
{
return
cPersistenceCAPI
->
persetattro
(
OBJECT
(
self
),
name
,
v
,
Record_setattr
);
return
cPersistenceCAPI
->
persetattro
(
OBJECT
(
self
),
name
,
v
,
Record_setattr
);
}
}
...
@@ -289,7 +261,7 @@ pRecord_setattr(Recordobject *self, PyObject *name, PyObject *v)
...
@@ -289,7 +261,7 @@ pRecord_setattr(Recordobject *self, PyObject *name, PyObject *v)
static
int
static
int
Record_compare
(
Record
object
*
v
,
Recordobject
*
w
)
Record_compare
(
Record
*
v
,
Record
*
w
)
{
{
int
lv
,
lw
,
i
,
c
;
int
lv
,
lw
,
i
,
c
;
PyObject
**
dv
,
**
dw
;
PyObject
**
dv
,
**
dw
;
...
@@ -313,11 +285,188 @@ Record_compare(Recordobject *v, Recordobject *w)
...
@@ -313,11 +285,188 @@ Record_compare(Recordobject *v, Recordobject *w)
return
0
;
return
0
;
}
}
/* Code to handle accessing Record objects as sequence objects */
static
PyObject
*
Record_concat
(
Record
*
self
,
PyObject
*
bb
)
{
PyErr_SetString
(
PyExc_TypeError
,
"Record objects do not support concatenation"
);
return
NULL
;
}
static
PyObject
*
Record_repeat
(
Record
*
self
,
int
n
)
{
PyErr_SetString
(
PyExc_TypeError
,
"Record objects do not support repetition"
);
return
NULL
;
}
static
PyObject
*
IndexError
(
int
i
)
{
PyObject
*
v
;
if
((
v
=
PyInt_FromLong
(
i
)))
{
PyErr_SetObject
(
PyExc_IndexError
,
v
);
Py_DECREF
(
v
);
}
return
NULL
;
}
static
PyObject
*
Record_item
(
Record
*
self
,
int
i
)
{
PyObject
*
o
;
int
l
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
NULL
;
if
(
i
<
0
||
i
>=
l
)
return
IndexError
(
i
);
o
=
self
->
data
[
i
];
UNLESS
(
o
)
o
=
Py_None
;
Py_INCREF
(
o
);
return
o
;
}
static
PyObject
*
Record_slice
(
Record
*
self
,
int
ilow
,
int
ihigh
)
{
PyErr_SetString
(
PyExc_TypeError
,
"Record objects do not support slicing"
);
return
NULL
;
}
static
int
Record_ass_item
(
Record
*
self
,
int
i
,
PyObject
*
v
)
{
int
l
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
-
1
;
if
(
i
<
0
||
i
>=
l
)
{
IndexError
(
i
);
return
-
1
;
}
UNLESS
(
v
)
{
PyErr_SetString
(
PyExc_TypeError
,
"cannot delete record items"
);
return
-
1
;
}
Py_INCREF
(
v
);
ASSIGN
(
self
->
data
[
i
],
v
);
return
0
;
}
static
int
Record_ass_slice
(
Record
*
self
,
int
ilow
,
int
ihigh
,
PyObject
*
v
)
{
PyErr_SetString
(
PyExc_TypeError
,
"Record objects do not support slice assignment"
);
return
-
1
;
}
static
PySequenceMethods
Record_as_sequence
=
{
(
inquiry
)
Record_init
,
/*sq_length*/
(
binaryfunc
)
Record_concat
,
/*sq_concat*/
(
intargfunc
)
Record_repeat
,
/*sq_repeat*/
(
intargfunc
)
Record_item
,
/*sq_item*/
(
intintargfunc
)
Record_slice
,
/*sq_slice*/
(
intobjargproc
)
Record_ass_item
,
/*sq_ass_item*/
(
intintobjargproc
)
Record_ass_slice
,
/*sq_ass_slice*/
};
/* -------------------------------------------------------------- */
static
PyObject
*
Record_subscript
(
Record
*
self
,
PyObject
*
key
)
{
int
i
,
l
;
PyObject
*
io
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
NULL
;
if
(
PyInt_Check
(
key
))
{
i
=
PyInt_AsLong
(
key
);
if
(
i
<
0
)
i
+=
l
;
return
Record_item
(
self
,
i
);
}
if
(
io
=
PyObject_GetItem
(
self
->
schema
,
key
))
{
UNLESS
(
PyInt_Check
(
io
))
{
PyErr_SetString
(
PyExc_TypeError
,
"invalid record schema"
);
return
NULL
;
}
i
=
PyInt_AsLong
(
io
);
if
(
i
>=
0
&&
i
<
l
)
{
ASSIGN
(
io
,
self
->
data
[
i
]);
UNLESS
(
io
)
io
=
Py_None
;
}
else
ASSIGN
(
io
,
Py_None
);
Py_INCREF
(
io
);
return
io
;
}
return
NULL
;
}
static
int
Record_ass_sub
(
Record
*
self
,
PyObject
*
key
,
PyObject
*
v
)
{
int
i
,
l
;
PyObject
*
io
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
-
1
;
if
(
PyInt_Check
(
key
))
{
i
=
PyInt_AsLong
(
key
);
if
(
i
<
0
)
i
+=
l
;
return
Record_ass_item
(
self
,
i
,
v
);
}
if
(
io
=
PyObject_GetItem
(
self
->
schema
,
key
))
{
UNLESS
(
PyInt_Check
(
io
))
{
PyErr_SetString
(
PyExc_TypeError
,
"invalid record schema"
);
return
-
1
;
}
i
=
PyInt_AsLong
(
io
);
Py_DECREF
(
io
);
if
(
i
>=
0
&&
i
<
l
)
{
Py_XINCREF
(
v
);
ASSIGN
(
self
->
data
[
i
],
v
);
return
0
;
}
}
return
-
1
;
}
static
PyMappingMethods
Record_as_mapping
=
{
(
inquiry
)
Record_init
,
/*mp_length*/
(
binaryfunc
)
Record_subscript
,
/*mp_subscript*/
(
objobjargproc
)
Record_ass_sub
,
/*mp_ass_subscript*/
};
/* -------------------------------------------------------- */
static
PyExtensionClass
RecordType
=
{
static
PyExtensionClass
RecordType
=
{
PyObject_HEAD_INIT
(
NULL
)
PyObject_HEAD_INIT
(
NULL
)
0
,
/*ob_size*/
0
,
/*ob_size*/
"Record"
,
/*tp_name*/
"Record"
,
/*tp_name*/
sizeof
(
Record
object
),
/*tp_basicsize*/
sizeof
(
Record
),
/*tp_basicsize*/
0
,
/*tp_itemsize*/
0
,
/*tp_itemsize*/
/* methods */
/* methods */
(
destructor
)
Record_dealloc
,
/*tp_dealloc*/
(
destructor
)
Record_dealloc
,
/*tp_dealloc*/
...
@@ -327,8 +476,8 @@ static PyExtensionClass RecordType = {
...
@@ -327,8 +476,8 @@ static PyExtensionClass RecordType = {
(
cmpfunc
)
Record_compare
,
/*tp_compare*/
(
cmpfunc
)
Record_compare
,
/*tp_compare*/
(
reprfunc
)
0
,
/*tp_repr*/
(
reprfunc
)
0
,
/*tp_repr*/
0
,
/*tp_as_number*/
0
,
/*tp_as_number*/
0
,
/*tp_as_sequence*/
&
Record_as_sequence
,
/*tp_as_sequence*/
0
,
/*tp_as_mapping*/
&
Record_as_mapping
,
/*tp_as_mapping*/
(
hashfunc
)
0
,
/*tp_hash*/
(
hashfunc
)
0
,
/*tp_hash*/
(
ternaryfunc
)
0
,
/*tp_call*/
(
ternaryfunc
)
0
,
/*tp_call*/
(
reprfunc
)
0
,
/*tp_str*/
(
reprfunc
)
0
,
/*tp_str*/
...
@@ -363,7 +512,7 @@ void
...
@@ -363,7 +512,7 @@ void
initRecord
()
initRecord
()
{
{
PyObject
*
m
,
*
d
;
PyObject
*
m
,
*
d
;
char
*
rev
=
"$Revision: 1.
1
$"
;
char
*
rev
=
"$Revision: 1.
2
$"
;
UNLESS
(
py___record_schema__
=
PyString_FromString
(
"__record_schema__"
))
return
;
UNLESS
(
py___record_schema__
=
PyString_FromString
(
"__record_schema__"
))
return
;
...
@@ -402,6 +551,9 @@ initRecord()
...
@@ -402,6 +551,9 @@ initRecord()
Revision Log:
Revision Log:
$Log: Record.c,v $
$Log: Record.c,v $
Revision 1.2 1997/09/26 15:05:17 jim
Added sequence and mapping behavior.
Revision 1.1 1997/09/25 22:12:28 jim
Revision 1.1 1997/09/25 22:12:28 jim
*** empty log message ***
*** empty log message ***
...
...
lib/Components/ExtensionClass/src/Record.c
View file @
34c24bee
...
@@ -3,57 +3,14 @@
...
@@ -3,57 +3,14 @@
Copyright 1997 Digital Creations, L.L.C., 910 Princess Anne
Copyright 1997 Digital Creations, L.L.C., 910 Princess Anne
Street, Suite 300, Fredericksburg, Virginia 22401 U.S.A. All
Street, Suite 300, Fredericksburg, Virginia 22401 U.S.A. All
rights reserved. Copyright in this software is owned by DCLC,
rights reserved.
unless otherwise indicated. Permission to use, copy and
distribute this software is hereby granted, provided that the
above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear. Note that
any product, process or technology described in this software
may be the subject of other Intellectual Property rights
reserved by Digital Creations, L.C. and are not licensed
hereunder.
Trademarks
Digital Creations & DCLC, are trademarks of Digital Creations, L.C..
All other trademarks are owned by their respective companies.
No Warranty
The software is provided "as is" without warranty of any kind,
either express or implied, including, but not limited to, the
implied warranties of merchantability, fitness for a particular
purpose, or non-infringement. This software could include
technical inaccuracies or typographical errors. Changes are
periodically made to the software; these changes will be
incorporated in new editions of the software. DCLC may make
improvements and/or changes in this software at any time
without notice.
Limitation Of Liability
In no event will DCLC be liable for direct, indirect, special,
incidental, economic, cover, or consequential damages arising
out of the use of or inability to use this software even if
advised of the possibility of such damages. Some states do not
allow the exclusion or limitation of implied warranties or
limitation of liability for incidental or consequential
damages, so the above limitation or exclusion may not apply to
you.
If you have questions regarding this software,
contact:
Digital Creations L.L.C.
info@digicool.com
(540) 371-6909
******************************************************************/
******************************************************************/
static
char
Record_module_documentation
[]
=
static
char
Record_module_documentation
[]
=
""
""
"
\n
$Id: Record.c,v 1.
1 1997/09/25 22:12:28
jim Exp $"
"
\n
$Id: Record.c,v 1.
2 1997/09/26 15:05:17
jim Exp $"
;
;
#ifdef PERSISTENCE
#ifdef PERSISTENCE
...
@@ -82,14 +39,14 @@ typedef struct {
...
@@ -82,14 +39,14 @@ typedef struct {
#endif
#endif
PyObject
**
data
;
PyObject
**
data
;
PyObject
*
schema
;
PyObject
*
schema
;
}
Record
object
;
}
Record
;
staticforward
PyExtensionClass
RecordType
;
staticforward
PyExtensionClass
RecordType
;
/* ---------------------------------------------------------------- */
/* ---------------------------------------------------------------- */
static
int
static
int
Record_init
(
Record
object
*
self
)
Record_init
(
Record
*
self
)
{
{
int
l
;
int
l
;
...
@@ -111,7 +68,7 @@ Record_init(Recordobject *self)
...
@@ -111,7 +68,7 @@ Record_init(Recordobject *self)
}
}
static
PyObject
*
static
PyObject
*
Record___setstate__
(
Record
object
*
self
,
PyObject
*
args
)
Record___setstate__
(
Record
*
self
,
PyObject
*
args
)
{
{
PyObject
*
state
=
0
,
**
d
;
PyObject
*
state
=
0
,
**
d
;
int
l
,
ls
,
i
;
int
l
,
ls
,
i
;
...
@@ -145,7 +102,7 @@ Record___setstate__(Recordobject *self, PyObject *args)
...
@@ -145,7 +102,7 @@ Record___setstate__(Recordobject *self, PyObject *args)
}
}
static
PyObject
*
static
PyObject
*
Record___getstate__
(
Record
object
*
self
,
PyObject
*
args
)
Record___getstate__
(
Record
*
self
,
PyObject
*
args
)
{
{
PyObject
*
r
,
**
d
,
*
v
;
PyObject
*
r
,
**
d
,
*
v
;
int
i
,
l
;
int
i
,
l
;
...
@@ -165,7 +122,7 @@ Record___getstate__( Recordobject *self, PyObject *args)
...
@@ -165,7 +122,7 @@ Record___getstate__( Recordobject *self, PyObject *args)
}
}
static
void
static
void
Record_deal
(
Record
object
*
self
)
Record_deal
(
Record
*
self
)
{
{
int
l
;
int
l
;
PyObject
**
d
;
PyObject
**
d
;
...
@@ -184,7 +141,7 @@ Record_deal(Recordobject *self)
...
@@ -184,7 +141,7 @@ Record_deal(Recordobject *self)
#ifdef PERSISTENCE
#ifdef PERSISTENCE
static
PyObject
*
static
PyObject
*
Record__p___reinit__
(
Record
object
*
self
,
PyObject
*
args
)
Record__p___reinit__
(
Record
*
self
,
PyObject
*
args
)
{
{
Record_deal
(
self
);
Record_deal
(
self
);
self
->
schema
=
NULL
;
self
->
schema
=
NULL
;
...
@@ -216,21 +173,31 @@ static struct PyMethodDef Record_methods[] = {
...
@@ -216,21 +173,31 @@ static struct PyMethodDef Record_methods[] = {
/* ---------- */
/* ---------- */
static
void
static
void
Record_dealloc
(
Record
object
*
self
)
Record_dealloc
(
Record
*
self
)
{
{
Record_deal
(
self
);
Record_deal
(
self
);
PyMem_DEL
(
self
);
PyMem_DEL
(
self
);
}
}
static
PyObject
*
static
PyObject
*
Record_getattr
(
Record
object
*
self
,
PyObject
*
name
)
Record_getattr
(
Record
*
self
,
PyObject
*
name
)
{
{
int
l
,
i
;
int
l
,
i
;
PyObject
*
io
;
PyObject
*
io
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
NULL
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
NULL
;
if
(
io
=
Py_FindAttr
((
PyObject
*
)
self
,
name
))
return
io
;
PyErr_Clear
();
if
(
io
=
PyObject_GetItem
(
self
->
schema
,
name
))
if
(
io
=
PyObject_GetItem
(
self
->
schema
,
name
))
{
{
UNLESS
(
PyInt_Check
(
io
))
{
PyErr_SetString
(
PyExc_TypeError
,
"invalid record schema"
);
return
NULL
;
}
i
=
PyInt_AsLong
(
io
);
i
=
PyInt_AsLong
(
io
);
if
(
i
>=
0
&&
i
<
l
)
if
(
i
>=
0
&&
i
<
l
)
{
{
...
@@ -241,13 +208,14 @@ Record_getattr(Recordobject *self, PyObject *name)
...
@@ -241,13 +208,14 @@ Record_getattr(Recordobject *self, PyObject *name)
Py_INCREF
(
io
);
Py_INCREF
(
io
);
return
io
;
return
io
;
}
}
PyErr_Clear
();
PyErr_SetObject
(
PyExc_AttributeError
,
name
);
return
Py_FindAttr
((
PyObject
*
)
self
,
name
);
return
NULL
;
}
}
static
int
static
int
Record_setattr
(
Record
object
*
self
,
PyObject
*
name
,
PyObject
*
v
)
Record_setattr
(
Record
*
self
,
PyObject
*
name
,
PyObject
*
v
)
{
{
int
l
,
i
;
int
l
,
i
;
PyObject
*
io
;
PyObject
*
io
;
...
@@ -255,24 +223,28 @@ Record_setattr(Recordobject *self, PyObject *name, PyObject *v)
...
@@ -255,24 +223,28 @@ Record_setattr(Recordobject *self, PyObject *name, PyObject *v)
if
((
l
=
Record_init
(
self
))
<
0
)
return
-
1
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
-
1
;
if
(
io
=
PyObject_GetItem
(
self
->
schema
,
name
))
if
(
io
=
PyObject_GetItem
(
self
->
schema
,
name
))
{
{
UNLESS
(
PyInt_Check
(
io
))
{
PyErr_SetString
(
PyExc_TypeError
,
"invalid record schema"
);
return
-
1
;
}
i
=
PyInt_AsLong
(
io
);
i
=
PyInt_AsLong
(
io
);
Py_DECREF
(
io
);
Py_DECREF
(
io
);
if
(
i
>=
0
&&
i
<
l
)
if
(
i
>=
0
&&
i
<
l
)
{
{
Py_INCREF
(
v
);
Py_
X
INCREF
(
v
);
ASSIGN
(
self
->
data
[
i
],
v
);
ASSIGN
(
self
->
data
[
i
],
v
);
return
0
;
return
0
;
}
}
}
}
else
PyErr_Clear
();
PyErr_SetObject
(
PyExc_AttributeError
,
name
);
PyErr_SetObject
(
PyExc_AttributeError
,
name
);
return
-
1
;
return
-
1
;
}
}
#ifdef PERSISTENCE
#ifdef PERSISTENCE
static
PyObject
*
static
PyObject
*
pRecord_getattr
(
Record
object
*
self
,
PyObject
*
name
)
pRecord_getattr
(
Record
*
self
,
PyObject
*
name
)
{
{
char
*
c
;
char
*
c
;
UNLESS
(
c
=
PyString_AsString
(
name
))
return
NULL
;
UNLESS
(
c
=
PyString_AsString
(
name
))
return
NULL
;
...
@@ -281,7 +253,7 @@ pRecord_getattr(Recordobject *self, PyObject *name)
...
@@ -281,7 +253,7 @@ pRecord_getattr(Recordobject *self, PyObject *name)
}
}
static
int
static
int
pRecord_setattr
(
Record
object
*
self
,
PyObject
*
name
,
PyObject
*
v
)
pRecord_setattr
(
Record
*
self
,
PyObject
*
name
,
PyObject
*
v
)
{
{
return
cPersistenceCAPI
->
persetattro
(
OBJECT
(
self
),
name
,
v
,
Record_setattr
);
return
cPersistenceCAPI
->
persetattro
(
OBJECT
(
self
),
name
,
v
,
Record_setattr
);
}
}
...
@@ -289,7 +261,7 @@ pRecord_setattr(Recordobject *self, PyObject *name, PyObject *v)
...
@@ -289,7 +261,7 @@ pRecord_setattr(Recordobject *self, PyObject *name, PyObject *v)
static
int
static
int
Record_compare
(
Record
object
*
v
,
Recordobject
*
w
)
Record_compare
(
Record
*
v
,
Record
*
w
)
{
{
int
lv
,
lw
,
i
,
c
;
int
lv
,
lw
,
i
,
c
;
PyObject
**
dv
,
**
dw
;
PyObject
**
dv
,
**
dw
;
...
@@ -313,11 +285,188 @@ Record_compare(Recordobject *v, Recordobject *w)
...
@@ -313,11 +285,188 @@ Record_compare(Recordobject *v, Recordobject *w)
return
0
;
return
0
;
}
}
/* Code to handle accessing Record objects as sequence objects */
static
PyObject
*
Record_concat
(
Record
*
self
,
PyObject
*
bb
)
{
PyErr_SetString
(
PyExc_TypeError
,
"Record objects do not support concatenation"
);
return
NULL
;
}
static
PyObject
*
Record_repeat
(
Record
*
self
,
int
n
)
{
PyErr_SetString
(
PyExc_TypeError
,
"Record objects do not support repetition"
);
return
NULL
;
}
static
PyObject
*
IndexError
(
int
i
)
{
PyObject
*
v
;
if
((
v
=
PyInt_FromLong
(
i
)))
{
PyErr_SetObject
(
PyExc_IndexError
,
v
);
Py_DECREF
(
v
);
}
return
NULL
;
}
static
PyObject
*
Record_item
(
Record
*
self
,
int
i
)
{
PyObject
*
o
;
int
l
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
NULL
;
if
(
i
<
0
||
i
>=
l
)
return
IndexError
(
i
);
o
=
self
->
data
[
i
];
UNLESS
(
o
)
o
=
Py_None
;
Py_INCREF
(
o
);
return
o
;
}
static
PyObject
*
Record_slice
(
Record
*
self
,
int
ilow
,
int
ihigh
)
{
PyErr_SetString
(
PyExc_TypeError
,
"Record objects do not support slicing"
);
return
NULL
;
}
static
int
Record_ass_item
(
Record
*
self
,
int
i
,
PyObject
*
v
)
{
int
l
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
-
1
;
if
(
i
<
0
||
i
>=
l
)
{
IndexError
(
i
);
return
-
1
;
}
UNLESS
(
v
)
{
PyErr_SetString
(
PyExc_TypeError
,
"cannot delete record items"
);
return
-
1
;
}
Py_INCREF
(
v
);
ASSIGN
(
self
->
data
[
i
],
v
);
return
0
;
}
static
int
Record_ass_slice
(
Record
*
self
,
int
ilow
,
int
ihigh
,
PyObject
*
v
)
{
PyErr_SetString
(
PyExc_TypeError
,
"Record objects do not support slice assignment"
);
return
-
1
;
}
static
PySequenceMethods
Record_as_sequence
=
{
(
inquiry
)
Record_init
,
/*sq_length*/
(
binaryfunc
)
Record_concat
,
/*sq_concat*/
(
intargfunc
)
Record_repeat
,
/*sq_repeat*/
(
intargfunc
)
Record_item
,
/*sq_item*/
(
intintargfunc
)
Record_slice
,
/*sq_slice*/
(
intobjargproc
)
Record_ass_item
,
/*sq_ass_item*/
(
intintobjargproc
)
Record_ass_slice
,
/*sq_ass_slice*/
};
/* -------------------------------------------------------------- */
static
PyObject
*
Record_subscript
(
Record
*
self
,
PyObject
*
key
)
{
int
i
,
l
;
PyObject
*
io
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
NULL
;
if
(
PyInt_Check
(
key
))
{
i
=
PyInt_AsLong
(
key
);
if
(
i
<
0
)
i
+=
l
;
return
Record_item
(
self
,
i
);
}
if
(
io
=
PyObject_GetItem
(
self
->
schema
,
key
))
{
UNLESS
(
PyInt_Check
(
io
))
{
PyErr_SetString
(
PyExc_TypeError
,
"invalid record schema"
);
return
NULL
;
}
i
=
PyInt_AsLong
(
io
);
if
(
i
>=
0
&&
i
<
l
)
{
ASSIGN
(
io
,
self
->
data
[
i
]);
UNLESS
(
io
)
io
=
Py_None
;
}
else
ASSIGN
(
io
,
Py_None
);
Py_INCREF
(
io
);
return
io
;
}
return
NULL
;
}
static
int
Record_ass_sub
(
Record
*
self
,
PyObject
*
key
,
PyObject
*
v
)
{
int
i
,
l
;
PyObject
*
io
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
-
1
;
if
(
PyInt_Check
(
key
))
{
i
=
PyInt_AsLong
(
key
);
if
(
i
<
0
)
i
+=
l
;
return
Record_ass_item
(
self
,
i
,
v
);
}
if
(
io
=
PyObject_GetItem
(
self
->
schema
,
key
))
{
UNLESS
(
PyInt_Check
(
io
))
{
PyErr_SetString
(
PyExc_TypeError
,
"invalid record schema"
);
return
-
1
;
}
i
=
PyInt_AsLong
(
io
);
Py_DECREF
(
io
);
if
(
i
>=
0
&&
i
<
l
)
{
Py_XINCREF
(
v
);
ASSIGN
(
self
->
data
[
i
],
v
);
return
0
;
}
}
return
-
1
;
}
static
PyMappingMethods
Record_as_mapping
=
{
(
inquiry
)
Record_init
,
/*mp_length*/
(
binaryfunc
)
Record_subscript
,
/*mp_subscript*/
(
objobjargproc
)
Record_ass_sub
,
/*mp_ass_subscript*/
};
/* -------------------------------------------------------- */
static
PyExtensionClass
RecordType
=
{
static
PyExtensionClass
RecordType
=
{
PyObject_HEAD_INIT
(
NULL
)
PyObject_HEAD_INIT
(
NULL
)
0
,
/*ob_size*/
0
,
/*ob_size*/
"Record"
,
/*tp_name*/
"Record"
,
/*tp_name*/
sizeof
(
Record
object
),
/*tp_basicsize*/
sizeof
(
Record
),
/*tp_basicsize*/
0
,
/*tp_itemsize*/
0
,
/*tp_itemsize*/
/* methods */
/* methods */
(
destructor
)
Record_dealloc
,
/*tp_dealloc*/
(
destructor
)
Record_dealloc
,
/*tp_dealloc*/
...
@@ -327,8 +476,8 @@ static PyExtensionClass RecordType = {
...
@@ -327,8 +476,8 @@ static PyExtensionClass RecordType = {
(
cmpfunc
)
Record_compare
,
/*tp_compare*/
(
cmpfunc
)
Record_compare
,
/*tp_compare*/
(
reprfunc
)
0
,
/*tp_repr*/
(
reprfunc
)
0
,
/*tp_repr*/
0
,
/*tp_as_number*/
0
,
/*tp_as_number*/
0
,
/*tp_as_sequence*/
&
Record_as_sequence
,
/*tp_as_sequence*/
0
,
/*tp_as_mapping*/
&
Record_as_mapping
,
/*tp_as_mapping*/
(
hashfunc
)
0
,
/*tp_hash*/
(
hashfunc
)
0
,
/*tp_hash*/
(
ternaryfunc
)
0
,
/*tp_call*/
(
ternaryfunc
)
0
,
/*tp_call*/
(
reprfunc
)
0
,
/*tp_str*/
(
reprfunc
)
0
,
/*tp_str*/
...
@@ -363,7 +512,7 @@ void
...
@@ -363,7 +512,7 @@ void
initRecord
()
initRecord
()
{
{
PyObject
*
m
,
*
d
;
PyObject
*
m
,
*
d
;
char
*
rev
=
"$Revision: 1.
1
$"
;
char
*
rev
=
"$Revision: 1.
2
$"
;
UNLESS
(
py___record_schema__
=
PyString_FromString
(
"__record_schema__"
))
return
;
UNLESS
(
py___record_schema__
=
PyString_FromString
(
"__record_schema__"
))
return
;
...
@@ -402,6 +551,9 @@ initRecord()
...
@@ -402,6 +551,9 @@ initRecord()
Revision Log:
Revision Log:
$Log: Record.c,v $
$Log: Record.c,v $
Revision 1.2 1997/09/26 15:05:17 jim
Added sequence and mapping behavior.
Revision 1.1 1997/09/25 22:12:28 jim
Revision 1.1 1997/09/25 22:12:28 jim
*** empty log message ***
*** empty log message ***
...
...
lib/python/Shared/DC/Record/Record.c
View file @
34c24bee
...
@@ -3,57 +3,14 @@
...
@@ -3,57 +3,14 @@
Copyright 1997 Digital Creations, L.L.C., 910 Princess Anne
Copyright 1997 Digital Creations, L.L.C., 910 Princess Anne
Street, Suite 300, Fredericksburg, Virginia 22401 U.S.A. All
Street, Suite 300, Fredericksburg, Virginia 22401 U.S.A. All
rights reserved. Copyright in this software is owned by DCLC,
rights reserved.
unless otherwise indicated. Permission to use, copy and
distribute this software is hereby granted, provided that the
above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear. Note that
any product, process or technology described in this software
may be the subject of other Intellectual Property rights
reserved by Digital Creations, L.C. and are not licensed
hereunder.
Trademarks
Digital Creations & DCLC, are trademarks of Digital Creations, L.C..
All other trademarks are owned by their respective companies.
No Warranty
The software is provided "as is" without warranty of any kind,
either express or implied, including, but not limited to, the
implied warranties of merchantability, fitness for a particular
purpose, or non-infringement. This software could include
technical inaccuracies or typographical errors. Changes are
periodically made to the software; these changes will be
incorporated in new editions of the software. DCLC may make
improvements and/or changes in this software at any time
without notice.
Limitation Of Liability
In no event will DCLC be liable for direct, indirect, special,
incidental, economic, cover, or consequential damages arising
out of the use of or inability to use this software even if
advised of the possibility of such damages. Some states do not
allow the exclusion or limitation of implied warranties or
limitation of liability for incidental or consequential
damages, so the above limitation or exclusion may not apply to
you.
If you have questions regarding this software,
contact:
Digital Creations L.L.C.
info@digicool.com
(540) 371-6909
******************************************************************/
******************************************************************/
static
char
Record_module_documentation
[]
=
static
char
Record_module_documentation
[]
=
""
""
"
\n
$Id: Record.c,v 1.
1 1997/09/25 22:12:28
jim Exp $"
"
\n
$Id: Record.c,v 1.
2 1997/09/26 15:05:17
jim Exp $"
;
;
#ifdef PERSISTENCE
#ifdef PERSISTENCE
...
@@ -82,14 +39,14 @@ typedef struct {
...
@@ -82,14 +39,14 @@ typedef struct {
#endif
#endif
PyObject
**
data
;
PyObject
**
data
;
PyObject
*
schema
;
PyObject
*
schema
;
}
Record
object
;
}
Record
;
staticforward
PyExtensionClass
RecordType
;
staticforward
PyExtensionClass
RecordType
;
/* ---------------------------------------------------------------- */
/* ---------------------------------------------------------------- */
static
int
static
int
Record_init
(
Record
object
*
self
)
Record_init
(
Record
*
self
)
{
{
int
l
;
int
l
;
...
@@ -111,7 +68,7 @@ Record_init(Recordobject *self)
...
@@ -111,7 +68,7 @@ Record_init(Recordobject *self)
}
}
static
PyObject
*
static
PyObject
*
Record___setstate__
(
Record
object
*
self
,
PyObject
*
args
)
Record___setstate__
(
Record
*
self
,
PyObject
*
args
)
{
{
PyObject
*
state
=
0
,
**
d
;
PyObject
*
state
=
0
,
**
d
;
int
l
,
ls
,
i
;
int
l
,
ls
,
i
;
...
@@ -145,7 +102,7 @@ Record___setstate__(Recordobject *self, PyObject *args)
...
@@ -145,7 +102,7 @@ Record___setstate__(Recordobject *self, PyObject *args)
}
}
static
PyObject
*
static
PyObject
*
Record___getstate__
(
Record
object
*
self
,
PyObject
*
args
)
Record___getstate__
(
Record
*
self
,
PyObject
*
args
)
{
{
PyObject
*
r
,
**
d
,
*
v
;
PyObject
*
r
,
**
d
,
*
v
;
int
i
,
l
;
int
i
,
l
;
...
@@ -165,7 +122,7 @@ Record___getstate__( Recordobject *self, PyObject *args)
...
@@ -165,7 +122,7 @@ Record___getstate__( Recordobject *self, PyObject *args)
}
}
static
void
static
void
Record_deal
(
Record
object
*
self
)
Record_deal
(
Record
*
self
)
{
{
int
l
;
int
l
;
PyObject
**
d
;
PyObject
**
d
;
...
@@ -184,7 +141,7 @@ Record_deal(Recordobject *self)
...
@@ -184,7 +141,7 @@ Record_deal(Recordobject *self)
#ifdef PERSISTENCE
#ifdef PERSISTENCE
static
PyObject
*
static
PyObject
*
Record__p___reinit__
(
Record
object
*
self
,
PyObject
*
args
)
Record__p___reinit__
(
Record
*
self
,
PyObject
*
args
)
{
{
Record_deal
(
self
);
Record_deal
(
self
);
self
->
schema
=
NULL
;
self
->
schema
=
NULL
;
...
@@ -216,21 +173,31 @@ static struct PyMethodDef Record_methods[] = {
...
@@ -216,21 +173,31 @@ static struct PyMethodDef Record_methods[] = {
/* ---------- */
/* ---------- */
static
void
static
void
Record_dealloc
(
Record
object
*
self
)
Record_dealloc
(
Record
*
self
)
{
{
Record_deal
(
self
);
Record_deal
(
self
);
PyMem_DEL
(
self
);
PyMem_DEL
(
self
);
}
}
static
PyObject
*
static
PyObject
*
Record_getattr
(
Record
object
*
self
,
PyObject
*
name
)
Record_getattr
(
Record
*
self
,
PyObject
*
name
)
{
{
int
l
,
i
;
int
l
,
i
;
PyObject
*
io
;
PyObject
*
io
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
NULL
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
NULL
;
if
(
io
=
Py_FindAttr
((
PyObject
*
)
self
,
name
))
return
io
;
PyErr_Clear
();
if
(
io
=
PyObject_GetItem
(
self
->
schema
,
name
))
if
(
io
=
PyObject_GetItem
(
self
->
schema
,
name
))
{
{
UNLESS
(
PyInt_Check
(
io
))
{
PyErr_SetString
(
PyExc_TypeError
,
"invalid record schema"
);
return
NULL
;
}
i
=
PyInt_AsLong
(
io
);
i
=
PyInt_AsLong
(
io
);
if
(
i
>=
0
&&
i
<
l
)
if
(
i
>=
0
&&
i
<
l
)
{
{
...
@@ -241,13 +208,14 @@ Record_getattr(Recordobject *self, PyObject *name)
...
@@ -241,13 +208,14 @@ Record_getattr(Recordobject *self, PyObject *name)
Py_INCREF
(
io
);
Py_INCREF
(
io
);
return
io
;
return
io
;
}
}
PyErr_Clear
();
PyErr_SetObject
(
PyExc_AttributeError
,
name
);
return
Py_FindAttr
((
PyObject
*
)
self
,
name
);
return
NULL
;
}
}
static
int
static
int
Record_setattr
(
Record
object
*
self
,
PyObject
*
name
,
PyObject
*
v
)
Record_setattr
(
Record
*
self
,
PyObject
*
name
,
PyObject
*
v
)
{
{
int
l
,
i
;
int
l
,
i
;
PyObject
*
io
;
PyObject
*
io
;
...
@@ -255,24 +223,28 @@ Record_setattr(Recordobject *self, PyObject *name, PyObject *v)
...
@@ -255,24 +223,28 @@ Record_setattr(Recordobject *self, PyObject *name, PyObject *v)
if
((
l
=
Record_init
(
self
))
<
0
)
return
-
1
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
-
1
;
if
(
io
=
PyObject_GetItem
(
self
->
schema
,
name
))
if
(
io
=
PyObject_GetItem
(
self
->
schema
,
name
))
{
{
UNLESS
(
PyInt_Check
(
io
))
{
PyErr_SetString
(
PyExc_TypeError
,
"invalid record schema"
);
return
-
1
;
}
i
=
PyInt_AsLong
(
io
);
i
=
PyInt_AsLong
(
io
);
Py_DECREF
(
io
);
Py_DECREF
(
io
);
if
(
i
>=
0
&&
i
<
l
)
if
(
i
>=
0
&&
i
<
l
)
{
{
Py_INCREF
(
v
);
Py_
X
INCREF
(
v
);
ASSIGN
(
self
->
data
[
i
],
v
);
ASSIGN
(
self
->
data
[
i
],
v
);
return
0
;
return
0
;
}
}
}
}
else
PyErr_Clear
();
PyErr_SetObject
(
PyExc_AttributeError
,
name
);
PyErr_SetObject
(
PyExc_AttributeError
,
name
);
return
-
1
;
return
-
1
;
}
}
#ifdef PERSISTENCE
#ifdef PERSISTENCE
static
PyObject
*
static
PyObject
*
pRecord_getattr
(
Record
object
*
self
,
PyObject
*
name
)
pRecord_getattr
(
Record
*
self
,
PyObject
*
name
)
{
{
char
*
c
;
char
*
c
;
UNLESS
(
c
=
PyString_AsString
(
name
))
return
NULL
;
UNLESS
(
c
=
PyString_AsString
(
name
))
return
NULL
;
...
@@ -281,7 +253,7 @@ pRecord_getattr(Recordobject *self, PyObject *name)
...
@@ -281,7 +253,7 @@ pRecord_getattr(Recordobject *self, PyObject *name)
}
}
static
int
static
int
pRecord_setattr
(
Record
object
*
self
,
PyObject
*
name
,
PyObject
*
v
)
pRecord_setattr
(
Record
*
self
,
PyObject
*
name
,
PyObject
*
v
)
{
{
return
cPersistenceCAPI
->
persetattro
(
OBJECT
(
self
),
name
,
v
,
Record_setattr
);
return
cPersistenceCAPI
->
persetattro
(
OBJECT
(
self
),
name
,
v
,
Record_setattr
);
}
}
...
@@ -289,7 +261,7 @@ pRecord_setattr(Recordobject *self, PyObject *name, PyObject *v)
...
@@ -289,7 +261,7 @@ pRecord_setattr(Recordobject *self, PyObject *name, PyObject *v)
static
int
static
int
Record_compare
(
Record
object
*
v
,
Recordobject
*
w
)
Record_compare
(
Record
*
v
,
Record
*
w
)
{
{
int
lv
,
lw
,
i
,
c
;
int
lv
,
lw
,
i
,
c
;
PyObject
**
dv
,
**
dw
;
PyObject
**
dv
,
**
dw
;
...
@@ -313,11 +285,188 @@ Record_compare(Recordobject *v, Recordobject *w)
...
@@ -313,11 +285,188 @@ Record_compare(Recordobject *v, Recordobject *w)
return
0
;
return
0
;
}
}
/* Code to handle accessing Record objects as sequence objects */
static
PyObject
*
Record_concat
(
Record
*
self
,
PyObject
*
bb
)
{
PyErr_SetString
(
PyExc_TypeError
,
"Record objects do not support concatenation"
);
return
NULL
;
}
static
PyObject
*
Record_repeat
(
Record
*
self
,
int
n
)
{
PyErr_SetString
(
PyExc_TypeError
,
"Record objects do not support repetition"
);
return
NULL
;
}
static
PyObject
*
IndexError
(
int
i
)
{
PyObject
*
v
;
if
((
v
=
PyInt_FromLong
(
i
)))
{
PyErr_SetObject
(
PyExc_IndexError
,
v
);
Py_DECREF
(
v
);
}
return
NULL
;
}
static
PyObject
*
Record_item
(
Record
*
self
,
int
i
)
{
PyObject
*
o
;
int
l
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
NULL
;
if
(
i
<
0
||
i
>=
l
)
return
IndexError
(
i
);
o
=
self
->
data
[
i
];
UNLESS
(
o
)
o
=
Py_None
;
Py_INCREF
(
o
);
return
o
;
}
static
PyObject
*
Record_slice
(
Record
*
self
,
int
ilow
,
int
ihigh
)
{
PyErr_SetString
(
PyExc_TypeError
,
"Record objects do not support slicing"
);
return
NULL
;
}
static
int
Record_ass_item
(
Record
*
self
,
int
i
,
PyObject
*
v
)
{
int
l
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
-
1
;
if
(
i
<
0
||
i
>=
l
)
{
IndexError
(
i
);
return
-
1
;
}
UNLESS
(
v
)
{
PyErr_SetString
(
PyExc_TypeError
,
"cannot delete record items"
);
return
-
1
;
}
Py_INCREF
(
v
);
ASSIGN
(
self
->
data
[
i
],
v
);
return
0
;
}
static
int
Record_ass_slice
(
Record
*
self
,
int
ilow
,
int
ihigh
,
PyObject
*
v
)
{
PyErr_SetString
(
PyExc_TypeError
,
"Record objects do not support slice assignment"
);
return
-
1
;
}
static
PySequenceMethods
Record_as_sequence
=
{
(
inquiry
)
Record_init
,
/*sq_length*/
(
binaryfunc
)
Record_concat
,
/*sq_concat*/
(
intargfunc
)
Record_repeat
,
/*sq_repeat*/
(
intargfunc
)
Record_item
,
/*sq_item*/
(
intintargfunc
)
Record_slice
,
/*sq_slice*/
(
intobjargproc
)
Record_ass_item
,
/*sq_ass_item*/
(
intintobjargproc
)
Record_ass_slice
,
/*sq_ass_slice*/
};
/* -------------------------------------------------------------- */
static
PyObject
*
Record_subscript
(
Record
*
self
,
PyObject
*
key
)
{
int
i
,
l
;
PyObject
*
io
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
NULL
;
if
(
PyInt_Check
(
key
))
{
i
=
PyInt_AsLong
(
key
);
if
(
i
<
0
)
i
+=
l
;
return
Record_item
(
self
,
i
);
}
if
(
io
=
PyObject_GetItem
(
self
->
schema
,
key
))
{
UNLESS
(
PyInt_Check
(
io
))
{
PyErr_SetString
(
PyExc_TypeError
,
"invalid record schema"
);
return
NULL
;
}
i
=
PyInt_AsLong
(
io
);
if
(
i
>=
0
&&
i
<
l
)
{
ASSIGN
(
io
,
self
->
data
[
i
]);
UNLESS
(
io
)
io
=
Py_None
;
}
else
ASSIGN
(
io
,
Py_None
);
Py_INCREF
(
io
);
return
io
;
}
return
NULL
;
}
static
int
Record_ass_sub
(
Record
*
self
,
PyObject
*
key
,
PyObject
*
v
)
{
int
i
,
l
;
PyObject
*
io
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
-
1
;
if
(
PyInt_Check
(
key
))
{
i
=
PyInt_AsLong
(
key
);
if
(
i
<
0
)
i
+=
l
;
return
Record_ass_item
(
self
,
i
,
v
);
}
if
(
io
=
PyObject_GetItem
(
self
->
schema
,
key
))
{
UNLESS
(
PyInt_Check
(
io
))
{
PyErr_SetString
(
PyExc_TypeError
,
"invalid record schema"
);
return
-
1
;
}
i
=
PyInt_AsLong
(
io
);
Py_DECREF
(
io
);
if
(
i
>=
0
&&
i
<
l
)
{
Py_XINCREF
(
v
);
ASSIGN
(
self
->
data
[
i
],
v
);
return
0
;
}
}
return
-
1
;
}
static
PyMappingMethods
Record_as_mapping
=
{
(
inquiry
)
Record_init
,
/*mp_length*/
(
binaryfunc
)
Record_subscript
,
/*mp_subscript*/
(
objobjargproc
)
Record_ass_sub
,
/*mp_ass_subscript*/
};
/* -------------------------------------------------------- */
static
PyExtensionClass
RecordType
=
{
static
PyExtensionClass
RecordType
=
{
PyObject_HEAD_INIT
(
NULL
)
PyObject_HEAD_INIT
(
NULL
)
0
,
/*ob_size*/
0
,
/*ob_size*/
"Record"
,
/*tp_name*/
"Record"
,
/*tp_name*/
sizeof
(
Record
object
),
/*tp_basicsize*/
sizeof
(
Record
),
/*tp_basicsize*/
0
,
/*tp_itemsize*/
0
,
/*tp_itemsize*/
/* methods */
/* methods */
(
destructor
)
Record_dealloc
,
/*tp_dealloc*/
(
destructor
)
Record_dealloc
,
/*tp_dealloc*/
...
@@ -327,8 +476,8 @@ static PyExtensionClass RecordType = {
...
@@ -327,8 +476,8 @@ static PyExtensionClass RecordType = {
(
cmpfunc
)
Record_compare
,
/*tp_compare*/
(
cmpfunc
)
Record_compare
,
/*tp_compare*/
(
reprfunc
)
0
,
/*tp_repr*/
(
reprfunc
)
0
,
/*tp_repr*/
0
,
/*tp_as_number*/
0
,
/*tp_as_number*/
0
,
/*tp_as_sequence*/
&
Record_as_sequence
,
/*tp_as_sequence*/
0
,
/*tp_as_mapping*/
&
Record_as_mapping
,
/*tp_as_mapping*/
(
hashfunc
)
0
,
/*tp_hash*/
(
hashfunc
)
0
,
/*tp_hash*/
(
ternaryfunc
)
0
,
/*tp_call*/
(
ternaryfunc
)
0
,
/*tp_call*/
(
reprfunc
)
0
,
/*tp_str*/
(
reprfunc
)
0
,
/*tp_str*/
...
@@ -363,7 +512,7 @@ void
...
@@ -363,7 +512,7 @@ void
initRecord
()
initRecord
()
{
{
PyObject
*
m
,
*
d
;
PyObject
*
m
,
*
d
;
char
*
rev
=
"$Revision: 1.
1
$"
;
char
*
rev
=
"$Revision: 1.
2
$"
;
UNLESS
(
py___record_schema__
=
PyString_FromString
(
"__record_schema__"
))
return
;
UNLESS
(
py___record_schema__
=
PyString_FromString
(
"__record_schema__"
))
return
;
...
@@ -402,6 +551,9 @@ initRecord()
...
@@ -402,6 +551,9 @@ initRecord()
Revision Log:
Revision Log:
$Log: Record.c,v $
$Log: Record.c,v $
Revision 1.2 1997/09/26 15:05:17 jim
Added sequence and mapping behavior.
Revision 1.1 1997/09/25 22:12:28 jim
Revision 1.1 1997/09/25 22:12:28 jim
*** empty log message ***
*** empty log message ***
...
...
lib/python/Shared/DC/ZRDB/Record.c
View file @
34c24bee
...
@@ -3,57 +3,14 @@
...
@@ -3,57 +3,14 @@
Copyright 1997 Digital Creations, L.L.C., 910 Princess Anne
Copyright 1997 Digital Creations, L.L.C., 910 Princess Anne
Street, Suite 300, Fredericksburg, Virginia 22401 U.S.A. All
Street, Suite 300, Fredericksburg, Virginia 22401 U.S.A. All
rights reserved. Copyright in this software is owned by DCLC,
rights reserved.
unless otherwise indicated. Permission to use, copy and
distribute this software is hereby granted, provided that the
above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear. Note that
any product, process or technology described in this software
may be the subject of other Intellectual Property rights
reserved by Digital Creations, L.C. and are not licensed
hereunder.
Trademarks
Digital Creations & DCLC, are trademarks of Digital Creations, L.C..
All other trademarks are owned by their respective companies.
No Warranty
The software is provided "as is" without warranty of any kind,
either express or implied, including, but not limited to, the
implied warranties of merchantability, fitness for a particular
purpose, or non-infringement. This software could include
technical inaccuracies or typographical errors. Changes are
periodically made to the software; these changes will be
incorporated in new editions of the software. DCLC may make
improvements and/or changes in this software at any time
without notice.
Limitation Of Liability
In no event will DCLC be liable for direct, indirect, special,
incidental, economic, cover, or consequential damages arising
out of the use of or inability to use this software even if
advised of the possibility of such damages. Some states do not
allow the exclusion or limitation of implied warranties or
limitation of liability for incidental or consequential
damages, so the above limitation or exclusion may not apply to
you.
If you have questions regarding this software,
contact:
Digital Creations L.L.C.
info@digicool.com
(540) 371-6909
******************************************************************/
******************************************************************/
static
char
Record_module_documentation
[]
=
static
char
Record_module_documentation
[]
=
""
""
"
\n
$Id: Record.c,v 1.
1 1997/09/25 22:12:28
jim Exp $"
"
\n
$Id: Record.c,v 1.
2 1997/09/26 15:05:17
jim Exp $"
;
;
#ifdef PERSISTENCE
#ifdef PERSISTENCE
...
@@ -82,14 +39,14 @@ typedef struct {
...
@@ -82,14 +39,14 @@ typedef struct {
#endif
#endif
PyObject
**
data
;
PyObject
**
data
;
PyObject
*
schema
;
PyObject
*
schema
;
}
Record
object
;
}
Record
;
staticforward
PyExtensionClass
RecordType
;
staticforward
PyExtensionClass
RecordType
;
/* ---------------------------------------------------------------- */
/* ---------------------------------------------------------------- */
static
int
static
int
Record_init
(
Record
object
*
self
)
Record_init
(
Record
*
self
)
{
{
int
l
;
int
l
;
...
@@ -111,7 +68,7 @@ Record_init(Recordobject *self)
...
@@ -111,7 +68,7 @@ Record_init(Recordobject *self)
}
}
static
PyObject
*
static
PyObject
*
Record___setstate__
(
Record
object
*
self
,
PyObject
*
args
)
Record___setstate__
(
Record
*
self
,
PyObject
*
args
)
{
{
PyObject
*
state
=
0
,
**
d
;
PyObject
*
state
=
0
,
**
d
;
int
l
,
ls
,
i
;
int
l
,
ls
,
i
;
...
@@ -145,7 +102,7 @@ Record___setstate__(Recordobject *self, PyObject *args)
...
@@ -145,7 +102,7 @@ Record___setstate__(Recordobject *self, PyObject *args)
}
}
static
PyObject
*
static
PyObject
*
Record___getstate__
(
Record
object
*
self
,
PyObject
*
args
)
Record___getstate__
(
Record
*
self
,
PyObject
*
args
)
{
{
PyObject
*
r
,
**
d
,
*
v
;
PyObject
*
r
,
**
d
,
*
v
;
int
i
,
l
;
int
i
,
l
;
...
@@ -165,7 +122,7 @@ Record___getstate__( Recordobject *self, PyObject *args)
...
@@ -165,7 +122,7 @@ Record___getstate__( Recordobject *self, PyObject *args)
}
}
static
void
static
void
Record_deal
(
Record
object
*
self
)
Record_deal
(
Record
*
self
)
{
{
int
l
;
int
l
;
PyObject
**
d
;
PyObject
**
d
;
...
@@ -184,7 +141,7 @@ Record_deal(Recordobject *self)
...
@@ -184,7 +141,7 @@ Record_deal(Recordobject *self)
#ifdef PERSISTENCE
#ifdef PERSISTENCE
static
PyObject
*
static
PyObject
*
Record__p___reinit__
(
Record
object
*
self
,
PyObject
*
args
)
Record__p___reinit__
(
Record
*
self
,
PyObject
*
args
)
{
{
Record_deal
(
self
);
Record_deal
(
self
);
self
->
schema
=
NULL
;
self
->
schema
=
NULL
;
...
@@ -216,21 +173,31 @@ static struct PyMethodDef Record_methods[] = {
...
@@ -216,21 +173,31 @@ static struct PyMethodDef Record_methods[] = {
/* ---------- */
/* ---------- */
static
void
static
void
Record_dealloc
(
Record
object
*
self
)
Record_dealloc
(
Record
*
self
)
{
{
Record_deal
(
self
);
Record_deal
(
self
);
PyMem_DEL
(
self
);
PyMem_DEL
(
self
);
}
}
static
PyObject
*
static
PyObject
*
Record_getattr
(
Record
object
*
self
,
PyObject
*
name
)
Record_getattr
(
Record
*
self
,
PyObject
*
name
)
{
{
int
l
,
i
;
int
l
,
i
;
PyObject
*
io
;
PyObject
*
io
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
NULL
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
NULL
;
if
(
io
=
Py_FindAttr
((
PyObject
*
)
self
,
name
))
return
io
;
PyErr_Clear
();
if
(
io
=
PyObject_GetItem
(
self
->
schema
,
name
))
if
(
io
=
PyObject_GetItem
(
self
->
schema
,
name
))
{
{
UNLESS
(
PyInt_Check
(
io
))
{
PyErr_SetString
(
PyExc_TypeError
,
"invalid record schema"
);
return
NULL
;
}
i
=
PyInt_AsLong
(
io
);
i
=
PyInt_AsLong
(
io
);
if
(
i
>=
0
&&
i
<
l
)
if
(
i
>=
0
&&
i
<
l
)
{
{
...
@@ -241,13 +208,14 @@ Record_getattr(Recordobject *self, PyObject *name)
...
@@ -241,13 +208,14 @@ Record_getattr(Recordobject *self, PyObject *name)
Py_INCREF
(
io
);
Py_INCREF
(
io
);
return
io
;
return
io
;
}
}
PyErr_Clear
();
PyErr_SetObject
(
PyExc_AttributeError
,
name
);
return
Py_FindAttr
((
PyObject
*
)
self
,
name
);
return
NULL
;
}
}
static
int
static
int
Record_setattr
(
Record
object
*
self
,
PyObject
*
name
,
PyObject
*
v
)
Record_setattr
(
Record
*
self
,
PyObject
*
name
,
PyObject
*
v
)
{
{
int
l
,
i
;
int
l
,
i
;
PyObject
*
io
;
PyObject
*
io
;
...
@@ -255,24 +223,28 @@ Record_setattr(Recordobject *self, PyObject *name, PyObject *v)
...
@@ -255,24 +223,28 @@ Record_setattr(Recordobject *self, PyObject *name, PyObject *v)
if
((
l
=
Record_init
(
self
))
<
0
)
return
-
1
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
-
1
;
if
(
io
=
PyObject_GetItem
(
self
->
schema
,
name
))
if
(
io
=
PyObject_GetItem
(
self
->
schema
,
name
))
{
{
UNLESS
(
PyInt_Check
(
io
))
{
PyErr_SetString
(
PyExc_TypeError
,
"invalid record schema"
);
return
-
1
;
}
i
=
PyInt_AsLong
(
io
);
i
=
PyInt_AsLong
(
io
);
Py_DECREF
(
io
);
Py_DECREF
(
io
);
if
(
i
>=
0
&&
i
<
l
)
if
(
i
>=
0
&&
i
<
l
)
{
{
Py_INCREF
(
v
);
Py_
X
INCREF
(
v
);
ASSIGN
(
self
->
data
[
i
],
v
);
ASSIGN
(
self
->
data
[
i
],
v
);
return
0
;
return
0
;
}
}
}
}
else
PyErr_Clear
();
PyErr_SetObject
(
PyExc_AttributeError
,
name
);
PyErr_SetObject
(
PyExc_AttributeError
,
name
);
return
-
1
;
return
-
1
;
}
}
#ifdef PERSISTENCE
#ifdef PERSISTENCE
static
PyObject
*
static
PyObject
*
pRecord_getattr
(
Record
object
*
self
,
PyObject
*
name
)
pRecord_getattr
(
Record
*
self
,
PyObject
*
name
)
{
{
char
*
c
;
char
*
c
;
UNLESS
(
c
=
PyString_AsString
(
name
))
return
NULL
;
UNLESS
(
c
=
PyString_AsString
(
name
))
return
NULL
;
...
@@ -281,7 +253,7 @@ pRecord_getattr(Recordobject *self, PyObject *name)
...
@@ -281,7 +253,7 @@ pRecord_getattr(Recordobject *self, PyObject *name)
}
}
static
int
static
int
pRecord_setattr
(
Record
object
*
self
,
PyObject
*
name
,
PyObject
*
v
)
pRecord_setattr
(
Record
*
self
,
PyObject
*
name
,
PyObject
*
v
)
{
{
return
cPersistenceCAPI
->
persetattro
(
OBJECT
(
self
),
name
,
v
,
Record_setattr
);
return
cPersistenceCAPI
->
persetattro
(
OBJECT
(
self
),
name
,
v
,
Record_setattr
);
}
}
...
@@ -289,7 +261,7 @@ pRecord_setattr(Recordobject *self, PyObject *name, PyObject *v)
...
@@ -289,7 +261,7 @@ pRecord_setattr(Recordobject *self, PyObject *name, PyObject *v)
static
int
static
int
Record_compare
(
Record
object
*
v
,
Recordobject
*
w
)
Record_compare
(
Record
*
v
,
Record
*
w
)
{
{
int
lv
,
lw
,
i
,
c
;
int
lv
,
lw
,
i
,
c
;
PyObject
**
dv
,
**
dw
;
PyObject
**
dv
,
**
dw
;
...
@@ -313,11 +285,188 @@ Record_compare(Recordobject *v, Recordobject *w)
...
@@ -313,11 +285,188 @@ Record_compare(Recordobject *v, Recordobject *w)
return
0
;
return
0
;
}
}
/* Code to handle accessing Record objects as sequence objects */
static
PyObject
*
Record_concat
(
Record
*
self
,
PyObject
*
bb
)
{
PyErr_SetString
(
PyExc_TypeError
,
"Record objects do not support concatenation"
);
return
NULL
;
}
static
PyObject
*
Record_repeat
(
Record
*
self
,
int
n
)
{
PyErr_SetString
(
PyExc_TypeError
,
"Record objects do not support repetition"
);
return
NULL
;
}
static
PyObject
*
IndexError
(
int
i
)
{
PyObject
*
v
;
if
((
v
=
PyInt_FromLong
(
i
)))
{
PyErr_SetObject
(
PyExc_IndexError
,
v
);
Py_DECREF
(
v
);
}
return
NULL
;
}
static
PyObject
*
Record_item
(
Record
*
self
,
int
i
)
{
PyObject
*
o
;
int
l
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
NULL
;
if
(
i
<
0
||
i
>=
l
)
return
IndexError
(
i
);
o
=
self
->
data
[
i
];
UNLESS
(
o
)
o
=
Py_None
;
Py_INCREF
(
o
);
return
o
;
}
static
PyObject
*
Record_slice
(
Record
*
self
,
int
ilow
,
int
ihigh
)
{
PyErr_SetString
(
PyExc_TypeError
,
"Record objects do not support slicing"
);
return
NULL
;
}
static
int
Record_ass_item
(
Record
*
self
,
int
i
,
PyObject
*
v
)
{
int
l
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
-
1
;
if
(
i
<
0
||
i
>=
l
)
{
IndexError
(
i
);
return
-
1
;
}
UNLESS
(
v
)
{
PyErr_SetString
(
PyExc_TypeError
,
"cannot delete record items"
);
return
-
1
;
}
Py_INCREF
(
v
);
ASSIGN
(
self
->
data
[
i
],
v
);
return
0
;
}
static
int
Record_ass_slice
(
Record
*
self
,
int
ilow
,
int
ihigh
,
PyObject
*
v
)
{
PyErr_SetString
(
PyExc_TypeError
,
"Record objects do not support slice assignment"
);
return
-
1
;
}
static
PySequenceMethods
Record_as_sequence
=
{
(
inquiry
)
Record_init
,
/*sq_length*/
(
binaryfunc
)
Record_concat
,
/*sq_concat*/
(
intargfunc
)
Record_repeat
,
/*sq_repeat*/
(
intargfunc
)
Record_item
,
/*sq_item*/
(
intintargfunc
)
Record_slice
,
/*sq_slice*/
(
intobjargproc
)
Record_ass_item
,
/*sq_ass_item*/
(
intintobjargproc
)
Record_ass_slice
,
/*sq_ass_slice*/
};
/* -------------------------------------------------------------- */
static
PyObject
*
Record_subscript
(
Record
*
self
,
PyObject
*
key
)
{
int
i
,
l
;
PyObject
*
io
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
NULL
;
if
(
PyInt_Check
(
key
))
{
i
=
PyInt_AsLong
(
key
);
if
(
i
<
0
)
i
+=
l
;
return
Record_item
(
self
,
i
);
}
if
(
io
=
PyObject_GetItem
(
self
->
schema
,
key
))
{
UNLESS
(
PyInt_Check
(
io
))
{
PyErr_SetString
(
PyExc_TypeError
,
"invalid record schema"
);
return
NULL
;
}
i
=
PyInt_AsLong
(
io
);
if
(
i
>=
0
&&
i
<
l
)
{
ASSIGN
(
io
,
self
->
data
[
i
]);
UNLESS
(
io
)
io
=
Py_None
;
}
else
ASSIGN
(
io
,
Py_None
);
Py_INCREF
(
io
);
return
io
;
}
return
NULL
;
}
static
int
Record_ass_sub
(
Record
*
self
,
PyObject
*
key
,
PyObject
*
v
)
{
int
i
,
l
;
PyObject
*
io
;
if
((
l
=
Record_init
(
self
))
<
0
)
return
-
1
;
if
(
PyInt_Check
(
key
))
{
i
=
PyInt_AsLong
(
key
);
if
(
i
<
0
)
i
+=
l
;
return
Record_ass_item
(
self
,
i
,
v
);
}
if
(
io
=
PyObject_GetItem
(
self
->
schema
,
key
))
{
UNLESS
(
PyInt_Check
(
io
))
{
PyErr_SetString
(
PyExc_TypeError
,
"invalid record schema"
);
return
-
1
;
}
i
=
PyInt_AsLong
(
io
);
Py_DECREF
(
io
);
if
(
i
>=
0
&&
i
<
l
)
{
Py_XINCREF
(
v
);
ASSIGN
(
self
->
data
[
i
],
v
);
return
0
;
}
}
return
-
1
;
}
static
PyMappingMethods
Record_as_mapping
=
{
(
inquiry
)
Record_init
,
/*mp_length*/
(
binaryfunc
)
Record_subscript
,
/*mp_subscript*/
(
objobjargproc
)
Record_ass_sub
,
/*mp_ass_subscript*/
};
/* -------------------------------------------------------- */
static
PyExtensionClass
RecordType
=
{
static
PyExtensionClass
RecordType
=
{
PyObject_HEAD_INIT
(
NULL
)
PyObject_HEAD_INIT
(
NULL
)
0
,
/*ob_size*/
0
,
/*ob_size*/
"Record"
,
/*tp_name*/
"Record"
,
/*tp_name*/
sizeof
(
Record
object
),
/*tp_basicsize*/
sizeof
(
Record
),
/*tp_basicsize*/
0
,
/*tp_itemsize*/
0
,
/*tp_itemsize*/
/* methods */
/* methods */
(
destructor
)
Record_dealloc
,
/*tp_dealloc*/
(
destructor
)
Record_dealloc
,
/*tp_dealloc*/
...
@@ -327,8 +476,8 @@ static PyExtensionClass RecordType = {
...
@@ -327,8 +476,8 @@ static PyExtensionClass RecordType = {
(
cmpfunc
)
Record_compare
,
/*tp_compare*/
(
cmpfunc
)
Record_compare
,
/*tp_compare*/
(
reprfunc
)
0
,
/*tp_repr*/
(
reprfunc
)
0
,
/*tp_repr*/
0
,
/*tp_as_number*/
0
,
/*tp_as_number*/
0
,
/*tp_as_sequence*/
&
Record_as_sequence
,
/*tp_as_sequence*/
0
,
/*tp_as_mapping*/
&
Record_as_mapping
,
/*tp_as_mapping*/
(
hashfunc
)
0
,
/*tp_hash*/
(
hashfunc
)
0
,
/*tp_hash*/
(
ternaryfunc
)
0
,
/*tp_call*/
(
ternaryfunc
)
0
,
/*tp_call*/
(
reprfunc
)
0
,
/*tp_str*/
(
reprfunc
)
0
,
/*tp_str*/
...
@@ -363,7 +512,7 @@ void
...
@@ -363,7 +512,7 @@ void
initRecord
()
initRecord
()
{
{
PyObject
*
m
,
*
d
;
PyObject
*
m
,
*
d
;
char
*
rev
=
"$Revision: 1.
1
$"
;
char
*
rev
=
"$Revision: 1.
2
$"
;
UNLESS
(
py___record_schema__
=
PyString_FromString
(
"__record_schema__"
))
return
;
UNLESS
(
py___record_schema__
=
PyString_FromString
(
"__record_schema__"
))
return
;
...
@@ -402,6 +551,9 @@ initRecord()
...
@@ -402,6 +551,9 @@ initRecord()
Revision Log:
Revision Log:
$Log: Record.c,v $
$Log: Record.c,v $
Revision 1.2 1997/09/26 15:05:17 jim
Added sequence and mapping behavior.
Revision 1.1 1997/09/25 22:12:28 jim
Revision 1.1 1997/09/25 22:12:28 jim
*** empty log message ***
*** empty log message ***
...
...
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