Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > #define problem

Reply
Thread Tools

#define problem

 
 
Andreas
Guest
Posts: n/a
 
      10-30-2003
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
 
Reply With Quote
 
 
 
 
Mark A. Odell
Guest
Posts: n/a
 
      10-30-2003
http://www.velocityreviews.com/forums/(E-Mail Removed) (Andreas) wrote in
news:(E-Mail Removed) om:

> 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 ->
--
 
Reply With Quote
 
 
 
 
Andreas
Guest
Posts: n/a
 
      10-31-2003
Thanks!

Now it's kind of obvious.

"Mark A. Odell" <(E-Mail Removed)> wrote in message news:<Xns94245EA443871CopyrightMarkOdell@130.133.1 .4>...
> (E-Mail Removed) (Andreas) wrote in
> news:(E-Mail Removed) om:
>
> > 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?

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem problem problem :( Need Help Mike ASP General 2 05-11-2004 08:36 AM



Advertisments