home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c480 / 19.ddi / SOURCE / STARTUP / RTERR.IN_ / RTERR.IN
Encoding:
Text File  |  1993-02-08  |  4.6 KB  |  161 lines

  1. ;***
  2. ;rterr.inc - Runtime Error Messages
  3. ;
  4. ;    Copyright (c) 1988-1992, Microsoft Corporation. All rights reserved.
  5. ;
  6. ;Purpose:
  7. ;    This file contains all of the fatal C library runtime error
  8. ;    messages and a macro that allows routines to easily set up
  9. ;    the message format.
  10. ;
  11. ;*******************************************************************************
  12.  
  13.  
  14. ;
  15. ; --- Runtime Error Constants ---
  16. ; [NOTE: These must be 3-char strings (see _RTERR macro).]
  17. ;
  18.  
  19. _RT_STACK    equ    <000>    ; stack overflow
  20. _RT_NULLPTR    equ    <001>    ; null pointer assignment
  21. _RT_FLOAT    equ    <002>    ; floating point not loaded
  22. _RT_INTDIV    equ    <003>    ; integer divide by 0
  23. ;            <004>
  24. ;--- The following 3 EXEC message must be in order (see DOS exec code) ---
  25. _RT_EXECMEM    equ    <005>    ; not enough memory on exec
  26. _RT_EXECFORM    equ    <006>    ; bad format on exec
  27. _RT_EXECENV    equ    <007>    ; bad environment on exec
  28. ;---
  29. _RT_SPACEARG    equ    <008>    ; not enough space for arguments
  30. _RT_SPACEENV    equ    <009>    ; not enough space for environment
  31. _RT_ABORT    equ    <010>    ; Abnormal program termination
  32. ;            <011>
  33. _RT_NPTR    equ    <012>    ; illegal near pointer use
  34. _RT_FPTR    equ    <013>    ; illegal far pointer use
  35. _RT_BREAK    equ    <014>    ; control-BREAK encountered (QC 1.0 only)
  36. _RT_INT     equ    <015>    ; unexpected interrupt      (QC 1.0 only)
  37. _RT_THREAD    equ    <016>    ; not enough space for thread data
  38. _RT_LOCK    equ    <017>    ; unexpected multi-thread lock error
  39. _RT_HEAP    equ    <018>    ; unexpected heap error
  40. _RT_OPENCON    equ    <019>    ; unable to open console device
  41. _RT_QWIN    equ    <020>    ; unexpected QuickWin error
  42. _RT_NOMAIN    equ    <021>    ; no main procedure
  43. _RT_NONCONT    equ    <022>    ; Win32 CRT error
  44. _RT_INVALDISP    equ    <023>    ; Win32 CRT error
  45. _RT_ONEXIT    equ    <024>    ; Win32 CRT error
  46. _RT_PURVIRT    equ    <025>    ; pure virtual function call (C++ error)
  47. _RT_CRNL    equ    <252>    ; \r\n
  48. _RT_BANNER    equ    <255>    ; runtime error (banner)
  49.  
  50. ;
  51. ; The 3 EXEC messages must be in order for DOS (see DOS exec code).
  52. ;
  53.  
  54. .ERRE    (_RT_EXECFORM EQ _RT_EXECMEM+1)
  55. .ERRE    (_RT_EXECENV  EQ _RT_EXECFORM+1)
  56.  
  57. ;
  58. ; --- Message types ---
  59. ; [See _RTERR macro description for info on these types.]
  60. ;
  61.  
  62. _RT_STANDARD    equ    1
  63. _RT_STRING    equ    2
  64. _RT_DOLLAR    equ    3
  65.  
  66. ;
  67. ; Definitions that allow caller to strip message out of _RT_STANDARD
  68. ; string:
  69. ;
  70. ; _RT_STANDARD_STRING = Number of bytes to "step over" to get to the
  71. ; string portion of an _RT_STANDARD message (i.e., step past "R6???\r\n- ").
  72. ;
  73. ; _RT_MATH_STRING = Number of bytes to "step over" to get to the string
  74. ; portion of a MATH fatal message (i.e., step past "M6???-math\r\n- ").
  75. ;
  76.  
  77. _RT_STANDARD_STRING    equ    9
  78. _RT_MATH_STRING     equ    15
  79.  
  80. include    cmsgs.inc        ; string literal declarations 
  81.  
  82. ;***
  83. ; _RTERR - Macro to generate runtime error message data entries
  84. ;
  85. ;Purpose:
  86. ;
  87. ;    Generate the appropriate data format for
  88. ;    various types of runtime error messages.
  89. ;
  90. ;    Standard C library error numbers have the format:
  91. ;
  92. ;            R6<nnn>
  93. ;
  94. ;    where:
  95. ;        R     = Error occurred at runtime
  96. ;        6     = C library routine error series
  97. ;        <nnn> = 3-digit code indicating the error that occurred
  98. ;
  99. ;Entry:
  100. ;    errnum    = runtime error number (one of the above parameters)
  101. ;    errmsg    = ascii string with error message in it
  102. ;    msgtype = message type:
  103. ;          _RT_STANDARD = standard 'R6' message format
  104. ;          _RT_STRING = simply store the supplied string
  105. ;          _RT_DOLLAR = terminate message with '$'
  106. ;                   (for use with DOS EXEC messages)
  107. ;
  108. ;Exit:
  109. ;    Allocate storage as follows:
  110. ;
  111. ;    _RT_STANDARD:
  112. ;        dw    <errnum>
  113. ;        db    'R6<errnum>',13,10,'- <errmsg>',13,10,0
  114. ;
  115. ;    _RT_STRING:
  116. ;        dw    <errnum>
  117. ;        db    '<errmsg>',0
  118. ;
  119. ;    _RT_DOLLAR:
  120. ;        dw    <errnum>
  121. ;        db    13,10,'run-time error '
  122. ;        db    'R6<errnum>',13,10,'- <errmsg>',13,10,'$',0
  123. ;
  124. ;    [NOTE:    If you change the format of these, make sure
  125. ;    _RT_STANDARD_STRING/_RT_STANDARD_ENDCHAR/etc are adjusted accordingly.]
  126. ;
  127. ;Exceptions:
  128. ;
  129. ;*******************************************************************************
  130.  
  131.  
  132. ;
  133. ; Form the message data as follows:
  134. ;    (1) Store the error number
  135. ;    (2) Form the appropriate ascii message (based on message type)
  136. ;    (3) Terminate message with a null char
  137. ;
  138. ; [To get masm to store the ascii value of the error number, prepend a
  139. ; '%' char to the errnum arg and call a second macro to build the string.]
  140. ;
  141.  
  142. _RTERR    MACRO    errnum, errmsg, msgtype
  143.     _RTERR1 %&errnum, <errmsg>, msgtype
  144.     ENDM
  145.  
  146. _RTERR1  MACRO     errnum, errmsg, msgtype
  147.     dw    errnum
  148.     IF    (msgtype EQ _RT_STANDARD)
  149.        db    'R6&errnum',_RT_CRNL_TXT,'- ',&errmsg,_RT_CRNL_TXT
  150.     ELSEIF    (msgtype EQ _RT_STRING)
  151.        db    &errmsg
  152.     ELSEIF    (msgtype EQ _RT_DOLLAR)
  153.        db    _RT_CRNL_TXT,'run-time error '
  154.        db    'R6&errnum',_RT_CRNL_TXT,'- ',&errmsg,_RT_CRNL_TXT,'$'
  155.     ELSE
  156.        %OUT Unknown _RTERR option
  157.        .ERR
  158.     ENDIF
  159.     db    0
  160.     ENDM
  161.