home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / C++-7 / DISK7 / SOURCE / STARTUP / RTERR.IN$ / RTERR
Encoding:
Text File  |  1991-11-06  |  4.5 KB  |  158 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.  
  44. _RT_CRNL    equ    <252>    ; \r\n
  45. _RT_BANNER    equ    <255>    ; runtime error (banner)
  46.  
  47. ;
  48. ; The 3 EXEC messages must be in order for DOS (see DOS exec code).
  49. ;
  50.  
  51. .ERRE    (_RT_EXECFORM EQ _RT_EXECMEM+1)
  52. .ERRE    (_RT_EXECENV  EQ _RT_EXECFORM+1)
  53.  
  54. ;
  55. ; --- Message types ---
  56. ; [See _RTERR macro description for info on these types.]
  57. ;
  58.  
  59. _RT_STANDARD    equ    1
  60. _RT_STRING    equ    2
  61. _RT_DOLLAR    equ    3
  62.  
  63. ;
  64. ; Definitions that allow caller to strip message out of _RT_STANDARD
  65. ; string:
  66. ;
  67. ; _RT_STANDARD_STRING = Number of bytes to "step over" to get to the
  68. ; string portion of an _RT_STANDARD message (i.e., step past "R6???\r\n- ").
  69. ;
  70. ; _RT_MATH_STRING = Number of bytes to "step over" to get to the string
  71. ; portion of a MATH fatal message (i.e., step past "M6???-math\r\n- ").
  72. ;
  73.  
  74. _RT_STANDARD_STRING    equ    9
  75. _RT_MATH_STRING     equ    15
  76.  
  77. include    cmsgs.inc        ; string literal declarations 
  78.  
  79. ;***
  80. ; _RTERR - Macro to generate runtime error message data entries
  81. ;
  82. ;Purpose:
  83. ;
  84. ;    Generate the appropriate data format for
  85. ;    various types of runtime error messages.
  86. ;
  87. ;    Standard C library error numbers have the format:
  88. ;
  89. ;            R6<nnn>
  90. ;
  91. ;    where:
  92. ;        R     = Error occurred at runtime
  93. ;        6     = C library routine error series
  94. ;        <nnn> = 3-digit code indicating the error that occurred
  95. ;
  96. ;Entry:
  97. ;    errnum    = runtime error number (one of the above parameters)
  98. ;    errmsg    = ascii string with error message in it
  99. ;    msgtype = message type:
  100. ;          _RT_STANDARD = standard 'R6' message format
  101. ;          _RT_STRING = simply store the supplied string
  102. ;          _RT_DOLLAR = terminate message with '$'
  103. ;                   (for use with DOS EXEC messages)
  104. ;
  105. ;Exit:
  106. ;    Allocate storage as follows:
  107. ;
  108. ;    _RT_STANDARD:
  109. ;        dw    <errnum>
  110. ;        db    'R6<errnum>',13,10,'- <errmsg>',13,10,0
  111. ;
  112. ;    _RT_STRING:
  113. ;        dw    <errnum>
  114. ;        db    '<errmsg>',0
  115. ;
  116. ;    _RT_DOLLAR:
  117. ;        dw    <errnum>
  118. ;        db    13,10,'run-time error '
  119. ;        db    'R6<errnum>',13,10,'- <errmsg>',13,10,'$',0
  120. ;
  121. ;    [NOTE:    If you change the format of these, make sure
  122. ;    _RT_STANDARD_STRING/_RT_STANDARD_ENDCHAR/etc are adjusted accordingly.]
  123. ;
  124. ;Exceptions:
  125. ;
  126. ;*******************************************************************************
  127.  
  128.  
  129. ;
  130. ; Form the message data as follows:
  131. ;    (1) Store the error number
  132. ;    (2) Form the appropriate ascii message (based on message type)
  133. ;    (3) Terminate message with a null char
  134. ;
  135. ; [To get masm to store the ascii value of the error number, prepend a
  136. ; '%' char to the errnum arg and call a second macro to build the string.]
  137. ;
  138.  
  139. _RTERR    MACRO    errnum, errmsg, msgtype
  140.     _RTERR1 %&errnum, <errmsg>, msgtype
  141.     ENDM
  142.  
  143. _RTERR1  MACRO     errnum, errmsg, msgtype
  144.     dw    errnum
  145.     IF    (msgtype EQ _RT_STANDARD)
  146.        db    'R6&errnum',_RT_CRNL_TXT,'- ',&errmsg,_RT_CRNL_TXT
  147.     ELSEIF    (msgtype EQ _RT_STRING)
  148.        db    &errmsg
  149.     ELSEIF    (msgtype EQ _RT_DOLLAR)
  150.        db    _RT_CRNL_TXT,'run-time error '
  151.        db    'R6&errnum',_RT_CRNL_TXT,'- ',&errmsg,_RT_CRNL_TXT,'$'
  152.     ELSE
  153.        %OUT Unknown _RTERR option
  154.        .ERR
  155.     ENDIF
  156.     db    0
  157.     ENDM
  158.