Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ include planarity/c/LICENSE.TXT
include README.md
include planarity/c/README

recursive-include planarity/c/ *.h

include planarity/classic/cplanarity.pxd
include planarity/classic/planarity.c
include planarity/classic/planarity.pyx
Expand Down
3 changes: 2 additions & 1 deletion planarity/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
gp_GetLibPlanarityVersionFull,
Graph,
OK,
AT_EDGE_CAPACITY_LIMIT,
NONEMBEDDABLE,
NOTOK,
NIL,
Expand All @@ -21,4 +22,4 @@

# NOTE: In the future, we could automatically generate the version number by
# configuring setuptools-scm, but presently this seems simpler.
__version__ = "0.7.11"
__version__ = "0.7.13"
29 changes: 14 additions & 15 deletions planarity/c/graphLib/extensionSystem/graphExtensions.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static int moduleIDGenerator = 0;

2) Define an extension context structure to contain all of the data
and function pointers that extend the graph. The context must
include a graphFunctionTable to allow overloading of functions.
include a graphFunctionTableStruct to allow overloading of functions.
An instance of this context structure is passed to the "context"
parameter of gp_AddExtension().

Expand Down Expand Up @@ -110,23 +110,22 @@ static int moduleIDGenerator = 0;

b) If any data must be associated with vertices and virtual vertices,
then it is necessary to perform initialization parallel to the
initialization of anyTypeVertexRec instances. Similarly, if data
initialization of VertexRec instances. Similarly, if data
must be associated only with vertices (and not virtual vertices),
then initialization parallel to VertexInfo initialization is
required. At this time, there do not exist overloadable functions
for fpInitAnyTypeVertexRec() and fpInitVertexInfo().
Instead, overload fpInitGraph() and fpReinitializeGraph(). Also
if an extension must delete an edge, it should have its own
for fpInitVertexRec() and fpInitVertexInfo().
Instead, overload fpInitGraph() and fpReinitGraph().

c) If any data must be associated with the edges, then the extension
creates a parallel array that is initialized and reinitialized
in overloads of fpInitGraph() and fpReinitializeGraph().
in overloads of fpInitGraph() and fpReinitGraph().
Also, if the extension deletes edges, then the extension provides
its own _Feature_DeleteEdge() that initializes its edge
extension data along with calling gp_DeleteEdge().

d) If any graph-level data structures are needed, then an
overload of fpReinitializeGraph() will also be needed, not just the
overload of fpReinitGraph() will also be needed, not just the
overload of fpInitGraph().

e) If any data must be persisted in the file format, then overloads
Expand All @@ -149,7 +148,7 @@ static int moduleIDGenerator = 0;
list collection, should be created _and_ initialized.

c) The _Feature_InitStructures() should invoke just the functions
needed to initialize the custom AnyTypeVertexRec, VertexInfo and
needed to initialize the custom VertexRec, VertexInfo and
EdgeRec data members, if any.

8) Define a function gp_Detach_Feature() that invokes gp_RemoveExtension()
Expand Down Expand Up @@ -217,7 +216,7 @@ int gp_AddExtension(graphP theGraph,
}

