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
64d05329
Commit
64d05329
authored
Mar 10, 1999
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial
parent
8fca31a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
288 additions
and
0 deletions
+288
-0
lib/Components/ExtensionClass/ComputedAttribute.c
lib/Components/ExtensionClass/ComputedAttribute.c
+144
-0
lib/Components/ExtensionClass/src/ComputedAttribute.c
lib/Components/ExtensionClass/src/ComputedAttribute.c
+144
-0
No files found.
lib/Components/ExtensionClass/ComputedAttribute.c
0 → 100644
View file @
64d05329
/*
Copyright (c) 1996-1998, Digital Creations, Fredericksburg, VA, USA.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
o Redistributions of source code must retain the above copyright
notice, this list of conditions, and the disclaimer that follows.
o Redistributions in binary form must reproduce the above copyright
notice, this list of conditions, and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
o Neither the name of Digital Creations nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS AND CONTRIBUTORS *AS
IS* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL
CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
$Id: ComputedAttribute.c,v 1.1 1999/03/10 15:20:23 jim Exp $
If you have questions regarding this software,
contact:
Digital Creations L.C.
info@digicool.com
(540) 371-6909
*/
#include "ExtensionClass.h"
static
void
PyVar_Assign
(
PyObject
**
v
,
PyObject
*
e
)
{
Py_XDECREF
(
*
v
);
*
v
=
e
;
}
#define ASSIGN(V,E) PyVar_Assign(&(V),(E))
#define UNLESS(E) if(!(E))
#define UNLESS_ASSIGN(V,E) ASSIGN(V,E); UNLESS(V)
#define OBJECT(O) ((PyObject*)(O))
typedef
struct
{
PyObject_HEAD
PyObject
*
callable
;
}
CA
;
static
PyObject
*
CA__init__
(
CA
*
self
,
PyObject
*
args
)
{
PyObject
*
callable
;
UNLESS
(
PyArg_ParseTuple
(
args
,
"O"
,
&
callable
))
return
NULL
;
Py_INCREF
(
callable
);
self
->
callable
=
callable
;
Py_INCREF
(
Py_None
);
return
Py_None
;
}
static
void
CA_dealloc
(
CA
*
self
)
{
Py_DECREF
(
self
->
callable
);
PyMem_DEL
(
self
);
}
static
PyObject
*
CA_of
(
CA
*
self
,
PyObject
*
args
)
{
PyObject
*
inst
,
*
r
;
UNLESS
(
PyArg_ParseTuple
(
args
,
"O"
,
&
inst
)
&&
(
r
=
PyTuple_New
(
1
)))
return
NULL
;
PyTuple_SET_ITEM
(
r
,
0
,
inst
);
Py_INCREF
(
inst
);
if
(
self
->
callable
)
ASSIGN
(
r
,
PyObject_CallObject
(
self
->
callable
,
r
));
return
r
;
}
static
struct
PyMethodDef
CA_methods
[]
=
{
{
"__init__"
,(
PyCFunction
)
CA__init__
,
METH_VARARGS
,
""
},
{
"__of__"
,
(
PyCFunction
)
CA_of
,
METH_VARARGS
,
""
},
{
NULL
,
NULL
}
/* sentinel */
};
static
PyExtensionClass
ComputedAttributeType
=
{
PyObject_HEAD_INIT
(
NULL
)
0
,
"ComputedAttribute"
,
sizeof
(
CA
),
0
,
(
destructor
)
CA_dealloc
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
"ComputedAttribute(callable) -- Create a computed attribute"
,
METHOD_CHAIN
(
CA_methods
),
EXTENSIONCLASS_BINDABLE_FLAG
};
static
struct
PyMethodDef
methods
[]
=
{
{
NULL
,
NULL
}
};
void
initComputedAttribute
()
{
PyObject
*
m
,
*
d
;
char
*
rev
=
"$Revision: 1.1 $"
;
UNLESS
(
ExtensionClassImported
)
return
;
ComputedAttributeType
.
tp_getattro
=
(
getattrofunc
)
PyExtensionClassCAPI
->
getattro
;
/* Create the module and add the functions */
m
=
Py_InitModule4
(
"ComputedAttribute"
,
methods
,
"Provide Computed Attributes
\n\n
"
"$Id: ComputedAttribute.c,v 1.1 1999/03/10 15:20:23 jim Exp $
\n
"
,
OBJECT
(
NULL
),
PYTHON_API_VERSION
);
d
=
PyModule_GetDict
(
m
);
PyExtensionClass_Export
(
d
,
"ComputedAttribute"
,
ComputedAttributeType
);
PyDict_SetItemString
(
d
,
"__version__"
,
PyString_FromStringAndSize
(
rev
+
11
,
strlen
(
rev
+
11
)
-
2
));
CHECK_FOR_ERRORS
(
"can't initialize module Acquisition"
);
}
lib/Components/ExtensionClass/src/ComputedAttribute.c
0 → 100644
View file @
64d05329
/*
Copyright (c) 1996-1998, Digital Creations, Fredericksburg, VA, USA.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
o Redistributions of source code must retain the above copyright
notice, this list of conditions, and the disclaimer that follows.
o Redistributions in binary form must reproduce the above copyright
notice, this list of conditions, and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
o Neither the name of Digital Creations nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS AND CONTRIBUTORS *AS
IS* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL
CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
$Id: ComputedAttribute.c,v 1.1 1999/03/10 15:20:23 jim Exp $
If you have questions regarding this software,
contact:
Digital Creations L.C.
info@digicool.com
(540) 371-6909
*/
#include "ExtensionClass.h"
static
void
PyVar_Assign
(
PyObject
**
v
,
PyObject
*
e
)
{
Py_XDECREF
(
*
v
);
*
v
=
e
;
}
#define ASSIGN(V,E) PyVar_Assign(&(V),(E))
#define UNLESS(E) if(!(E))
#define UNLESS_ASSIGN(V,E) ASSIGN(V,E); UNLESS(V)
#define OBJECT(O) ((PyObject*)(O))
typedef
struct
{
PyObject_HEAD
PyObject
*
callable
;
}
CA
;
static
PyObject
*
CA__init__
(
CA
*
self
,
PyObject
*
args
)
{
PyObject
*
callable
;
UNLESS
(
PyArg_ParseTuple
(
args
,
"O"
,
&
callable
))
return
NULL
;
Py_INCREF
(
callable
);
self
->
callable
=
callable
;
Py_INCREF
(
Py_None
);
return
Py_None
;
}
static
void
CA_dealloc
(
CA
*
self
)
{
Py_DECREF
(
self
->
callable
);
PyMem_DEL
(
self
);
}
static
PyObject
*
CA_of
(
CA
*
self
,
PyObject
*
args
)
{
PyObject
*
inst
,
*
r
;
UNLESS
(
PyArg_ParseTuple
(
args
,
"O"
,
&
inst
)
&&
(
r
=
PyTuple_New
(
1
)))
return
NULL
;
PyTuple_SET_ITEM
(
r
,
0
,
inst
);
Py_INCREF
(
inst
);
if
(
self
->
callable
)
ASSIGN
(
r
,
PyObject_CallObject
(
self
->
callable
,
r
));
return
r
;
}
static
struct
PyMethodDef
CA_methods
[]
=
{
{
"__init__"
,(
PyCFunction
)
CA__init__
,
METH_VARARGS
,
""
},
{
"__of__"
,
(
PyCFunction
)
CA_of
,
METH_VARARGS
,
""
},
{
NULL
,
NULL
}
/* sentinel */
};
static
PyExtensionClass
ComputedAttributeType
=
{
PyObject_HEAD_INIT
(
NULL
)
0
,
"ComputedAttribute"
,
sizeof
(
CA
),
0
,
(
destructor
)
CA_dealloc
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
"ComputedAttribute(callable) -- Create a computed attribute"
,
METHOD_CHAIN
(
CA_methods
),
EXTENSIONCLASS_BINDABLE_FLAG
};
static
struct
PyMethodDef
methods
[]
=
{
{
NULL
,
NULL
}
};
void
initComputedAttribute
()
{
PyObject
*
m
,
*
d
;
char
*
rev
=
"$Revision: 1.1 $"
;
UNLESS
(
ExtensionClassImported
)
return
;
ComputedAttributeType
.
tp_getattro
=
(
getattrofunc
)
PyExtensionClassCAPI
->
getattro
;
/* Create the module and add the functions */
m
=
Py_InitModule4
(
"ComputedAttribute"
,
methods
,
"Provide Computed Attributes
\n\n
"
"$Id: ComputedAttribute.c,v 1.1 1999/03/10 15:20:23 jim Exp $
\n
"
,
OBJECT
(
NULL
),
PYTHON_API_VERSION
);
d
=
PyModule_GetDict
(
m
);
PyExtensionClass_Export
(
d
,
"ComputedAttribute"
,
ComputedAttributeType
);
PyDict_SetItemString
(
d
,
"__version__"
,
PyString_FromStringAndSize
(
rev
+
11
,
strlen
(
rev
+
11
)
-
2
));
CHECK_FOR_ERRORS
(
"can't initialize module Acquisition"
);
}
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