Commit 44b77a04 authored by Jim Fulton's avatar Jim Fulton

Added macro, PERSISTENCE_FLAGS, that contains the standard persistence...

Added macro, PERSISTENCE_FLAGS, that contains the standard persistence ExtensionClass class flags. This macro is provided to make it easier to maintain persistent base classes.
parent 0d3fb391
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
attributions are listed in the accompanying credits file. attributions are listed in the accompanying credits file.
****************************************************************************/ ****************************************************************************/
static char *what_string = "$Id: cPersistence.c,v 1.36 2000/05/16 17:18:11 jim Exp $"; static char *what_string = "$Id: cPersistence.c,v 1.37 2000/05/16 17:31:58 jim Exp $";
#include <string.h> #include <string.h>
#include "cPersistence.h" #include "cPersistence.h"
...@@ -731,9 +731,7 @@ static PyExtensionClass Pertype = { ...@@ -731,9 +731,7 @@ static PyExtensionClass Pertype = {
/* Space for future expansion */ /* Space for future expansion */
0L,0L,"", 0L,0L,"",
METHOD_CHAIN(Per_methods), METHOD_CHAIN(Per_methods),
EXTENSIONCLASS_BASICNEW_FLAG PERSISTENCE_FLAGS,
| PERSISTENT_TYPE_FLAG
| EXTENSIONCLASS_PYTHONICATTR_FLAG,
}; };
/* End of code for Persistent objects */ /* End of code for Persistent objects */
...@@ -785,7 +783,7 @@ void ...@@ -785,7 +783,7 @@ void
initcPersistence() initcPersistence()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.36 $"; char *rev="$Revision: 1.37 $";
TimeStamp=PyString_FromString("TimeStamp"); TimeStamp=PyString_FromString("TimeStamp");
if (! TimeStamp) return; if (! TimeStamp) return;
......
...@@ -118,6 +118,12 @@ static cPersistenceCAPIstruct *cPersistenceCAPI; ...@@ -118,6 +118,12 @@ static cPersistenceCAPIstruct *cPersistenceCAPI;
#define PERSISTENT_TYPE_FLAG EXTENSIONCLASS_USER_FLAG8 #define PERSISTENT_TYPE_FLAG EXTENSIONCLASS_USER_FLAG8
/* ExtensionClass class flags for persistent base classes should
include PERSISTENCE_FLAGS.
*/
#define PERSISTENCE_FLAGS EXTENSIONCLASS_BASICNEW_FLAG | PERSISTENT_TYPE_FLAG \
| EXTENSIONCLASS_PYTHONICATTR_FLAG
#define PER_USE_OR_RETURN(O,R) {if((O)->state==cPersistent_GHOST_STATE && cPersistenceCAPI->setstate((PyObject*)(O)) < 0) return (R); else if ((O)->state==cPersistent_UPTODATE_STATE) (O)->state=cPersistent_STICKY_STATE;} #define PER_USE_OR_RETURN(O,R) {if((O)->state==cPersistent_GHOST_STATE && cPersistenceCAPI->setstate((PyObject*)(O)) < 0) return (R); else if ((O)->state==cPersistent_UPTODATE_STATE) (O)->state=cPersistent_STICKY_STATE;}
#define PER_CHANGED(O) (cPersistenceCAPI->changed((cPersistentObject*)(O))) #define PER_CHANGED(O) (cPersistenceCAPI->changed((cPersistentObject*)(O)))
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
attributions are listed in the accompanying credits file. attributions are listed in the accompanying credits file.
****************************************************************************/ ****************************************************************************/
static char *what_string = "$Id: cPersistence.c,v 1.36 2000/05/16 17:18:11 jim Exp $"; static char *what_string = "$Id: cPersistence.c,v 1.37 2000/05/16 17:31:58 jim Exp $";
#include <string.h> #include <string.h>
#include "cPersistence.h" #include "cPersistence.h"
...@@ -731,9 +731,7 @@ static PyExtensionClass Pertype = { ...@@ -731,9 +731,7 @@ static PyExtensionClass Pertype = {
/* Space for future expansion */ /* Space for future expansion */
0L,0L,"", 0L,0L,"",
METHOD_CHAIN(Per_methods), METHOD_CHAIN(Per_methods),
EXTENSIONCLASS_BASICNEW_FLAG PERSISTENCE_FLAGS,
| PERSISTENT_TYPE_FLAG
| EXTENSIONCLASS_PYTHONICATTR_FLAG,
}; };
/* End of code for Persistent objects */ /* End of code for Persistent objects */
...@@ -785,7 +783,7 @@ void ...@@ -785,7 +783,7 @@ void
initcPersistence() initcPersistence()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.36 $"; char *rev="$Revision: 1.37 $";
TimeStamp=PyString_FromString("TimeStamp"); TimeStamp=PyString_FromString("TimeStamp");
if (! TimeStamp) return; if (! TimeStamp) return;
......
...@@ -118,6 +118,12 @@ static cPersistenceCAPIstruct *cPersistenceCAPI; ...@@ -118,6 +118,12 @@ static cPersistenceCAPIstruct *cPersistenceCAPI;
#define PERSISTENT_TYPE_FLAG EXTENSIONCLASS_USER_FLAG8 #define PERSISTENT_TYPE_FLAG EXTENSIONCLASS_USER_FLAG8
/* ExtensionClass class flags for persistent base classes should
include PERSISTENCE_FLAGS.
*/
#define PERSISTENCE_FLAGS EXTENSIONCLASS_BASICNEW_FLAG | PERSISTENT_TYPE_FLAG \
| EXTENSIONCLASS_PYTHONICATTR_FLAG
#define PER_USE_OR_RETURN(O,R) {if((O)->state==cPersistent_GHOST_STATE && cPersistenceCAPI->setstate((PyObject*)(O)) < 0) return (R); else if ((O)->state==cPersistent_UPTODATE_STATE) (O)->state=cPersistent_STICKY_STATE;} #define PER_USE_OR_RETURN(O,R) {if((O)->state==cPersistent_GHOST_STATE && cPersistenceCAPI->setstate((PyObject*)(O)) < 0) return (R); else if ((O)->state==cPersistent_UPTODATE_STATE) (O)->state=cPersistent_STICKY_STATE;}
#define PER_CHANGED(O) (cPersistenceCAPI->changed((cPersistentObject*)(O))) #define PER_CHANGED(O) (cPersistenceCAPI->changed((cPersistentObject*)(O)))
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
attributions are listed in the accompanying credits file. attributions are listed in the accompanying credits file.
****************************************************************************/ ****************************************************************************/
static char *what_string = "$Id: cPersistence.c,v 1.36 2000/05/16 17:18:11 jim Exp $"; static char *what_string = "$Id: cPersistence.c,v 1.37 2000/05/16 17:31:58 jim Exp $";
#include <string.h> #include <string.h>
#include "cPersistence.h" #include "cPersistence.h"
...@@ -731,9 +731,7 @@ static PyExtensionClass Pertype = { ...@@ -731,9 +731,7 @@ static PyExtensionClass Pertype = {
/* Space for future expansion */ /* Space for future expansion */
0L,0L,"", 0L,0L,"",
METHOD_CHAIN(Per_methods), METHOD_CHAIN(Per_methods),
EXTENSIONCLASS_BASICNEW_FLAG PERSISTENCE_FLAGS,
| PERSISTENT_TYPE_FLAG
| EXTENSIONCLASS_PYTHONICATTR_FLAG,
}; };
/* End of code for Persistent objects */ /* End of code for Persistent objects */
...@@ -785,7 +783,7 @@ void ...@@ -785,7 +783,7 @@ void
initcPersistence() initcPersistence()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.36 $"; char *rev="$Revision: 1.37 $";
TimeStamp=PyString_FromString("TimeStamp"); TimeStamp=PyString_FromString("TimeStamp");
if (! TimeStamp) return; if (! TimeStamp) return;
......
...@@ -118,6 +118,12 @@ static cPersistenceCAPIstruct *cPersistenceCAPI; ...@@ -118,6 +118,12 @@ static cPersistenceCAPIstruct *cPersistenceCAPI;
#define PERSISTENT_TYPE_FLAG EXTENSIONCLASS_USER_FLAG8 #define PERSISTENT_TYPE_FLAG EXTENSIONCLASS_USER_FLAG8
/* ExtensionClass class flags for persistent base classes should
include PERSISTENCE_FLAGS.
*/
#define PERSISTENCE_FLAGS EXTENSIONCLASS_BASICNEW_FLAG | PERSISTENT_TYPE_FLAG \
| EXTENSIONCLASS_PYTHONICATTR_FLAG
#define PER_USE_OR_RETURN(O,R) {if((O)->state==cPersistent_GHOST_STATE && cPersistenceCAPI->setstate((PyObject*)(O)) < 0) return (R); else if ((O)->state==cPersistent_UPTODATE_STATE) (O)->state=cPersistent_STICKY_STATE;} #define PER_USE_OR_RETURN(O,R) {if((O)->state==cPersistent_GHOST_STATE && cPersistenceCAPI->setstate((PyObject*)(O)) < 0) return (R); else if ((O)->state==cPersistent_UPTODATE_STATE) (O)->state=cPersistent_STICKY_STATE;}
#define PER_CHANGED(O) (cPersistenceCAPI->changed((cPersistentObject*)(O))) #define PER_CHANGED(O) (cPersistenceCAPI->changed((cPersistentObject*)(O)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment