JDK-4165111 : text strings, groups of, perl
  • Type: Enhancement
  • Component: other-libs
  • Sub-Component: other
  • Affected Version: 1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 1998-08-10
  • Updated: 1998-08-10
  • Resolved: 1998-08-10
Description

Name: clC74495			Date: 08/10/98


Please implement some type of multiline
text thing like perl:

print <<

Here is my RATIONALE:

I write hardware production test programs and do
alot of messages for test operators.
Some of them do get rather long.

    String intro = new String(
      "      Production 407 Controller Automated
Test\n" +
      "      Release: " + version +
      "\n\n" +
      "      An automated test program
implementing the XXX\n" +
      "      Test Procedure described: \n" +
      "      Product box\n" +
      "         Model Number  407\n" +
      "         Part Number   519950-XX\n" +
      "         T.P. Number   519950\n" +
      "         T.P. Rev.     A\n" +
      "      Approvals box\n" +
      "         Initials     \"Kant\"\n" +
      "         Date         \"7-7-96\"\n" +
      "      Revision History box\n" +
      "         Rev Level     B\n" +
      "         Date          11/25/97\n" +
      "                 TEST UNDER
DEVELOPMENT           \n" +
      "\n" +
      "         Use under Test Development
supervision\n" +
      "\n" +
      "\n" +
      "\n" +
      " ----> Please acknowledge the testing
conditions above.");

or


    String manualMessage = new String(
      "Perform manual tests/operations.  Be
familar with items 2, 3, 4 and 5 \n" +
      "before beginning.  Once the boot begins the
operator must be ready.\n\n" + 
      "   1. Turn on 407 controller.\n" +
      "      a. Insure orientation of power
switch;  UP = ON\n" +
      "\n" +
      "   2. Initialize defaults with key '9'
boot.\n" +
      "      a. Depress & hold the '9' key until
\"BRAM Init Request\" appears\n" +
      "         on the front panel display.
(Request appears about 20 seconds\n" +
      "         into the boot at rev 5.0.0 -
conditions may vary with release).\n" +
      "\n" +
      "   3. Controller may ask to perform a BRAM
update.  Do update.  This\n" +
      "      update request may not occur.  It
should never occur twice.\n" +
      "\n" +
      "   4. Insure all front panel LEDS light
during the bootup selftest.\n" +
      "\n" +
      "   5. Check LED colors.\n" +
      "      a. RED = 'Interlock', 'Off' 'Stop'\n"
+
      "      b. YELLOW = 'Low' 'Hold'\n" +
      "      c. GREEN = 'High' 'Run' 'Enable'\n" +
      "\n" +
      "   6. Four green LEDs should light on the
power supply.\n" +
      "\n" +
      "   7. Exersize all keys.\n\n" +
      "\n" +
      "   8. Exercise encoder wheel.\n" +
      "      a. Go to AC conditioner, select
coarse zero, press 'Enable' \n" +
      "         and spin the wheel.  Numbers
should changes on \"C Zero\"\n" +
      "         display line item.\n" +
      "\n" +
      "   9 ! Don't forget .... Place
communications in REMOTE mode.\n" +
      "\n" +
      "\n" +
      "\n" +
      "----> Have these manual tests/operations
been completed successfully?");


Some thought has been given to placing the
messages
in text files, but alot of these messages document
the test
and belong in the source.

Messages built this way are difficult to edit,
something done frequently on
production tests.  Some of the error messages also
contain alot of state
information that would be nice if it could be
dumped into the perl constuct.
This is no fun - when you do it often:

        emo.eMsg(new String(
          "Fail DC +excitation at 9.998.  Value
read " + gpF + ".  Expected " +
         
tc.dcPlusExcitation_voltageAt9998_dcReadout_VDC));

It would be nice if the perl construct was
available to 
output "document" areas or build strings to pass
to error/information format 
methods.

I would love to see
the above appear in a source file as

PerlStringBuffer psbuf = new PerlStringBuffer();
      
psbuf.makeString("_manPrompt",

      Perform manual tests/operations.  Be familar
with items 2, 3, 4 and 5
      before beginning.  Once the boot begins the
operator must be ready. 
         1. Turn on 407 controller.
            a. Insure orientation of power
switch;  UP = ON
      
         2. Initialize defaults with key '9' boot.
            a. Depress & hold the '9' key until
"BRAM Init Request" appears
               on the front panel display.
(Request appears about 20 seconds
               into the boot at rev 5.0.0 -
conditions may vary with release).
      
         3. Controller may ask to perform a BRAM
update.  Do update.  This
            update request may not occur.  It
should never occur twice.
      
         4. Insure all front panel LEDS light
during the bootup selftest.
      
         5. Check LED colors.
            a. RED = 'Interlock', 'Off' 'Stop'
            b. YELLOW = 'Low' 'Hold'
            c. GREEN = 'High' 'Run' 'Enable'
      
         6. Four green LEDs should light on the
power supply.
      
         7. Exersize all keys.
      
         8. Exercise encoder wheel.
            a. Go to AC conditioner, select coarse
zero, press 'Enable'
               and spin the wheel.  Numbers should
changes on "C Zero"
               display line item.
      
         9 ! Don't forget .... Place
communications in REMOTE mode.
      
      
      
      ----> Have these manual tests/operations
been completed successfully?

__manPrompt);

or something like it.

Thanks for taking a look.
-- 
###@###.###
612-361-5900 x5919, fax 612-361-5950
MTS Systems, Minneapolis, Minnesota, USA, 5ZULU

(Review ID: 36723)
======================================================================

Comments
EVALUATION While text imbedded in source files is very convenient for scripting languages such as Perl, this would not be an appropriate construct for Java. It isn't all THAT hard to encode string literals with \" and \n. I suggest that it will look much cleaner if you stay disciplined about the use of quotes and escapes: " Production 407 Controller Automated Test \n" + " Release: " + version + " \n" + " \n" + " An automated test program implementing the XXX \n" + " Test Procedure described: \n" + " Product box \n" + " Model Number 407 \n" + " Part Number 519950-XX \n" + etc. Note that it is never necessary to write new String("foo"); just the quoted text "foo" will work as well. All of the messages in the JDK are kept in separate text files. This is done to facilitate localization (translation of the messages into different languages) but would address the submitter's concerns. david.stoutamire@Eng 1998-08-10
10-08-1998