nto not defined

bridged with qdn.public.qnxrtp.porting
Post Reply
Tray Karra

nto not defined

Post by Tray Karra » Thu Sep 12, 2002 3:44 am

Hello all,
I have a small code which basically allocates physical memory buffers
for DMA purposes. The code was originally written in QNX4.25 and then ported
to QNX6.2 using statements like
#ifdef NTO
mem_offset(....)
#else
qnx_segment_allocate(...)
#endif

The above is just ann example to let you how the code is written. DO NOT
TAKE IT AS IT LOOKS.

My problem is, how do i compile the code?
When I do gcc -c DmaBuffer.cpp .... on QNX6.2, it looks for the old header
files in QNX4.25 which are no longer in QNX6.2 by the same name. How do i
mention that NTO is defined??
Any clues are greatly appreciated..
Thanks,
Tray

Chris McKillop

Re: nto not defined

Post by Chris McKillop » Thu Sep 12, 2002 6:06 am

#if defined(__QNXNTO__)
#define NTO
#endif

That should do it I think.

chris

Tray Karra <tkarra@ces.clemson.edu> wrote:
Hello all,
I have a small code which basically allocates physical memory buffers
for DMA purposes. The code was originally written in QNX4.25 and then ported
to QNX6.2 using statements like
#ifdef NTO
mem_offset(....)
#else
qnx_segment_allocate(...)
#endif

The above is just ann example to let you how the code is written. DO NOT
TAKE IT AS IT LOOKS.

My problem is, how do i compile the code?
When I do gcc -c DmaBuffer.cpp .... on QNX6.2, it looks for the old header
files in QNX4.25 which are no longer in QNX6.2 by the same name. How do i
mention that NTO is defined??
Any clues are greatly appreciated..
Thanks,
Tray

--
Chris McKillop <cdm@qnx.com> "The faster I go, the behinder I get."
Software Engineer, QSSL -- Lewis Carroll --
http://qnx.wox.org/

Mario Charest

Re: nto not defined

Post by Mario Charest » Fri Sep 13, 2002 2:52 am

#ifdef NTO
mem_offset(....)
#else
qnx_segment_allocate(...)
#endif
or

gcc -DNTO=1 -c DmaBuffer.cpp

Igor Kovalenko

Re: nto not defined

Post by Igor Kovalenko » Sat Sep 14, 2002 5:50 pm

Or
sed -e "s/NTO/__QNXNTO__/g" DmaBuffer.cpp >dmabuffer.cpp

;)

"Mario Charest" <postmaster@127.0.0.1> wrote in message
news:alrjh4$9cg$1@inn.qnx.com...

#ifdef NTO
mem_offset(....)
#else
qnx_segment_allocate(...)
#endif


or

gcc -DNTO=1 -c DmaBuffer.cpp


Robert Krten

Re: nto not defined

Post by Robert Krten » Sat Sep 14, 2002 6:12 pm

Igor Kovalenko <kovalenko@attbi.com> wrote:
Or
sed -e "s/NTO/__QNXNTO__/g" DmaBuffer.cpp >dmabuffer.cpp

;)
Shudder :-) I'm against unbounded substitutes like that :-)
For example, it'll change PRONTO to PRO__QNXNTO__ :-(

Cheers,
-RK
"Mario Charest" <postmaster@127.0.0.1> wrote in message
news:alrjh4$9cg$1@inn.qnx.com...


#ifdef NTO
mem_offset(....)
#else
qnx_segment_allocate(...)
#endif


or

gcc -DNTO=1 -c DmaBuffer.cpp



--
Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at www.parse.com.
Email my initials at parse dot com.

Igor Kovalenko

Re: nto not defined

Post by Igor Kovalenko » Sat Sep 14, 2002 6:29 pm

Bah, or course it will. That was meant to be a hint/joke, not literal
advice. What's with the humor sense of people these days... ;)

"Robert Krten" <nospam83@parse.com> wrote in message
news:alvu62$d4d$1@inn.qnx.com...
Igor Kovalenko <kovalenko@attbi.com> wrote:
Or
sed -e "s/NTO/__QNXNTO__/g" DmaBuffer.cpp >dmabuffer.cpp

