next up previous contents
Next: Adding a Step Up: Adding a module Previous: Adding a module   Contents

Formats

The example source code explains which rules for commenting I generally follow.

 /****************************************************************
  *    ts16                                                      *
  *                                                              *
  * truncated sinc 16 points                                     *
  *                                                              *
  * input:                                                       *
  *  - x-axis                                                    *
  * output:                                                      *
  *  - y=f(x); function evaluated at x                           *
  *                                                              *
  *    Bert Kampes, 16-Mar-1999                                  *
  ****************************************************************/
 matrix<real4> ts16(
         const matrix<real4> &x)
   {
 #ifdef __DEBUG
   DEBUG("ts16.");
   if (x.pixels() != 1)
     ERROR("ts16: standing vectors only.");
 #endif
   matrix<real4> y(x.lines(),1);
   for (register int32 i=0;i<y.lines();i++)
     y(i,0) = sinc(x(i,0)) * rect(x(i,0)/16.);
   return y;
   } // END ts16

Indenting is done with 2 spaces, with the curly braces as shown below.

if (expression)
  {
    action1;
    action2;
  }

You can display information (depending on the value of the variable displevel) with the functions:

 DEBUG(char[ONE27]);
 INFO(char[ONE27]); 
 PROGRESS(char[ONE27]); 
 WARNING(char[ONE27]); 
 ERROR(char[ONE27]);



Leijen 2009-04-14