 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Steven Fisher Guest
|
Posted: Sun Oct 05, 2003 9:20 am Post subject: A tool to print C/C++ source with smart page breaks? |
|
|
(I'll trust the moderator to decide if this is on topic or not. I've
been looking through the posts and can't really tell.)
I'm looking for a tool to print C/C++ source with smart page breaks that
runs on Mac OS X or Windows. If Windows, something with source available
would be preferred so I could port it at some point. :)
I'm not referring to a "pretty print" tool for reformatting it; I like
my code formatted as it is!
I'm getting really tired of stuff like this (two examples follow, that
probably wouldn't compile, they're just off the top of my head):
/* -------------------------------------------
MySum()
<page break>
Called by Calculations()
Totals input vector of numbers.
*/
Double MySum(double* doubles, UInt32 count)
{
double accum = 0.0;
for (i=0; i<count; i++)
accum = accum + doubles[i];
return accum;
}
Or:
/* -------------------------------------------
MySum()
Called by Calculations()
Totals input vector of numbers.
*/
Double MySum(double* doubles, UInt32 count)
{
double accum = 0.0;
for (i=0; i
accum = accum + doubles[i];
return accum;
}
Anyone have any ideas? :)
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
kanze@gabi-soft.fr Guest
|
Posted: Mon Oct 06, 2003 6:59 pm Post subject: Re: A tool to print C/C++ source with smart page breaks? |
|
|
Steven Fisher <sdfisher (AT) spamcop (DOT) net> wrote
| Quote: | I'm looking for a tool to print C/C++ source with smart page breaks
that runs on Mac OS X or Windows. If Windows, something with source
available would be preferred so I could port it at some point. :)
I'm not referring to a "pretty print" tool for reformatting it; I like
my code formatted as it is!
|
Not a tool, but why don't you just insert the form feeds yourself where
you want the page breaks? The C++ standard requires a form feed to be
accepted anywhere a blank is.
Otherwise: how do you define what is acceptable? The code itself would
be almost trivial (read lines into a deque until you had a pagefull,
then scan backwards to an accepable breakpoint), but defining what is
acceptable isn't.
--
James Kanze GABI Software mailto:kanze (AT) gabi-soft (DOT) fr
Conseils en informatique orientée objet/ http://www.gabi-soft.fr
Beratung in objektorientierter Datenverarbeitung
11 rue de Rambouillet, 78460 Chevreuse, France, +33 (0)1 30 23 45 16
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Attila Feher Guest
|
Posted: Sat Nov 01, 2003 10:23 am Post subject: Re: A tool to print C/C++ source with smart page breaks? |
|
|
[email]kanze (AT) gabi-soft (DOT) fr[/email] wrote:
| Quote: | Steven Fisher <sdfisher (AT) spamcop (DOT) net> wrote in message
news:<SvFfb.15821$6C4.10997@pd7tw1no>...
I'm looking for a tool to print C/C++ source with smart page breaks
that runs on Mac OS X or Windows. If Windows, something with source
available would be preferred so I could port it at some point. :)
I'm not referring to a "pretty print" tool for reformatting it; I
like my code formatted as it is!
Not a tool, but why don't you just insert the form feeds yourself
where you want the page breaks? The C++ standard requires a form
feed to be accepted anywhere a blank is.
Otherwise: how do you define what is acceptable? The code itself
would be almost trivial (read lines into a deque until you had a
pagefull, then scan backwards to an accepable breakpoint), but
defining what is acceptable isn't.
|
That Unix thingy called a2ps works this way. You can instruct it to obey
formfeeds in the original text. And it can reformat code, highlight
keywords - if you want it to. If not, it can be disabled - printing C++ as
text. Then the GhostScript package (also free) can be used to print it
out - if you have no Postscript printer. All is free and IIRC MingW has
them and CygWin surely has it.
--
Attila aka WW
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|