472,951 Members | 2,007 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,951 software developers and data experts.

#define problem

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
Nov 13 '05 #1
2 5528
d9****@efd.lth.se (Andreas) wrote in
news:f7**************************@posting.google.c 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 ->
--
Nov 13 '05 #2
Thanks!

Now it's kind of obvious.

"Mark A. Odell" <no****@embeddedfw.com> wrote in message news:<Xn********************************@130.133.1 .4>...
d9****@efd.lth.se (Andreas) wrote in
news:f7**************************@posting.google.c 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?

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Rayer | last post by:
I have got some project src, and find it out that there is no ppl using "const" to define a constance, but using #define still more. Discussing with my friend, he said 1. #define is much easier in...
18
by: Bryan Parkoff | last post by:
"#define" can only be inside the global scope before main() function. "#if" can be tested after "#define" is executed. The problem is that "#define" can't be inside main() function. I do not wish...
9
by: pozz | last post by:
Hi all, I have the below #defines #define NUMBER1 30 #define NUMBER2 50 #define SUM (NUMBER1+NUMBER2) #define STRING1 "Byte: \x30" #define STRING2 "Byte: \x50"...
9
by: Harshit | last post by:
I am working on socket programming, encountered a new and strange problem today. I am using #define PORT 80, before main(), and I am calling PORT in one of the statments inside main(), I get an...
5
by: eiji | last post by:
Hi folks, I hope this is not "off topic"! :-) Consider the next code: /* Declarations of types that could become platform-dependent */ #define MyChar char #define MyInt int
29
by: Ancient_Hacker | last post by:
It sure would be nice if I could have a macro that add a level of indirection to its argument. So if I write: AddIndirection( X ) The macro AddIndirection will do: #define X (*X) ...
3
by: ashwani | last post by:
Hi Can any one tell me the difference between preprocessor macros like #define and enum. If i want to define MAX_LIMIT=100 as preprocessor macro as #define MAX_LIMIT 100 or if i define enum...
71
by: David T. Ashley | last post by:
Where is the best place to define TRUE and FALSE? Are they in any of the standard include files, ever? Do any standards apply? What I've traditionally done is something like: #ifndef...
28
by: ravi | last post by:
Hello everybody, I am writing a small application which does some work before the user main function starts execution. I am trying to #define the main function. But the problem is that,
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.