473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 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 5555
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.