Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

156 lines
3.1 KiB

  1. /* asmerr.c -- microsoft 80x86 assembler
  2. **
  3. ** microsoft (r) macro assembler
  4. ** copyright (c) microsoft corp 1986. all rights reserved
  5. **
  6. ** randy nevin
  7. **
  8. ** 10/90 - Quick conversion to 32 bit by Jeff Spencer
  9. */
  10. #include <stdio.h>
  11. #include <string.h>
  12. #include "asm86.h"
  13. #include "asmfcn.h"
  14. #include "asmmsg.h"
  15. #define MSGLEN 50
  16. static char errstring[MSGLEN + 1];
  17. extern char FAR * FAR messages[];
  18. extern short FAR msgnum[];
  19. static USHORT badoff;
  20. /*** errordisplay - display error
  21. *
  22. * errordisplay();
  23. *
  24. * Entry debug = debug output flag
  25. * pass2 = TRUE if pass 2
  26. * listquiet = FALSE if error output to console
  27. * Exit
  28. * Returns
  29. * Calls
  30. */
  31. VOID PASCAL
  32. errordisplay ()
  33. {
  34. if (pass2 || fPass1Err || debug) {
  35. if (lsting) {
  36. error_line (lst.fil, pFCBCur->fname, errorlineno);
  37. fputs(NLINE, lst.fil);
  38. }
  39. }
  40. if (!listquiet){
  41. error_line (ERRFILE, pFCBCur->fname, errorlineno);
  42. fputs("\n", ERRFILE);
  43. }
  44. if (pass2)
  45. if (warnCode > 0){ /* if its not a serve error */
  46. /* and were interested in this level*/
  47. if (warnCode <= warnlevel)
  48. warnnum++;
  49. }
  50. else
  51. errornum++;
  52. else if (fPass1Err)
  53. errornum++;
  54. }
  55. VOID PASCAL CODESIZE
  56. error (
  57. USHORT code,
  58. UCHAR *str
  59. ){
  60. if (errorcode && code != E_LTL)
  61. return;
  62. fPass1Err = code & E_PASS1;
  63. warnCode = ((code >> 12) & 0x3);
  64. code &= E_ERRMASK;
  65. if (warnCode > warnlevel)
  66. /* don't bother with this warning; just return */
  67. return;
  68. errorcode = code;
  69. if (str)
  70. strncpy (strcpy(errstring, ": ")+2, str, MSGLEN-2);
  71. else
  72. *errstring = 0;
  73. }
  74. VOID PASCAL CODESIZE
  75. errorn (
  76. USHORT code
  77. ){
  78. error (code,naim.pszName);
  79. }
  80. VOID PASCAL CODESIZE
  81. errorc (
  82. USHORT code
  83. ){
  84. error (code,(char *)0);
  85. }
  86. VOID PASCAL
  87. ferrorc (
  88. USHORT code
  89. ){
  90. error (code,(char *)0);
  91. }
  92. VOID PASCAL CODESIZE
  93. errorcSYN ()
  94. {
  95. error (E_SYN,(char *)0);
  96. }
  97. /*** error_line - print error message
  98. *
  99. * error_line (code, l, file, line)
  100. *
  101. * Entry l = listing file
  102. * line = line number in source or include file
  103. */
  104. VOID PASCAL
  105. error_line (
  106. FILE *l,
  107. UCHAR *file,
  108. short line
  109. ){
  110. static char mpWarnCode[3] = {'2', '4', '5'};
  111. char msgstring[MSGLEN+1], messT[MSGLEN+1];
  112. if (!messages[errorcode])
  113. messages[errorcode] = __FMSG_TEXT(msgnum[errorcode]);
  114. STRNFCPY(msgstring, (errorcode < E_MAX)? messages[errorcode]:
  115. (char FAR *) __NMSG_TEXT(ER_UNK));
  116. if (errorcode == E_JOR) {
  117. strcpy(messT, msgstring);
  118. sprintf(msgstring, messT, (long) CondJmpDist);
  119. }
  120. fprintf(l, __NMSG_TEXT(ER_STR), file, line,
  121. warnCode > 0 ? "warning" : "error",
  122. mpWarnCode[warnCode], (SHORT)(errorcode - 1),
  123. msgstring, errstring);
  124. }