Posts

Showing posts with the label C

Glib resume

Image
Glib resume Table of Contents Overview of Glib Glib's main event loop Threads Asynchronous Queues Dynamic loading of Modules Memory Management IO Channels 1 Overview of Glib The fully glib document was located in the glib website. This article is nothing but just repeat what I learned from above website. Or I consider this as an echo from mystery valley, because Glib is excellent, which provided both portability and elegant solution for the cross-system programer, it should be my base utilities in my daily programming life. 2 Glib's main event loop I think the main event loop is the heart of the glib library, and it is the most import part of this library. So why? Because the event loop engine is always the critical and basic part of the architecture of a project. There are many paradigms of the architecture of event loop. Glib is based on reactor model which is also the most popular and developer friendly paradigm. A reactor model can be sep...

Install GTK+-3.8.7 into Ubuntu 12.04 from scratch

Image
Install Gtk+-3.8.7 into Ubuntu 12.04 from scratch Table of Contents Preparation How the compile the source code from the beginning? 1 Preparation The first step is alway to download the needed package. I give the following shopping list: software package Download URL glib-2.36.4 http://ftp.gnome.org/pub/gnome/sources/glib/2.36/ gdk-pixbuf-2.28.2 http://ftp.gnome.org/pub/gnome/sources/gdk-pixbuf/2.28/ atk-2.8.0 http://ftp.gnome.org/pub/gnome/sources/atk/2.8/ fontconfig-2.11.0 http://www.freedesktop.org/software/fontconfig/release/ harfbuzz-0.9.24 http://www.freedesktop.org/software/harfbuzz/release/ pango-1.34.1 http://ftp.gnome.org/pub/gnome/sources/pango/1.34/ libatk-bridge2.0 http://packages.ubuntu.com/zh-cn/quantal/libatk-bridge2.0-0 libatk-bridge2.0-dev http://packages.ubuntu.com/zh-cn/quantal/libatk-bridge2.0-dev gtk+-3.8.7 http://ftp.gnome.org/pub/gnome/sources/gtk+/3.8/ My operating system is Ubuntu 12.04 ...

Plugin architecture design by C

Image
Plugin architecture design by C Table of Contents 1 How to make a plugin architecture in C? 2 Problems I met 3 How I solve this problem? 4 Pros and Cons of plugin architecture. 1 How to make a plugin architecture in C? The plugin architecture is a great design in order to make extensible and resilience software. The software's modules were loaded dynamically from the plugin modules at running time. In C language, this architecture can be implemented by dlopen which is the programming interface to the dynamic linking loader in Linux.  In other words, A software is split into separate modules which are compiled and linked into shared libs. And the software can load the shared libs into memory dynamically, this is what I wanna genesis to be. genesis is a reactor architecture middleware lib that I am working on. 2 Problems I met In order to make a plugin architecture, I use dlopen API to implement plugin modules. But I met some troubles in the d...

Using Gnu Global to navigating source code

Image
Using GNU Global to navigating source code I use etags as the default tagging system to navigating the C-like source code before. It works good, but sometimes it didn't perform as good as ctags which were used by vimer. Table of Contents 1 why not etags? 2 gtags's advantage 3 gtags's disadvantage 4 Install gtags 5 tagging source code systems of emacs 1 why not etags? Etags has a flaw compared with ctags, which is it didn't pop up the mini-buffer when searching a symbol. Which means I can not get options then decide where to jump when multi locations match the symbol. I have to jump one by one to find the right location in emacs with etags,which push me over the edge sometimes.  2 gtags's advantage Today I tried the gtags source tagging system which provided by Gnu Global project.  It can pop up the minibuffer when multiple targets match the symbol, which functions let me felt much more comfortable. 3 gtags's disadv...

Chain of Responsibility design pattern

Chain Of Responsibility design pattern Table of Contents 1 What is it? 2 Practice this pattern in C 1 What is it? According to Gof95, Chain of Responsibility belong to Behavioral Patterns. The definition of this pattern in Gof95 is: Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it. 2 Practice this pattern in C In wikipadia , it gives an example code to illustrate this pattern in java code. And I translate those code into C. I upload the source code into the github. chain of responsibility in C