Category : Science and Education
Archive   : PCB.ZIP
Filename : PCBROUTE.C

 
Output of file : PCBROUTE.C contained in archive : PCB.ZIP
/*
** printed circuit board autorouter, Copyright (C) Randy Nevin 1989.
**
** you may give this software to anyone, make as many copies as you like, and
** post it on public computer bulletin boards and file servers. you may not
** sell it or charge any fee for distribution (except for media and postage),
** remove this comment or the copyright notice from the code, or claim that
** you wrote this code or anything derived from it. you may modify the code as
** much as you want (please document clearly with comments, and maintain the
** coding style), but programs which are derived from this one are subject to
** the conditions stated here. i am providing this code so that people can
** learn from it, so if you distribute it, please include source code, not
** just executables. contact me to report bugs or suggest enhancements; i do
** not guarantee support, but i will make an effort in good faith to help you,
** and i want to act as a central clearing house for future versions. you
** should contact me before undertaking a significant development effort, to
** avoid reinventing the wheel. if you come up with an enhancement you
** consider particularly useful, i would appreciate being informed so that it
** can be incorporated in future versions. my address is: Randy Nevin,
** 1731 211th PL NE, Redmond, WA 98053. this code is available directly from
** the author; just send a floppy and a self-addressed floppy mailer with
** sufficient postage.
**
** HISTORY
** (name date description)
** ----------------------------------------------------
** randy nevin 2/1/89 initial version
** randy nevin 2/4/89 made retrace table driven, instead of
** doubly-nested switch statements.
** randy nevin 2/4/89 changed dir from int to char (cut
** storage for it in half).
** randy nevin 2/8/89 changed SetQueue and ReSetQueue to
** give priority to goal nodes.
** randy nevin 2/11/89 don't output incremental search
** results if stdout is redirected.
** randy nevin 2/11/89 released version 1.00
** randy nevin 5/7/89 added /N switch (don't sort
** non-PRIORITY CONNECTs)
*/

#include
#include
#include
#include
#include
#include "cell.h"

/*
** if you run out of memory while routing large boards, there are two things
** you can do: (1) go into your config.sys file and disable everything you
** don't need. getting rid of things like ansi.sys, ramdisks, disk caches, and
** other terminate and stay resident (tsr) programs can free a lot of memory.
** (2) link the router, inspect the .map file, relink with the /CPARMAXALLOC:n
** switch, where n is calculated to allow for a near heap of about 5k. read
** the linker documentation before you do this. for me, the route.map file
** says the program needs 81EFh bytes. to this i add 1400h (5k) for a near
** heap to get 95EFh bytes or 95Fh paragraphs, which is 2399 decimal.
*/

int JustBoard = 0; /* need all data structures, not just the board */
int SortConnects = 1; /* default is to sort non-PRIORITY CONNECTs */

extern void Initialize( FILE *, int );
extern void Solve( void );
extern void Report( FILE * );

void main( int, char *[] );

void main ( argc, argv ) /* input board, route traces, output routed board */
int argc;
char *argv[];
{
char *self, *p;
FILE *fin, *fout;
long start, stop;

printf( "Copyright (C) Randy Nevin, 1989. Version 1.00\n" );
printf( "See source code for rights granted.\n\n" );
start = time( NULL );
self = argv[0];
/* get rid of initial part of path */
if ((p = strrchr( self, '\\' )) || (p = strrchr( self, ':' )))
self = ++p;
/* get rid of extension */
if ((p = strrchr( self, '.' )) && !stricmp( p, ".EXE" ))
*p = 0;
if (argc == 4 && *(argv[1]) == '/' && (*(argv[1]+1) == 'n'
|| *(argv[1]+1) == 'N') && !*(argv[1]+2)) {
SortConnects = 0; /* don't do sorting */
argv[1] = argv[2];
argv[2] = argv[3];
argc = 3;
}
else if (argc != 3) { /* need infile and outfile */
fprintf( stderr, "usage: %s [/N] infile outfile\n", self );
fprintf( stderr,
" /N = no sorting of non-PRIORITY CONNECTs\n" );
exit( -1 );
}
if (!(fin = fopen( argv[1], "r" ))) {
fprintf( stderr, "can't open %s\n", argv[1] );
exit( -1 );
}
if (!(fout = fopen( argv[2], "wb" ))) {
fprintf( stderr, "can't open %s\n", argv[2] );
exit( -1 );
}
Initialize( fin, 1 ); /* echo memory used */
Solve();
Report( fout );
stop = time( NULL ) - start;
printf( "time = %ld second%s\n", stop, (stop == 1) ? "" : "s" );
exit( 0 );
}


  3 Responses to “Category : Science and Education
Archive   : PCB.ZIP
Filename : PCBROUTE.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/