anchor.diff:    set DEBUG.EXITCODE=%!%MACRO.ARGS%!%%\n%
     if defined DEBUG.EXITCODE set DEBUG.EXITCODE=%!%DEBUG.EXITCODE: =%!%%\n%
     if not defined DEBUG.EXITCODE set DEBUG.EXITCODE=%!%DEBUG.ERRORLEVEL%!%%\n%
  -  set "DEBUG.SETARGS=" %\n%
  -  for %%v in (%!%DEBUG.RETVARS%!%) do ( %\n%
  -    set "DEBUG.VALUE=%'!%%%v%'!%" %# We must remove problematic characters in that value #% %\n%
  -    if defined DEBUG.VALUE ( %# Else the following lines will generate phantom characters #% %\n%
  -      set "DEBUG.VALUE=%'!%DEBUG.VALUE:%%=%%DEBUG.percnt%%%'!%"	%# Encode percent #% %\n%
  -      for %%e in (sp tab cr lf quot) do for %%c in ("%'!%DEBUG.%%e%'!%") do ( %# Encode named character entities #% %\n%
  -	set "DEBUG.VALUE=%'!%DEBUG.VALUE:%%~c=%%DEBUG.%%e%%%'!%" %\n%
  +  for %%l in ("%'!%LF%'!%") do ( %# Make it easy to insert line-feeds in any mode #% %\n%
  +    set "DEBUG.SETARGS=""" %# The initial "" makes sure that for loops below never get an empty arg list #% %\n%
  +    for %%v in (%!%DEBUG.RETVARS%!%) do ( %\n%
  +      set "DEBUG.VALUE=%'!%%%v%'!%" %# We must remove problematic characters in that value #% %\n%
  +      if defined DEBUG.VALUE ( %# Else the following lines will generate phantom characters #% %\n%
  +	set "DEBUG.VALUE=%'!%DEBUG.VALUE:%%=%%DEBUG.percnt%%%'!%"	%# Encode percent #% %\n%
  +	for %%e in (sp tab cr lf quot amp vert lt gt) do for %%c in ("%'!%DEBUG.%%e%'!%") do ( %# Encode named character entities #% %\n%
  +	  set "DEBUG.VALUE=%'!%DEBUG.VALUE:%%~c=%%DEBUG.%%e%%%'!%" %\n%
  +	) %\n%
  +	set "DEBUG.VALUE=%'!%DEBUG.VALUE:^^=%%DEBUG.hat%%%'!%"	%# Encode carets #% %\n%
  +	call set "DEBUG.VALUE=%%DEBUG.VALUE:%!%=^^^^%%" 		%# Encode exclamation points #% %\n%
  +	set "DEBUG.VALUE=%'!%DEBUG.VALUE:^^^^=%%DEBUG.excl%%%'!%"	%# Encode exclamation points #% %\n%
         ) %\n%
  -      set "DEBUG.VALUE=%'!%DEBUG.VALUE:^^=%%DEBUG.hat%%%'!%"	%# Encode carets #% %\n%
  -      call set "DEBUG.VALUE=%%DEBUG.VALUE:%!%=^^^^%%" 		%# Encode exclamation points #% %\n%
  -      set "DEBUG.VALUE=%'!%DEBUG.VALUE:^^^^=%%DEBUG.excl%%%'!%"	%# Encode exclamation points #% %\n%
  -      set "DEBUG.VALUE=%'!%DEBUG.VALUE:?=%%DEBUG.quest%%%'!%"	%# Encode question marks #% %\n%
  +      set DEBUG.SETARGS=%!%DEBUG.SETARGS%!% "%%v=%'!%DEBUG.VALUE%'!%"%\n%
       ) %\n%
  -    set DEBUG.SETARGS=%!%DEBUG.SETARGS%!% "%%v=%'!%DEBUG.VALUE%'!%" %\n%
  -  ) %\n%
  -  if %!%DEBUG%!%==1 ( %# Build the debug message and display it #% %\n%
  -    set "DEBUG.MSG=return %'!%DEBUG.EXITCODE%'!%" %\n%
  -    for %%v in (%!%DEBUG.SETARGS%!%) do ( %\n%
  -      set "DEBUG.MSG=%'!%DEBUG.MSG%'!% %%DEBUG.amp%% set %%v" %!% %\n%
  +    if %!%DEBUG%!%==1 ( %# Build the debug message and display it #% %\n%
  +      set "DEBUG.MSG=return %'!%DEBUG.EXITCODE%'!%" %\n%
  +      for /f "delims=" %%v in ("%'!%DEBUG.SETARGS: =%%~l%'!%") do if not %%v=="" ( %# for /f avoids issues with ? and * #% %\n%
  +	set "DEBUG.MSG=%'!%DEBUG.MSG%'!% %%DEBUG.amp%% set %%v" %!% %\n%
  +      ) %\n%
  +      call set "DEBUG.MSG=%'!%DEBUG.MSG:%%=%%DEBUG.excl%%%'!%" %# Change all percent to ! #%  %\n%
  +      if defined ^^%>%DEBUGOUT ( %# If we use a debugging stream distinct from stdout #% %\n%
  +	call :Echo.Eval2DebugOut %!%DEBUG.MSG%!%%# Use a helper routine, as delayed redirection does not work #%%\n%
  +      ) else ( %# Output directly here, which is faster #% %\n%
  +	for /f "delims=" %%c in ("%'!%INDENT%'!%%'!%DEBUG.MSG%'!%") do echo %%c%# Use a for loop to do a double !variable! expansion #% %\n%
  +      ) %\n%
  +      if defined LOGFILE ( %# If we have to send a copy to a log file #% %\n%
  +	call :Echo.Eval2LogFile %!%DEBUG.MSG%!%%# Use a helper routine, as delayed redirection does not work #%%\n%
  +      ) %\n%
       ) %\n%
  -    call set "DEBUG.MSG=%'!%DEBUG.MSG:%%=%%DEBUG.excl%%%'!%" %# Change all percent to ! #%  %\n%
  -    if defined ^^%>%DEBUGOUT ( %# If we use a debugging stream distinct from stdout #% %\n%
  -      call :Echo.Eval2DebugOut %!%DEBUG.MSG%!%%# Use a helper routine, as delayed redirection does not work #%%\n%
  -    ) else ( %# Output directly here, which is faster #% %\n%
  -      for /f "delims=" %%c in ("%'!%INDENT%'!%%'!%DEBUG.MSG%'!%") do echo %%c%# Use a for loop to do a double !variable! expansion #% %\n%
  -    ) %\n%
  -    if defined LOGFILE ( %# If we have to send a copy to a log file #% %\n%
  -      call :Echo.Eval2LogFile %!%DEBUG.MSG%!%%# Use a helper routine, as delayed redirection does not work #%%\n%
  -    ) %\n%
  -  ) %\n%
  -  for %%r in (%!%DEBUG.EXITCODE%!%) do ( %# Carry the return values through the endlocal barriers #% %\n%
  -    for /f "delims=" %%a in (""" %'!%DEBUG.SETARGS%'!%") do ( %# The initial "" makes sure the body runs even if the arg list is empty #% %\n%
  -      endlocal %&% endlocal %&% endlocal %# Exit the RETURN and FUNCTION local scopes #% %\n%
  -      if "%'!%%'!%"=="" ( %# Delayed expansion is ON #% %\n%
  +    for %%r in (%!%DEBUG.EXITCODE%!%) do ( %# Carry the return values through the endlocal barriers #% %\n%
  +      for /f "delims=" %%a in ("%'!%DEBUG.SETARGS%'!%") do ( %\n%
  +	endlocal %&% endlocal %&% endlocal %# Exit the RETURN and FUNCTION local scopes #% %\n%
   	set "DEBUG.SETARGS=%%a" %\n%
  -	call set "DEBUG.SETARGS=%'!%DEBUG.SETARGS:%%=%%DEBUG.excl%%%'!%" %# Change all percent to ! #%  %\n%
  -	for %%v in (%!%DEBUG.SETARGS:~3%!%) do ( %\n%
  -	  set %%v %# Set each upvar variable in the caller's scope #% %\n%
  +	if "%'!%%'!%"=="" ( %# Delayed expansion is ON #% %\n%
  +	  call set "DEBUG.SETARGS=%'!%DEBUG.SETARGS:%%=%%DEBUG.excl%%%'!%" %# Change all percent to ! #%  %\n%
  +	  for /f "delims=" %%v in ("%'!%DEBUG.SETARGS: =%%~l%'!%") do if not %%v=="" ( %# for /f avoids issues with ? and * #% %\n%
  +	    set %%v %# Set each upvar variable in the caller's scope #% %\n%
  +	  ) %\n%
  +	) else ( %# Delayed expansion is OFF #% %\n%
  +	  setlocal EnableDelayedExpansion %\n%
  +	  for /f "delims=" %%v in ("%'!%DEBUG.SETARGS: =%%~l%'!%") do if %%v=="" ( %# for /f avoids issues with ? and * #% %\n%
  +	    endlocal %\n%
  +	  ) else ( %\n%
  +	    call set %%v %# Set each upvar variable in the caller's scope #% %\n%
  +	  ) %\n%
   	) %\n%
   	set "DEBUG.SETARGS=" %\n%
  -      ) else ( %# Delayed expansion is OFF #% %\n%
  -	set "DEBUG.hat=^^^^" %# Carets need to be doubled to be set right below #% %\n%
  -	for %%v in (%%a) do if not %%v=="" ( %\n%
  -	  call set %%v %# Set each upvar variable in the caller's scope #% %\n%
  -	) %\n%
  -	set "DEBUG.hat=^^" %# Restore the normal value with a single caret #% %\n%
  +	exit /b %%r %# Return to the caller #% %\n%
         ) %\n%
  -      exit /b %%r %# Return to the caller #% %\n%
       ) %\n%
     ) %\n%
   ) %/MACRO%
  
positive.code: call :trimright "%~1" "%~2"
  %UPVAR% %~1
  %RETURN%
  
  :#----------------------------------------------------------------------------#
  :#                                                                            #
  
negative.code: :#   2016-09-01 JFL Bug fix: %RETURN% incorrectly returned empty variables.   #
  :#   2016-11-02 JFL Bug fix: Avoid log file redirection failures in recursive #
  :#                  scripts.                                                  #
  :#   2016-11-13 JFL Bug fix: Correctly return special characters & | < > ? *  #
  :#                                                                            #
  :#----------------------------------------------------------------------------#
  
  