41 #if !defined(DGL_DEFINE_TREE_PROCS) && !defined(DGL_DEFINE_FLAT_PROCS)
82 VisitedItem.
nKey = nDestination;
88 PredistItem.
nKey = nDestination;
110 unsigned char *pstack =
NULL;
119 VisitedItem.
nKey = nDestination;
125 PredistItem.
nKey = nDestination;
131 for (PredistItem.
nKey = nDestination,
133 pPredistItem; PredistItem.
nKey = pPredistItem->
nFrom,
135 if (pPredistItem->
nFrom < 0) {
177 if (arc.
nFrom == nStart)
181 if (pPredistItem ==
NULL) {
192 pReport->
cArc = istack;
226 #if defined(DGL_DEFINE_TREE_PROCS) || defined(DGL_DEFINE_FLAT_PROCS)
228 #define __EDGELOOP_BODY_1(f) \
230 pDestination = _DGL_EDGE_TAILNODE(pgraph, pEdge); \
233 pDestination = _DGL_EDGE_HEADNODE(pgraph, pEdge); \
235 if (!(DGL_NODE_STATUS(pDestination) & DGL_NS_TAIL) && \
236 pgraph->Version < 3) { \
237 pgraph->iErrno = DGL_ERR_BadEdge; \
240 clipOutput.nEdgeCost = DGL_EDGE_COST(pEdge); \
242 clipInput.pnPrevEdge = NULL; \
243 clipInput.pnNodeFrom = pStart; \
244 clipInput.pnEdge = pEdge; \
245 clipInput.pnNodeTo = pDestination; \
246 clipInput.nFromDistance = 0; \
247 if (fnClip(pgraph, &clipInput, &clipOutput, pvClipArg)) \
250 findPredist.nKey = DGL_NODE_ID(pDestination); \
251 if ((pPredistItem = avl_find(pCache->pvPredist, &findPredist)) == NULL) { \
252 if ((pPredistItem = dglTreePredistAdd( \
253 pCache->pvPredist, DGL_NODE_ID(pDestination))) == NULL) { \
254 pgraph->iErrno = DGL_ERR_MemoryExhausted; \
259 if (pPredistItem->nDistance <= clipOutput.nEdgeCost) { \
263 pPredistItem->nFrom = nStart; \
264 pPredistItem->pnEdge = pEdge; \
265 pPredistItem->nCost = clipOutput.nEdgeCost; \
266 pPredistItem->nDistance = clipOutput.nEdgeCost; \
267 pPredistItem->bFlags = (f); \
268 heapvalue.pv = pEdge; \
269 if (dglHeapInsertMin(&pCache->NodeHeap, pPredistItem->nDistance, f, \
271 pgraph->iErrno = DGL_ERR_HeapError; \
275 #define __EDGELOOP_BODY_2(f) \
277 pDestination = _DGL_EDGE_TAILNODE(pgraph, pEdge); \
279 else if (pgraph->Version == 3) { \
280 pDestination = _DGL_EDGE_HEADNODE(pgraph, pEdge); \
282 if (!(DGL_NODE_STATUS(pDestination) & DGL_NS_TAIL) && \
283 pgraph->Version < 3) { \
284 pgraph->iErrno = DGL_ERR_BadEdge; \
287 clipOutput.nEdgeCost = DGL_EDGE_COST(pEdge); \
289 clipInput.pnPrevEdge = pEdge_prev; \
290 clipInput.pnNodeFrom = pStart; \
291 clipInput.pnEdge = pEdge; \
292 clipInput.pnNodeTo = pDestination; \
293 clipInput.nFromDistance = fromDist; \
294 if (fnClip(pgraph, &clipInput, &clipOutput, pvClipArg)) \
297 findPredist.nKey = DGL_NODE_ID(pDestination); \
298 if ((pPredistItem = avl_find(pCache->pvPredist, &findPredist)) == NULL) { \
299 if ((pPredistItem = dglTreePredistAdd( \
300 pCache->pvPredist, DGL_NODE_ID(pDestination))) == NULL) { \
301 pgraph->iErrno = DGL_ERR_MemoryExhausted; \
306 if (pPredistItem->nDistance <= fromDist + clipOutput.nEdgeCost) { \
310 pPredistItem->nFrom = DGL_NODE_ID(pStart); \
311 pPredistItem->pnEdge = pEdge; \
312 pPredistItem->nCost = clipOutput.nEdgeCost; \
313 pPredistItem->nDistance = fromDist + clipOutput.nEdgeCost; \
314 pPredistItem->bFlags = (f); \
315 heapvalue.pv = pEdge; \
316 if (dglHeapInsertMin(&pCache->NodeHeap, pPredistItem->nDistance, f, \
318 pgraph->iErrno = DGL_ERR_HeapError; \
372 if (pCache ==
NULL) {
380 nDestination)) !=
NULL) {
386 nDestination) >= 0) {
444 pEdgeset = _DGL_OUTEDGESET(pgraph, pStart);
450 __EDGELOOP_BODY_1(0);
455 pEdgeset = _DGL_INEDGESET(pgraph, pStart);
463 __EDGELOOP_BODY_1(1);
486 if (heapnode.
flags == 0) {
487 pStart = _DGL_EDGE_TAILNODE(
491 pStart = _DGL_EDGE_HEADNODE(pgraph, pEdge);
518 goto destination_found;
531 goto destination_found;
566 pEdgeset = _DGL_OUTEDGESET(pgraph, pStart);
572 __EDGELOOP_BODY_2(0);
577 pEdgeset = _DGL_INEDGESET(pgraph, pStart);
585 __EDGELOOP_BODY_2(1);
597 goto destination_found;
602 if (pCache == &spCache) {
613 if (*ppReport ==
NULL) {
629 if (pCache == &spCache) {
#define UNUSED
A macro for an attribute, if attached to a variable, indicating that the variable is not used.
int(* dglSPClip_fn)(dglGraph_s *, dglSPClipInput_s *, dglSPClipOutput_s *, void *)
#define DGL_ERR_MemoryExhausted
#define DGL_ERR_HeadNodeNotFound
#define DGL_ERR_UnexpectedNullPointer
#define DGL_ERR_TailNodeNotFound
void dglHeapInit(dglHeap_s *pheap)
void dglHeapFree(dglHeap_s *pheap, dglHeapCancelItem_fn pfnCancelItem)
int dglHeapExtractMin(dglHeap_s *pheap, dglHeapNode_s *pnoderet)
unsigned char * dgl_mempop(unsigned char *pstack, long *istack, long size)
unsigned char * dgl_mempush(unsigned char *pstack, long *istack, long size, void *pv)
void DGL_EDGESET_T_RELEASE_FUNC(dglEdgesetTraverser_s *pT UNUSED)
dglInt32_t * DGL_EDGESET_T_FIRST_FUNC(dglEdgesetTraverser_s *pT)
int DGL_EDGESET_T_INITIALIZE_FUNC(dglGraph_s *pGraph, dglEdgesetTraverser_s *pT, dglInt32_t *pnEdgeset)
dglInt32_t * DGL_EDGESET_T_NEXT_FUNC(dglEdgesetTraverser_s *pT)
dglInt32_t * DGL_GET_NODE_FUNC(dglGraph_s *pgraph, dglInt32_t nodeid)
void DGL_SP_CACHE_RELEASE_FUNC(dglGraph_s *pgraph UNUSED, dglSPCache_s *pCache)
int DGL_SP_CACHE_INITIALIZE_FUNC(dglGraph_s *pgraph UNUSED, dglSPCache_s *pCache, dglInt32_t nStart)
dglInt32_t nDestinationNode
int dglTreePredistCompare(const void *pvPredistA, const void *pvPredistB, void *pvParam UNUSED)
void dglTreeTouchI32Cancel(void *pvTouchI32, void *pvParam UNUSED)
void * dglTreeGetAllocator(void)
dglTreeTouchI32_s * dglTreeTouchI32Add(void *pavl, dglInt32_t nKey)
void dglTreePredistCancel(void *pvPredist, void *pvParam UNUSED)
int dglTreeTouchI32Compare(const void *pvTouchI32A, const void *pvTouchI32B, void *pvParam UNUSED)
#define DGL_SP_CACHE_REPORT_FUNC
#define DGL_EDGE_TAILNODE_OFFSET
#define DGL_EDGE_STATUS(p)
#define DGL_SP_CACHE_DISTANCE_FUNC
#define DGL_EDGE_HEADNODE_OFFSET
#define DGL_NODEBUFFER_SHIFT
void dglFreeSPReport(dglGraph_s *pgraph UNUSED, dglSPReport_s *pSPReport)