Export the babeltrace API in babeltrace.h
authorJulien Desfossez <julien.desfossez@polymtl.ca>
Sat, 13 Aug 2011 00:15:28 +0000 (20:15 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 13 Aug 2011 00:15:28 +0000 (20:15 -0400)
Rename the previous babeltrace.h as babeltrace-internal.h

[ Edit by Mathieu Desnoyers: API cleanup. ]

Signed-off-by: Julien Desfossez <julien.desfossez@polymtl.ca>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
22 files changed:
configure.ac
converter/babeltrace-api.h [deleted file]
converter/babeltrace-lib.c
converter/babeltrace-log.c
converter/babeltrace.c
formats/bt-dummy/bt-dummy.c
formats/ctf-text/ctf-text.c
formats/ctf/ctf.c
formats/ctf/metadata/ctf-lexer.l
formats/ctf/metadata/ctf-parser-test.c
formats/ctf/metadata/ctf-parser.y
formats/ctf/metadata/ctf-visitor-generate-io-struct.c
formats/ctf/metadata/ctf-visitor-parent-links.c
formats/ctf/metadata/ctf-visitor-semantic-validator.c
formats/ctf/metadata/ctf-visitor-xml.c
formats/ctf/types/string.c
include/Makefile.am
include/babeltrace/babeltrace-internal.h [new file with mode: 0644]
include/babeltrace/babeltrace.h
include/babeltrace/ctf-text/types.h
include/babeltrace/ctf/types.h
types/types.c

index 7764b1507b3902237dddde03c45c264ae7bec10d..1ed70d71a30919b26900cb1da13f36a44dfbb4e1 100644 (file)
@@ -48,6 +48,9 @@ LIBS="$LIBS $GMODULE_LIBS"
 PACKAGE_CFLAGS="$GMODULE_CFLAGS -Wall -Wformat"
 AC_SUBST(PACKAGE_CFLAGS)
 
+babeltraceincludedir="${includedir}"
+AC_SUBST(babeltraceincludedir)
+
 AC_CONFIG_FILES([
        Makefile
        types/Makefile
diff --git a/converter/babeltrace-api.h b/converter/babeltrace-api.h
deleted file mode 100644 (file)
index d16352a..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-#ifndef _BABELTRACE_LIB_H
-#define _BABELTRACE_LIB_H
-
-/*
- * BabelTrace API
- *
- * Copyright 2010-2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- */
-
-#include <babeltrace/types.h>
-#include <babeltrace/format.h>
-#include <babeltrace/ctf/types.h>
-#include <babeltrace/ctf-ir/metadata.h>
-
-/*
- * struct babeltrace_iter: data structure representing an iterator on a trace
- * collection.
- */
-struct babeltrace_iter {
-       struct ptr_heap *stream_heap;
-       struct trace_collection *tc;
-};
-
-struct babeltrace_iter_pos {
-       GPtrArray *pos; /* struct babeltrace_iter_stream_pos */
-};
-
-struct babeltrace_iter_stream_pos {
-       struct stream_pos parent;
-       ssize_t offset;
-       size_t cur_index;
-};
-
-/*
- * Initialization/teardown.
- */
-struct babeltrace_iter *babeltrace_iter_create(struct trace_collection *tc);
-void babeltrace_iter_destroy(struct babeltrace_iter *iter);
-
-/*
- * Move within the trace.
- */
-/*
- * babeltrace_iter_next: Move stream position to the next event.
- *
- * Returns 0 on success, a negative value on error
- */
-int babeltrace_iter_next(struct babeltrace_iter *iter);
-
-/* Get the current position for each stream of the trace */
-struct babeltrace_iter_pos *
-babeltrace_iter_get_pos(struct babeltrace_iter *iter);
-
-/* The position needs to be freed after use */
-void babeltrace_iter_free_pos(struct babeltrace_iter_pos *pos);
-
-/* Seek the trace to the position */
-int babeltrace_iter_seek_pos(struct babeltrace_iter *iter,
-               struct babeltrace_iter_pos *pos);
-
-/*
- * babeltrace_iter_seek_time: Seek the trace to the given timestamp.
- *
- * Return EOF if timestamp is after the last event of the trace.
- * Return other negative value for other errors.
- * Return 0 for success.
- */
-int babeltrace_iter_seek_time(struct babeltrace_iter *iter,
-               uint64_t timestamp);
-
-/*
- * babeltrace_iter_read_event: Read the current event data.
- *
- * @iter: trace iterator (input)
- * @stream: stream containing event at current position (output)
- * @event: current event (output)
- * Return 0 on success, negative error value on error.
- */
-int babeltrace_iter_read_event(struct babeltrace_iter *iter,
-               struct ctf_stream **stream,
-               struct ctf_stream_event **event);
-
-#endif /* _BABELTRACE_LIB_H */
index 656bae868eac75b44177d4b88df83a2c298046a2..ee34d283167cf89d975786297883286be0854872 100644 (file)
 #include <errno.h>
 #include <stdio.h>
 #include <inttypes.h>
-#include <babeltrace/babeltrace.h>
+#include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/format.h>
 #include <babeltrace/ctf/types.h>
 #include <babeltrace/ctf/metadata.h>
 #include <babeltrace/ctf-text/types.h>
 #include <babeltrace/prio_heap.h>
+#include <babeltrace/babeltrace.h>
+#include <babeltrace/types.h>
+#include <babeltrace/ctf/types.h>
+#include <babeltrace/ctf-ir/metadata.h>
 
-#include "babeltrace-api.h"
+/*
+ * struct babeltrace_iter: data structure representing an iterator on a trace
+ * collection.
+ */
+struct babeltrace_iter {
+       struct ptr_heap *stream_heap;
+       struct trace_collection *tc;
+};
+
+struct babeltrace_iter_pos {
+       GPtrArray *pos; /* struct babeltrace_iter_stream_pos */
+};
+
+struct babeltrace_iter_stream_pos {
+       struct stream_pos parent;
+       ssize_t offset;
+       size_t cur_index;
+};
 
 static int stream_read_event(struct ctf_file_stream *sin)
 {
index 16f9a17929026a060282faf4b70a631ff7bf7f1e..9ca2b479f398f62dfa42d64e33e011eb556bcf97 100644 (file)
@@ -35,7 +35,7 @@
 #include <string.h>
 #include <endian.h>
 
-#include <babeltrace/babeltrace.h>
+#include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/ctf/types.h>
 
 #define USEC_PER_SEC 1000000UL
index ded493cede3e6c37c5d8d46de56452e0d82d6fa3..5c3724252936392b0ae110c2691a71bb2b37d8b5 100644 (file)
@@ -20,7 +20,7 @@
 
 #define _XOPEN_SOURCE 700
 #include <config.h>
-#include <babeltrace/babeltrace.h>
+#include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/format.h>
 #include <popt.h>
 #include <errno.h>
index 221b51ffe8d9e01f5af47d1dddfc7d78d17b6e36..41cfb741202eb0d765a181a0a095dba696c9e907 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <babeltrace/ctf-text/types.h>
 #include <babeltrace/format.h>
-#include <babeltrace/babeltrace.h>
+#include <babeltrace/babeltrace-internal.h>
 #include <inttypes.h>
 #include <uuid/uuid.h>
 #include <sys/mman.h>
index ac35cfb769450a7b96f830399cae0409f8466c98..f1ddbaf5e77b18f2f3855d9f7f2d23a708efe949 100644 (file)
@@ -21,7 +21,7 @@
 #include <babeltrace/format.h>
 #include <babeltrace/ctf-text/types.h>
 #include <babeltrace/ctf/metadata.h>
-#include <babeltrace/babeltrace.h>
+#include <babeltrace/babeltrace-internal.h>
 #include <inttypes.h>
 #include <uuid/uuid.h>
 #include <sys/mman.h>
index b39b86906e506ffbbe8cc77619a9a90d01c0b5e6..95a581fa4300f55c65cb9677f90c8196852bdef3 100644 (file)
@@ -21,7 +21,7 @@
 #include <babeltrace/format.h>
 #include <babeltrace/ctf/types.h>
 #include <babeltrace/ctf/metadata.h>
-#include <babeltrace/babeltrace.h>
+#include <babeltrace/babeltrace-internal.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <uuid/uuid.h>
index 7e81add5a9a70d192328965be2bc92ecda88f864..7a0e73fe1abb7c8e73690fe64f645c4242f25227 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 #include <stdio.h>
-#include <babeltrace/babeltrace.h>
+#include <babeltrace/babeltrace-internal.h>
 #include "ctf-scanner.h"
 #include "ctf-parser.h"
 #include "ctf-ast.h"
index 9d1025155b094085fc4dbbb2548f5177481b85ab..e84dc1289c168c124c7e6109a47fc795b88b58cb 100644 (file)
@@ -21,7 +21,7 @@
 #include <glib.h>
 #include <errno.h>
 #include <endian.h>
-#include <babeltrace/babeltrace.h>
+#include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/ctf/metadata.h>
 #include "ctf-scanner.h"
 #include "ctf-parser.h"
index 1d40d04f1a656b635449684d5cbcdb489b4dc9de..d216cd0e6479acd1cb65a626336bf59b85539d2b 100644 (file)
@@ -26,7 +26,7 @@
 #include <errno.h>
 #include <inttypes.h>
 #include <babeltrace/list.h>
-#include <babeltrace/babeltrace.h>
+#include <babeltrace/babeltrace-internal.h>
 #include "ctf-scanner.h"
 #include "ctf-parser.h"
 #include "ctf-ast.h"
index 6fbc7c02b0f74aeb41026a7bc0ed8391febaf2d6..725235d18a8d66a980134600fe44dade95aec6bc 100644 (file)
@@ -25,7 +25,7 @@
 #include <inttypes.h>
 #include <endian.h>
 #include <errno.h>
-#include <babeltrace/babeltrace.h>
+#include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/list.h>
 #include <babeltrace/types.h>
 #include <babeltrace/ctf/metadata.h>
index 0258fd63591276fff956ebc733c6258c0e0e7aa6..3dea11a01798c8dc748ecfaae00f12c667112a47 100644 (file)
@@ -24,7 +24,7 @@
 #include <glib.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <babeltrace/babeltrace.h>
+#include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/list.h>
 #include "ctf-scanner.h"
 #include "ctf-parser.h"
index b89f7bd7660d0d363faf4dab4dd77d009bb57320..eab4391b7007015df38504a7d1f6efe9acc2e3a1 100644 (file)
@@ -24,7 +24,7 @@
 #include <glib.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <babeltrace/babeltrace.h>
+#include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/list.h>
 #include "ctf-scanner.h"
 #include "ctf-parser.h"
index c47bd27d8ed61ae0c64bf3f7939f443b239fdfd2..56974c382f70e07a4a1781467856decd14fd7d54 100644 (file)
@@ -24,7 +24,7 @@
 #include <glib.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <babeltrace/babeltrace.h>
+#include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/list.h>
 #include "ctf-scanner.h"
 #include "ctf-parser.h"
index 682bd76d116b158e7b9577308040facaec1acd65..3b54a2df680ea5acffbba3c6f932aff1f2da096c 100644 (file)
@@ -18,7 +18,7 @@
  * all copies or substantial portions of the Software.
  */
 
-#include <babeltrace/babeltrace.h>
+#include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/ctf/types.h>
 #include <limits.h>            /* C99 limits */
 #include <string.h>
index 7239596cec3d27fc57d621e8b2a1a39310dc68cb..a5f5454263adb47272c46d889a28e4f6991571a1 100644 (file)
@@ -1,6 +1,8 @@
+babeltraceinclude_HEADERS = babeltrace/babeltrace.h
+
 noinst_HEADERS = \
        babeltrace/align.h \
-       babeltrace/babeltrace.h \
+       babeltrace/babeltrace-internal.h \
        babeltrace/bitfield.h \
        babeltrace/compiler.h \
        babeltrace/format.h \
diff --git a/include/babeltrace/babeltrace-internal.h b/include/babeltrace/babeltrace-internal.h
new file mode 100644 (file)
index 0000000..7c02948
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef _BABELTRACE_INTERNAL_H
+#define _BABELTRACE_INTERNAL_H
+
+#include <stdio.h>
+#include <glib.h>
+
+extern int babeltrace_verbose, babeltrace_debug;
+
+#define printf_verbose(fmt, args...)                           \
+       do {                                                    \
+               if (babeltrace_verbose)                         \
+                       printf("[verbose] " fmt, ## args);      \
+       } while (0)
+
+#define printf_debug(fmt, args...)                             \
+       do {                                                    \
+               if (babeltrace_debug)                           \
+                       printf("[debug] " fmt, ## args);        \
+       } while (0)
+
+struct trace_descriptor;
+struct trace_collection {
+       GPtrArray *array;
+};
+
+int convert_trace(struct trace_descriptor *td_write,
+                 struct trace_collection *trace_collection_read);
+
+extern int opt_field_names;
+
+#endif
index 8091ac441d9d758f9d7a1c4897d7b2fc9c815b22..c8b0581a4df5772294e2f8d0da254003e302d7a6 100644 (file)
@@ -1,31 +1,87 @@
 #ifndef _BABELTRACE_H
 #define _BABELTRACE_H
 
-#include <stdio.h>
-#include <glib.h>
+/*
+ * BabelTrace API
+ *
+ * Copyright 2010-2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ */
 
-extern int babeltrace_verbose, babeltrace_debug;
+/* Forward declarations */
+struct babeltrace_iter;
+struct babeltrace_iter_pos;
+struct babeltrace_iter_stream_pos;
+struct trace_collection;
+struct ctf_stream_event;
+struct ctf_stream;
 
-#define printf_verbose(fmt, args...)                           \
-       do {                                                    \
-               if (babeltrace_verbose)                         \
-                       printf("[verbose] " fmt, ## args);      \
-       } while (0)
+/*
+ * babeltrace_iter_create - Allocate a trace collection iterator.
+ */
+struct babeltrace_iter *babeltrace_iter_create(struct trace_collection *tc);
 
-#define printf_debug(fmt, args...)                             \
-       do {                                                    \
-               if (babeltrace_debug)                           \
-                       printf("[debug] " fmt, ## args);        \
-       } while (0)
+/*
+ * babeltrace_iter_destroy - Free a trace collection iterator.
+ */
+void babeltrace_iter_destroy(struct babeltrace_iter *iter);
 
-struct trace_descriptor;
-struct trace_collection {
-       GPtrArray *array;
-};
+/*
+ * babeltrace_iter_next: Move trace collection position to the next event.
+ *
+ * Returns 0 on success, a negative value on error
+ */
+int babeltrace_iter_next(struct babeltrace_iter *iter);
 
-int convert_trace(struct trace_descriptor *td_write,
-                 struct trace_collection *trace_collection_read);
+/*
+ * babeltrace_iter_get_pos - Get the current trace collection position.
+ *
+ * The position returned by this function needs to be freed by
+ * babeltrace_iter_free_pos after use.
+ */
+struct babeltrace_iter_pos *
+       babeltrace_iter_get_pos(struct babeltrace_iter *iter);
 
-extern int opt_field_names;
+/*
+ * babeltrace_iter_free_pos - Free the position.
+ */
+void babeltrace_iter_free_pos(struct babeltrace_iter_pos *pos);
 
-#endif
+/*
+ * babeltrace_iter_seek_pos - Seek the trace collection to the position.
+ */
+int babeltrace_iter_seek_pos(struct babeltrace_iter *iter,
+               struct babeltrace_iter_pos *pos);
+
+/*
+ * babeltrace_iter_seek_time: Seek the trace collection to the given timestamp.
+ *
+ * Return EOF if timestamp is after the last event of the trace collection.
+ * Return other negative value for other errors.
+ * Return 0 for success.
+ */
+int babeltrace_iter_seek_time(struct babeltrace_iter *iter,
+               uint64_t timestamp);
+
+/*
+ * babeltrace_iter_read_event: Read the iterator's current event data.
+ *
+ * @iter: trace collection iterator (input)
+ * @stream: stream containing event at current position (output)
+ * @event: current event (output)
+ * Return 0 on success, negative error value on error.
+ */
+int babeltrace_iter_read_event(struct babeltrace_iter *iter,
+               struct ctf_stream **stream,
+               struct ctf_stream_event **event);
+
+#endif /* _BABELTRACE_H */
index 1b05523e5430585afd3ed9984294825fbd3d413b..400e62c689d0ee3319cb706a73f64f54e15436a1 100644 (file)
@@ -24,7 +24,7 @@
 #include <stdint.h>
 #include <unistd.h>
 #include <glib.h>
-#include <babeltrace/babeltrace.h>
+#include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/types.h>
 #include <babeltrace/format.h>
 
index 8d57ec74249108b983a6ce294b243529b235c865..58352ef7b15a7bf4b39ba08842bcc3ff34543e1b 100644 (file)
@@ -20,7 +20,7 @@
  */
 
 #include <babeltrace/types.h>
-#include <babeltrace/babeltrace.h>
+#include <babeltrace/babeltrace-internal.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
index 11e91b02218524b15a21f558c0f7ec311f69f50a..4e96f443645ca72cec72f21ae409617ee140a2b6 100644 (file)
@@ -21,7 +21,7 @@
  */
 
 #include <babeltrace/format.h>
-#include <babeltrace/babeltrace.h>
+#include <babeltrace/babeltrace-internal.h>
 #include <limits.h>
 #include <glib.h>
 #include <errno.h>
This page took 0.034795 seconds and 4 git commands to generate.