// Allocate the new extension
if ((newExtension = (graphExtensionP)malloc(sizeof(graphExtension))) == NULL)
if ((newExtension = (graphExtensionP)malloc(sizeof(graphExtensionStruct))) == NULL)
{
return NOTOK;
}
Expand All @@ -232,7 +231,7 @@ int gp_AddExtension(graphP theGraph,
_OverloadFunctions(theGraph, functions);

// Make the new linkages
newExtension->next = (struct graphExtension *)theGraph->extensions;
newExtension->next = (struct graphExtensionStruct *)theGraph->extensions;
theGraph->extensions = newExtension;

// The new extension was successfully added
Expand All @@ -257,9 +256,9 @@ int gp_AddExtension(graphP theGraph,

void _OverloadFunctions(graphP theGraph, graphFunctionTableP functions)
{
void **currFunctionTable = (void **)&theGraph->functions;
void **currFunctionTable = (void **)theGraph->functions;
void **newFunctionTable = (void **)functions;
int numFunctions = sizeof(theGraph->functions) / sizeof(void *);
int numFunctions = sizeof(graphFunctionTableStruct) / sizeof(void *);
int K;

for (K = 0; K < numFunctions; K++)
Expand Down Expand Up @@ -383,7 +382,7 @@ int gp_RemoveExtension(graphP theGraph, int moduleID)

// Unhook the curr extension
if (prev != NULL)
prev->next = (struct graphExtension *)next;
prev->next = (struct graphExtensionStruct *)next;
else
theGraph->extensions = next;

Expand Down Expand Up @@ -473,7 +472,7 @@ int gp_CopyExtensions(graphP dstGraph, graphP srcGraph)

while (next != NULL)
{
if ((newNext = (graphExtensionP)malloc(sizeof(graphExtension))) == NULL)
if ((newNext = (graphExtensionP)malloc(sizeof(graphExtensionStruct))) == NULL)
{
gp_FreeExtensions(dstGraph);
return NOTOK;
Expand All @@ -487,7 +486,7 @@ int gp_CopyExtensions(graphP dstGraph, graphP srcGraph)
newNext->next = NULL;

if (newLast != NULL)
newLast->next = (struct graphExtension *)newNext;
newLast->next = (struct graphExtensionStruct *)newNext;
else
dstGraph->extensions = newNext;

Expand Down
2 changes: 1 addition & 1 deletion planarity/c/graphLib/extensionSystem/graphExtensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extern "C"
{
#endif

#include "../graphStructures.h"
#include "../graph.h"

int gp_AddExtension(graphP theGraph,
int *pModuleID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C"
{
#endif

typedef struct
struct graphExtensionStruct
{
int moduleID;
void *context;
Expand All @@ -23,10 +23,11 @@ extern "C"

graphFunctionTableP functions;

struct graphExtension *next;
} graphExtension;
struct graphExtensionStruct *next;
};

typedef graphExtension *graphExtensionP;
typedef struct graphExtensionStruct graphExtensionStruct;
typedef graphExtensionStruct *graphExtensionP;

#ifdef __cplusplus
}
Expand Down
16 changes: 8 additions & 8 deletions planarity/c/graphLib/extensionSystem/graphFunctionTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ extern "C"

/*
NOTE: If you add any FUNCTION POINTERS to this function table, then you must
also initialize them in _InitFunctionTable() in graphUtils.c.
also initialize them in _InitFunctionTable() in graph.c.
*/
typedef struct baseGraphStructure baseGraphStructure;
typedef baseGraphStructure *graphP;
typedef struct graphStruct graphStruct;
typedef graphStruct *graphP;

typedef struct
struct graphFunctionTableStruct
{
// These function pointers allow extension modules to overload some of
// the behaviors of protected functions. Only advanced applications
Expand All @@ -41,7 +41,7 @@ extern "C"
// These function pointers allow extension modules to overload some
// of the behaviors of gp_* function in the public API
int (*fpInitGraph)(graphP, int);
void (*fpReinitializeGraph)(graphP);
void (*fpReinitGraph)(graphP);
int (*fpEnsureEdgeCapacity)(graphP, int);
int (*fpSortVertices)(graphP);

Expand All @@ -54,10 +54,10 @@ extern "C"
int (*fpRestoreVertex)(graphP);
int (*fpContractEdge)(graphP, int);
int (*fpIdentifyVertices)(graphP, int, int, int);
};

} graphFunctionTable;

typedef graphFunctionTable *graphFunctionTableP;
typedef struct graphFunctionTableStruct graphFunctionTableStruct;
typedef graphFunctionTableStruct *graphFunctionTableP;

#ifdef __cplusplus
}
Expand Down
Loading