[augeas-devel] [PATCH 1/8] * src/transform.h: move transform decls out of syntax.h

David Lutterkort lutter at redhat.com
Wed Feb 25 21:58:31 UTC 2009


---
 src/Makefile.am |    4 +-
 src/augeas.c    |    1 +
 src/builtin.c   |    1 +
 src/syntax.c    |    1 +
 src/syntax.h    |   47 +--------------------------------
 src/transform.c |    1 +
 src/transform.h |   79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 86 insertions(+), 48 deletions(-)
 create mode 100644 src/transform.h

diff --git a/src/Makefile.am b/src/Makefile.am
index a4516aa..30dc6f7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -22,8 +22,8 @@ include_HEADERS = augeas.h fa.h
 libaugeas_la_SOURCES = augeas.h augeas.c pathx.c \
 	internal.h internal.c \
 	memory.h memory.c ref.h \
-        syntax.c syntax.h parser.y builtin.c lens.c lens.h regexp.c \
-	transform.c ast.c get.c put.c list.h
+    syntax.c syntax.h parser.y builtin.c lens.c lens.h regexp.c \
+	transform.h transform.c ast.c get.c put.c list.h
 libaugeas_la_LDFLAGS = $(VERSION_SCRIPT_FLAGS)$(srcdir)/augeas_sym.version \
         -version-info $(LIBAUGEAS_VERSION_INFO)
 libaugeas_la_LIBADD = liblexer.la libfa.la $(LIB_SELINUX) $(GNULIB)
diff --git a/src/augeas.c b/src/augeas.c
index 98bee5f..7262ac2 100644
--- a/src/augeas.c
+++ b/src/augeas.c
@@ -25,6 +25,7 @@
 #include "internal.h"
 #include "memory.h"
 #include "syntax.h"
+#include "transform.h"
 
 #include <fnmatch.h>
 #include <argz.h>
diff --git a/src/builtin.c b/src/builtin.c
index 1396eb3..59bc844 100644
--- a/src/builtin.c
+++ b/src/builtin.c
@@ -26,6 +26,7 @@
 
 #include "syntax.h"
 #include "memory.h"
+#include "transform.h"
 
 #define UNIMPL_BODY(name)                       \
     {                                           \
diff --git a/src/syntax.c b/src/syntax.c
index d639be1..176de2b 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -35,6 +35,7 @@
 #include "memory.h"
 #include "syntax.h"
 #include "augeas.h"
+#include "transform.h"
 
 /* Extension of source files */
 #define AUG_EXT ".aug"
diff --git a/src/syntax.h b/src/syntax.h
index 208c4db..b458bc6 100644
--- a/src/syntax.h
+++ b/src/syntax.h
@@ -1,7 +1,7 @@
 /*
  * syntax.h: Data types to represent language syntax
  *
- * Copyright (C) 2007, 2008 Red Hat Inc.
+ * Copyright (C) 2007 - 2009 Red Hat Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -219,51 +219,6 @@ struct native {
     struct value *(*impl)(void);
 };
 
-/*
- * Transformers for going from file globs to path names in the tree
- * functions are in transform.c
- */
-
-/* Filters for globbing files */
-struct filter {
-    unsigned int   ref;
-    struct filter *next;
-    struct string *glob;
-    unsigned int   include : 1;
-};
-
-struct filter *make_filter(struct string *glb, unsigned int include);
-void free_filter(struct filter *filter);
-
-/* Transformers that actually run lenses on contents of files */
-struct transform {
-    unsigned int      ref;
-    struct lens      *lens;
-    struct filter    *filter;
-};
-
-struct transform *make_transform(struct lens *lens, struct filter *filter);
-void free_transform(struct transform *xform);
-
-/* Load all files matching the TRANSFORM's filter into the tree in AUG by
- * applying the TRANSFORM's lens to their contents and putting the
- * resulting tree under "/files" + filename. Also stores some information
- * about filename underneath "/augeas/files" + filename
- */
-int transform_load(struct augeas *aug, struct transform *transform);
-
-/* Return 1 if TRANSFORM applies to PATH, 0 otherwise. The TRANSFORM
- * applies to PATH if (1) PATH starts with "/files/" and (2) the rest of
- * PATH matches the transform's filter
-*/
-int transform_applies(struct transform *transform, const char *path);
-
-/* Save TREE into the file corresponding to PATH. It is assumed that the
- * TRANSFORM applies to that PATH
- */
-int transform_save(struct augeas *aug, struct transform *transform,
-                   const char *path, struct tree *tree);
-
 /* An exception in the interpreter */
 struct exn {
     struct info *info;
diff --git a/src/transform.c b/src/transform.c
index f1434f2..847e43c 100644
--- a/src/transform.c
+++ b/src/transform.c
@@ -36,6 +36,7 @@
 #include "memory.h"
 #include "augeas.h"
 #include "syntax.h"
+#include "transform.h"
 
 static const int fnm_flags = FNM_PATHNAME;
 static const int glob_flags = GLOB_NOSORT;
diff --git a/src/transform.h b/src/transform.h
new file mode 100644
index 0000000..9eff28b
--- /dev/null
+++ b/src/transform.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2009 Red Hat Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ * Author: David Lutterkort <lutter at redhat.com>
+ */
+
+#ifndef TRANSFORM_H_
+#define TRANSFORM_H_
+
+/*
+ * Transformers for going from file globs to path names in the tree
+ * functions are in transform.c
+ */
+
+/* Filters for globbing files */
+struct filter {
+    unsigned int   ref;
+    struct filter *next;
+    struct string *glob;
+    unsigned int   include : 1;
+};
+
+struct filter *make_filter(struct string *glb, unsigned int include);
+void free_filter(struct filter *filter);
+
+/* Transformers that actually run lenses on contents of files */
+struct transform {
+    unsigned int      ref;
+    struct lens      *lens;
+    struct filter    *filter;
+};
+
+struct transform *make_transform(struct lens *lens, struct filter *filter);
+void free_transform(struct transform *xform);
+
+/* Load all files matching the TRANSFORM's filter into the tree in AUG by
+ * applying the TRANSFORM's lens to their contents and putting the
+ * resulting tree under "/files" + filename. Also stores some information
+ * about filename underneath "/augeas/files" + filename
+ */
+int transform_load(struct augeas *aug, struct transform *transform);
+
+/* Return 1 if TRANSFORM applies to PATH, 0 otherwise. The TRANSFORM
+ * applies to PATH if (1) PATH starts with "/files/" and (2) the rest of
+ * PATH matches the transform's filter
+*/
+int transform_applies(struct transform *transform, const char *path);
+
+/* Save TREE into the file corresponding to PATH. It is assumed that the
+ * TRANSFORM applies to that PATH
+ */
+int transform_save(struct augeas *aug, struct transform *transform,
+                   const char *path, struct tree *tree);
+
+#endif
+
+
+/*
+ * Local variables:
+ *  indent-tabs-mode: nil
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ *  tab-width: 4
+ * End:
+ */
-- 
1.6.0.6




More information about the augeas-devel mailing list