;)

Shudder :-) I'm against unbounded substitutes like that :-)
For example, it'll change PRONTO to PRO__QNXNTO__ :-(

Cheers,
-RK

"Mario Charest" <postmaster@127.0.0.1> wrote in message
news:alrjh4$9cg$1@inn.qnx.com...


#ifdef NTO
mem_offset(....)
#else
qnx_segment_allocate(...)
#endif


or

gcc -DNTO=1 -c DmaBuffer.cpp






--
Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at www.parse.com.
Email my initials at parse dot com.

Robert Krten

Re: nto not defined

Post by Robert Krten » Sat Sep 14, 2002 8:01 pm

Igor Kovalenko <kovalenko@attbi.com> wrote:
Bah, or course it will. That was meant to be a hint/joke, not literal
advice. What's with the humor sense of people these days... ;)
The problem is, I've done stuff like that (years ago). And then spent *days* kicking myself :-)

Funnier would have been:

sed -e "s/NTO/__QNXNTO__/g" DmaBuffer.cpp >DmaBuffer.cpp

Been there, done that too :-)

Cheers,
-RK
"Robert Krten" <nospam83@parse.com> wrote in message
news:alvu62$d4d$1@inn.qnx.com...
Igor Kovalenko <kovalenko@attbi.com> wrote:
Or
sed -e "s/NTO/__QNXNTO__/g" DmaBuffer.cpp >dmabuffer.cpp

;)

Shudder :-) I'm against unbounded substitutes like that :-)
For example, it'll change PRONTO to PRO__QNXNTO__ :-(

Cheers,
-RK

"Mario Charest" <postmaster@127.0.0.1> wrote in message
news:alrjh4$9cg$1@inn.qnx.com...


#ifdef NTO
mem_offset(....)
#else
qnx_segment_allocate(...)
#endif


or

gcc -DNTO=1 -c DmaBuffer.cpp






--
Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at www.parse.com.
Email my initials at parse dot com.

--
Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at www.parse.com.
Email my initials at parse dot com.

Igor Kovalenko

Re: nto not defined

Post by Igor Kovalenko » Sun Sep 15, 2002 5:36 am

Well, unless you did it they way you did, you have a fallback version.
Pretty safe ;)
And with your way you don't have any version at all, so you'd have bigger
problem than PRONTO being replaced by PRO__QNXNTO__ :p

"Robert Krten" <nospam83@parse.com> wrote in message
news:am04hv$gq3$1@inn.qnx.com...
Igor Kovalenko <kovalenko@attbi.com> wrote:
Bah, or course it will. That was meant to be a hint/joke, not literal
advice. What's with the humor sense of people these days... ;)

The problem is, I've done stuff like that (years ago). And then spent
*days* kicking myself :-)

Funnier would have been:

sed -e "s/NTO/__QNXNTO__/g" DmaBuffer.cpp >DmaBuffer.cpp

Been there, done that too :-)

Cheers,
-RK

"Robert Krten" <nospam83@parse.com> wrote in message
news:alvu62$d4d$1@inn.qnx.com...
Igor Kovalenko <kovalenko@attbi.com> wrote:
Or
sed -e "s/NTO/__QNXNTO__/g" DmaBuffer.cpp >dmabuffer.cpp

;)

Shudder :-) I'm against unbounded substitutes like that :-)
For example, it'll change PRONTO to PRO__QNXNTO__ :-(

Cheers,
-RK

"Mario Charest" <postmaster@127.0.0.1> wrote in message
news:alrjh4$9cg$1@inn.qnx.com...


#ifdef NTO
mem_offset(....)
#else
qnx_segment_allocate(...)
#endif


or

gcc -DNTO=1 -c DmaBuffer.cpp






--
Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at www.parse.com.
Email my initials at parse dot com.



--
Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at www.parse.com.
Email my initials at parse dot com.

Kris Warkentin

Re: nto not defined

Post by Kris Warkentin » Mon Sep 16, 2002 1:38 pm

"Robert Krten" <nospam83@parse.com> wrote in message
news:am04hv$gq3$1@inn.qnx.com...
Igor Kovalenko <kovalenko@attbi.com> wrote:
Bah, or course it will. That was meant to be a hint/joke, not literal
advice. What's with the humor sense of people these days... ;)

