#define problem

Discussion in 'C Programming' started by Andreas, Oct 30, 2003.

  1. Andreas

    Andreas Guest

    Hi!

    I'm using an IplImage library from camellia.sourceforge.net, and the
    testbench calls a file only containing code like the one below. In
    cam_morphomaths_code.c the real computation is made, but I don't
    understand where cam_morphomaths_code.c is included and how to set
    what parameters to use in the testbench.

    How does this code execure? I don't understand a bit...

    #undef CAM_MM_NEIGHB
    #define CAM_MM_NEIGHB 5
    #include "cam_morphomaths_code.c"

    #define CAM_MM_ONE_OP

    #undef CAM_MM_NEIGHB
    #define CAM_MM_NEIGHB 3
    #define CAM_MM_DO_EROSION
    #define CamMorphoMathsKernel CamErode3x3
    #define CamMorphoMathsKernel1U CamErode3x31U
    #include "cam_morphomaths_code.c"
    #undef CamMorphoMathsKernel
    #undef CamMorphoMathsKernel1U
    #undef CAM_MM_DO_EROSION
    #define CAM_MM_DO_DILATION
    #define CamMorphoMathsKernel CamDilate3x3
    #define CamMorphoMathsKernel1U CamDilate3x31U
    #include "cam_morphomaths_code.c"
    #undef CAM_MM_DO_DILATION
    #undef CamMorphoMathsKernel
    #undef CamMorphoMathsKernel1U

    #undef CAM_MM_NEIGHB
    #define CAM_MM_NEIGHB 5
    #define CAM_MM_DO_EROSION
    #define CamMorphoMathsKernel CamErode5x5
    #define CamMorphoMathsKernel1U CamErode5x51U
    #include "cam_morphomaths_code.c"
    #undef CamMorphoMathsKernel
    #undef CamMorphoMathsKernel1U
    #undef CAM_MM_DO_EROSION
    #define CAM_MM_DO_DILATION
    #define CamMorphoMathsKernel CamDilate5x5
    #define CamMorphoMathsKernel1U CamDilate5x51U
    #include "cam_morphomaths_code.c"
    #undef CAM_MM_DO_DILATION
    #undef CamMorphoMathsKernel
    #undef CamMorphoMathsKernel1U

    /Andreas
     
    Andreas, Oct 30, 2003
    #1
    1. Advertising

  2. (Andreas) wrote in
    news::

    > Hi!
    >
    > I'm using an IplImage library from camellia.sourceforge.net, and the
    > testbench calls a file only containing code like the one below. In
    > cam_morphomaths_code.c the real computation is made, but I don't
    > understand where cam_morphomaths_code.c is included and how to set
    > what parameters to use in the testbench.
    >
    > How does this code execure? I don't understand a bit...
    >
    > #undef CAM_MM_NEIGHB
    > #define CAM_MM_NEIGHB 5
    > #include "cam_morphomaths_code.c"
    >
    > #define CAM_MM_ONE_OP
    >
    > #undef CAM_MM_NEIGHB
    > #define CAM_MM_NEIGHB 3
    > #define CAM_MM_DO_EROSION
    > #define CamMorphoMathsKernel CamErode3x3
    > #define CamMorphoMathsKernel1U CamErode3x31U
    > #include "cam_morphomaths_code.c"
    > #undef CamMorphoMathsKernel
    > #undef CamMorphoMathsKernel1U
    > #undef CAM_MM_DO_EROSION
    > #define CAM_MM_DO_DILATION
    > #define CamMorphoMathsKernel CamDilate3x3
    > #define CamMorphoMathsKernel1U CamDilate3x31U
    > #include "cam_morphomaths_code.c"
    > #undef CAM_MM_DO_DILATION
    > #undef CamMorphoMathsKernel
    > #undef CamMorphoMathsKernel1U
    >
    > #undef CAM_MM_NEIGHB
    > #define CAM_MM_NEIGHB 5
    > #define CAM_MM_DO_EROSION
    > #define CamMorphoMathsKernel CamErode5x5
    > #define CamMorphoMathsKernel1U CamErode5x51U
    > #include "cam_morphomaths_code.c"
    > #undef CamMorphoMathsKernel
    > #undef CamMorphoMathsKernel1U
    > #undef CAM_MM_DO_EROSION
    > #define CAM_MM_DO_DILATION
    > #define CamMorphoMathsKernel CamDilate5x5
    > #define CamMorphoMathsKernel1U CamDilate5x51U
    > #include "cam_morphomaths_code.c"
    > #undef CAM_MM_DO_DILATION
    > #undef CamMorphoMathsKernel
    > #undef CamMorphoMathsKernel1U


    Each time you include the .c source file, this "harness" re-defines
    certain manifest constants that proabably change the behavior of the C
    module. Each include actually ends up producing a new instantiation of the
    source code, modified by the manifest constants. The functions in the .c
    file are changed for each inclusion to prevent name-space clashes. What's
    not to understand?

    --
    - Mark ->
    --
     
    Mark A. Odell, Oct 30, 2003
    #2
    1. Advertising

  3. Andreas

    Andreas Guest

    Thanks!

    Now it's kind of obvious.

    "Mark A. Odell" <> wrote in message news:<Xns94245EA443871CopyrightMarkOdell@130.133.1.4>...
    > (Andreas) wrote in
    > news::
    >
    > > Hi!
    > >
    > > I'm using an IplImage library from camellia.sourceforge.net, and the
    > > testbench calls a file only containing code like the one below. In
    > > cam_morphomaths_code.c the real computation is made, but I don't
    > > understand where cam_morphomaths_code.c is included and how to set
    > > what parameters to use in the testbench.
    > >
    > > How does this code execure? I don't understand a bit...
    > >
    > > #undef CAM_MM_NEIGHB
    > > #define CAM_MM_NEIGHB 5
    > > #include "cam_morphomaths_code.c"
    > >
    > > #define CAM_MM_ONE_OP
    > >
    > > #undef CAM_MM_NEIGHB
    > > #define CAM_MM_NEIGHB 3
    > > #define CAM_MM_DO_EROSION
    > > #define CamMorphoMathsKernel CamErode3x3
    > > #define CamMorphoMathsKernel1U CamErode3x31U
    > > #include "cam_morphomaths_code.c"
    > > #undef CamMorphoMathsKernel
    > > #undef CamMorphoMathsKernel1U
    > > #undef CAM_MM_DO_EROSION
    > > #define CAM_MM_DO_DILATION
    > > #define CamMorphoMathsKernel CamDilate3x3
    > > #define CamMorphoMathsKernel1U CamDilate3x31U
    > > #include "cam_morphomaths_code.c"
    > > #undef CAM_MM_DO_DILATION
    > > #undef CamMorphoMathsKernel
    > > #undef CamMorphoMathsKernel1U
    > >
    > > #undef CAM_MM_NEIGHB
    > > #define CAM_MM_NEIGHB 5
    > > #define CAM_MM_DO_EROSION
    > > #define CamMorphoMathsKernel CamErode5x5
    > > #define CamMorphoMathsKernel1U CamErode5x51U
    > > #include "cam_morphomaths_code.c"
    > > #undef CamMorphoMathsKernel
    > > #undef CamMorphoMathsKernel1U
    > > #undef CAM_MM_DO_EROSION
    > > #define CAM_MM_DO_DILATION
    > > #define CamMorphoMathsKernel CamDilate5x5
    > > #define CamMorphoMathsKernel1U CamDilate5x51U
    > > #include "cam_morphomaths_code.c"
    > > #undef CAM_MM_DO_DILATION
    > > #undef CamMorphoMathsKernel
    > > #undef CamMorphoMathsKernel1U

    >
    > Each time you include the .c source file, this "harness" re-defines
    > certain manifest constants that proabably change the behavior of the C
    > module. Each include actually ends up producing a new instantiation of the
    > source code, modified by the manifest constants. The functions in the .c
    > file are changed for each inclusion to prevent name-space clashes. What's
    > not to understand?
     
    Andreas, Oct 31, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. prettysmurfed
    Replies:
    3
    Views:
    10,410
    MPBroida
    Oct 24, 2003
  2. theotyflos
    Replies:
    3
    Views:
    506
    Thomas Matthews
    Feb 19, 2004
  3. Daniel Wild

    preprozessor and #define Problem

    Daniel Wild, Jun 25, 2004, in forum: C Programming
    Replies:
    8
    Views:
    333
    Dan Pop
    Jun 28, 2004
  4. robin liu
    Replies:
    3
    Views:
    863
    Robin Liu
    Apr 21, 2006
  5. Brian Takita

    #define _ and #define __

    Brian Takita, Jan 23, 2006, in forum: Ruby
    Replies:
    0
    Views:
    509
    Brian Takita
    Jan 23, 2006
Loading...

Share This Page