Citizens of the Imperium

Citizens of the Imperium (http://www.travellerrpg.com/CotI/Discuss/index.php)
-   Software Solutions (http://www.travellerrpg.com/CotI/Discuss/forumdisplay.php?f=63)
-   -   Making big PDF maps (http://www.travellerrpg.com/CotI/Discuss/showthread.php?t=11576)

Flynn April 13th, 2004 10:20 AM

Perl code? Would you mind sharing that, and how to set it up to run? [img]smile.gif[/img]

Thanks,
Flynn

Flynn April 13th, 2004 12:03 PM

Pushing my envelope somewhat, as I'm not a C/C++ programmer, but I thought I'd see what could be done anyway...

Okay, I've tried downloading a C/C++ compiler off the internet and running nroute.c through it. Unfortunately, I get the following issues from the program itself:

</font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">nroute.c:
if( p = strrchr( out, '.' ) ) *p = 0;
^
nroute.c(120) : Warning 2: possible unintended assignment
if( (p = strchr( buf, '1' ))) POS=p-buf; else return;
^
nroute.c(145) : Warning 2: possible unintended assignment
if( (p = strchr( buf, '2' ))) PORT=p-buf; else return;
^
nroute.c(146) : Warning 2: possible unintended assignment
if( (p = strchr( buf, '3' ))) BASE=p-buf; else return;
^
nroute.c(148) : Warning 2: possible unintended assignment
if( (p = strchr( buf, '4' ))) TRADE=p-buf; else return;
^
nroute.c(149) : Warning 2: possible unintended assignment
if( (p = strchr( buf, '5' ))) ZONE=p-buf; else return;
^
nroute.c(150) : Warning 2: possible unintended assignment
if( (p = strchr( buf, '6' ))) GAS=p-buf+2; else return;
^
nroute.c(151) : Warning 2: possible unintended assignment
if( (p = strchr( buf, '7' ))) ALIGN=p-buf; else return;
^
nroute.c(152) : Warning 2: possible unintended assignment</pre>[/QUOTE]Any thoughts?

-Flynn

FlightCommanderSolitude April 13th, 2004 01:54 PM

Those are just warnings*, and the compilation should have produced an executable anyway, unless there were actual errors - perhaps you only posted some of the compiler's output. In any case, there aren't any errors there.

* The coder is doing two things in one go: assigning something to the variable p, and then testing the value of p; a common enough C idiom, but the compiler doesn't neccessarily know the programmer meant to do that, hence the warning.

vutpakdi April 13th, 2004 02:00 PM

Quote:

Originally posted by Flynn:
Pushing my envelope somewhat, as I'm not a C/C++ programmer, but I thought I'd see what could be done anyway...

Okay, I've tried downloading a C/C++ compiler off the internet and running nroute.c through it. Unfortunately, I get the following issues from the program itself:

</font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">nroute.c:
if( p = strrchr( out, '.' ) ) *p = 0;
^
nroute.c(120) : Warning 2: possible unintended assignment</pre>

Any thoughts?
[/quote]&lt;dusts off a really dusty and dirty C/C++ cap&gt; I think that those warnings should be okay (ie, whoever wrote that really did want to do the assignment and then test the result). But, that being said, it something acts funny when you run the program, you could try changing the = to ==.

Ron

Flynn April 13th, 2004 04:02 PM

Thanks, Ron,

Making those changes removed the warnings. The only errors now come from the file I'm processing itself. :(

More later,
Flynn

vutpakdi April 13th, 2004 05:17 PM

Quote:

Originally posted by Flynn:

Making those changes removed the warnings. The only errors now come from the file I'm processing itself. :(

Well, you might want/need to keep the assignments as they were since the original developer could have intended for them to be there. There should be a compiler switch to allow the executable to be built even if there are warnings but not errors(this is usually the default, I think).

I generally avoid(ed) doing assignments in conditionals for this exact reason: later on, discerning the intent is easier even if the code is more verbose.

Ron

FlightCommanderSolitude April 13th, 2004 05:19 PM

Ack! Making those changes will, of course, completely alter the logic of the program.

Straybow April 14th, 2004 03:08 AM

Programmers never document :mad:

vutpakdi April 14th, 2004 07:57 AM

Quote:

Originally posted by Straybow:
Programmers never document :mad:
Nah, some do (I do somewhat, on the rare occasions that I code these days: I'm a UI designer now). I did have a professor who declared that in code comments can be dangerous because they tend not to be updated when the code changes. He always advocated making the code as clear (if verbose) as possible and keeping comments to a minimum.

Ron

tjoneslo April 14th, 2004 10:05 AM

Gee Flynn, I didn't realise you'd actually try this.

http://www.cs.wisc.edu/~ghost/doc/AFPL/6.50/Ps2pdf.htm
This is a link to PS2PDF, which is included with most of the RedHat Linux distributions.

The NRoute code from Anthony site also assume you are running it on a Linux server (or at least a Unix one). If you are not, you will have a porting job on your hands.

As others have noted, the warnings can be ignored as the assignments in the conditionals are intentional.

Start with reviewing the blankmap.ps file (it the postscript text file that forms the basis of the postscript file you will convert later).

Next look through the nroute.c code for the show_sector () function. A careful reading of the items begin written will show how the postscript is written. And then it calls the ps2pdf to convert the postscript ot a pdf file.

I took a look this morning and realized I lost the fixes for the nroute to produce the quadrant code when the our red hat server got upgraded. If you are really interested I can reproduce it.

Otherwise, If you only want one or two, you may be able to write by hand the PS file for your notes or tweak the show_sector() code.

Don't forget though, PDF is a page oriented file format, it likes things to be on a 8x11 page (or similar).


All times are GMT -4. The time now is 12:22 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright (c) 2010-2013, Far Future Enterprises. All Rights Reserved.