From abc74d7854a504c94f6f66d997d3a2448a0c0322 Mon Sep 17 00:00:00 2001
From: dos-reis <gdr@axiomatics.org>
Date: Wed, 15 Dec 2010 10:30:34 +0000
Subject: 	* interp/msgdb.boot (applyPrefix2String): New. 
 (substituteSegmentedMsg): Use to implement documented behaviour 	of
 formatting code P. 	* interp/i-analy.boot (printableArgModeSetList): Don't
 call 	prefix2String here. 	(bottomUpForm0): Likewise.

---
 src/ChangeLog           |  9 +++++++++
 src/interp/i-analy.boot |  6 +++---
 src/interp/msgdb.boot   | 16 +++++++++++++---
 3 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 5f41fd6d..21772fcc 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
+2010-12-15  Gabriel Dos Reis  <gdr@cs.tamu.edu>
+
+	* interp/msgdb.boot (applyPrefix2String): New.
+	(substituteSegmentedMsg): Use to implement documented behaviour 
+	of formatting code P.
+	* interp/i-analy.boot (printableArgModeSetList): Don't call
+	prefix2String here.
+	(bottomUpForm0): Likewise.
+
 2010-12-15  Gabriel Dos Reis  <gdr@cs.tamu.edu>
 
 	* boot/tokens.boot: symbolName is now a builtin function.
diff --git a/src/interp/i-analy.boot b/src/interp/i-analy.boot
index 8645b391..7b44377d 100644
--- a/src/interp/i-analy.boot
+++ b/src/interp/i-analy.boot
@@ -579,9 +579,9 @@ removeUnionsAtStart(argl,modeSets) ==
 printableArgModeSetList() ==
   amsl := nil
   for a in reverse $origArgModeSetList repeat
-    b := prefix2String first a
+    b := first a
     if atom b then b := [b]
-    amsl := ['"%l",:b,:amsl]
+    amsl := ['"%l",b,:amsl]
   if amsl then amsl := rest amsl
   amsl
 
@@ -642,7 +642,7 @@ bottomUpForm0(t,op,opName,argl,argModeSetList) ==
 
   if null(opName1) then
     opName1 :=
-        (o := getValue op0) => prefix2String objMode o
+        (o := getValue op0) => objMode o
         '"<unknown type>"
     msgKey :=
         null amsl => "S2IB0013"
diff --git a/src/interp/msgdb.boot b/src/interp/msgdb.boot
index 6e68ae3f..efa3ddff 100644
--- a/src/interp/msgdb.boot
+++ b/src/interp/msgdb.boot
@@ -153,6 +153,16 @@ removeAttributes msg ==
     attList := rest attList
     [msg,attList]
 
+applyPrefix2String args ==
+  [:f x for x in args] where
+    f x ==
+      -- FIXME: we should in fact check for formatting codes
+      cons? x => g x
+      [x]
+    g x ==
+      $texFormatting => prefix2StringAsTeX x
+      prefix2String x
+
 substituteSegmentedMsg(msg,args) ==
   -- this does substitution of the parameters
   l := NIL
@@ -192,9 +202,9 @@ substituteSegmentedMsg(msg,args) ==
           $texFormatting => arg := prefix2StringAsTeX arg
           arg := prefix2String arg 
       if char 'P in q then
-          $texFormatting => arg := [prefix2StringAsTeX x for x in arg]
-          arg := [prefix2String x for x in arg]
-      if char 'o in  q and $texFormatting then arg := operationLink(arg)
+        arg := applyPrefix2String arg
+      if char 'o in  q and $texFormatting then
+        arg := operationLink(arg)
 
       if char 'c in q then arg := [['"%ce",:arg]]
       if char 'r in q then arg := [['"%rj",:arg]]
-- 
cgit v1.2.3