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
# $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}
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} };
$segname= '';
$sign= '';
} else {
- my ($map_ctx);
+ my ($map_ctx,$specifickey);
$ctx->{SegName} =~ m/^\-?/ or die;
$sign .= $&;
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= $';
}
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;
}
$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);
}
}
}