xersve.cpp 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. /* xersve.f -- translated by f2c (version 20100827).
  2. This file no longer depends on f2c.
  3. */
  4. #include "slatec-internal.hpp"
  5. /* Table of constant values */
  6. static integer const c__4 = 4;
  7. static integer const c__1 = 1;
  8. int xersve_(char const *librar, char const *subrou, char const *messg, integer
  9. const *kflag, integer const *nerr, integer const *level, integer *icount, ftnlen
  10. librar_len, ftnlen subrou_len, ftnlen messg_len)
  11. {
  12. /* Initialized data */
  13. static integer kountx = 0;
  14. static integer nmsg = 0;
  15. /* Format strings */
  16. static char fmt_9000[] = "(\0020 ERROR MESSAGE SUMMARY\002/\002\
  17. LIBRARY SUBROUTINE MESSAGE START NERR\002,\002 LEVEL \
  18. COUNT\002)";
  19. static char fmt_9010[] = "(1x,a,3x,a,3x,a,3i10)";
  20. static char fmt_9020[] = "(\0020OTHER ERRORS NOT INDIVIDUALLY TABULATED \
  21. = \002,i10)";
  22. static char fmt_9030[] = "(1x)";
  23. /* System generated locals */
  24. integer i__1, i__2;
  25. /* Local variables */
  26. integer i__;
  27. char lib[8], mes[20], sub[8];
  28. integer lun[5], iunit, kunit, nunit;
  29. static integer kount[10];
  30. static char libtab[8*10], mestab[20*10];
  31. static integer nertab[10], levtab[10];
  32. static char subtab[8*10];
  33. /* Fortran I/O blocks */
  34. static cilist io___7 = { 0, 0, 0, fmt_9000, 0 };
  35. static cilist io___9 = { 0, 0, 0, fmt_9010, 0 };
  36. static cilist io___16 = { 0, 0, 0, fmt_9020, 0 };
  37. static cilist io___17 = { 0, 0, 0, fmt_9030, 0 };
  38. /* ***BEGIN PROLOGUE XERSVE */
  39. /* ***SUBSIDIARY */
  40. /* ***PURPOSE Record that an error has occurred. */
  41. /* ***LIBRARY SLATEC (XERROR) */
  42. /* ***CATEGORY R3 */
  43. /* ***TYPE ALL (XERSVE-A) */
  44. /* ***KEYWORDS ERROR, XERROR */
  45. /* ***AUTHOR Jones, R. E., (SNLA) */
  46. /* ***DESCRIPTION */
  47. /* *Usage: */
  48. /* INTEGER KFLAG, NERR, LEVEL, ICOUNT */
  49. /* CHARACTER * (len) LIBRAR, SUBROU, MESSG */
  50. /* CALL XERSVE (LIBRAR, SUBROU, MESSG, KFLAG, NERR, LEVEL, ICOUNT) */
  51. /* *Arguments: */
  52. /* LIBRAR :IN is the library that the message is from. */
  53. /* SUBROU :IN is the subroutine that the message is from. */
  54. /* MESSG :IN is the message to be saved. */
  55. /* KFLAG :IN indicates the action to be performed. */
  56. /* when KFLAG > 0, the message in MESSG is saved. */
  57. /* when KFLAG=0 the tables will be dumped and */
  58. /* cleared. */
  59. /* when KFLAG < 0, the tables will be dumped and */
  60. /* not cleared. */
  61. /* NERR :IN is the error number. */
  62. /* LEVEL :IN is the error severity. */
  63. /* ICOUNT :OUT the number of times this message has been seen, */
  64. /* or zero if the table has overflowed and does not */
  65. /* contain this message specifically. When KFLAG=0, */
  66. /* ICOUNT will not be altered. */
  67. /* *Description: */
  68. /* Record that this error occurred and possibly dump and clear the */
  69. /* tables. */
  70. /* ***REFERENCES R. E. Jones and D. K. Kahaner, XERROR, the SLATEC */
  71. /* Error-handling Package, SAND82-0800, Sandia */
  72. /* Laboratories, 1982. */
  73. /* ***ROUTINES CALLED I1MACH, XGETUA */
  74. /* ***REVISION HISTORY (YYMMDD) */
  75. /* 800319 DATE WRITTEN */
  76. /* 861211 REVISION DATE from Version 3.2 */
  77. /* 891214 Prologue converted to Version 4.0 format. (BAB) */
  78. /* 900413 Routine modified to remove reference to KFLAG. (WRB) */
  79. /* 900510 Changed to add LIBRARY NAME and SUBROUTINE to calling */
  80. /* sequence, use IF-THEN-ELSE, make number of saved entries */
  81. /* easily changeable, changed routine name from XERSAV to */
  82. /* XERSVE. (RWC) */
  83. /* 910626 Added LIBTAB and SUBTAB to SAVE statement. (BKS) */
  84. /* 920501 Reformatted the REFERENCES section. (WRB) */
  85. /* ***END PROLOGUE XERSVE */
  86. /* ***FIRST EXECUTABLE STATEMENT XERSVE */
  87. if (*kflag <= 0) {
  88. /* Dump the table. */
  89. if (nmsg == 0) {
  90. return 0;
  91. }
  92. /* Print to each unit. */
  93. xgetua_(lun, &nunit);
  94. i__1 = nunit;
  95. for (kunit = 1; kunit <= i__1; ++kunit) {
  96. iunit = lun[kunit - 1];
  97. if (iunit == 0) {
  98. iunit = i1mach_(4);
  99. }
  100. /* Print the table header. */
  101. io___7.ciunit = iunit;
  102. f2c::s_wsfe(&io___7);
  103. f2c::e_wsfe();
  104. /* Print body of table. */
  105. i__2 = nmsg;
  106. for (i__ = 1; i__ <= i__2; ++i__) {
  107. io___9.ciunit = iunit;
  108. f2c::s_wsfe(&io___9);
  109. f2c::do_fio(&c__1, libtab + (i__ - 1 << 3), (ftnlen)8);
  110. f2c::do_fio(&c__1, subtab + (i__ - 1 << 3), (ftnlen)8);
  111. f2c::do_fio(&c__1, mestab + (i__ - 1) * 20, (ftnlen)20);
  112. f2c::do_fio(&c__1, (char *)&nertab[i__ - 1], (ftnlen)sizeof(integer));
  113. f2c::do_fio(&c__1, (char *)&levtab[i__ - 1], (ftnlen)sizeof(integer));
  114. f2c::do_fio(&c__1, (char *)&kount[i__ - 1], (ftnlen)sizeof(integer));
  115. f2c::e_wsfe();
  116. /* L10: */
  117. }
  118. /* Print number of other errors. */
  119. if (kountx != 0) {
  120. io___16.ciunit = iunit;
  121. f2c::s_wsfe(&io___16);
  122. f2c::do_fio(&c__1, (char *)&kountx, (ftnlen)sizeof(integer));
  123. f2c::e_wsfe();
  124. }
  125. io___17.ciunit = iunit;
  126. f2c::s_wsfe(&io___17);
  127. f2c::e_wsfe();
  128. /* L20: */
  129. }
  130. /* Clear the error tables. */
  131. if (*kflag == 0) {
  132. nmsg = 0;
  133. kountx = 0;
  134. }
  135. } else {
  136. /* PROCESS A MESSAGE... */
  137. /* SEARCH FOR THIS MESSG, OR ELSE AN EMPTY SLOT FOR THIS MESSG, */
  138. /* OR ELSE DETERMINE THAT THE ERROR TABLE IS FULL. */
  139. f2c::s_copy(lib, librar, (ftnlen)8, librar_len);
  140. f2c::s_copy(sub, subrou, (ftnlen)8, subrou_len);
  141. f2c::s_copy(mes, messg, (ftnlen)20, messg_len);
  142. i__1 = nmsg;
  143. for (i__ = 1; i__ <= i__1; ++i__) {
  144. if (f2c::s_cmp(lib, libtab + (i__ - 1 << 3), (ftnlen)8, (ftnlen)8) ==
  145. 0 && f2c::s_cmp(sub, subtab + (i__ - 1 << 3), (ftnlen)8, (
  146. ftnlen)8) == 0 && f2c::s_cmp(mes, mestab + (i__ - 1) * 20, (
  147. ftnlen)20, (ftnlen)20) == 0 && *nerr == nertab[i__ - 1] &&
  148. *level == levtab[i__ - 1]) {
  149. ++kount[i__ - 1];
  150. *icount = kount[i__ - 1];
  151. return 0;
  152. }
  153. /* L30: */
  154. }
  155. if (nmsg < 10) {
  156. /* Empty slot found for new message. */
  157. ++nmsg;
  158. f2c::s_copy(libtab + (i__ - 1 << 3), lib, (ftnlen)8, (ftnlen)8);
  159. f2c::s_copy(subtab + (i__ - 1 << 3), sub, (ftnlen)8, (ftnlen)8);
  160. f2c::s_copy(mestab + (i__ - 1) * 20, mes, (ftnlen)20, (ftnlen)20);
  161. nertab[i__ - 1] = *nerr;
  162. levtab[i__ - 1] = *level;
  163. kount[i__ - 1] = 1;
  164. *icount = 1;
  165. } else {
  166. /* Table is full. */
  167. ++kountx;
  168. *icount = 0;
  169. }
  170. }
  171. return 0;
  172. /* Formats. */
  173. } /* xersve_ */