Traveller Store CotI Features New Posts Mark Forums Read Register


Go Back TravellerRPG.com > Citizens of the Imperium > General Traveller Discussions > Software Solutions

Software Solutions Discussions on Traveller related software.

Reply
 
Thread Tools Display Modes
  #11  
Old April 13th, 2004, 10:20 AM
Flynn's Avatar
Flynn Flynn is offline
Citizen: SOC-14
 
Join Date: Aug 2002
Location: Austin, TX, USA
Posts: 2,720
Gallery : 0
Visit Flynn's Blog
Flynn Citizen
Send a message via AIM to Flynn
Post

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

Thanks,
Flynn
__________________
Jason "Flynn" Kemp
Editor of Stellar Reaches, a free fanzine for Traveller T20 and Classic Traveller
http://stellarreaches.nwgamers.org/
Reply With Quote
  #12  
Old April 13th, 2004, 12:03 PM
Flynn's Avatar
Flynn Flynn is offline
Citizen: SOC-14
 
Join Date: Aug 2002
Location: Austin, TX, USA
Posts: 2,720
Gallery : 0
Visit Flynn's Blog
Flynn Citizen
Send a message via AIM to Flynn
Post

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
__________________
Jason "Flynn" Kemp
Editor of Stellar Reaches, a free fanzine for Traveller T20 and Classic Traveller
http://stellarreaches.nwgamers.org/
Reply With Quote
  #13  
Old April 13th, 2004, 01:54 PM
FlightCommanderSolitude FlightCommanderSolitude is offline
Citizen: SOC-13
 
Join Date: Apr 2001
Location: SF, CA
Posts: 553
Gallery : 0
FlightCommanderSolitude Citizen
Post

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.
Reply With Quote
  #14  
Old April 13th, 2004, 02:00 PM
vutpakdi's Avatar
vutpakdi vutpakdi is offline
Citizen: SOC-13
 
Join Date: Aug 2002
Location: Houston, TX
Posts: 589
Gallery : 0
vutpakdi Citizen
Post

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
Reply With Quote
  #15  
Old April 13th, 2004, 04:02 PM
Flynn's Avatar
Flynn Flynn is offline
Citizen: SOC-14
 
Join Date: Aug 2002
Location: Austin, TX, USA
Posts: 2,720
Gallery : 0
Visit Flynn's Blog
Flynn Citizen
Send a message via AIM to Flynn
Post

Thanks, Ron,

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

More later,
Flynn
__________________
Jason "Flynn" Kemp
Editor of Stellar Reaches, a free fanzine for Traveller T20 and Classic Traveller
http://stellarreaches.nwgamers.org/
Reply With Quote
  #16  
Old April 13th, 2004, 05:17 PM
vutpakdi's Avatar
vutpakdi vutpakdi is offline
Citizen: SOC-13
 
Join Date: Aug 2002
Location: Houston, TX
Posts: 589
Gallery : 0
vutpakdi Citizen
Post

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
Reply With Quote
  #17  
Old April 13th, 2004, 05:19 PM
FlightCommanderSolitude FlightCommanderSolitude is offline
Citizen: SOC-13
 
Join Date: Apr 2001
Location: SF, CA
Posts: 553
Gallery : 0
FlightCommanderSolitude Citizen
Post

Ack! Making those changes will, of course, completely alter the logic of the program.
Reply With Quote
  #18  
Old April 14th, 2004, 03:08 AM
Straybow's Avatar
Straybow Straybow is offline
Citizen: SOC-14
 
Join Date: Jan 2004
Location: not too hot, not too cold
Posts: 1,738
Gallery : 0
Straybow Citizen
Post

Programmers never document
__________________
(\__/). Save a bunny, eat more Smurf! (Brought to you by the National Smurfmeat Council)
(='.'=) Smurf, the original blue meat! 1999, and (except that "Smurf" bit)
(")_(") tc+ ru- c+ au+ ls- pi he++ eti=0 hs++ pc++ !zuchai(=dilithium)
Han shot first, and per parsec pricing is RAW!
Reply With Quote
  #19  
Old April 14th, 2004, 07:57 AM
vutpakdi's Avatar
vutpakdi vutpakdi is offline
Citizen: SOC-13
 
Join Date: Aug 2002
Location: Houston, TX
Posts: 589
Gallery : 0
vutpakdi Citizen
Post

Quote:
Originally posted by Straybow:
Programmers never document
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
Reply With Quote
  #20  
Old April 14th, 2004, 10:05 AM
tjoneslo tjoneslo is offline
Citizen: SOC-14
 
Join Date: Feb 2001
Location: Ferrisburgh, VT, USA
Posts: 2,885
Gallery : 2
Visit tjoneslo's Blog
tjoneslo Citizen+tjoneslo Citizen+tjoneslo Citizen+
Post

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).
__________________
Archduke of the Solomani Rim - Terra (Solomani Rim 1827)
Duke Akumid - Akumid (Vland 1628)
Marquis Yeremyh - Yeremyh (Solomani Rim 1804)
Marquis Hysyl - Hysyl (Deneb 2425)
Baron Regina - Regina (Spinward Marches 1910)
TAS member - Vipan (Empty Quarter 1038)
Be part of the Traveller history:http://wiki.travellerrpg.com/Main_Page
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

This website and its contents are copyright ©2010- Far Future Enterprises. All rights reserved. Traveller is a registered trademark of Far Future Enterprises .
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2010-2013, Far Future Enterprises. All Rights Reserved.