chiark / gitweb /
abortive segment movpos-specific mapping arrangements (actually unneeded because... branch-deadend-2008-04-13-fiddlesegs
authorian <ian>
Sun, 13 Apr 2008 15:16:30 +0000 (15:16 +0000)
committerian <ian>
Sun, 13 Apr 2008 15:16:30 +0000 (15:16 +0000)
layout/informat.txt
layout/layout
layout/ours.m4

index c65471e505d2d3539de5e117ffcc14f569d412b3..0b71b89deae826b9e78b41ed50348fe8e85c90d9 100644 (file)
@@ -92,9 +92,12 @@ Commands
 
    S       D
    ----    ----
-   N       N'     remaps an entire segment including all features
-   N/M     M'     remaps a particular moveable feature; N is the
-                    unmapped name (if applicable)
+   N       N'         remaps an entire segment including all features
+   N/M     M'         remaps a particular moveable feature; N is the
+                        unmapped name (if applicable)
+   N/[MP]  N'/[M'P']  remaps a specific moveable feature position to a
+                        specific other moveable feature position;
+                       empty M and M' mean the fixed portions.
 
   The effect is that (sub)segments or features used in segment
   commands are translated when the segment command is read; the
index 72fc31b3fc70f9107d0bf71ffddf4b0e0b2da79b..678878c1648a29b5d7861b4e7b30f5b07ba8053c 100755 (executable)
@@ -229,8 +229,9 @@ our $allwidthmin= allwidth(undef);
 #  $ctx->{SegName}        # initial segment name (at start of object or file)
 #                         #  or nonexistent if in object in unknown segment
 #                         #  may have leading `-'
-#  $ctx->{SegMapN}{$s}= $o
-#  $ctx->{SegMapNM}{$s}= $o
+#  $ctx->{SegMapN2N}{$s}= $o
+#  $ctx->{SegMapNM2M}{$s}= $o
+#  $ctx->{SegMapNMP2NMP}{$s}= $o
 #  $ctx->{SavedSegment}   # exists iff segment command used, is a $csss
 #  $ctx->{Layer}{Level}
 #  $ctx->{Layer}{Kind}
@@ -1268,8 +1269,9 @@ sub newctx (;$) {
        Trans => { X => 0.0, Y => 0.0, A => 0.0, R => 1.0 },
        InRunObj => "",
        DrawMap => sub { $_[0]; },
-       SegMapN => { },
-       SegMapNM => { }
+       SegMapN2N => { },
+       SegMapNM2M => { },
+       SegMapNMP2NMP => { },
        };
     if (defined $ctx_save) {
        %{ $ctx->{Layer} }= %{ $ctx_save->{Layer} };
@@ -1345,7 +1347,7 @@ sub cva_subsegspec ($) {
        $segname= '';
        $sign= '';
     } else {
-       my ($map_ctx);
+       my ($map_ctx,$specifickey);
        
        $ctx->{SegName} =~ m/^\-?/ or die;
        $sign .= $&;
@@ -1354,12 +1356,21 @@ sub cva_subsegspec ($) {
        for ($map_ctx= $ctx;
             defined $map_ctx;
             $map_ctx= $map_ctx->{Parent}) {
+           $specifickey= $segname.'/'.
+               (defined $movfeat ? sprintf "%s%d", $movfeat, $movconf : '');
+           if (exists $map_ctx->{SegMapNMP2NMP}{$specifickey}) {
+               $map_ctx->{SegMapNMP2NMP}{$specifickey} =~
+                   m,^(\-?)(.*)/([A-Za-z]*)(\d*)$, or die;
+               $sign .= $1;
+               $segname= $2;
+               ($movfeat,$movconf)= length($3) ? ($3,$4) : (undef,undef);
+           }
            if (defined $movfeat &&
-               exists $map_ctx->{SegMapNM}{"$segname/$movfeat"}) {
-               $movfeat= $map_ctx->{SegMapNM}{"$segname/$movfeat"};
+               exists $map_ctx->{SegMapNM2M}{"$segname/$movfeat"}) {
+               $movfeat= $map_ctx->{SegMapNM2M}{"$segname/$movfeat"};
            }
-           if (exists $map_ctx->{SegMapN}{$segname}) {
-               $map_ctx->{SegMapN}{$segname} =~ m/^\-?/ or die;
+           if (exists $map_ctx->{SegMapN2N}{$segname}) {
+               $map_ctx->{SegMapN2N}{$segname} =~ m/^\-?/ or die;
                $sign .= $&;
                $segname= $';
            }
@@ -1387,7 +1398,7 @@ sub cmd_segment {
 
 sub cva_segmap_s {
     my ($sp) = @_;
-    $sp =~ m,^\w+(?:/[a-zA-Z_]+)?$,
+    $sp =~ m,^\w+(?:/(?:[a-zA-Z_]+\d*)?)?$,
         or die "invalid (sub)segment mapping S \`$sp'";
     return $sp;
 }
@@ -1397,21 +1408,30 @@ sub cva_segmap_n {
     $sp =~ m,^\-?\w+$, or die "invalid segment mapping N' \`$sp'";
     return $sp;
 }
-    
+
 sub cva_segmap_m {
     my ($sp) = @_;
     $sp =~ m,^[a-zA-Z_]+$, or die "invalid segment mapping M' \`$sp'";
     return $sp;
 }
 
+sub cva_segmap_nmp {
+    my ($sp) = @_;
+    $sp =~ m,^\-?\w+/(?:[a-zA-Z]+\d+)$, or
+       die "invalid segment mapping N'/[M'P'] \`$sp'";
+    return $sp;
+}
+    
 sub cmd_segmap {
-    my ($s,$d);
+    my ($s);
     while (@al) {
        $s= can(\&cva_segmap_s);
-       if ($s =~ m,/,) {
-           $ctx->{SegMapNM}{$s}= can(\&cva_segmap_m);
+       if ($s !~ m,/,) {
+           $ctx->{SegMapN2N}{$s}= can(\&cva_segmap_n);
+       } elsif ($s =~ m/[a-zA-Z]$/) {
+           $ctx->{SegMapNM2M}{$s}= can(\&cva_segmap_m);
        } else {
-           $ctx->{SegMapN}{$s}= can(\&cva_segmap_n);
+           $ctx->{SegMapNMP2NMP}{$s}= can(\&cva_segmap_nmp);
        }
     }
 }
index 93f9f00b1fb56fbb8caeafa12b6c0a9c5acccd0a..35d8f9c679bdc5775768ac6dd7590eb2474dc921 100644 (file)
@@ -162,10 +162,11 @@ join bot_3rj_b bot_2rx_bl 450
 
 extend bot_2rx_tr bot_0mx_bl len 19 1400
 
-segmap  bot_0mx_B -A5  bot_0mx_F -A6
 segment bot_0mx_
+segmap  bot_0mx_B/ A5/J1  bot_0mx_F/ A6/J1
 part bot_0mx cross_pecof_s bl
-segment A5
+
+segment -A5/J1
 extend -bot_0mx_br -bot_0rj_b len 8
 
 segment -A5