<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Damien Lespiau</title>
	<atom:link href="http://damien.lespiau.name/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://damien.lespiau.name/blog</link>
	<description>errands</description>
	<lastBuildDate>Sat, 17 Sep 2011 00:37:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>A simple autotool template</title>
		<link>http://damien.lespiau.name/blog/2011/09/17/a-simple-autotool-template/</link>
		<comments>http://damien.lespiau.name/blog/2011/09/17/a-simple-autotool-template/#comments</comments>
		<pubDate>Sat, 17 Sep 2011 00:25:52 +0000</pubDate>
		<dc:creator>damien</dc:creator>
				<category><![CDATA[misc]]></category>

		<guid isPermaLink="false">http://damien.lespiau.name/blog/?p=249</guid>
		<description><![CDATA[Every now and then, you feel a big urge to start hacking on a small thingy and need to create Makefiles for it. Turns out that the autotools won&#8217;t be that intrusive when we are talking about small programs and you get do a reasonable job with a few lines, first the configure.ac file: # [...]]]></description>
			<content:encoded><![CDATA[<p>Every now and then, you feel a big urge to start hacking on a small thingy and need to create Makefiles for it. Turns out that the autotools won&#8217;t be that intrusive when we are talking about small programs and you get do a reasonable job with a few lines, first the <code class="filename">configure.ac</code> file:</p>
<pre># autoconf
AC_PREREQ(2.59)
AC_INIT([fart], [0.0.1], [damien.lespiau@gmail.com])
AC_CONFIG_MACRO_DIR([build])
AC_CONFIG_AUX_DIR([build])
AC_CONFIG_SRCDIR([fart.c])
AC_CONFIG_HEADERS([config.h])

# automake
AM_INIT_AUTOMAKE([1.11 -Wall foreign no-define])
AM_SILENT_RULES([yes])

# Check for programs
AC_PROG_CC

# Check for header files
AC_HEADER_STDC

AS_COMPILER_FLAGS([WARNING_CFLAGS],
		  ["-Wall -Wshadow -Wcast-align -Wno-uninitialized
		   -Wno-strict-aliasing -Wempty-body -Wformat -Wformat-security
		   -Winit-self -Wdeclaration-after-statement -Wvla
		   -Wpointer-arith"])

PKG_CHECK_MODULES([GLIB], [glib-2.0 &gt;= 2.24])

AC_OUTPUT([
  Makefile
])</pre>
<p>and then <code class="filename">Makefile.am</code>:</p>
<pre>ACLOCAL_AMFLAGS = -I build ${ACLOCAL_FLAGS}

bin_PROGRAMS = fart

fart_SOURCES =	fart.c
fart_CFLAGS  = $(WARNING_CFLAGS) $(GLIB_CFLAGS)
fart_LDADD   = $(GLIB_LIBS)</pre>
<p>After that, it&#8217;s just a matter of running <code class="command">autoreconf</code></p>
<pre>$ autoreconf -i</pre>
<p>and you are all set!</p>
<p>So, what do you get for this amount of lines?</p>
<ul>
<li>The usual set of automake targets, handy! (&#8220;make tags&#8221; is so under used!) and bonus features (out of tree builds, extra rules to reconfigure/rebuild the Makefiles on changes in configure.ac/Makefile.an, &#8230;)</li>
<li>Trying to make the autoconf/automake discreet (putting auxiliary files out of the way, silence mode, automake for non GNU projects)</li>
<li>Some decent warning flags (tweak to your liking!)</li>
<li>autoreconf cooperating with aclocal thanks to ACLOCAL_AMFLAGS and coping with non standard locations for system m4 macros</li>
</ul>
<p>I&#8217;ll maintain a <a title="A simple autotool template" href="http://git.lespiau.name/cgit/program-template-simple/">git tree</a> to help bootstrap my next small hacks, feel free to use it as well!</p>
]]></content:encoded>
			<wfw:commentRss>http://damien.lespiau.name/blog/2011/09/17/a-simple-autotool-template/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Clutter on Android: first results</title>
		<link>http://damien.lespiau.name/blog/2011/05/31/clutter-on-android-first-results/</link>
		<comments>http://damien.lespiau.name/blog/2011/05/31/clutter-on-android-first-results/#comments</comments>
		<pubDate>Tue, 31 May 2011 14:41:27 +0000</pubDate>
		<dc:creator>damien</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Clutter]]></category>

		<guid isPermaLink="false">http://damien.lespiau.name/blog/?p=232</guid>
		<description><![CDATA[With the release of Android 2.3, there&#8217;s a decent way to integrate native applications with the NativeActivity class, an EGL library, and some C API to expose events, main loop, etc. So? how about porting Clutter to it now that it looks actually feasible? After a few days of work, the first results are there, [...]]]></description>
			<content:encoded><![CDATA[<p>With the release of Android 2.3, there&#8217;s a <em>decent</em> way to  integrate native applications with the NativeActivity class, an EGL  library, and some C API to expose events, main loop, etc. So? how about porting Clutter to it now that it looks actually feasible? After a few days of work, the first results are there, quite promising!</p>
<p style="text-align: center;"><video src="http://damien.lespiau.name/files/blog/clutter-android.ogv" controls>Your browser does not support the <code>video</code> element. Download the <a href="http://damien.lespiau.name/files/blog/clutter-android.ogv">original source</a>.</video>
<p>There&#8217;s still a fairly large number of items in my TODO before being happy with the state of this work, the most prominent items are:</p>
<ul>
<li>Get a clean up pass done to have something upstreamable, this includes finishing the event integration (it receives events but not yet forward them to Clutter),</li>
<li>Come up with a plan to manage the application life cycle and handle the case when Android destroys the EGL surface that you were using (probably by having the app save a state, and properly tear down Clutter).,</li>
<li>While you probably have the droid font installed in /system/fonts, this is not part of the advertised NDK interface. The safest choice is to  embed the font you want to use with your application. Unfortunately  fontconfig + freetype + pango + compressed assets in your Android package don&#8217;t work really well together. Maybe solve it at the Pango level with a custom &#8220;direct&#8221; fontmap implementation that would let you register fonts from files easily?</li>
<li>What to do with text entries? show soft keyboard? Mx or Clutter problem? what happens to the GL surface in that case?</li>
<li>Better test the GMainLoop/ALooper main loop integration (esp. adding and removing file descriptors),</li>
<li>All the libraries that Clutter depends on are linked into a big .so (which is the Android NDK application). It results in a big .so (~5 MB, ~1.7 MB compressed in the .apk). That size can be dramatically reduced, sometimes at the expense of changes that will break the current API/ABI, but hell, you&#8217;ll be statically linking anyway,</li>
<li>Provide &#8220;prebuilt libraries&#8221;, ie. pre-compiled libraries that makes it easy to just use Clutter to build applications.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://damien.lespiau.name/blog/2011/05/31/clutter-on-android-first-results/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
<enclosure url="http://damien.lespiau.name/files/blog/clutter-android.ogv" length="1616469" type="video/ogg" />
		</item>
		<item>
		<title>A simple transition effect with Clutter</title>
		<link>http://damien.lespiau.name/blog/2011/05/10/a-simple-transition-effect-with-clutter/</link>
		<comments>http://damien.lespiau.name/blog/2011/05/10/a-simple-transition-effect-with-clutter/#comments</comments>
		<pubDate>Tue, 10 May 2011 14:06:08 +0000</pubDate>
		<dc:creator>damien</dc:creator>
				<category><![CDATA[Clutter]]></category>

		<guid isPermaLink="false">http://damien.lespiau.name/blog/?p=204</guid>
		<description><![CDATA[When doing something with graphics, your first need an idea (granted, as with pretty much everything else). In this case, a simple transition that I&#8217;ve seen somewhere a long time ago and I wanted to reproduce with Clutter. Your browser does not support the video element. Download the original source. The code is available in [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">When doing something with graphics, your first need an idea (granted, as with pretty much everything else). In this case, a simple transition that I&#8217;ve seen somewhere a long time ago and I wanted to reproduce with Clutter.</p>
<p style="text-align: center;"><video src="http://damien.lespiau.name/files/blog/tileout-effect.ogv" controls>Your browser does not support the <code>video</code> element. Download the <a href="http://damien.lespiau.name/files/blog/tileout-effect.ogv">original source</a>.</video>
<p>The code is available in a <a title="wip/tileout-effect branch" href="https://github.com/media-explorer/media-explorer/tree/wip%2Ftileout-effect">branch</a> of a <a title="media explorer" href="http://media-explorer.github.com/">media explorer</a> I&#8217;m currently working on. A few bullet points to follow the code:</p>
<ul>
<li>As the effect needs a &#8220;screenshot&#8221; of a Clutter scene to play with. You first need to create a subclass of <code>ClutterOffscreenEffect</code> as it does the work of redirecting the painting of a subtree of actors in an offscreen buffer that you can  reuse to texture the rectangles you&#8217;ll be animating in the effect. This subclass has a &#8220;progress&#8221; property to control the animation.</li>
<li>Then actually compute the coordinates of the grid cells both in screen space and in texture space. To be able to use <code>cogl_rectangles_with_texture_coords()</code>, to try limit the number of GL calls (and/or by the Cogl journal and to ease the animation of the cells fading out, I decided to store the diagonals of the rectangle in a 1D array so that the following grid:</li>
</ul>
<p style="text-align: center;"><a href="http://damien.lespiau.name/blog/wp-content/uploads/2011/05/grild-diagonals.png"><img class="size-full wp-image-209" title="grild-diagonals" src="http://damien.lespiau.name/blog/wp-content/uploads/2011/05/grild-diagonals.png" alt="a 5x5 grid with one color per diagonal line" width="281" height="281" /></a></p>
<p style="text-align: left;">is stored as:</p>
<p style="text-align: center;"><a href="http://damien.lespiau.name/blog/wp-content/uploads/2011/05/tileout-1d-rects.png"><img class="size-full wp-image-210 alignnone" title="tileout-1d-rects" src="http://damien.lespiau.name/blog/wp-content/uploads/2011/05/tileout-1d-rects.png" alt="A 1D array with all the diagonals of the grid" width="561" height="57" /></a></p>
<ul>
<li><code>::paint_target()</code>looks at the &#8220;progress&#8221; property, animate those grid cells accordingly and draw them. <code>priv-&gt;rects</code> is the array storing the initial rectangles, <code>priv-&gt;animated_rects</code> the animated ones and <code>priv-&gt;chunks</code> stores the start and duration of each diagonal animation along with a (index, length) tuple that references the diagonal rectangles in priv-&gt;rects and priv-&gt;animated_rects.</li>
</ul>
<p>Some more details:</p>
<ul>
<li>in the <code>::paint_target()</code> function, you can special case when the progress is 0.0 (paint the whole FBO instead of the textured grid) and 1.0 (don&#8217;t do anything),</li>
<li>Clutter does not currently allow to just rerun the effect when you animate a property of an offscreen effect for instance. This means that when animating the &#8220;progress&#8221; property on the effect, it queues a redraw on the actor that end up in the offscreen to trigger the effect <code>::paint_target()</code> again. A branch from <a title="Neil" href="http://busydoingnothing.co.uk/">Neil</a> allows to queue a &#8220;rerun&#8221; on the effect to avoid having to do that,</li>
<li>The code has some limitations right now (ie, n_colums must be equal to n_rows) but easily fixable. Once done, it makes sense to try to push the effect to <a title="Mx" href="https://github.com/clutter-project/mx">Mx</a>.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://damien.lespiau.name/blog/2011/05/10/a-simple-transition-effect-with-clutter/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
<enclosure url="http://damien.lespiau.name/files/blog/tileout-effect.ogv" length="219913" type="video/ogg" />
		</item>
		<item>
		<title>The GStreamer conference from a Clutter point of view</title>
		<link>http://damien.lespiau.name/blog/2010/11/16/the-gstreamer-conference-from-a-clutter-point-of-view/</link>
		<comments>http://damien.lespiau.name/blog/2010/11/16/the-gstreamer-conference-from-a-clutter-point-of-view/#comments</comments>
		<pubDate>Tue, 16 Nov 2010 19:30:21 +0000</pubDate>
		<dc:creator>damien</dc:creator>
				<category><![CDATA[Clutter]]></category>
		<category><![CDATA[GNOME]]></category>

		<guid isPermaLink="false">http://damien.lespiau.name/blog/?p=193</guid>
		<description><![CDATA[Two weeks ago I attended the first GStreamer conference, and it was great. I won&#8217;t talk about the 1.0 plan that seems to take shape and looks really good but just what stroke me the most: Happy Clutter Stories and an Tale To Be Told to your manager. Let&#8217;s move on the Clutter stories. You [...]]]></description>
			<content:encoded><![CDATA[<p>Two weeks ago I attended<a href="http://gstreamer.freedesktop.org/conference/"> the first GStreamer conference</a>, and it was great. I won&#8217;t talk about the 1.0 plan that seems to take shape and looks really good but just what stroke me the most: Happy Clutter Stories and an Tale To Be Told to your manager.</p>
<p>Let&#8217;s move on the Clutter stories. You had a surprising number of people mixing GStreamer and Clutter, two talks especially:</p>
<ul>
<li>Florent Thiery founder of <a href="http://www.ubicast.eu">Ubicast</a> talked about one of their products: a<a href="http://www.ubicast.eu/en/Products/easycast/"> portable recording system</a> with quite a bit of bling (records the slides, movement detection with OpenCV, RoI, &#8230;). The system was used to <a href="http://gstreamer-devel.966125.n4.nabble.com/GStreamer-Conference-2010-Talks-Recordings-td3043270.html#a3043270">record the talks on the main track</a>. Now, what was of particular interest for me is that the UI to control the system is entirely written with Clutter and python. They have built a whole toolkit on top of Clutter, in python, called <a href="https://launchpad.net/candies">candies</a>/<a href="https://launchpad.net/touchwizard">touchwizard</a> and written their UI with it, cooool.</li>
<li>A very impressive talk from the <a href="http://www.tandberg.com/">Tanberg</a> (now Cisco) guys about their <a href="http://www.tandberg.com/">Movi software</a>, video conferencing at its finest. It uses GStreamer extensively and Clutter for its UI (on Windows!). They said that about 150,000 copies of Movi are deployed in the wild. Patches from Ole André Vadla Ravnås and Haakon Sporsheim have been flowing to Clutter and Clutter-gst (win32 support).</li>
</ul>
<p>As a side note, Fluendo talked about their Open Source, Intel founded, <a href="https://core.fluendo.com/gstreamer/trac/browser/trunk/gst-fluendo-ismd">GStreamer codecs</a> for Intel CE3100/CE4100. This platform specificities are supported natively by Clutter (./configure &#8211;with-flavour=cex100) using the native EGL winsys called &#8220;GDL&#8221; and evdev events coming from the kernel. More on this later :p</p>
<p>A very interesting point about those success stories is that the companies and engineers working with open source software to build their applications, sometimes with parts heavily covered by patents, <strong>while</strong> contributing back to the ecosystem that allowed to build those applications in the first place. Contributing is done at many levels: directly patches but also feedback on the libraries/platform (eg. input for GStreamer 1.0). And guess what? It works! To me, that&#8217;s exactly how the GNOME platform should be used to build proprietary applications: build on top and contribute back to consolidate the libraries. I&#8217;d go as far as saying that contributing upstream is the best way to share code inside the same big corporation. Such companies are always very bad a cooperating between divisions.</p>
]]></content:encoded>
			<wfw:commentRss>http://damien.lespiau.name/blog/2010/11/16/the-gstreamer-conference-from-a-clutter-point-of-view/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>g_object_notify_by_pspec()</title>
		<link>http://damien.lespiau.name/blog/2010/09/28/g_object_notify_by_pspec/</link>
		<comments>http://damien.lespiau.name/blog/2010/09/28/g_object_notify_by_pspec/#comments</comments>
		<pubDate>Tue, 28 Sep 2010 13:30:44 +0000</pubDate>
		<dc:creator>damien</dc:creator>
				<category><![CDATA[GNOME]]></category>

		<guid isPermaLink="false">http://damien.lespiau.name/blog/?p=186</guid>
		<description><![CDATA[Now that GLib 2.26.0 is out, it&#8217;s time to talk about a little patch to GObject I&#8217;ve written (well, the original idea was born while looking at it with Neil): add a new g_object_notify_by_pspec() symbol to GObject. As shown in the bug it can improve the notification of GObject properties by 10-15% (the test case [...]]]></description>
			<content:encoded><![CDATA[<p>Now that  GLib 2.26.0 is out, it&#8217;s time to talk about a little patch to GObject I&#8217;ve written (well, the original idea was born while looking at it with <a href="http://www.busydoingnothing.co.uk/blog/">Neil</a>): add a new <a href="http://library.gnome.org/devel/gobject/stable/gobject-The-Base-Object-Type.html#g-object-notify-by-pspec"><code>g_object_notify_by_pspec()</code></a> symbol to GObject. As shown <a href="https://bugzilla.gnome.org/show_bug.cgi?id=615425">in the bug </a>it can improve the notification of GObject properties by 10-15% (the test case tested was without any handler connected to the notify signal).</p>
<p>If you can depend on GLib 2.26, consider using it!</p>
]]></content:encoded>
			<wfw:commentRss>http://damien.lespiau.name/blog/2010/09/28/g_object_notify_by_pspec/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning how to draw</title>
		<link>http://damien.lespiau.name/blog/2010/06/03/learning-how-to-draw/</link>
		<comments>http://damien.lespiau.name/blog/2010/06/03/learning-how-to-draw/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 17:35:16 +0000</pubDate>
		<dc:creator>damien</dc:creator>
				<category><![CDATA[drawing]]></category>

		<guid isPermaLink="false">http://damien.lespiau.name/blog/?p=173</guid>
		<description><![CDATA[I can&#8217;t draw. I&#8217;ve never been able to. Yet, for some reason, I decided to give it a serious try, buy a book to guide me in that journey (listening to an advice from pippin, yeah I know, crazy). The first step was, like a pilgrim walking to a sacred place, to go and buy [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://damien.lespiau.name/files/blog/horse-rider-web.jpg"><img class="alignleft" title="German horse and rider" src="http://damien.lespiau.name/files/blog/horse-rider-web.jpg" alt=" " width="320" height="394" /></a>I can&#8217;t draw. I&#8217;ve never been able to. Yet, for some reason, I decided to give it a serious try, buy <a href="http://www.amazon.co.uk/exec/obidos/ASIN/0874774195/ref=ed_oe_h/002-5450444-4780047">a book</a> to guide me in that journey (listening to an advice from <a href="http://pippin.gimp.org">pippin</a>, yeah I know, crazy). The first step was, like a pilgrim walking to a sacred place, to go and buy some art supplies, which turned out to be a really enjoyable experience.</p>
<p>The first thing you have to do is a snapshot of your skills before reading more of the book to be able to do a &#8220;before/after&#8221; comparison. I thought it was quite hard, but was surprised that the result was all right, by my low standards anyway. You have to do 3 drawings: a self-portrait, looking at yourself in a mirror, a person/character drawn from memory without a visual help and your hand.</p>
<p>The next exercise is there to make you realize that you&#8217;ll have to forget everything you know and re-learn how to see to draw. It&#8217;s about copying drawings upside down, copying it curve by curve without associating any meaning to what you are doing. The result is quite surprising as you can see on the left. Now it&#8217;s a matter to learn how to do that without resorting to the upside down trick.</p>
<p>It&#8217;s only the beginning of a long journey, so many things can go wrong, but worth giving it a try!</p>
]]></content:encoded>
			<wfw:commentRss>http://damien.lespiau.name/blog/2010/06/03/learning-how-to-draw/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Using glib.py and gobject.py GDB scripts</title>
		<link>http://damien.lespiau.name/blog/2010/03/23/using-glibpy-and-gobjectpy-gdb-scripts/</link>
		<comments>http://damien.lespiau.name/blog/2010/03/23/using-glibpy-and-gobjectpy-gdb-scripts/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 20:58:31 +0000</pubDate>
		<dc:creator>damien</dc:creator>
				<category><![CDATA[GNOME]]></category>

		<guid isPermaLink="false">http://damien.lespiau.name/blog/?p=158</guid>
		<description><![CDATA[Some time ago, Alexander Larson blogged about using gdb python macros when debugging Glib and GObject projects. I&#8217;ve wanted to try those for ages, so I spent part of the week-end looking at what you could do with the new python enabled GDB, result: quite a lot of neat stuff! Let&#8217;s start by making the [...]]]></description>
			<content:encoded><![CDATA[<p>Some time ago, Alexander Larson blogged about <a href="http://blogs.gnome.org/alexl/2009/09/21/archer-gdb-macros-for-glib/ ">using gdb python macros</a> when debugging Glib and GObject projects. I&#8217;ve wanted to try those for ages, so I spent part of the week-end looking at what you could do with the new python enabled GDB, result: quite a lot of neat stuff!</p>
<p>Let&#8217;s start by making the script that now comes with glib work on stock gdb 7.0 and 7.1 (ie not the archer branch that contains more of the python work). If those two scripts don&#8217;t work for you yet (because your distribution is not packaging them, or is packaging a stock gdb 7.0. 7.1), here are a few hints you can follow:</p>
<ul>
<li>glib&#8217;s GDB macros rely on GDB&#8217;s auto-load feature, ie, every time GDB load a library your program uses, it&#8217;ll look for a corresponding python script to execute:</li>
</ul>
<pre>open("/lib/libglib-2.0.so.0.2200.4-gdb.py", O_RDONLY)
open("/usr/lib/debug/lib/libglib-2.0.so.0.2200.4-gdb.py", O_RDONLY)
open("/usr/share/gdb/auto-load/lib/libglib-2.0.so.0.2200.4-gdb.py", O_RDONLY)</pre>
<p>Some distributions have decided not to ship glib&#8217;s and gobject&#8217;s auto-load helpers, if you are in that case, you&#8217;d need to load <code class="filename">gobject.py</code> and <code class="filename">glib.py</code> by hand. For that purpose I&#8217;ve added a small python command in my <code class="filename">~/.gdbinit</code>:</p>
<pre>python
import os.path
import sys
import gdb

# Update module path.
dir = os.path.join(os.path.expanduser("~"), ".gdb")
if not dir in sys.path:
    sys.path.insert(0, dir)

class RegisterCommand (gdb.Command):
    """Register GLib and GObject modules"""

    def __init__ (self):
        super (RegisterCommand, self).__init__ ("gregister",
                                                gdb.COMMAND_DATA,
                                                gdb.COMPLETE_NONE)

    def invoke (self, arg, from_tty):
        objects = gdb.objfiles ()
        for object in objects:
            if object.filename.find ("libglib-2.0.so.") != -1:
                from glib import register
                register (object)
            elif object.filename.find ("libgobject-2.0.so.") != -1:
                from gobject import register
                register (object)

RegisterCommand ()
end</pre>
<p>What I do is put <code class="filename">glib.py</code> and <code class="filename">gobject.py</code> in a<code class="filename"> ~/.gdb</code> directory and don&#8217;t forget to call <code>gregister</code> inside GDB (once gdb has loaded glib and gobject)</p>
<ul>
<li>The scripts that are inside glib&#8217;s repository were written with the archer branch of gdb (which bring all the python stuff). Unfortunately stock GDB (7.0 and 7.1) does not have everything the archer gdb has. I have a <a href="https://bugzilla.gnome.org/show_bug.cgi?id=613732">couple</a> of <a href="https://bugzilla.gnome.org/show_bug.cgi?id=613736">patches</a> to fix that in the queue. Meanwhile you can grab them in <a href="http://git.lespiau.name/cgit/sk/tree/dotfiles/gdb">my survival kit repository</a>. This will disable the back trace filters as they are still not in stock GDB.</li>
</ul>
<p>You&#8217;re all set! it&#8217;s time to enjoy pretty printing and <code>gforeach</code>. Hopefully people will join the fun at some point and add more GDB python macro goodness both inside glib and in other projects (for instance a ClutterActor could print its name).</p>
<pre>int main (int argc, char **argv)
{
	glist = g_list_append (glist, "first");
	glist = g_list_append (glist, "second");

	return breeeaaak_oooon_meeeee ();
}</pre>
<p>gives:</p>
<pre>(gdb) b breeeaaak_oooon_meeeee
Breakpoint 1 at 0x80484b7: file glib.c, line 9.
(gdb) r
Starting program: /home/damien/src/test-gdb/glib
Breakpoint 1, breeeaaak_oooon_meeeee () at glib.c:9
9        return 0;
(gdb) gregister
(gdb) gforeach s in glistp: print ((char *)$s)
No symbol "glistp" in current context.
(gdb) gforeach s in glist: print ((char *)$s)
$2 = 0x80485d0 "first"
$3 = 0x80485d6 "second"</pre>
]]></content:encoded>
			<wfw:commentRss>http://damien.lespiau.name/blog/2010/03/23/using-glibpy-and-gobjectpy-gdb-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS_AM_STFU</title>
		<link>http://damien.lespiau.name/blog/2010/02/03/as_am_stfu/</link>
		<comments>http://damien.lespiau.name/blog/2010/02/03/as_am_stfu/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 15:04:19 +0000</pubDate>
		<dc:creator>damien</dc:creator>
				<category><![CDATA[cool hacks]]></category>

		<guid isPermaLink="false">http://damien.lespiau.name/blog/?p=154</guid>
		<description><![CDATA[Writing m4 macro is fun, it really is. If you want to have make be a &#8220;make -s&#8221; without doing boring stuff like aliases and actually respect the default verbosity of automake &#62;= 1.11, use this small m4 macro I wrote.]]></description>
			<content:encoded><![CDATA[<p>Writing m4 macro is fun, it really is.</p>
<p>If you want to have make be a &#8220;make -s&#8221; without doing boring stuff like aliases and actually respect the default verbosity of automake &gt;= 1.11, use <a href="http://git.lespiau.name/cgit/sk/tree/build/m4/as-am-stfu.m4">this small m4 macro</a> I wrote.</p>
]]></content:encoded>
			<wfw:commentRss>http://damien.lespiau.name/blog/2010/02/03/as_am_stfu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Aligning C function parameters with vim</title>
		<link>http://damien.lespiau.name/blog/2009/12/07/aligning-c-function-parameters-with-vim/</link>
		<comments>http://damien.lespiau.name/blog/2009/12/07/aligning-c-function-parameters-with-vim/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 12:56:11 +0000</pubDate>
		<dc:creator>damien</dc:creator>
				<category><![CDATA[GNOME]]></category>

		<guid isPermaLink="false">http://damien.lespiau.name/blog/?p=145</guid>
		<description><![CDATA[updated: now saves/retores the paste register It has bothered me for a while, some coding styles, most notably in the GNOME world try to enforce good looking alignment of functions parameters such as: static UniqueResponse on_unique_message_received (UniqueApp         *unique_app, gint               command, UniqueMessageData *message_data, guint              time_, gpointer           user_data) { } Until now, I aligned the arguments by [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">updated:</span> now saves/retores the paste register</p>
<p>It has bothered me for a while, some coding styles, most notably in the GNOME world try to enforce good looking alignment of functions parameters such as:</p>
<pre>static UniqueResponse
on_unique_message_received (UniqueApp         *unique_app,
                            gint               command,
                            UniqueMessageData *message_data,
                            guint              time_,
                            gpointer           user_data)
{
}</pre>
<p>Until now, I aligned the arguments by hand, but that time is over! Please welcome my first substantial vim plugin: it defines a  <code class="command">GNOMEAlignArguments</code> command to help you in that task. All you have to do is to <a title="GNOME-align-args.vim" href="http://git.lespiau.name/cgit/sk/plain/dotfiles/vim/plugin/GNOME-align-args.vim">add this file</a> in your  <code class="filename">~/.vim/plugin</code> directory and define a macro in your  <code class="filename">~/.vimrc</code> to invoke it just like this:</p>
<pre>" Align arguments
nmap ,a :GNOMEAlignArguments&lt;CR&gt;</pre>
<p>HTH.</p>
]]></content:encoded>
			<wfw:commentRss>http://damien.lespiau.name/blog/2009/12/07/aligning-c-function-parameters-with-vim/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Cogl + JS = Love</title>
		<link>http://damien.lespiau.name/blog/2009/09/21/cogl-js-love/</link>
		<comments>http://damien.lespiau.name/blog/2009/09/21/cogl-js-love/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 16:59:38 +0000</pubDate>
		<dc:creator>damien</dc:creator>
				<category><![CDATA[Clutter]]></category>

		<guid isPermaLink="false">http://damien.lespiau.name/blog/?p=138</guid>
		<description><![CDATA[Played a bit with Gjs and Cogl this weekend and ended up rewriting Clutter&#8217;s test-cogl-primitives in JavaScript. In the unlikely case someone is interested in trying it, you&#8217;ll need a patch to support arrays of float as argument in introspected functions and another small patch to add introspection annotations for a few Cogl symbols. As [...]]]></description>
			<content:encoded><![CDATA[<p>Played a bit with <a title="Gjs" href="http://live.gnome.org/Gjs">Gjs</a> and <a href="http://www.clutter-project.org/docs/cogl/stable/">Cogl</a> this weekend and ended up rewriting Clutter&#8217;s test-cogl-primitives in JavaScript. In the unlikely case someone is interested in trying it, you&#8217;ll need a <a href="https://bugzilla.gnome.org/show_bug.cgi?id=593245">patch to support arrays of float as argument in introspected functions</a> and another small <a href="http://bugzilla.openedhand.com/show_bug.cgi?id=1817">patch to add introspection annotations for a few Cogl symbols</a>. As usual you can grab the code in<a href="http://git.lespiau.name/cgit/clutter-gjs-examples/"> its git repository</a>:</p>
<p><img class="aligncenter size-full wp-image-140" title="cogl-primitives-js" src="http://damien.lespiau.name/blog/wp-content/uploads/2009/09/cogl-primitives-js.png" alt="cogl-primitives-js" width="418" height="454" /></p>
]]></content:encoded>
			<wfw:commentRss>http://damien.lespiau.name/blog/2009/09/21/cogl-js-love/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

