Mail Archives: djgpp/1995/02/13/11:28:39
Eeewww... I didn't realize how messy this problem was until I started
trying to describe it. :/
I have one source file that does all of my graphics primitives (all four
of them - this prog only needs a few very specific ones) called video.cc.
In order to make the thing a little smaller, I broke some of it into three
separate files - vga.cc, svga.cc and text.cc. I kept the clipping and
palette functions in video.cc, and #included the other three towards the
end of video.cc. I like this arrangement, it makes me happy. I like my
source files to be around 4k. (text.cc is only ~1k, but it's a sacrifice I
had to make...)
Here's an illustration of what I'm talking about:
// begin video.cc
// .. clipping functions
// .. palette functions
#include "vga.cc"
#include "svga.cc"
#include "text.cc"
// one function that will start any graphics or text mode
// end video.cc
My problem is this. When I debug my graphics stuff, gdb doesn't seem to
realize when the function it's debugging is in one of the sub-modules. In
other words, if I call StartVesa() which is in svga.cc, it'll say something
like "line 197 out of range - video.cc has only 150 lines" or something
like that. I want a way to have the debug info in my program let gdb know
that the function it's looking for is really in another file.
Now I only expect this for normal functions - like the mode set
function. I don't expect ScreenBlockVesa256Grey() to work because I call
it via a variable pointer called ScreenBlock which is in video.cc.
Please don't tell me to reorganize my code - I can't very easily since
there's some weird interdependancies going on. vga.cc depends on the
palette and clipping code, and the function after I #include vga.cc
depends on the code in vga.cc. I don't want to use headers since that
would give the user prototypes for functions I don't want to be public. I
don't want to stick the vga code in video.cc since it makes video.cc too
busy and complicated.
I have tried using the #line directive described in the docs, but it
didn't work very well - cpp gave me an error saying I used it the wrong
way. What I had done was put...
#line 1 vga.cc
... at the very top of vga.cc.
Kim
- Raw text -