Break up a Large Source File

  • Follow


I have source that was generated by swig. It is over 120,000 lines
long. This makes it difficult to debug because MSVC 6 won't let me set
a break point past 60,000 something. Anyway I would to break it up
into smaller files. Is there a program or some scripts anyone knows of
that can do this automatically. Thanks in advance!

Jonathan

      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
0
Reply jfischoff 7/27/2004 10:59:52 AM

You could just split up the file into cppfile1.cpp, cppfile2.cpp, etc, and
make sure there in the project.

"Jonathan Fischoff" <jfischoff@yahoo.com> wrote in message
news:f9b594d7.0407261856.bb11ac2@posting.google.com...
> I have source that was generated by swig. It is over 120,000 lines
> long. This makes it difficult to debug because MSVC 6 won't let me set
> a break point past 60,000 something. Anyway I would to break it up
> into smaller files. Is there a program or some scripts anyone knows of
> that can do this automatically. Thanks in advance!
>
> Jonathan



      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
0
Reply Colin 7/28/2004 1:54:50 AM


Hi,

Jonathan Fischoff wrote:
> I have source that was generated by swig. It is over 120,000 lines
> long.

An approach quite different from what you might expect is to... break 
the source that was used as input to SWIG and as a result get two or 
more small C++ output files.

This approach has one serious advantage: SWIG is a generator and all the 
changes you do to its output will be overwritten the next time you run 
it. Breaking the input files has repeatable results, so there's no grief 
and sorrow when you run the SWIG again.


-- 
Maciej Sobczak : http://www.msobczak.com/
Programming    : http://www.msobczak.com/prog/


      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
0
Reply Maciej 7/28/2004 3:04:05 AM

jfischoff@yahoo.com (Jonathan Fischoff) wrote in message news:<f9b594d7.0407261856.bb11ac2@posting.google.com>...
> I have source that was generated by swig. It is over 120,000 lines
> long. This makes it difficult to debug because MSVC 6 won't let me set
> a break point past 60,000 something. Anyway I would to break it up
> into smaller files. Is there a program or some scripts anyone knows of
> that can do this automatically. Thanks in advance!
> 

what's swig, and what does it do? A link please.

Best,
John


John Torjo
Freelancer
-- john@torjo.com

Contributing editor, C/C++ Users Journal
-- "Win32 GUI Generics" -- generics & GUI do mix, after all
-- http://www.torjo.com/win32gui/
   
Professional Logging Solution for FREE
-- http://www.torjo.com/code/logging.zip (logging           - C++)
-- http://www.torjo.com/logview/         (viewing/filtering - Win32)
-- http://www.torjo.com/logbreak/        (debugging         - Win32)
                                         (source code available)

      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
0
Reply jtorjo 8/2/2004 2:26:22 PM

Hi,

John Torjo wrote:

 > what's swig,

http://www.swig.org/exec.html

 > and what does it do? A link please.

http://www.swig.org/

In short: most scripting languages allow to extend the language by
(dynamically) linking to the external modules. This creates the effect
of "importing" the functionality that is compiled into the external
library. This library may be written in C or C++ and that makes it
possible to extend the scripting languages with the functionality
provided by C/C++ libraries.
SWIG is able to generate (based on header files) the necessary C/C++
code that will mediate between the scripting language and the existing
C/C++ module. This means that SWIG can help to *non-intrusively* plug
your C++ module into the script interpreter.

I have a positive experience with this tool.
If you think about exposing your C++ code (a library module, preferably
something that is enough self-contained to form a shared library by its
own) to some scripting language, SWIG is a good starting point.

The only problem is that SWIG generates a glue C/C++ code that is not
really comprehensible (and even the generated comments state clearly
that readability was not the prime concern) and therefore hand-made
tuning is somewhat difficult. But it can be done.


-- 
Maciej Sobczak : http://www.msobczak.com/
Programming    : http://www.msobczak.com/prog/


      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
0
Reply Maciej 8/3/2004 11:18:06 AM

jtorjo@yahoo.com (John Torjo) wrote
 > what's swig, and what does it do? A link please.

See what I get?
Simplified Wrapper and Interface Generator, as seen on http://www.swig.org.
She wants immediate gratification!
Software Worth Investi-Gating
Sure wouldn't ignite gasoline!
South West International Gate (at the airport)
Swell! What's In, Girl?
Shame (that) We Ignore Greatness...
Sleep Well, It's Good
So Why Is Grandma (drooling?)
Snowy Weekends? I'm Grumpy!
So What? I'm green!
Same wait, impossible goal.
Say! Where is Gilligan?!?

      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
0
Reply allan_w 8/3/2004 11:32:18 AM

5 Replies
429 Views

(page loaded in 0.09 seconds)

Similiar Articles:













7/23/2012 6:16:44 PM


Reply: