[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: CVS update: refdes_renum



  User: danmc   
  Date: 05/12/20 19:09:56

  Modified:    .        refdes_renum
  Log:
  - Fix a bug where when using the --pgskip option, components which were 
  
    present on page n, but not on pages n+1 through n+j, and present again
  
    on page n+j+1 got numbered in a strange way.  For example, J101 on page
  
    1, no connectors on page 2, J201 on page 3 instead of J301.  Noted by
  
    Stuart Brorson.
  
  
  
  - While here allow the user to change the default increment from 100 to whatever
  
    they want.
  
  
  
  - Also fix a bug where exactly 101 components with the same refdes prefix
  
    would cause a duplicate refdes on the next page.
  
  
  
  
  Revision  Changes    Path
  1.2       +30 -8     eda/geda/devel/utils/scripts/refdes_renum
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: refdes_renum
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/utils/scripts/refdes_renum,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- refdes_renum	21 Feb 2003 03:21:12 -0000	1.1
  +++ refdes_renum	21 Dec 2005 00:09:56 -0000	1.2
  @@ -1,6 +1,6 @@
   #!/usr/bin/perl -w
   #
  -# $Id: refdes_renum,v 1.1 2003/02/21 03:21:12 ahvezda Exp $
  +# $Id: refdes_renum,v 1.2 2005/12/21 00:09:56 danmc Exp $
   #
   # Copyright (C) 2003 Dan McMahill
   #
  @@ -38,14 +38,20 @@
   
   &GetOptions(("help" => \&usage, 
   	     "nocopy" => \$nocopy,
  -	     "pgskip" => \$pkgskip,
  +	     "pgskip:i" => \$pgskip,
   	     "verbose" => \$verbose,
   	     "version" => \&version
   	     ));
   
   usage() if $Getopt::Long::error;
  +
  +# set the default increment for sheets
  +unless( $pgskip ) { $pgskip = 100; }
  +
   usage() unless @ARGV;
   
  +
  +
   # make sure the input schematic exists and we can read it
   $i=0;
   while(@ARGV) {
  @@ -83,7 +89,7 @@
   
       # if we're skipping numbers, then start at 100 for page 1
       # and we'll jump to 200 for page 2, etc.
  -    if( ! $devcnt{$pre} ) { $devcnt{$pre} = $pkgskip ? ($i+1)*100 : 0; }
  +    if( ! $devcnt{$pre} ) { $devcnt{$pre} = $pgskip ? ($i+1)*$pgskip : 0; }
       $devcnt{$pre}++;
       print "Renumbering $line to $pre$devcnt{$pre}\n" if($verbose);
       print OUTNET "refdes=$pre$devcnt{$pre}\n";
  @@ -93,9 +99,17 @@
   
     # round each element up to the next 100 to help identify what
     # schematic page a component is on by the refdes.
  -  if( $pkgskip ) {
  +  if( $pgskip ) {
         foreach $dev (keys %devcnt) {
  -	  $devcnt{$dev} = 100*POSIX::ceil($devcnt{$dev}/100);
  +	  my $new_cnt = ($i + 2)*$pgskip;
  +	  if( $new_cnt < $devcnt{$dev} ) {
  +	      print STDERR "ERROR:  You have more than $pgskip elements with\n";
  +	      print STDERR "prefix $dev on this sheet.  You will need to either\n";
  +	      print STDERR "reduce this number or specify a larger step with the\n";
  +	      print STDERR "--pgskip argument.\n";
  +	      exit( 1 );
  +	  }
  +	  $devcnt{$dev} = $new_cnt;
   	  print "Incremented \"$dev\" counter to $devcnt{$dev}\n" if($verbose);
         }
     }
  @@ -129,7 +143,7 @@
     $pname =~ s/.*\///g;
   
     print "Usage:\n\n";
  -  print "\t$pname [--nocopy] [--pgskip] file1 [file2 [file3 ... ] ]\n";
  +  print "\t$pname [--nocopy] [--pgskip [number] ] file1 [file2 [file3 ... ] ]\n";
     print "\t$pname --help\n";
     print "\t$pname --version\n";
     print "\n";
  @@ -147,12 +161,17 @@
     print "\n";
     print "    --pgskip    When this flag is used, components on the first schematic sheet\n";
     print "                are numbered starting with 101.  On the second sheet, they start\n";
  -  print "                with 201, etc.  \n";
  +  print "                with 201, etc  Specifying a value gives the step between pages.\n";
  +  print "                For example --pgskip 10 will start with 11, 21, 31, etc.\n";
     print "\n";
     print "    --verbose   Enables verbose output.\n";
     print "\n";
     print "    --version   Shows the version of this program.\n";
     print "\n\n";
  +  print "Example:\n\n";
  +  print "\t$pname mysch.sch\n";
  +  print "\t$pname --pgskip pg1.sch pg2.sch pg3.sch\n";
  +  print "\n\n";
     print "$pname was written by Dan McMahill <dmcmahill\@netbsd.org>\n";
     print "\n\n";
     exit;
  @@ -187,6 +206,19 @@
   # Change Log
   #
   # $Log: refdes_renum,v $
  +# Revision 1.2  2005/12/21 00:09:56  danmc
  +# - Fix a bug where when using the --pgskip option, components which were
  +#   present on page n, but not on pages n+1 through n+j, and present again
  +#   on page n+j+1 got numbered in a strange way.  For example, J101 on page
  +#   1, no connectors on page 2, J201 on page 3 instead of J301.  Noted by
  +#   Stuart Brorson.
  +#
  +# - While here allow the user to change the default increment from 100 to whatever
  +#   they want.
  +#
  +# - Also fix a bug where exactly 101 components with the same refdes prefix
  +#   would cause a duplicate refdes on the next page.
  +#
   # Revision 1.1  2003/02/21 03:21:12  ahvezda
   # Added scripts/refdes_renum written by Dan McMahill
   #