home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 20 / AACD20.BIN / AACD / Programming / Jikes / Source / src / platform.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-02-24  |  40.9 KB  |  1,117 lines

  1. // $Id: platform.cpp,v 1.14 2001/02/20 06:47:51 mdejong Exp $
  2. //
  3. // This software is subject to the terms of the IBM Jikes Compiler
  4. // License Agreement available at the following URL:
  5. // http://www.ibm.com/research/jikes.
  6. // Copyright (C) 1996, 1998, International Business Machines Corporation
  7. // and others.  All Rights Reserved.
  8. // You must accept the terms of that agreement to use this software.
  9. //
  10. #include "platform.h"
  11.  
  12. #include "long.h"
  13. #include "double.h"
  14.  
  15. #ifdef    HAVE_JIKES_NAMESPACE
  16. namespace Jikes {    // Open namespace Jikes block
  17. #endif
  18.  
  19. // Define the PathSeparator() function with the proper
  20. // impl for each platform.
  21.  
  22. #ifdef HAVE_PATHNAME_STYLE_DOS
  23. char PathSeparator() { return U_SEMICOLON; } // ";"
  24. #else
  25. char PathSeparator() { return U_COLON; } // ":"
  26. #endif
  27.  
  28.  
  29. // Define the SystemMkdir() function with the proper
  30. // impl for each platform.
  31.  
  32. int SystemMkdir(char *dirname) {
  33.  
  34. return
  35.  
  36. #ifdef HAVE_GLIBC_MKDIR
  37.  mkdir(dirname, S_IRWXU | S_IRWXG | S_IRWXO);
  38. #endif
  39.  
  40. #ifdef HAVE_LIBC5_MKDIR
  41.  mkdir(dirname, S_IRWXU);
  42. #endif
  43.  
  44. #ifdef HAVE_WIN32_MKDIR
  45.  mkdir(dirname);
  46. #endif
  47.  
  48. #ifdef HAVE_MAC_MKDIR
  49.  mkdir(dirname,0);
  50. #endif
  51.  
  52. }
  53.  
  54. //
  55. // The configure script checks each of these to see if we need our own implementation
  56. //
  57.  
  58. #ifndef HAVE_WCSLEN
  59. size_t wcslen(const wchar_t *cs)
  60. {
  61.   int n = 0;
  62.   while (*cs++)
  63.     n++;
  64.  
  65.   return n;
  66. }
  67. #endif
  68.  
  69. #ifndef HAVE_WCSCPY
  70. wchar_t *wcscpy(wchar_t *s, const wchar_t *ct)
  71. {
  72.   wchar_t *ptr;
  73.   for (ptr = s; *ct; ptr++, ct++)
  74.     *ptr = *ct;
  75.   *ptr = U_NULL;
  76.  
  77.   return s;
  78. }
  79. #endif
  80.  
  81. #ifndef HAVE_WCSNCPY
  82. wchar_t *wcsncpy(wchar_t *s, const wchar_t *ct, size_t n)
  83. {
  84.   wchar_t *ptr;
  85.   for (ptr = s; *ct && n-- > 0; ptr++, ct++)
  86.     *ptr = *ct;
  87.   while (n-- > 0)
  88.     *ptr++ = U_NULL;
  89.  
  90.   return s;
  91. }
  92. #endif
  93.  
  94. #ifndef HAVE_WCSCAT
  95. wchar_t *wcscat(wchar_t *s, const wchar_t *ct)
  96. {
  97.   wchar_t *ptr = s;
  98.  
  99.   while (*ptr)
  100.     ptr++;
  101.   wcscpy(ptr, ct);
  102.  
  103.   return s;
  104. }
  105. #endif
  106.  
  107. #ifndef HAVE_WCSCMP
  108. int wcscmp(const wchar_t *cs, const wchar_t *ct)
  109. {
  110.   while (*cs == *ct && *cs && *ct)
  111.   {
  112.     cs++;
  113.     ct++;
  114.   }
  115.  
  116.   return (*cs == *ct ? 0 : (*cs < *ct ? -1 : 1));
  117. }
  118. #endif
  119.  
  120. #ifndef HAVE_WCSNCMP
  121. int wcsncmp(const wchar_t *cs, const wchar_t *ct, size_t n)
  122. {
  123.   while (*cs == *ct && *cs && *ct && n-- > 0)
  124.   {
  125.     cs++;
  126.     ct++;
  127.   }
  128.  
  129.   return (n <= 0 || *cs == *ct ? 0 : (*cs < *ct ? -1 : 1));
  130. }
  131. #endif
  132.  
  133.  
  134. //
  135. // If the system runs out of memory, this function is invoked
  136. // This is tricky because VC++ on windows uses a non standard
  137. // implementation of the set_new_handler function.
  138. // 
  139.  
  140. #ifdef HAVE_VCPP_SET_NEW_HANDLER
  141. int OutOfMemory(size_t)
  142. #else
  143. void OutOfMemory()
  144. #endif
  145. {
  146.   fprintf(stderr, "***System Failure: Out of memory\n");
  147.   exit(1);
  148.  
  149. #ifdef HAVE_VCPP_SET_NEW_HANDLER
  150.   return 0;
  151. #endif
  152. }
  153.  
  154. void SetNewHandler()
  155. {
  156. #ifdef  HAVE_VCPP_SET_NEW_HANDLER
  157.   _set_new_handler(OutOfMemory);
  158. #else
  159.   set_new_handler(OutOfMemory);
  160. #endif
  161. }
  162.  
  163.  
  164. //
  165. // When using the ICC compiler on Win95 or OS/2, we need to disable
  166. // testing for various floating point exceptions. Default behavior
  167. // was causing problems reading some standard class files.
  168. //
  169. // We obviously don't need this on AIX (non x86), which uses xlC/ICC           
  170. //            
  171. void FloatingPointCheck()
  172. {
  173. #ifdef HAVE_ICC_FP_BUGS
  174.   _control87(EM_UNDERFLOW, EM_UNDERFLOW);
  175.   _control87(EM_ZERODIVIDE, EM_ZERODIVIDE);
  176.   _control87(EM_OVERFLOW, EM_OVERFLOW);
  177.   _control87(EM_INVALID, EM_INVALID);
  178. #endif
  179.   return;
  180. }
  181.  
  182.  
  183. //
  184. // This next set of functions may need some porting to work on various systems
  185. //
  186.  
  187. int SystemStat(const char *name, struct stat *stat_struct)
  188. {
  189.   return stat(name, stat_struct);
  190. }
  191. FILE *SystemFopen(const char *name, const char *mode)
  192. {
  193.   return fopen(name, mode);
  194. }
  195. size_t SystemFread(char *ptr, size_t element_size, size_t count, FILE *stream)
  196. {
  197.   return fread(ptr, element_size, count, stream);
  198. }
  199. int SystemIsDirectory(char *name)
  200. {
  201.   struct stat status;
  202.   return (((SystemStat(name, &status) == 0) && (status.st_mode & JIKES_STAT_S_IFDIR)) ? 1 : 0);
  203. }
  204.  
  205. int SystemMkdirhier(char *dirname)
  206. {
  207.   if (SystemIsDirectory(dirname))
  208.     return 0;
  209.  
  210.   for (char *ptr = dirname; *ptr; ptr++)
  211.     {
  212.       char delimiter = *ptr;
  213.       if (delimiter == U_SLASH)
  214.     {
  215.       *ptr = U_NULL;
  216.  
  217.       if (! SystemIsDirectory(dirname))
  218.         SystemMkdir(dirname);
  219.  
  220.       *ptr = delimiter;
  221.     }
  222.     }
  223.  
  224.   SystemMkdir(dirname);
  225.  
  226.   return (! SystemIsDirectory(dirname));
  227. }
  228.  
  229.  
  230.  
  231. // FIXME: These next two should definitely be inlined; but when I
  232. // add the "inline" keyword , I get linker problems.
  233.  
  234.  
  235. // Given three strings, return a newly-allocated string which is their concatenation.
  236. char * strcat3(const char * prefix, const char * middle, const char * suffix) {
  237.   int prefix_len = strlen(prefix);
  238.   int prefix_middle_len = prefix_len + strlen(middle);
  239.  
  240.   char * result = new char[prefix_middle_len + strlen(suffix) + 1];
  241.   strcpy(result, prefix);
  242.   // The below is more efficient than this commented-out code.
  243.   // strcat(result, middle);
  244.   // strcat(result, suffix);
  245.   strcpy(result + prefix_len, middle);
  246.   strcpy(result + prefix_middle_len, suffix);
  247.   return result;
  248. }
  249.  
  250. // It's inconceivable that this is the right way to go about this.
  251. // One alternative is to use ConvertUnicodeToUtf8.
  252. char * wstring2string(wchar_t * in) {
  253.   char * result = new char[wcslen(in) + 1];
  254.   result[wcslen(in)] = 0;
  255.   for (size_t i=0; i<wcslen(in); i++) {
  256.     wchar_t ch = in[i];
  257.     result[i] = (ch >> 8 == 0 ? (char)ch : '?');
  258.   }
  259.   return result;
  260. }
  261.  
  262.  
  263. // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  264. //
  265. // End of platform specific defines in this file, the rest of the code
  266. // in this file should work on any system
  267. //
  268. // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  269.  
  270.  
  271. IntToString::IntToString(int num)
  272. {
  273.     if (0x80000000 == (unsigned int) num)
  274.     {
  275.         str = info;
  276.         strcpy(str, StringConstant::U8S_smallest_int);
  277.     }
  278.     else
  279.     {
  280.         str = &info[TAIL_INDEX];
  281.         *str = U_NULL;
  282.         int n = (num < 0 ? -num : num);
  283.         do
  284.         {
  285.             *--str = (U_0 + n % 10);
  286.             n /= 10;
  287.         } while (n != 0);
  288.  
  289.         if (num < 0)
  290.             *--str = U_MINUS;
  291.     }
  292.  
  293.     return;
  294. }
  295.  
  296.  
  297. IntToWstring::IntToWstring(int num)
  298. {
  299.     if (0x80000000 == (unsigned int) num)
  300.     {
  301.         wstr = winfo;
  302.         wcscpy(wstr,  StringConstant::US_smallest_int);
  303.     }
  304.     else
  305.     {
  306.         wstr = &winfo[TAIL_INDEX];
  307.         *wstr = U_NULL;
  308.         int n = (num < 0 ? -num : num);
  309.         do
  310.         {
  311.             *--wstr = (U_0 + n % 10);
  312.             n /= 10;
  313.         } while (n != 0);
  314.  
  315.         if (num < 0)
  316.             *--wstr = U_MINUS;
  317.     }
  318.  
  319.     return;
  320. }
  321.  
  322.  
  323. ULongToDecString::ULongToDecString(ULongInt &num)
  324. {
  325.     str = &info[TAIL_INDEX];
  326.     *str = U_NULL;
  327.  
  328.     ULongInt n = num; // make a copy in order to not destroy reference argument
  329.     do
  330.     {
  331.         *--str = U_0 + (n % 10).LowWord();
  332.         n /= 10;
  333.     } while (n != 0);
  334.  
  335.     return;
  336. }
  337.  
  338.  
  339. LongToOctString::LongToOctString(BaseLong &num)
  340. {
  341.     str = &info[TAIL_INDEX];
  342.     *str = U_NULL;
  343.  
  344.     ULongInt n = num; // make a copy in order to not destroy reference argument
  345.     do
  346.     {
  347.         *--str = U_0 + (n % 8).LowWord();
  348.         n /= 8;
  349.     } while (n != 0);
  350.  
  351.     *--str = U_0;
  352.  
  353.     return;
  354. }
  355.  
  356.  
  357. LongToHexString::LongToHexString(BaseLong &num)
  358. {
  359.     str = &info[TAIL_INDEX];
  360.     *str = U_NULL;
  361.  
  362.     ULongInt n = num; // make a copy in order to not destroy reference argument
  363.     do
  364.     {
  365.         *--str = U_0 + (n % 16).LowWord();
  366.         n /= 16;
  367.     } while (n != 0);
  368.  
  369.     *--str = U_x;
  370.     *--str = U_0;
  371.  
  372.     return;
  373. }
  374.  
  375.  
  376. LongToDecString::LongToDecString(LongInt &num)
  377. {
  378.     if (num.HighWord() == 0x80000000 && num.LowWord() == 0x00000000)
  379.     {
  380.         str = info;
  381.         strcpy(str,  StringConstant::U8S_smallest_long_int);
  382.     }
  383.     else
  384.     {
  385.         str = &info[TAIL_INDEX];
  386.         *str = U_NULL;
  387.  
  388.         // compute absolute value
  389.         ULongInt n = (num.HighWord() & 0x80000000 ?
  390.             (ULongInt) -num : (ULongInt) num);
  391.  
  392.         do
  393.         {
  394.             *--str = U_0 + (n % 10).LowWord();
  395.             n /= 10;
  396.         } while (n != 0);
  397.  
  398.         if (num.HighWord() & 0x80000000)
  399.             *--str = U_MINUS;
  400.     }
  401.  
  402.     return;
  403. }
  404.  
  405.  
  406. //
  407. // Convert an double to its character string representation.
  408. //
  409. FloatToString::FloatToString(IEEEfloat &num)
  410. {
  411.     if (num.IsNaN())
  412.     {
  413.          strcpy(str,"NaN");
  414.          length = strlen("NaN");
  415.     }
  416.     else if (num.IsNegativeInfinity())
  417.     {
  418.          strcpy(str,"-Infinity");
  419.          length = strlen("-Infinity");
  420.     }
  421.     else if (num.IsPositiveInfinity())
  422.     {
  423.          strcpy(str,"Infinity");
  424.          length = strlen("Infinity");
  425.     }
  426.     else if (num.IsNegativeZero())
  427.     {
  428.          strcpy(str,"-0.0");
  429.          length = strlen("-0.0");
  430.     }
  431.     else if (num.IsPositiveZero())
  432.     {
  433.          strcpy(str,"0.0");
  434.          length = strlen("0.0");
  435.     }
  436.     else
  437.     {
  438.         //
  439.         // TODO: This conversion is a temporary patch. Need volunteer to implement
  440.         //       better algorithm:
  441.         //
  442.         //            Burger/Dybvig, PLDI 1996
  443.         //            Steele/White,  PLDI 1990
  444.         //
  445.         // If the absolute value f of the number in question is outside of the range 
  446.         //
  447.         //         1E-3 <= f < 1E+7
  448.         //
  449.         // we write the number out in "computerized scientific notation".
  450.         // Otherwise, we write it out in standard form.
  451.         //
  452.         int decimal_exponent = 0;
  453.         float f = (num.IsNegative() ? -num.FloatView() : num.FloatView());
  454.         if (f < 1E-3 || f >= 1E+7)
  455.         {
  456.             //
  457.             // The value of the number f can be expressed as
  458.             //
  459.             //     mantissa * (2 ** num.Exponent())
  460.             //
  461.             // But we really need to express it as:
  462.             //
  463.             //     mantissa * (10 ** decimal_exponent)
  464.             //
  465.             decimal_exponent = (int) ceil(num.Exponent() * log10(2.0));
  466.             f *= pow(10.0, -decimal_exponent); // shift f until it has precisely one decimal digit before the dot
  467.             while (floor(f) == 0.0)
  468.             {
  469.                 decimal_exponent--;
  470.                 f *= 10.0;
  471.             }
  472.  
  473.             assert(floor(f) > 0.0f && floor(f) < 10.0f); // make sure there is only one digit !!!
  474.         }
  475.  
  476.         char *s = str;
  477.         if (num.IsNegative()) // if the number is negative, add the minus sign
  478.             *s++ = U_MINUS;
  479.  
  480.         //
  481.         // convert whole part into its string representation
  482.         //
  483.         IntToString whole((int) f);
  484.  
  485.         char *ptr = whole.String();
  486.         while(*ptr)
  487.             *s++ = *ptr++;
  488.         *s++ = U_DOT;
  489.  
  490.         //
  491.         // Convert fractional part to its string representation
  492.         //
  493.         int limit = MAXIMUM_PRECISION + (num.IsNegative() ? 2 : 1);
  494.         float fraction = f - ((int) f);
  495.         do
  496.         {
  497.             fraction *= 10.0;
  498.             *s++ = U_0 + ((int) fraction);
  499.             fraction -= ((int) fraction);
  500.         } while((fraction > 0.0) && (s - str) < limit);
  501.  
  502.         //
  503.         // For each leading 0, add a little more precision.
  504.         // There can be at most 3.
  505.         // 
  506.         char *last = s - 1;
  507.         for (int i = 0; i < 3 && floor(f) == 0.0 && *last != U_0; i++)
  508.         {
  509.             f *= 10.0;
  510.             fraction *= 10.0;
  511.             last = s;
  512.             *s++ = U_0 + ((int) fraction);
  513.             fraction -= ((int) fraction);
  514.         }
  515.  
  516.         //
  517.         // Round if necessary
  518.         //
  519.         if (fraction >= 0.5)
  520.         {
  521.             while (*last == U_9)
  522.                 *last-- = U_0;
  523.             char *dot_character = (*last == U_DOT ? last : (char *) NULL);
  524.             if (dot_character)
  525.             {
  526.                 last--;
  527.                 while (last >= str && *last == U_9)
  528.                     *last-- = U_0;
  529.             }
  530.  
  531.             if (last < str)
  532.             {
  533.                 *++dot_character = U_DOT; // move dot over 1 place
  534.                 *str = 1;                 // place a 1 in the first position
  535.                 *s++ = U_0;               // add an extra zero at the end.
  536.             }
  537.             else (*last)++; // increment the number in the last position
  538.         }
  539.  
  540.         //
  541.         // Remove all excess trailing zeroes
  542.         //
  543.         while (*--s == U_0)
  544.             ;
  545.         s += (*s == U_DOT ? 2 : 1); // need at least one digit after the dot.
  546.  
  547.         //
  548.         // If the number is to be written out in scientific notation, add the exponent
  549.         //
  550.         if (decimal_exponent != 0)
  551.         {
  552.             *s++ = U_E;
  553.             IntToString exponent(decimal_exponent);
  554.             char *ptr = exponent.String();
  555.             while (*ptr)
  556.                 *s++ = *ptr++;
  557.         }
  558.  
  559.         *s = U_NULL;      // close string
  560.         length = s - str; // compute length
  561.     }
  562.  
  563.     assert(length <= MAXIMUM_STR_LENGTH);
  564.  
  565.     return;
  566. }
  567.  
  568.  
  569. //
  570. // Convert an double to its character string representation.
  571. //
  572. DoubleToString::DoubleToString(IEEEdouble &num)
  573. {
  574.     if (num.IsNaN())
  575.     {
  576.          strcpy(str,"NaN");
  577.          length = strlen("NaN");
  578.     }
  579.     else if (num.IsNegativeInfinity())
  580.     {
  581.          strcpy(str,"-Infinity");
  582.          length = strlen("-Infinity");
  583.     }
  584.     else if (num.IsPositiveInfinity())
  585.     {
  586.          strcpy(str,"Infinity");
  587.          length = strlen("Infinity");
  588.     }
  589.     else if (num.IsNegativeZero())
  590.     {
  591.          strcpy(str,"-0.0");
  592.          length = strlen("-0.0");
  593.     }
  594.     else if (num.IsPositiveZero())
  595.     {
  596.          strcpy(str,"0.0");
  597.          length = strlen("0.0");
  598.     }
  599.     else
  600.     {
  601.         //
  602.         // TODO: This conversion is a temporary patch. Need volunteer to implement
  603.         //       better algorithm:
  604.         //
  605.         //            Burger/Dybvig, PLDI 1996
  606.         //            Steele/White,  PLDI 1990
  607.         //
  608.         // If the absolute value d of the number in question is outside of the range 
  609.         //
  610.         //         1E-3 <= d < 1E+7
  611.         //
  612.         // we write the number out in "computerized scientific notation".
  613.         // Otherwise, we write it out in standard form.
  614.         //
  615.         int decimal_exponent = 0;
  616.         double d = (num.IsNegative() ? -num.DoubleView() : num.DoubleView());
  617.         if (d < 1E-3 || d >= 1E+7)
  618.         {
  619.             //
  620.             // The value of the number f can be expressed as
  621.             //
  622.             //     mantissa * (2 ** num.Exponent())
  623.             //
  624.             // But we really need to express it as:
  625.             //
  626.             //     mantissa * (10 ** decimal_exponent)
  627.             //
  628.             decimal_exponent = (int) ceil(num.Exponent() * log10(2.0));
  629.             d *= pow(10.0, -decimal_exponent); // shift f until it has precisely one decimal digit before the dot
  630.             while (floor(d) == 0.0)
  631.             {
  632.                 decimal_exponent--;
  633.                 d *= 10.0;
  634.             }
  635.  
  636.             assert(floor(d) > 0.0 && floor(d) < 10.0); // make sure there is only one digit !!!
  637.         }
  638.  
  639.         char *s = str;
  640.         if (num.IsNegative()) // if the number is negative, add the minus sign
  641.             *s++ = U_MINUS;
  642.  
  643.         //
  644.         // convert whole part into its string representation
  645.         //
  646.         IntToString whole((int) d);
  647.  
  648.         char *ptr = whole.String();
  649.         while(*ptr)
  650.             *s++ = *ptr++;
  651.         *s++ = U_DOT;
  652.  
  653.         //
  654.         // Convert fractional part to its string representation
  655.         //
  656.         int limit = MAXIMUM_PRECISION + (num.IsNegative() ? 2 : 1);
  657.         double fraction = d - ((int) d);
  658.         do
  659.         {
  660.             fraction *= 10.0;
  661.             *s++ = U_0 + ((int) fraction);
  662.             fraction -= ((int) fraction);
  663.         } while((fraction > 0.0) && (s - str) < limit);
  664.  
  665.         //
  666.         // For each leading 0, add a little more precision.
  667.         // There can be at most 3.
  668.         // 
  669.         char *last = s - 1;
  670.         for (int i = 0; i < 3 && floor(d) == 0.0 && *last != U_0; i++)
  671.         {
  672.             d *= 10.0;
  673.             fraction *= 10.0;
  674.             last = s;
  675.             *s++ = U_0 + ((int) fraction);
  676.             fraction -= ((int) fraction);
  677.         }
  678.  
  679.         //
  680.         // Round if necessary
  681.         //
  682.         if (fraction >= 0.5)
  683.         {
  684.             while (*last == U_9)
  685.                 *last-- = U_0;
  686.             char *dot_character = (*last == U_DOT ? last : (char *) NULL);
  687.             if (dot_character)
  688.             {
  689.                 last--;
  690.                 while (last >= str && *last == U_9)
  691.                     *last-- = U_0;
  692.             }
  693.  
  694.             if (last < str)
  695.             {
  696.                 *++dot_character = U_DOT; // move dot over 1 place
  697.                 *str = 1;                 // place a 1 in the first position
  698.                 *s++ = U_0;               // add an extra zero at the end.
  699.             }
  700.             else (*last)++; // increment the number in the last position
  701.         }
  702.  
  703.         //
  704.         // Remove all excess trailing zeroes
  705.         //
  706.         while (*--s == U_0)
  707.             ;
  708.         s += (*s == U_DOT ? 2 : 1); // need at least one digit after the dot.
  709.  
  710.         //
  711.         // If the number is to be written out in scientific notation, add the exponent
  712.         //
  713.         if (decimal_exponent != 0)
  714.         {
  715.             *s++ = U_E;
  716.             IntToString exponent(decimal_exponent);
  717.             char *ptr = exponent.String();
  718.             while (*ptr)
  719.                 *s++ = *ptr++;
  720.         }
  721.  
  722.         *s = U_NULL;      // close string
  723.         length = s - str; // compute length
  724.     }
  725.  
  726.     assert(length <= MAXIMUM_STR_LENGTH);
  727.  
  728.     return;
  729. }
  730.  
  731.  
  732. Ostream &Ostream::operator<<(LongInt a)
  733. {
  734.     if (os -> flags() & os -> dec)
  735.     {
  736.         LongToDecString long_int(a);
  737.         *os << long_int.String();
  738.     }
  739.     else if (os -> flags() & os -> oct)
  740.     {
  741.         LongToOctString long_int(a);
  742.         *os << (os -> flags() & os -> showbase ? long_int.StringWithBase() : long_int.String());
  743.     }
  744.     else if (os -> flags() & os -> hex)
  745.     {
  746.         LongToHexString long_int(a);
  747.         *os << (os -> flags() & os -> showbase ? long_int.StringWithBase() : long_int.String());
  748.     }
  749.     else
  750.     {
  751.          os -> flush();
  752.          assert(! "know how to print signed long value in specified format yet !!!");
  753.     }
  754.  
  755.     return *this;
  756. }
  757.  
  758. Ostream &Ostream::operator<<(ULongInt a)
  759. {
  760.     if (os -> flags() & os -> dec)
  761.     {
  762.         ULongToDecString ulong_int(a);
  763.         *os << ulong_int.String();
  764.     }
  765.     else if (os -> flags() & os -> oct)
  766.     {
  767.         LongToOctString ulong_int(a);
  768.         *os << (os -> flags() & os -> showbase ? ulong_int.StringWithBase() : ulong_int.String());
  769.     }
  770.     else if (os -> flags() & os -> hex)
  771.     {
  772.         LongToHexString ulong_int(a);
  773.         *os << (os -> flags() & os -> showbase ? ulong_int.StringWithBase() : ulong_int.String());
  774.     }
  775.     else
  776.     {
  777.         os -> flush();
  778.         assert(! "know how to print unsigned long value in specified format yet !!!");
  779.     }
  780.  
  781.     return *this;
  782. }
  783.  
  784. wchar_t StringConstant::US_AND[]                        = {U_AM, U_NU}, // "&"
  785.         StringConstant::US_AND_AND[]                    = {U_AM, U_AM, U_NU}, // "&&"
  786.         StringConstant::US_AND_EQUAL[]                  = {U_AM, U_EQ, U_NU}, // "&="
  787.         StringConstant::US_COLON[]                      = {U_CO, U_NU}, // ":"
  788.         StringConstant::US_COMMA[]                      = {U_CM, U_NU}, // ","
  789.         StringConstant::US_DIVIDE[]                     = {U_SL, U_NU}, // "/"
  790.         StringConstant::US_DIVIDE_EQUAL[]               = {U_SL, U_EQ, U_NU}, // "/="
  791.         StringConstant::US_DOT[]                        = {U_DO, U_NU}, // "."
  792.         StringConstant::US_EMPTY[]                      = {U_NU}, // ""
  793.         StringConstant::US_EQUAL[]                      = {U_EQ, U_NU}, // "="
  794.         StringConstant::US_EQUAL_EQUAL[]                = {U_EQ, U_EQ, U_NU}, // "=="
  795.         StringConstant::US_GREATER[]                    = {U_GT, U_NU}, // ">"
  796.         StringConstant::US_GREATER_EQUAL[]              = {U_GT, U_EQ, U_NU}, // ">="
  797.         StringConstant::US_LBRACE[]                     = {U_OS, U_NU}, // "{"
  798.         StringConstant::US_LBRACKET[]                   = {U_LB, U_NU}, // "["
  799.         StringConstant::US_LEFT_SHIFT[]                 = {U_LT, U_LT, U_NU}, // "<<"
  800.         StringConstant::US_LEFT_SHIFT_EQUAL[]           = {U_LT, U_LT, U_EQ, U_NU}, // "<<="
  801.         StringConstant::US_LESS[]                       = {U_LT, U_NU}, // "<"
  802.         StringConstant::US_LESS_EQUAL[]                 = {U_LT, U_EQ, U_NU}, // "<="
  803.         StringConstant::US_LPAREN[]                     = {U_LP, U_NU}, // "("
  804.         StringConstant::US_MINUS[]                      = {U_MI, U_NU}, // "-"
  805.         StringConstant::US_MINUS_EQUAL[]                = {U_MI, U_EQ, U_NU}, // "-="
  806.         StringConstant::US_MINUS_MINUS[]                = {U_MI, U_MI, U_NU}, // "--"
  807.         StringConstant::US_MULTIPLY[]                   = {U_ST, U_NU}, // "*"
  808.         StringConstant::US_MULTIPLY_EQUAL[]             = {U_ST, U_EQ, U_NU}, // "*="
  809.         StringConstant::US_NOT[]                        = {U_EX, U_NU}, // "!"
  810.         StringConstant::US_NOT_EQUAL[]                  = {U_EX, U_EQ, U_NU}, // "!="
  811.         StringConstant::US_OR[]                         = {U_BA, U_NU}, // "|"
  812.         StringConstant::US_OR_EQUAL[]                   = {U_BA, U_EQ, U_NU}, // "|="
  813.         StringConstant::US_OR_OR[]                      = {U_BA, U_BA, U_NU}, // "||"
  814.         StringConstant::US_PLUS[]                       = {U_PL, U_NU}, // "+"
  815.         StringConstant::US_PLUS_EQUAL[]                 = {U_PL, U_EQ, U_NU}, // "+="
  816.         StringConstant::US_PLUS_PLUS[]                  = {U_PL, U_PL, U_NU}, // "++"
  817.         StringConstant::US_QUESTION[]                   = {U_QU, U_NU}, // "?"
  818.         StringConstant::US_RBRACE[]                     = {U_CS, U_NU}, // "}"
  819.         StringConstant::US_RBRACKET[]                   = {U_RB, U_NU}, // "]"
  820.         StringConstant::US_REMAINDER[]                  = {U_PE, U_NU}, // "%"
  821.         StringConstant::US_REMAINDER_EQUAL[]            = {U_PE, U_EQ, U_NU}, // "%="
  822.         StringConstant::US_RIGHT_SHIFT[]                = {U_GT, U_GT, U_NU}, // ">>"
  823.         StringConstant::US_RIGHT_SHIFT_EQUAL[]          = {U_GT, U_GT, U_EQ, U_NU}, // ">>="
  824.         StringConstant::US_RPAREN[]                     = {U_RP, U_NU}, // ")"
  825.         StringConstant::US_SEMICOLON[]                  = {U_SC, U_NU}, // ";"
  826.         StringConstant::US_TWIDDLE[]                    = {U_TI, U_NU}, // "~"
  827.         StringConstant::US_UNSIGNED_RIGHT_SHIFT[]       = {U_GT, U_GT, U_GT, U_NU}, // ">>>"
  828.         StringConstant::US_UNSIGNED_RIGHT_SHIFT_EQUAL[] = {U_GT, U_GT, U_GT, U_EQ, U_NU}, // ">>>="
  829.         StringConstant::US_XOR[]                        = {U_CA, U_NU}, // "^"
  830.         StringConstant::US_XOR_EQUAL[]                  = {U_CA, U_EQ, U_NU}, // "^="
  831.  
  832.         StringConstant::US_Boolean[] = {U_B, U_o, U_o, U_l, U_e, U_a, U_n, U_NU}, // "Boolean"
  833.         StringConstant::US_Byte[] = {U_B, U_y, U_t, U_e, U_NU}, // "Byte"
  834.         StringConstant::US_Character[] = {U_C, U_h, U_a, U_r, U_a, U_c, U_t, U_e, U_r, U_NU}, // "Character"
  835.         StringConstant::US_Class[] = {U_C, U_l, U_a, U_s, U_s, U_NU}, // "Class"
  836.         StringConstant::US_ClassNotFoundException[] = {U_C, U_l, U_a, U_s, U_s, U_N, U_o, U_t, U_F, U_o, U_u, U_n, U_d, U_E, U_x, U_c, U_e, U_p, U_t, U_i, U_o, U_n, U_NU}, // "ClassNotFoundException"
  837.         StringConstant::US_Cloneable[] = {U_C, U_l, U_o, U_n, U_e, U_a, U_b, U_l, U_e, U_NU}, // "Cloneable"
  838.         StringConstant::US_Double[] = {U_D, U_o, U_u, U_b, U_l, U_e, U_NU}, // "Double"
  839.         StringConstant::US_Error[] = {U_E, U_r, U_r, U_o, U_r, U_NU}, // "Error"
  840.         StringConstant::US_Exception[] = { U_E, U_x, U_c, U_e, U_p, U_t, U_i, U_o, U_n, U_NU}, // "Exception"
  841.         StringConstant::US_Float[] = {U_F, U_l, U_o, U_a, U_t, U_NU},  // "Float"
  842.         StringConstant::US_Integer[] = {U_I, U_n, U_t, U_e, U_g, U_e, U_r, U_NU}, // "Integer"
  843.         StringConstant::US_L[] = {U_L, U_NU}, // "L"
  844.         StringConstant::US_Long[]  = {U_L, U_o, U_n, U_g, U_NU}, // "Long"
  845.         StringConstant::US_NoClassDefFoundError[] = {U_N, U_o, U_C, U_l, U_a, U_s, U_s, U_D, U_e, U_f, U_F, U_o, U_u, U_n, U_d, U_E, U_r, U_r, U_o, U_r, U_NU}, // "NoClassDefFoundError"
  846.         StringConstant::US_Object[] = {U_O, U_b, U_j, U_e, U_c, U_t, U_NU}, // "Object"
  847.         StringConstant::US_PObject[] = {U_P, U_O, U_b, U_j, U_e, U_c, U_t, U_NU}, // "PObject"
  848.         StringConstant::US_RuntimeException[] = {U_R, U_u, U_n, U_t, U_i, U_m, U_e, U_E, U_x, U_c, U_e, U_p, U_t, U_i, U_o, U_n, U_NU}, // RuntimeException
  849.         StringConstant::US_Serializable[] = {U_S, U_e, U_r, U_i, U_a, U_l, U_i, U_z, U_a, U_b, U_l, U_e, U_NU}, // Serializable
  850.         StringConstant::US_Short[] = {U_S, U_h, U_o, U_r, U_t, U_NU}, // Short
  851.         StringConstant::US_StringBuffer[] = {U_S, U_t, U_r, U_i, U_n, U_g, U_B, U_u, U_f, U_f, U_e, U_r, U_NU}, // StringBuffer
  852.         StringConstant::US_String[] = {U_S, U_t, U_r, U_i, U_n, U_g, U_NU}, // String
  853.         StringConstant::US_TYPE[] = {U_T, U_Y, U_P, U_E, U_NU}, // "TYPE"
  854.         StringConstant::US_Throwable[] = {U_T, U_h, U_r, U_o, U_w, U_a, U_b, U_l, U_e, U_NU}, // Throwable
  855.         StringConstant::US_Void[] = {U_V, U_o, U_i, U_d, U_NU}, // Void
  856.         StringConstant::US_Vector[] = {U_V, U_e, U_c, U_t, U_o, U_r, U_NU}, // Vector
  857.         StringConstant::US__DO[] = {U_DO, U_NU}, // "."
  858.         StringConstant::US__DO__DO[] = {U_DO, U_DO, U_NU}, // ".."
  859.         StringConstant::US__DS[] = {U_DS, U_NU}, // "$"
  860.         StringConstant::US__LB__RB[] = {U_LB, U_RB, U_NU}, // "[]"
  861.         StringConstant::US__LT_clinit_GT[] = {U_LT, U_c, U_l, U_i, U_n, U_i, U_t, U_GT, U_NU}, // "<clinit>"
  862.         StringConstant::US__LT_init_GT[] = {U_LT, U_i, U_n, U_i, U_t, U_GT, U_NU}, // "<init>"
  863.         StringConstant::US__QU__QU[] = {U_QU, U_QU, U_NU},  // "??"
  864.         StringConstant::US__SC[] = {U_SC, U_NU}, // ";"
  865.         StringConstant::US__SL[] = {U_SL, U_NU}, // "/"
  866.  
  867.         StringConstant::US__zip[] = {U_z, U_i, U_p, U_NU}, // "zip"
  868.         StringConstant::US__jar[] = {U_j, U_a, U_r, U_NU}, // "jar"
  869.  
  870.         StringConstant::US__array[] = {U_a, U_r, U_r, U_a, U_y, U_NU}, // "array"
  871.         StringConstant::US__access_DOLLAR[] = {U_a, U_c, U_c, U_e, U_s, U_s, U_DS, U_NU}, // "access$"
  872.         StringConstant::US__class_DOLLAR[] = {U_c, U_l, U_a, U_s, U_s, U_DS, U_NU}, // "class$"
  873.         StringConstant::US__constructor_DOLLAR[] = {U_c, U_o, U_n, U_s, U_t, U_r, U_u, U_c, U_t, U_o, U_r, U_DS, U_NU}, // "constructor$"
  874.         StringConstant::US__this_DOLLAR[] = {U_t, U_h, U_i, U_s, U_DS, U_NU}, // "this$"
  875.         StringConstant::US__val_DOLLAR[] = {U_v, U_a, U_l, U_DS, U_NU}, // "val$"
  876.  
  877.         StringConstant::US_abstract[] = {U_a, U_b, U_s, U_t, U_r, U_a, U_c, U_t, U_NU}, // "abstract"
  878.         StringConstant::US_append[] = {U_a, U_p, U_p, U_e, U_n, U_d, U_NU}, // "append"
  879.         StringConstant::US_block_DOLLAR[] = {U_b, U_l, U_o, U_c, U_k, U_DS, U_NU}, // "block$"
  880.         StringConstant::US_boolean[] = {U_b, U_o, U_o, U_l, U_e, U_a, U_n, U_NU}, // "boolean"
  881.         StringConstant::US_break[] = {U_b, U_r, U_e, U_a, U_k, U_NU}, // "break"
  882.         StringConstant::US_byte[] = {U_b, U_y, U_t, U_e, U_NU}, // "byte"
  883.         StringConstant::US_case[] = {U_c, U_a, U_s, U_e, U_NU}, // "case"
  884.         StringConstant::US_catch[] = {U_c, U_a, U_t, U_c, U_h, U_NU}, // "catch"
  885.         StringConstant::US_char[] = {U_c, U_h, U_a, U_r, U_NU}, // "char"
  886.         StringConstant::US_class[] = {U_c, U_l, U_a, U_s, U_s, U_NU}, // "class"
  887.         StringConstant::US_clone[] = {U_c, U_l, U_o, U_n, U_e, U_NU}, // "clone"
  888.         StringConstant::US_const[] = {U_c, U_o, U_n, U_s, U_t, U_NU}, // "const"
  889.         StringConstant::US_continue[] = {U_c, U_o, U_n, U_t, U_i, U_n, U_u, U_e, U_NU}, // "continue"
  890.         StringConstant::US_default[] = {U_d, U_e, U_f, U_a, U_u, U_l, U_t, U_NU}, // "default"
  891.         StringConstant::US_do[] = {U_d, U_o, U_NU}, // "do"
  892.         StringConstant::US_double[] = {U_d, U_o, U_u, U_b, U_l, U_e, U_NU}, // "double"
  893.         StringConstant::US_else[] = {U_e, U_l, U_s, U_e, U_NU}, // "else"
  894.         StringConstant::US_extends[] = {U_e, U_x, U_t, U_e, U_n, U_d, U_s, U_NU}, // "extends"
  895.         StringConstant::US_false[] = {U_f, U_a, U_l, U_s, U_e, U_NU}, // "false"
  896.         StringConstant::US_final[] = {U_f, U_i, U_n, U_a, U_l, U_NU}, // "final"
  897.         StringConstant::US_finally[] = {U_f, U_i, U_n, U_a, U_l, U_l, U_y, U_NU}, // "finally"
  898.         StringConstant::US_float[] = {U_f, U_l, U_o, U_a, U_t, U_NU}, // "float"
  899.         StringConstant::US_for[] = {U_f, U_o, U_r, U_NU}, // "for"
  900.         StringConstant::US_forName[] = {U_f, U_o, U_r, U_N, U_a, U_m, U_e, U_NU}, // "forName"
  901.         StringConstant::US_getMessage[] = {U_g, U_e, U_t, U_M, U_e, U_s, U_s, U_a, U_g, U_e, U_NU}, // "getMessage"
  902.         StringConstant::US_goto[] = {U_g, U_o, U_t, U_o, U_NU}, // "goto"
  903.         StringConstant::US_if[] = {U_i, U_f, U_NU}, // "if"
  904.         StringConstant::US_implements[] = {U_i, U_m, U_p, U_l, U_e, U_m, U_e, U_n, U_t, U_s, U_NU}, // "implements"
  905.         StringConstant::US_import[] = {U_i, U_m, U_p, U_o, U_r, U_t, U_NU}, // "import"
  906.         StringConstant::US_instanceof[] = {U_i, U_n, U_s, U_t, U_a, U_n, U_c, U_e, U_o, U_f, U_NU}, // "instanceof"
  907.         StringConstant::US_int[] = {U_i, U_n, U_t, U_NU}, // "int"
  908.         StringConstant::US_interface[] = {U_i, U_n, U_t, U_e, U_r, U_f, U_a, U_c, U_e, U_NU}, // "interface"
  909.         StringConstant::US_java_SL_io[] =  {U_j, U_a, U_v, U_a, U_SL, U_i, U_o, U_NU}, // "java/io"
  910.         StringConstant::US_java_SL_lang[] = {U_j, U_a, U_v, U_a, U_SL, U_l, U_a, U_n, U_g, U_NU}, // "java/lang"
  911.         StringConstant::US_java_SL_util[] = {U_j, U_a, U_v, U_a, U_SL, U_u, U_t, U_i, U_l, U_NU}, // "java/util"
  912.         StringConstant::US_length[] = {U_l, U_e, U_n, U_g, U_t, U_h, U_NU}, // "length"
  913.         StringConstant::US_long[] = {U_l, U_o, U_n, U_g, U_NU}, // "long"
  914.         StringConstant::US_native[] = {U_n, U_a, U_t, U_i, U_v, U_e, U_NU}, // "native"
  915.         StringConstant::US_new[] = {U_n, U_e, U_w, U_NU}, // "new"
  916.         StringConstant::US_null[] = {U_n, U_u, U_l, U_l, U_NU}, // "null"
  917.         StringConstant::US_package[] = {U_p, U_a, U_c, U_k, U_a, U_g, U_e, U_NU}, // "package"
  918.         StringConstant::US_private[] = {U_p, U_r, U_i, U_v, U_a, U_t, U_e, U_NU}, // "private"
  919.         StringConstant::US_protected[] = {U_p, U_r, U_o, U_t, U_e, U_c, U_t, U_e, U_d, U_NU}, // "protected"
  920.         StringConstant::US_public[] = {U_p, U_u, U_b, U_l, U_i, U_c, U_NU}, // "public"
  921.         StringConstant::US_return[] = {U_r, U_e, U_t, U_u, U_r, U_n, U_NU}, // "return"
  922.         StringConstant::US_short[] = {U_s, U_h, U_o, U_r, U_t, U_NU}, // "short"
  923.         StringConstant::US_static[] = {U_s, U_t, U_a, U_t, U_i, U_c, U_NU}, // "static"
  924.         StringConstant::US_strictfp[] = {U_s, U_t, U_r, U_i, U_c, U_t, U_f, U_p, U_NU}, // "strictfp"
  925.         StringConstant::US_super[] = {U_s, U_u, U_p, U_e, U_r, U_NU}, // "super"
  926.         StringConstant::US_switch[] = {U_s, U_w, U_i, U_t, U_c, U_h, U_NU}, // "switch"
  927.         StringConstant::US_synchronized[] = {U_s, U_y, U_n, U_c, U_h, U_r, U_o, U_n, U_i, U_z, U_e, U_d, U_NU}, // "synchronized"
  928.         StringConstant::US_this0[] = {U_t, U_h, U_i, U_s, U_DS, U_0, U_NU}, // "this$0"
  929.         StringConstant::US_this[] = {U_t, U_h, U_i, U_s, U_NU}, // "this"
  930.         StringConstant::US_throw[] = {U_t, U_h, U_r, U_o, U_w, U_NU}, // "throw"
  931.         StringConstant::US_throws[] = {U_t, U_h, U_r, U_o, U_w, U_s, U_NU}, // "throws"
  932.         StringConstant::US_toString[] = {U_t, U_o, U_S, U_t, U_r, U_i, U_n, U_g, U_NU}, // "toString"
  933.         StringConstant::US_transient[] = {U_t, U_r, U_a, U_n, U_s, U_i, U_e, U_n, U_t, U_NU}, // "transient"
  934.         StringConstant::US_true[] = {U_t, U_r, U_u, U_e, U_NU}, // "true"
  935.         StringConstant::US_try[] = {U_t, U_r, U_y, U_NU}, // "try"
  936.         StringConstant::US_void[] = {U_v, U_o, U_i, U_d, U_NU}, // "void"
  937.         StringConstant::US_volatile[] = {U_v, U_o, U_l, U_a, U_t, U_i, U_l, U_e, U_NU}, // "volatile"
  938.         StringConstant::US_while[] = {U_w, U_h, U_i, U_l, U_e, U_NU}, // "while"
  939.  
  940.         StringConstant::US_EOF[] = {U_E, U_O, U_F, U_NU}; // "EOF"
  941.  
  942. wchar_t StringConstant::US_smallest_int[] = {U_MINUS, U_2, U_1, U_4, U_7, U_4, U_8, U_3, U_6, U_4, U_8, U_NU}; // "-2147483648"
  943.  
  944.  
  945. char StringConstant::U8S_command_format[] = "use: jikes [-classpath path][-d dir][-debug][-depend|-Xdepend][-deprecation]"
  946. #if defined(HAVE_LIB_ICU_UC) || defined(HAVE_ICONV_H)
  947.                                             "[-encoding encoding]"
  948. #endif
  949.                         "[-g][-nowarn][-nowrite][-O][-verbose][-Xstdout]"
  950.                                             "[++][+B][+c][+OLDCSO][+D][+DR=filename][+E][+F][+Kname=TypeKeyWord][+M][+P][+Td...d][+U][+Z]"
  951.                                             " file.java...";
  952.  
  953. char StringConstant::U8S_B[] = {U_B,U_NU}, // "B"
  954.      StringConstant::U8S_C[] = {U_C,U_NU}, // "C"
  955.      StringConstant::U8S_Code[] = {U_C,U_o,U_d,U_e,U_NU}, // "Code"
  956.      StringConstant::U8S_ConstantValue[] = {U_C,U_o,U_n,U_s,U_t,U_a,U_n,U_t,U_V,U_a,U_l,U_u,U_e,U_NU}, // "ConstantValue"
  957.      StringConstant::U8S_D[] = {U_D,U_NU}, // "D"
  958.      StringConstant::U8S_Exceptions[] = {U_E,U_x,U_c,U_e,U_p,U_t,U_i,U_o,U_n,U_s,U_NU}, // "Exceptions"
  959.      StringConstant::U8S_F[] = {U_F,U_NU}, // "F"
  960.      StringConstant::U8S_I[] = {U_I,U_NU}, // "I"
  961.      StringConstant::U8S_InnerClasses[] = {U_I,U_n,U_n,U_e,U_r,U_C,U_l,U_a,U_s,U_s,U_e,U_s,U_NU}, // "InnerClasses"
  962.      StringConstant::U8S_J[] = {U_J,U_NU},  // "J"
  963.      StringConstant::U8S_LP_Ljava_SL_lang_SL_String_SC_RP_Ljava_SL_lang_SL_Class_SC[] = {U_LP,U_L,U_j,U_a,U_v,U_a,U_SL,U_l,U_a,U_n,U_g,U_SL,U_S,U_t,U_r,U_i,U_n,U_g,U_SC,U_RP,U_L,U_j,U_a,U_v,U_a,U_SL,U_l,U_a,U_n,U_g,U_SL,U_C,U_l,U_a,U_s,U_s,U_SC,U_NU}, // "(Ljava/lang/String;)Ljava/lang/Class;"
  964.      StringConstant::U8S_LP_Ljava_SL_lang_SL_String_SC_RP_V[] = {U_LP,U_L,U_j,U_a,U_v,U_a,U_SL,U_l,U_a,U_n,U_g,U_SL,U_S,U_t,U_r,U_i,U_n,U_g,U_SC,U_RP,U_V,U_NU}, // "(Ljava/lang/String;)V"
  965.      StringConstant::U8S_LP_RP_Ljava_SL_lang_SL_String_SC[] = {U_LP,U_RP,U_L,U_j,U_a,U_v,U_a,U_SL,U_l,U_a,U_n,U_g,U_SL,U_S,U_t,U_r,U_i,U_n,U_g,U_SC,U_NU}, // "()_Ljava/lang/String;"
  966.      StringConstant::U8S_LP_RP_V[] = {U_LP,U_RP,U_V,U_NU}, // "()V"
  967.      StringConstant::U8S_LineNumberTable[] = {U_L,U_i,U_n,U_e,U_N,U_u,U_m,U_b,U_e,U_r,U_T,U_a,U_b,U_l,U_e,U_NU}, // "LineNumberTable"
  968.      StringConstant::U8S_LocalVariableTable[] = {U_L,U_o,U_c,U_a,U_l,U_V,U_a,U_r,U_i,U_a,U_b,U_l,U_e,U_T,U_a,U_b,U_l,U_e,U_NU}, // "LocalVariableTable"
  969.      StringConstant::U8S_S[] = {U_S,U_NU}, // "S"
  970.      StringConstant::U8S_Sourcefile[] = {U_S,U_o,U_u,U_r,U_c,U_e,U_F,U_i,U_l,U_e,U_NU}, // "Sourcefile"
  971.      StringConstant::U8S_Synthetic[] = {U_S,U_y,U_n,U_t,U_h,U_e,U_t,U_i,U_c,U_NU}, // "Synthetic"
  972.      StringConstant::U8S_Deprecated[] = {U_D,U_e,U_p,U_r,U_e,U_c,U_a,U_t,U_e,U_d,U_NU}, // "Deprecated"
  973.      StringConstant::U8S_V[] = {U_V,U_NU}, // "V"
  974.      StringConstant::U8S_Z[] = {U_Z,U_NU}, // "Z"
  975.  
  976.      StringConstant::U8S__DO[] = {U_DO,U_NU}, // "."
  977.      StringConstant::U8S__DO_class[] = {U_DO,U_c,U_l,U_a,U_s,U_s,U_NU}, // ".class"
  978.      StringConstant::U8S__DO_java[] = {U_DO,U_j,U_a,U_v,U_a,U_NU}, // ".java"
  979.      StringConstant::U8S__DO_tok[] = {U_DO,U_t,U_o,U_k,U_NU}, // ".tok"
  980.      StringConstant::U8S__DO_u[] = {U_DO,U_u,U_NU}, // ".u"
  981.      StringConstant::U8S__LP[] = {U_LP,U_NU}, // "("
  982.      StringConstant::U8S__RP[] = {U_RP,U_NU}, // ")"
  983.      StringConstant::U8S__SL[] = {U_SL,U_NU}, // "/"
  984.      StringConstant::U8S__ST[] = {U_ST,U_NU}, // "*"
  985.  
  986.      StringConstant::U8S_class[] = {U_c,U_l,U_a,U_s,U_s,U_NU}, // "class"
  987.      StringConstant::U8S_java[] = {U_j,U_a,U_v,U_a,U_NU}, // "java"
  988.      StringConstant::U8S_java_SL_lang_SL_ClassNotFoundException[] = {U_j,U_a,U_v,U_a,U_SL,U_l,U_a,U_n,U_g,U_SL,U_C,U_l,U_a,U_s,U_s,U_N,U_o,U_t,U_F,U_o,U_u,U_n,U_d,U_E,U_x,U_c,U_e,U_p,U_t,U_i,U_o,U_n,U_NU}, // "java/lang/ClassNotFoundException"
  989.      StringConstant::U8S_java_SL_lang_SL_Class[] = {U_j,U_a,U_v,U_a,U_SL,U_l,U_a,U_n,U_g,U_SL,U_C,U_l,U_a,U_s,U_s,U_NU}, // "java/lang/Class"
  990.      StringConstant::U8S_java_SL_lang_SL_InternalError[] = {U_j,U_a,U_v,U_a,U_SL,U_l,U_a,U_n,U_g,U_SL,U_I,U_n,U_t,U_e,U_r,U_n,U_a,U_l,U_E,U_r,U_r,U_o,U_r,U_NU}, // "java/lang/InternalError"
  991.      StringConstant::U8S_java_SL_lang_SL_NoClassDefFoundError[] = {U_j,U_a,U_v,U_a,U_SL,U_l,U_a,U_n,U_g,U_SL,U_N,U_o,U_C,U_l,U_a,U_s,U_s,U_D,U_e,U_f,U_F,U_o,U_u,U_n,U_d,U_E,U_r,U_r,U_o,U_r,U_NU}, // "java/lang/NoClassDefFoundError"
  992.      StringConstant::U8S_java_SL_lang_SL_StringBuffer[] = {U_j,U_a,U_v,U_a,U_SL,U_l,U_a,U_n,U_g,U_SL,U_S,U_t,U_r,U_i,U_n,U_g,U_B,U_u,U_f,U_f,U_e,U_r,U_NU}, // "java/lang/StringBuffer"
  993.      StringConstant::U8S_java_SL_lang_SL_Throwable[] = {U_j,U_a,U_v,U_a,U_SL,U_l,U_a,U_n,U_g,U_SL,U_T,U_h,U_r,U_o,U_w,U_a,U_b,U_l,U_e,U_NU}, // "java/lang/Throwable"
  994.      StringConstant::U8S_null[] = {U_n,U_u,U_l,U_l,U_NU}, // "null"
  995.      StringConstant::U8S_quit[] = {U_q,U_u,U_i,U_t,U_NU}, // "quit"
  996.      StringConstant::U8S_this[] = {U_t,U_h,U_i,U_s,U_NU}, // "this"
  997.  
  998.      StringConstant::U8S_LP_LB_C_RP_Ljava_SL_lang_SL_StringBuffer_SC[] = {U_LP, U_LB, U_C, U_RP, U_L, U_j, U_a, U_v, U_a, U_SL, U_l, U_a, U_n, U_g, U_SL, U_S, U_t, U_r, U_i, U_n, U_g, U_B, U_u, U_f, U_f, U_e, U_r, U_SC, U_NU},
  999.      StringConstant::U8S_LP_C_RP_Ljava_SL_lang_SL_StringBuffer_SC[] = {U_LP, U_C, U_RP, U_L, U_j, U_a, U_v, U_a, U_SL, U_l, U_a, U_n, U_g, U_SL, U_S, U_t, U_r, U_i, U_n, U_g, U_B, U_u, U_f, U_f, U_e, U_r, U_SC, U_NU},
  1000.      StringConstant::U8S_LP_Z_RP_Ljava_SL_lang_SL_StringBuffer_SC[] = {U_LP, U_Z, U_RP, U_L, U_j, U_a, U_v, U_a, U_SL, U_l, U_a, U_n, U_g, U_SL, U_S, U_t, U_r, U_i, U_n, U_g, U_B, U_u, U_f, U_f, U_e, U_r, U_SC, U_NU},
  1001.      StringConstant::U8S_LP_I_RP_Ljava_SL_lang_SL_StringBuffer_SC[] = {U_LP, U_I, U_RP, U_L, U_j, U_a, U_v, U_a, U_SL, U_l, U_a, U_n, U_g, U_SL, U_S, U_t, U_r, U_i, U_n, U_g, U_B, U_u, U_f, U_f, U_e, U_r, U_SC, U_NU},
  1002.      StringConstant::U8S_LP_J_RP_Ljava_SL_lang_SL_StringBuffer_SC[] = {U_LP, U_J, U_RP, U_L, U_j, U_a, U_v, U_a, U_SL, U_l, U_a, U_n, U_g, U_SL, U_S, U_t, U_r, U_i, U_n, U_g, U_B, U_u, U_f, U_f, U_e, U_r, U_SC, U_NU},
  1003.      StringConstant::U8S_LP_F_RP_Ljava_SL_lang_SL_StringBuffer_SC[] = {U_LP, U_F, U_RP, U_L, U_j, U_a, U_v, U_a, U_SL, U_l, U_a, U_n, U_g, U_SL, U_S, U_t, U_r, U_i, U_n, U_g, U_B, U_u, U_f, U_f, U_e, U_r, U_SC, U_NU},
  1004.      StringConstant::U8S_LP_D_RP_Ljava_SL_lang_SL_StringBuffer_SC[] = {U_LP, U_D, U_RP, U_L, U_j, U_a, U_v, U_a, U_SL, U_l, U_a, U_n, U_g, U_SL, U_S, U_t, U_r, U_i, U_n, U_g, U_B, U_u, U_f, U_f, U_e, U_r, U_SC, U_NU},
  1005.      StringConstant::U8S_LP_Ljava_SL_lang_SL_String_SC_RP_Ljava_SL_lang_SL_StringBuffer_SC[] = {U_LP, U_L, U_j, U_a, U_v, U_a, U_SL, U_l, U_a, U_n, U_g, U_SL, U_S, U_t, U_r, U_i, U_n, U_g, U_SC, U_RP, U_L, U_j, U_a, U_v, U_a, U_SL, U_l, U_a, U_n, U_g, U_SL, U_S, U_t, U_r, U_i, U_n, U_g, U_B, U_u, U_f, U_f, U_e, U_r, U_SC, U_NU},
  1006.      StringConstant::U8S_LP_Ljava_SL_lang_SL_Object_SC_RP_Ljava_SL_lang_SL_StringBuffer_SC[] = {U_LP, U_L, U_j, U_a, U_v, U_a, U_SL, U_l, U_a, U_n, U_g, U_SL, U_O, U_b, U_j, U_e, U_c, U_t, U_SC, U_RP, U_L, U_j, U_a, U_v, U_a, U_SL, U_l, U_a, U_n, U_g, U_SL, U_S, U_t, U_r, U_i, U_n, U_g, U_B, U_u, U_f, U_f, U_e, U_r, U_SC, U_NU};
  1007.  
  1008. char StringConstant::U8S_smallest_int[] = {U_MINUS, U_2, U_1, U_4, U_7, U_4, U_8, U_3, U_6, U_4, U_8, U_NU}, // "-2147483648"
  1009.      StringConstant::U8S_smallest_long_int[] = {U_MINUS, U_9, U_2, U_2, U_3, U_3, U_7, U_2, U_0, U_3, U_6,
  1010.                                                          U_8, U_5, U_4, U_7, U_7, U_5, U_8, U_0, U_8, U_NU}; // "-9223372036854775808"
  1011.  
  1012. int StringConstant::U8S_ConstantValue_length = strlen(U8S_ConstantValue),
  1013.     StringConstant::U8S_Exceptions_length = strlen(U8S_Exceptions),
  1014.     StringConstant::U8S_InnerClasses_length = strlen(U8S_InnerClasses),
  1015.     StringConstant::U8S_Synthetic_length = strlen(U8S_Synthetic),
  1016.     StringConstant::U8S_Deprecated_length = strlen(U8S_Deprecated),
  1017.     StringConstant::U8S_LineNumberTable_length = strlen(U8S_LineNumberTable),
  1018.     StringConstant::U8S_LocalVariableTable_length = strlen(U8S_LocalVariableTable),
  1019.     StringConstant::U8S_Code_length = strlen(U8S_Code),
  1020.     StringConstant::U8S_Sourcefile_length = strlen(U8S_Sourcefile),
  1021.  
  1022.     StringConstant::U8S_null_length = strlen(U8S_null),
  1023.     StringConstant::U8S_this_length = strlen(U8S_this);
  1024.  
  1025.  
  1026. Ostream Coutput;
  1027.  
  1028. ErrorString::ErrorString():ConvertibleArray<wchar_t>(1024), fill_char(' '), field_width(0)
  1029. {
  1030. }
  1031.  
  1032. void ErrorString::do_fill(int n)
  1033. {
  1034.     while(n<field_width)
  1035.     {
  1036.         Next()=(wchar_t)fill_char;
  1037.         n++;
  1038.     }
  1039.     field_width = 0;
  1040. }
  1041.  
  1042. ErrorString &ErrorString::operator<<(const wchar_t c)
  1043. {
  1044.     do_fill(1);
  1045.     Next()=c;
  1046.     return *this;
  1047. }
  1048.  
  1049. ErrorString &ErrorString::operator<<(const char c)
  1050. {
  1051.     do_fill(1);
  1052.     Next()=(wchar_t)c;
  1053.     return *this;
  1054. }
  1055.  
  1056. ErrorString &ErrorString::operator<<(const wchar_t *s)
  1057. {
  1058.     do_fill(
  1059.             wcslen(
  1060. #ifdef HAVE_ERROR_CALL_WCSLEN_CONST
  1061.                    (wchar_t *)
  1062. #endif
  1063.                    s)
  1064.         );
  1065.     if(s)
  1066.         while(*s)
  1067.             Next()=*(s++);
  1068.  
  1069.     return *this;
  1070. }
  1071.  
  1072. ErrorString &ErrorString::operator<<(const char *s)
  1073. {
  1074.     do_fill(strlen(s));
  1075.     if(s)
  1076.         while(*s)
  1077.             Next()=(wchar_t) *(s++);
  1078.     
  1079.     return *this;
  1080. }
  1081.  
  1082. ErrorString &ErrorString::operator<<(int n)
  1083. {
  1084.     char buf[64];
  1085.     sprintf(buf,"%d",n);
  1086.     
  1087.     return (*this << buf);
  1088. }
  1089.  
  1090. wchar_t *ErrorString::Array()
  1091. {
  1092.     Next() = U_NULL; // zero terminate string
  1093.     wchar_t *s=ConvertibleArray<wchar_t>::Array();
  1094.     if(!s)
  1095.         return NULL;
  1096.  
  1097.     //TODO: optimize!
  1098.     wchar_t *res=new wchar_t[top];
  1099.     memcpy(res,s,top*sizeof(wchar_t));
  1100.     return res;
  1101. }
  1102.  
  1103. void ErrorString::width(int w)
  1104. {
  1105.     field_width = w;
  1106. }
  1107.  
  1108. void ErrorString::fill(const char c)
  1109. {
  1110.     fill_char = c;
  1111. }
  1112.  
  1113. #ifdef    HAVE_JIKES_NAMESPACE
  1114. }            // Close namespace Jikes block
  1115. #endif
  1116.  
  1117.