Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=848d1a04108a1678e7f7ead850ad955f59af3e15

commit 848d1a04108a1678e7f7ead850ad955f59af3e15
Author: Michel Hermier <[email protected]>
Date:   Sat Jun 8 16:09:32 2013 +0200

libflib: Add graph utility stubs.

diff --git a/lib/libflib/Makefile.am b/lib/libflib/Makefile.am
index 74c457c..31a991f 100644
--- a/lib/libflib/Makefile.am
+++ b/lib/libflib/Makefile.am
@@ -21,14 +21,18 @@ libflib_posix_SOURCES = \
fstdlib.c \
fstring.c

+libflib_utils_SOURCES = \
+       fgraph.c \
+       flist.c \
+       flistaccumulator.c \
+       fstringlist.c
+
libflib_la_SOURCES = \
$(libflib_crypto_SOURCES) \
$(libflib_posix_SOURCES) \
+       $(libflib_utils_SOURCES) \
fcallbacks.c \
-       flist.c \
-       flistaccumulator.c \
fobject.c \
-       fstringlist.c \
fvalue.c

#libflib_la_LDFLAGS = -L. -version-info $(SOVER)
diff --git a/lib/libflib/fgraph.c b/lib/libflib/fgraph.c
new file mode 100644
index 0000000..85d41ef
--- /dev/null
+++ b/lib/libflib/fgraph.c
@@ -0,0 +1,74 @@
+/*
+ *  fgraph.c
+ *
+ *  Copyright (c) 2013 by Michel Hermier <[email protected]>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ *  USA.
+ */
+
+#include "fgraph.h"
+
+void f_graph_init (FGraph *graph) {
+       if (graph != NULL) {
+               f_list_init (&graph->vertices);
+               f_list_init (&graph->edges);
+       }
+}
+
+void f_graph_fini (FGraph *graph, FVisitorFunc fn, void *user_data) {
+       if (graph != NULL) {
+               f_list_fini (&graph->vertices, NULL, NULL);
+               f_list_fini (&graph->edges, NULL, NULL);
+       }
+}
+
+FGraph *f_graph_new () {
+       FGraph *graph = f_zalloc (sizeof(*graph));
+
+       f_graph_init (graph);
+       return graph;
+}
+
+void f_graph_delete (FGraph *graph, FVisitorFunc fn, void *user_data) {
+}
+
+static
+void f_graph_add_edge (FGraph *graph, FGraphEdge *edge) {
+}
+
+static
+void f_graph_add_vertex (FGraph *graph, FGraphVertex *vertex) {
+}
+
+void f_graphedge_init (FGraphEdge *graphedge, FGraph *graph) {
+}
+
+void f_graphedge_fini (FGraphEdge *graphedge, FVisitorFunc fn, void 
*user_data) {
+}
+
+void f_graphedge_delete (FGraphEdge *graphedge, FVisitorFunc fn, void 
*user_data) {
+}
+
+void f_graphvertex_init (FGraphVertex *graphvertex, FGraph *graph) {
+}
+
+void f_graphvertex_fini (FGraphVertex *graphvertex, FVisitorFunc fn, void 
*user_data) {
+}
+
+void f_graphvertex_delete (FGraphVertex *graphvertex, FVisitorFunc fn, void 
*user_data) {
+}
+
+/* vim: set ts=2 sw=2 noet: */
diff --git a/lib/libflib/fgraph.h b/lib/libflib/fgraph.h
new file mode 100644
index 0000000..f402a97
--- /dev/null
+++ b/lib/libflib/fgraph.h
@@ -0,0 +1,64 @@
+/*
+ *  fgraph.h
+ *
+ *  Copyright (c) 2013 by Michel Hermier <[email protected]>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ *  USA.
+ */
+#ifndef F_GRAPH_H
+#define F_GRAPH_H
+
+#include <flist.h>
+
+typedef struct FGraph FGraph;
+typedef struct FGraphEdge FGraphEdge;
+typedef struct FGraphVertex FGraphVertex;
+
+struct FGraph {
+       FList *vertices;
+       FList *edges;
+};
+
+struct FGraphEdge {
+       FListItem *base;
+       FGraph *graph;
+};
+
+struct FGraphVertex {
+       FListItem *base;
+       FGraph *graph;
+       FPtrList *edges;
+};
+
+void f_graph_init (FGraph *graph);
+void f_graph_fini (FGraph *graph, FVisitorFunc fn, void *user_data);
+
+FGraph *f_graph_new (void);
+void f_graph_delete (FGraph *graph, FVisitorFunc fn, void *user_data);
+
+void f_graphedge_init (FGraphEdge *graphedge, FGraph *graph);
+void f_graphedge_fini (FGraphEdge *graphedge, FVisitorFunc fn, void 
*user_data);
+
+void f_graphedge_delete (FGraphEdge *graphedge, FVisitorFunc fn, void 
*user_data);
+
+void f_graphvertex_init (FGraphVertex *graphvertex, FGraph *graph);
+void f_graphvertex_fini (FGraphVertex *graphvertex, FVisitorFunc fn, void 
*user_data);
+
+void f_graphvertex_delete (FGraphVertex *graphvertex, FVisitorFunc fn, void 
*user_data);
+
+#endif /* F_GRAPH_H */
+
+/* vim: set ts=2 sw=2 noet: */
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to