]> git.lizzy.rs Git - libscout.git/commitdiff
Still unfinished
authorEliasFleckenstein03 <eliasfleckenstein@web.de>
Mon, 28 Sep 2020 13:36:11 +0000 (15:36 +0200)
committerEliasFleckenstein03 <eliasfleckenstein@web.de>
Mon, 28 Sep 2020 13:36:11 +0000 (15:36 +0200)
scout.c
scout.h

diff --git a/scout.c b/scout.c
index b9a2170db3dfc2b9942fa461266d97bf7f338857..78f0774091fdba7f62f4d50ba759e6acc75b92c6 100644 (file)
--- a/scout.c
+++ b/scout.c
@@ -1,4 +1,5 @@
 #include <stdlib.h>
+#define __LIBSCOUT_INTERNAL__
 #include "scout.h"
 
 typedef struct scnode scnode;
@@ -20,16 +21,35 @@ scway *scaddway(scnode *from, const scnode *to, int len)
        return way;
 }
 
-scwaypoint *__scallocwayp(const scnode *node, scway *way)
+scwaypoint *scout(const scnode *from, const scnode *to, scwaypoint *stack)
+{
+       scwaypoint *wayp = NULL;
+       if (from == to)
+               return __scallocwayp(from, NULL);
+       for (scway *way = from->way; way != NULL; way = way->alt) {
+               scwaypoint *stackend;
+               if ((stackend = __scstackfindgetend(stack, way)) == NULL)
+                       continue;
+               scwaypoint *twayp = __scallocwayp(from, way);
+               stackend->nxt = twayp;
+               scwaypoint *nwayp = scout(way->lto, to, stack)
+               if (wayp && wayp->len <= (twayp->len = __scstackgetlen(twayp)))
+                       __scstackfree(wayp);
+               wayp = twayp;
+       }
+       return wayp;
+}
+
+scwaypoint *__scallocwayp(const scnode *node, const scway *way)
 {
        scwaypoint *wayp = malloc(sizeof(scwaypoint));
        wayp->nod = node;
        wayp->way = way;
        wayp->nxt = NULL;
-       wayp->len = 0;
+       wayp->len = way->len;
 }
 
-scwaypoint *__scstackfindgetend(scwaypoint *stack, scway *way)
+scwaypoint *__scstackfindgetend(scwaypoint *stack, const scway *way)
 {
        scwaypoint *asptr, *sptr;
        for (asptr = stack; asptr != NULL; sptr = asptr, asptr = asptr->nxt)
@@ -43,25 +63,3 @@ void __scstackfree(scwaypoint *stack)
        for (scwaypoint *sptr = stack; sptr != NULL; sptr = sptr->nxt)
                free(sptr);
 }
-
-int __scstackgetlen(scwaypoint *stack)
-{
-       for (scwaypoitn)
-}
-
-scwaypoint *scout(const scnode *from, const scnode *to, scwaypoint *stack)
-{
-       scwaypoint *wayp = NULL;
-       if (from == to)
-               return __scallocwayp(from, NULL);
-       for (scway *way = from->way; way != NULL; way = way->alt) {
-               scwaypoint *stackend;
-               if ((stackend = __scstackfindgetend(stack, way)) == NULL)
-                       continue;
-               
-               if (wayp && wayp->len <= (tway->len = __scstackgetlen(tway)))
-                       __scstackfree(wayp);
-               wayp = twayp;
-       }
-       return wayp;
-}
diff --git a/scout.h b/scout.h
index aa1130cb40bbd1c6a2bb88cf024edf545b9ee20a..fc625f2072941130927186248b952c4f931e7aca 100644 (file)
--- a/scout.h
+++ b/scout.h
@@ -1,5 +1,5 @@
-#ifndef _LIBSCOUT_H_
-#define _LIBSCOUT_H_
+#ifndef __LIBSCOUT__
+#define __LIBSCOUT__
 
 struct scnode {
        struct scway *way;
@@ -22,4 +22,13 @@ struct scwaypoint {
 struct scway *scaddway(struct scnode *, const struct scnode *, int);
 struct scwaypoint *scout(const struct scnode *, const struct scnode *, struct scwaypoint *);
 
-#endif
+#ifdef __LIBSCOUT_INTERNAL__
+
+struct scwaypoint *__scallocwayp(const struct scnode *, const struct scway *);
+struct scwaypoint *__scstackfindgetend(struct scwaypoint *, const struct scway *);
+void __scstackfree(struct scwaypoint *);
+int __scstackgetlen(struct scwaypoint *);
+
+#endif // __LIBSCOUT_INTERNAL__
+
+#endif // __LIBSCOUT__