[Bio] / FigKernelPackages / Tracer.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/Tracer.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.27, Sat Oct 15 07:57:10 2005 UTC revision 1.28, Tue Oct 18 17:42:48 2005 UTC
# Line 825  Line 825 
825  C<< my $codedString = Tracer::Escape($realString); >>  C<< my $codedString = Tracer::Escape($realString); >>
826    
827  Escape a string for use in a command length. Tabs will be replaced by C<\t>, new-lines  Escape a string for use in a command length. Tabs will be replaced by C<\t>, new-lines
828  replaced by C<\n>, carriage returns by C<\r> and backslashes will be doubled. The effect  replaced by C<\n>, carriage returns will be deleted, and backslashes will be doubled. The
829  is to exactly reverse the effect of L</UnEscape>.  result is to reverse the effect of L</UnEscape>.
830    
831  =over 4  =over 4
832    
# Line 856  Line 856 
856              $retVal .= $1;              $retVal .= $1;
857              # Strip the processed section off the real string.              # Strip the processed section off the real string.
858              $realString = substr $realString, (length $2) + (length $1);              $realString = substr $realString, (length $2) + (length $1);
859              # Encode the escape sequence.              # Get the matched character.
860              my $char = $2;              my $char = $2;
861              $char =~ tr/\t\n\r/tnr/;              # If we have a CR, we are done.
862                if ($char ne "\r") {
863                    # It's not a CR, so encode the escape sequence.
864                    $char =~ tr/\t\n/tn/;
865              $retVal .= "\\" . $char;              $retVal .= "\\" . $char;
866                }
867          } else {          } else {
868              # Here there are no more escape sequences. The rest of the string is              # Here there are no more escape sequences. The rest of the string is
869              # transferred unmodified.              # transferred unmodified.
# Line 876  Line 880 
880  C<< my $realString = Tracer::UnEscape($codedString); >>  C<< my $realString = Tracer::UnEscape($codedString); >>
881    
882  Replace escape sequences with their actual equivalents. C<\t> will be replaced by  Replace escape sequences with their actual equivalents. C<\t> will be replaced by
883  a tab, C<\n> by a new-line character, C<\r> by a carriage return and C<\\> by a  a tab, C<\n> by a new-line character, and C<\\> by a backslash. C<\r> codes will
884  back-slash.  be deleted.
885    
886  =over 4  =over 4
887    
# Line 911  Line 915 
915                  # itself is in $2. First, move the clear text to the return variable.                  # itself is in $2. First, move the clear text to the return variable.
916                  $retVal .= $1;                  $retVal .= $1;
917                  $codedString = substr $codedString, (2 + length $1);                  $codedString = substr $codedString, (2 + length $1);
918                  # Decode the escape sequence.                  # Get the escape value.
919                  my $char = $2;                  my $char = $2;
920                  $char =~ tr/\\tnr/\\\t\n\r/;                  # If we have a "\r", we are done.
921                    if ($char ne 'r') {
922                        # Here it's not an 'r', so we convert it.
923                        $char =~ tr/\\tn/\\\t\n/;
924                  $retVal .= $char;                  $retVal .= $char;
925                    }
926              } else {              } else {
927                  # Here there are no more escape sequences. The rest of the string is                  # Here there are no more escape sequences. The rest of the string is
928                  # transferred unmodified.                  # transferred unmodified.

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3