From: ian Date: Fri, 22 Oct 2004 10:21:45 +0000 (+0000) Subject: generates segment encoding (but wrong - needs debugging) X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=0492d5393b413ec88e5aaae29c46905f2bb5ef5d;p=trains.git generates segment encoding (but wrong - needs debugging) --- diff --git a/layout/Makefile b/layout/Makefile index a31aea4..f63091b 100644 --- a/layout/Makefile +++ b/layout/Makefile @@ -38,13 +38,13 @@ o=>$@.new && mv -f $@.new $@ ./layout -S1.0 <$< $(LAYOUTOPTS) '-e*A' '-ep=rm' $o ours-g%.ps: ours.d4 ours-g%.segcmap layout - ./layout <$< -l$* $(LAYOUTOPTS_SEGS) -GRours-g$*.segcmap $o + ./layout <$< -l$* $(LAYOUTOPTS_SEGS) -GLours-g$*.segcmap $o ours-g%.segcmap: ours-g%.segcmapreq segcmapassign ./segcmapassign <$< $o ours-g%.segcmapreq: ours.d4 layout - ./layout <$< -l$* $(LAYOUTOPTS_SEGS) -GL $o + ./layout <$< -l$* $(LAYOUTOPTS_SEGS) -GR $o ours-l%.ps: ours.d4 layout ./layout <$< -l$* $(LAYOUTOPTS) $(XLAYOUTOPTS_LAYER) $o diff --git a/layout/layout b/layout/layout index e3e78c7..c5e43b0 100755 --- a/layout/layout +++ b/layout/layout @@ -1,6 +1,9 @@ #!/usr/bin/perl -w use POSIX; +use IO::Handle; +use IO::File; + use strict; no strict 'subs'; @@ -47,15 +50,18 @@ while (@ARGV && $ARGV[0] =~ m/^\-/) { elsif (s/^l(\d+|\*)//) { $output_layer=$1; } elsif (s/^S([0-9.]+)$//) { $scale= $1 * 1.0; } elsif (s/^P(\d+)x(\d+)$//) { $page_x= $1; $page_y= $2; } - elsif (s/^GL//) { $subsegcmapreq=1; } - elsif (s/^GR(.*)$//) { + elsif (s/^GR//) { $subsegcmapreq=1; } + elsif (s/^GL(.*)$//) { my ($sscmfn) = $1; my ($sscmf); local ($_); $sscmf= new IO::File $sscmfn, 'r' or die "$sscmfn: cannot open: $!\n"; - while (<$sscmf>) { - m,^\s*(\w+/(?:[a-z]+\d+))\s+(\S.*\S)\s*$, + for (;;) { + $!=0; $_= <$sscmf>; die $! unless defined $_; + last if m/^E/; + next unless m/^C/; + m,^C\s+(\w*/(?:[A-Za-z_]+\d+)?)\s+(\S.*\S)\s*$, or die "$sscmfn:$.: syntax error in subseg cmap\n"; $subsegcmap{$1}= $2; } diff --git a/layout/segcmapassign b/layout/segcmapassign index 8ddf3ca..f25ec6d 100755 --- a/layout/segcmapassign +++ b/layout/segcmapassign @@ -51,7 +51,7 @@ while (<>) { ($seg,$movfeat,$movconf)=($1,$2,$3); if (!length $seg) { printf("C /%s%s 0 0\n", - $seg, $movfeat, $movconf) + $movfeat, $movconf) or die $!; next; }