home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / Fortran.51 / DISK5 / RTERR.IN$ / RTERR.bin
Text File  |  1989-09-27  |  4KB  |  137 lines

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