Home

Awesome

Caffeine, C Application Framework

Caffeine is a C language based framework which uses C99, POSIX and SUSv3 standards, and system specific system calls -- Linux and FreeBSD for now -- to support the development of daemons and services. The idea is to have predefined algorithms to help you in some tasks for building your own daemons, command line applications and complex tasks such as integrating plugin interfaces to your applications. The concrete goal of this project is to implement most common algorithms to develop service oriented applications.

Features

STEPS FOR BUILDING CAFFEINE

Build Tools:

CMake is a Makefile generator tool writen in C++. To build Caffeine manually you must run:


cmake .
make

In the bin directory resides a script called cmk.sh, it's script that helps in the compilation of caffeine, setting verbose output and debug binaries generation, written to help in debugging tasks.

To build Caffeine with cmk.sh you must run:


cmk.sh -mcb

To clean the proyect output, usually to get a patch:


cmk.sh -mc

To import the proyect into kdevelop:


cmk.sh -kcb

To clean the project output made by kdevelop:


cmk.sh -kc

Caffeine Coding Style

Indenting and Formatting

The style in Caffeine is a mixture between ISO C 99 calling conventions, K&R blocks breakings and KNF -- Kernel Normal Form -- indenting.

Concrete tabs are used to speed up the compile time of caffeine, concrete tabs means less tokens to parse.

Naming Conventions

For core functions, you must use: <module_abbreviation>_<function_name> I.E.: cbuf_create

For caffeine functions, you must use: <caf><module_abbreviation><function_name>

For parameters, and local variables, abbreviations are permitted.

For typedefs, you must use: <module_abbreviation>_<typedef>_t

For structures, you must use: <module_abbreviation>_<structure>_s

For single variables and parameters, hungarian notation -- type prefix or suffix -- isn't permitted.

Emacs Style

To use emacs during caffeine hacking you must use the next sentence in your .emacs file:


(c-add-style "caffeine"
         '((c-basic-offset . 4)
           (c-comment-only-line-offset . 0)
           (c-offsets-alist . ((statement-block-intro . +)
                   (knr-argdecl-intro . +)
                   (substatement-open . 0)
                   (label . 0)
                   (statement-cont . +)
                   (inline-open . 0)
                   (inexpr-class . 0)
                   ))))

This will ensure that the code is indented under the caffeine rules.

Vim Style

For VIM is needed the cino variable. I'm working on that, but isn't ready yet.

Kate Style

On Kate you must turn off the mixed indenting style and set the tab key to insert concrete tabs. As part of KNF indenting style.

Caffeine Hacking Guide

Before you start

You must read the STYLE guide.

  1. What can I do?

  1. Centralized Development

  1. Avoid Compile Warnings

Caffeine is build under strict compilation flags. Common flags to build caffeine are:

-Wall -Wextra -Wshadow -pedantic -std=c99

This means that the code must be 100% C99 (ISO/IEC 9899:1990) compilant. Every compile warning related to this standard, must be removed. To build Caffeine under debugging configuration, see the BUILDING text file.

Related Webpages

The caffeine main web page is located here coder.cl

Authors