chiark / gitweb /
fix angle and "right" handling in cmd_rel; allow "=" as prefix for identity; make...
authorian <ian>
Mon, 26 Jan 2004 02:08:53 +0000 (02:08 +0000)
committerian <ian>
Mon, 26 Jan 2004 02:08:53 +0000 (02:08 +0000)
layout/informat.txt
layout/layout

index a47dee5a721e83adffa901834d552010bebba461..77db5ed25f8a94cdb9d484aadf7bbfc3190aca65 100644 (file)
@@ -22,9 +22,9 @@ Commands
  abs P X Y A
   Defines loc P given coordinates (distances) and absolute bearing
 
- rel F T L R A
+ rel F T [L R A]
   Defines loc T: start at loc F, go forward L, translate right R,
-  turn left A.
+  turn left A (defaults are all 0).
 
  extend F T len L [R]        length L
  extend F T upto U [R]       s.t. perpendicular at T passes through U
@@ -63,6 +63,8 @@ Commands
   (`formal parameter', F must be just <identifier>) is placed at
   existing loc A (`actual parameter').  If prefix P (syntax is that of
   an identifier) is specified, each other loc L inside O is exported
-  into the global namespace as a new loc PL.  If `flip' is used then
-  the object is placed with object-space y coordinates negated (ie, it
-  is mirrored so that the object's North exchanges with South).
+  into the global namespace as a new loc PL.  P may be `=' to indicate
+  an empty prefix (default is not to export locs).  If `flip' is used
+  then the object is placed with object-space y coordinates negated
+  (ie, it is mirrored so that the object's North exchanges with
+  South).
index 0db06b5e9542c05c34e3c43a383742604c0927a2..b3f366643869124bb3fd1e9b46aff7df86400a08 100755 (executable)
@@ -232,9 +232,9 @@ sub cmd_rel {
     my ($from,$to,$len,$right,$turn);
     $from= can(\&cva_idex);
     $to= can(\&cva_idnew);
-    $len= can(\&cva_len);
-    $right= can(\&cva_len);
-    $turn= cano(\&cva_absang, 0);
+    $len= cano(\&cva_len,0);
+    $right= cano(\&cva_len,0) * $ctx->{Trans}{R};
+    $turn= cano(\&cva_ang, 0) * $ctx->{Trans}{R};
     my ($u)= ev_compose({}, $from, { X => $len, Y => -$right, A => 0 });
     ev_compose($to, $u, { X => 0, Y => 0, A => $turn });
 }
@@ -667,6 +667,8 @@ sub cmd__obj ($) {
     $ctx->{Trans}{X}= $actual->{X} - $formcv->{X};
     $ctx->{Trans}{Y}= $actual->{Y} - $formcv->{Y};
     $ctx->{InRunObj}= $ctx_save->{InRunObj}."${obj_id}::";
+    $ctx->{Draw}{T}= $ctx_save->{Draw}{T};
+    $ctx->{Draw}{L}= $ctx_save->{Draw}{L};
     $ctx->{Draw}{L} =~ s/L//;
 dv("cmd__obj $obj_id ",'$ctx',$ctx);
     {
@@ -677,10 +679,14 @@ dv("cmd__obj $obj_id ",'$ctx',$ctx);
            cmd__one();
        }
     };
-    $pfx= cano(\&cva_idstr,'');
+    if (@al && $al[0] eq '=') {
+       $pfx= ''; shift @al;
+    } else {
+       $pfx= cano(\&cva_idstr,undef);
+    }
     $ctx_inobj= $ctx;
     $ctx= $ctx_save;
-    if (length $pfx) {
+    if (defined $pfx) {
        foreach $id (keys %{ $ctx_inobj->{Loc} }) {
            next if $id eq $formal_id;
            $newid= $pfx.$id;