Do not use `bool` type; use new `bt_bool` instead
[babeltrace.git] / lib / babeltrace.c
index 8fe44fbf35caa842661357b50488dd2161e36103..2b675eb299d4eb18a7efd5b6853ae70fe97aa43e 100644 (file)
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
  */
 
 #include <babeltrace/babeltrace.h>
-#include <babeltrace/ctf-text/types.h>
+#include <babeltrace/types.h>
 #include <stdlib.h>
 
-int babeltrace_verbose, babeltrace_debug;
+bt_bool babeltrace_verbose, babeltrace_debug;
 
-int convert_trace(struct trace_descriptor *td_write,
-                 struct trace_collection *trace_collection_read)
+static
+void __attribute__((constructor)) init_babeltrace_lib(void)
 {
-       struct babeltrace_iter *iter;
-       struct ctf_stream *stream;
-       struct ctf_stream_event *event;
-       struct ctf_text_stream_pos *sout;
-       struct trace_collection_pos begin_pos;
-       int ret = 0;
+       if (getenv("BABELTRACE_VERBOSE"))
+               babeltrace_verbose = BT_TRUE;
+       if (getenv("BABELTRACE_DEBUG"))
+               babeltrace_debug = BT_TRUE;
+}
 
-       sout = container_of(td_write, struct ctf_text_stream_pos,
-                       trace_descriptor);
+int bt_version_get_major(void)
+{
+       return BT_VERSION_MAJOR;
+}
 
-       begin_pos.type = BT_SEEK_BEGIN;
-       iter = babeltrace_iter_create(trace_collection_read, &begin_pos, NULL);
-       while (babeltrace_iter_read_event(iter, &stream, &event) == 0) {
-               ret = sout->parent.event_cb(&sout->parent, stream);
-               if (ret) {
-                       fprintf(stdout, "[error] Writing event failed.\n");
-                       goto end;
-               }
-               ret = babeltrace_iter_next(iter);
-               if (ret < 0)
-                       goto end;
-       }
-end:
-       babeltrace_iter_destroy(iter);
-       return ret;
+int bt_version_get_minor(void)
+{
+       return BT_VERSION_MINOR;
 }
 
-static
-void __attribute__((constructor)) init_babeltrace_lib(void)
+int bt_version_get_patch(void) {
+       return BT_VERSION_PATCH;
+}
+
+const char *bt_version_get_extra(void)
 {
-       if (getenv("BABELTRACE_VERBOSE"))
-               babeltrace_verbose = 1;
-       if (getenv("BABELTRACE_DEBUG"))
-               babeltrace_debug = 1;
+       return BT_VERSION_EXTRA;
 }
This page took 0.027533 seconds and 4 git commands to generate.