rygel r61 - in trunk: . src
- From: zeeshanak svn gnome org
- To: svn-commits-list gnome org
- Subject: rygel r61 - in trunk: . src
- Date: Tue, 28 Oct 2008 20:59:23 +0000 (UTC)
Author: zeeshanak
Date: Tue Oct 28 20:59:23 2008
New Revision: 61
URL: http://svn.gnome.org/viewvc/rygel?rev=61&view=rev
Log:
Put all low-level stuff into a separate module.
This module will be the only one kept in C and all the code that currently
can't be written (easily) in Vala, will go there.
Added:
trunk/src/cstuff.c
trunk/src/cstuff.h
trunk/src/cstuff.vapi
Modified:
trunk/ChangeLog
trunk/src/Makefile.am
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Tue Oct 28 20:59:23 2008
@@ -15,6 +15,8 @@
BUILT_SOURCES = gupnp-media-server.stamp
gupnp_media_server_SOURCES = main.c \
+ cstuff.c \
+ cstuff.h \
gupnp-media-server.h \
gupnp-media-server.c \
gupnp-media-server.vala \
@@ -29,7 +31,7 @@
gupnp-media-tracker.vala
gupnp-media-server.stamp: $(filter %.vala,$(gupnp_media_server_SOURCES))
- $(VALAC) -C --pkg gupnp-1.0 \
+ $(VALAC) -C --vapidir=$(srcdir) --pkg cstuff --pkg gupnp-1.0 \
--pkg gupnp-av-1.0 --pkg dbus-glib-1 --pkg gconf-2.0 $^
touch $@
@@ -40,3 +42,4 @@
gupnp_media_server_LDFLAGS = -export-dynamic
MAINTAINERCLEANFILES = Makefile.in
+EXTRA_DIST = cstuff.vala
Added: trunk/src/cstuff.c
==============================================================================
--- (empty file)
+++ trunk/src/cstuff.c Tue Oct 28 20:59:23 2008
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2008 Zeeshan Ali.
+ * Copyright (C) 2007 OpenedHand Ltd.
+ *
+ * Author: Zeeshan Ali <zeenix gstreamer net>
+ * Author: Jorn Baayen <jorn openedhand com>
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <cstuff.h>
+
+/* Copy-paste from gupnp. */
+xmlNode *
+get_xml_element (xmlNode *node,
+ ...)
+{
+ va_list var_args;
+
+ va_start (var_args, node);
+
+ while (TRUE) {
+ const char *arg;
+
+ arg = va_arg (var_args, const char *);
+ if (!arg)
+ break;
+
+ for (node = node->children; node; node = node->next)
+ if (!strcmp (arg, (char *) node->name))
+ break;
+
+ if (!node)
+ break;
+ }
+
+ va_end (var_args);
+
+ return node;
+}
+
+char *
+generate_random_udn (void)
+{
+ char *str, *default_value;
+ uuid_t id;
+
+ default_value = g_malloc (64);
+ strcpy (default_value, "uuid:");
+
+ /* Generate new UUID */
+ uuid_generate (id);
+ uuid_unparse (id, default_value + 5);
+
+ return default_value;
+}
+
Added: trunk/src/cstuff.h
==============================================================================
--- (empty file)
+++ trunk/src/cstuff.h Tue Oct 28 20:59:23 2008
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2008 Zeeshan Ali.
+ * Copyright (C) 2007 OpenedHand Ltd.
+ *
+ * Author: Zeeshan Ali <zeenix gstreamer net>
+ * Author: Jorn Baayen <jorn openedhand com>
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __CSTUFF_H__
+#define __CSTUFF_H__
+
+#include <libxml/tree.h>
+#include <glib.h>
+#include <uuid/uuid.h>
+
+G_GNUC_INTERNAL xmlNode *
+get_xml_element (xmlNode *node,
+ ...);
+
+G_GNUC_INTERNAL char *
+generate_random_udn (void);
+
+#endif /* __CSTUFF_H__ */
+
Added: trunk/src/cstuff.vapi
==============================================================================
--- (empty file)
+++ trunk/src/cstuff.vapi Tue Oct 28 20:59:23 2008
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2008 Zeeshan Ali.
+ *
+ * Author: Zeeshan Ali <zeenix gstreamer net>
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+namespace CStuff {
+ class BuildConfig {
+ [CCode (cname = "DATA_DIR")]
+ public static const string DATA_DIR;
+ }
+
+ public class Utils {
+ [CCode (cname = "get_xml_element")]
+ public static weak Xml.Node * get_xml_element (Xml.Node node,
+ ...);
+ [CCode (cname = "generate_random_udn")]
+ public static string generate_random_udn ();
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]