The problem is, I've done stuff like that (years ago). And then spent
*days* kicking myself :-)

Funnier would have been:

sed -e "s/NTO/__QNXNTO__/g" DmaBuffer.cpp >DmaBuffer.cpp
I've done these sort of things before but I usually try something like this
to avoid matching other identifiers:

sed -e"s/\([^A-Za-z_]\)NTO\([^A-Za-z_]\)/\1__QNXNTO__\2/g" DmaBuffer.cpp >
foo

Kris

Robert Krten

Re: nto not defined

Post by Robert Krten » Mon Sep 16, 2002 2:07 pm

Kris Warkentin <kewarken@qnx.com> wrote:
"Robert Krten" <nospam83@parse.com> wrote in message
news:am04hv$gq3$1@inn.qnx.com...
Igor Kovalenko <kovalenko@attbi.com> wrote:
Bah, or course it will. That was meant to be a hint/joke, not literal
advice. What's with the humor sense of people these days... ;)

The problem is, I've done stuff like that (years ago). And then spent
*days* kicking myself :-)

Funnier would have been:

sed -e "s/NTO/__QNXNTO__/g" DmaBuffer.cpp >DmaBuffer.cpp

I've done these sort of things before but I usually try something like this
to avoid matching other identifiers:

sed -e"s/\([^A-Za-z_]\)NTO\([^A-Za-z_]\)/\1__QNXNTO__\2/g" DmaBuffer.cpp
Yup.. My version of "vi" has \{ and \} that match the beginning and end
of identifier. So I wouldn't even bother with sed, and just do:

:%s/\{NTO\}/__QNXNTO__/g

which is certainly less grief. But I fear we are going down a rathole :-) :-)

Cheers,
-RK


--
Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at www.parse.com.
Email my initials at parse dot com.

Kris Warkentin

Re: nto not defined

Post by Kris Warkentin » Mon Sep 16, 2002 2:37 pm

"Robert Krten" <nospam83@parse.com> wrote in message
news:am4ojr$o5i$1@inn.qnx.com...
Kris Warkentin <kewarken@qnx.com> wrote:
I've done these sort of things before but I usually try something like
this
to avoid matching other identifiers:

sed -e"s/\([^A-Za-z_]\)NTO\([^A-Za-z_]\)/\1__QNXNTO__\2/g" DmaBuffer.cpp


Yup.. My version of "vi" has \{ and \} that match the beginning and end
of identifier. So I wouldn't even bother with sed, and just do:

:%s/\{NTO\}/__QNXNTO__/g

which is certainly less grief. But I fear we are going down a rathole :-)
:-)
Yeah...but don't you just LOVE regexes? I can think of few things that make
me happier than writing a nasty regex that looks like line noise but does
exactly the weirdness that I was trying to do. ;-)

Kris

Bill Caroselli (Q-TPS)

Re: nto not defined

Post by Bill Caroselli (Q-TPS) » Mon Sep 16, 2002 11:09 pm

Yup! Kind of makes you proud to be an American Nerd!

"Kris Warkentin" <kewarken@qnx.com> wrote in message
news:am4q6f$44q$1@nntp.qnx.com...
"Robert Krten" <nospam83@parse.com> wrote in message
news:am4ojr$o5i$1@inn.qnx.com...
Kris Warkentin <kewarken@qnx.com> wrote:
I've done these sort of things before but I usually try something like
this
to avoid matching other identifiers:

sed -e"s/\([^A-Za-z_]\)NTO\([^A-Za-z_]\)/\1__QNXNTO__\2/g"
DmaBuffer.cpp


Yup.. My version of "vi" has \{ and \} that match the beginning and end
of identifier. So I wouldn't even bother with sed, and just do:

:%s/\{NTO\}/__QNXNTO__/g

which is certainly less grief. But I fear we are going down a rathole
:-)
:-)


Yeah...but don't you just LOVE regexes? I can think of few things that
make
me happier than writing a nasty regex that looks like line noise but does
exactly the weirdness that I was trying to do. ;-)

Kris

Post Reply

Return to “qdn.public.qnxrtp.porting”