Difference between revisions of "Concept of meta"

From Ethersex_Wiki
Jump to: navigation, search
m
Line 3: Line 3:
 
== Intro ==
 
== Intro ==
 
With meta information in each module the main program is set up depending on the configuration.
 
With meta information in each module the main program is set up depending on the configuration.
AT the end there will be a short exemaple of such meta information.
+
At the end there will be a short example of such meta information.
  
== meta.c ==
+
== meta.c / meta_magic.m4 ==
 
The creation of this file is mainly controlled by the file "meta_magic.m4".
 
The creation of this file is mainly controlled by the file "meta_magic.m4".
  
What is in the file?
+
What is in the file meta_magic.m4?
 +
 
 +
=== framework of the file meta.c ===
 +
The framework consists of several divert sections, in which code of the used modules is injected.
 +
 
 +
Only the idea of the injection is explained with the first injection point.
 +
 
 +
The second section starts with "divert(initearly_divert)dnl" and contains the function "ethersex_meta_init", but the final closing brace of the function is missing. So if you define further divert sections with the index "initearly_divert", then it will be in the output before the closing brace and so part of "ethersex_meta_init".
 +
 
 +
Therefore later in in the file some macros are defined - in this case it is named "initearly".
 +
 
 +
This macros and some others are all defined the same way:
 +
 
 +
define(`initearly',`dnl
 +
divert(inetearly_divert) $1 ();
 +
divert(-1)')
 +
 
 +
So if the meta macro initearly(<module-initearly-functionname>) is used, the module initearly function will be called from the function ethersex_meta_init, because the function call will be in the output directly after the section.
 +
 
 +
The closing brace of the function is part of the next section "divert(net_init_divert)".
 +
 
  
  

Revision as of 19:37, 1 May 2012

Intro

With meta information in each module the main program is set up depending on the configuration. At the end there will be a short example of such meta information.

meta.c / meta_magic.m4

The creation of this file is mainly controlled by the file "meta_magic.m4".

What is in the file meta_magic.m4?

framework of the file meta.c

The framework consists of several divert sections, in which code of the used modules is injected.

Only the idea of the injection is explained with the first injection point.

The second section starts with "divert(initearly_divert)dnl" and contains the function "ethersex_meta_init", but the final closing brace of the function is missing. So if you define further divert sections with the index "initearly_divert", then it will be in the output before the closing brace and so part of "ethersex_meta_init".

Therefore later in in the file some macros are defined - in this case it is named "initearly".

This macros and some others are all defined the same way:

define(`initearly',`dnl
divert(inetearly_divert) $1 ();
divert(-1)')

So if the meta macro initearly(<module-initearly-functionname>) is used, the module initearly function will be called from the function ethersex_meta_init, because the function call will be in the output directly after the section.

The closing brace of the function is part of the next section "divert(net_init_divert)".