home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 5.ddi / CLIBSRC2.ZIP / CVTFAK.ASM < prev    next >
Encoding:
Assembly Source File  |  1992-06-10  |  3.8 KB  |  104 lines

  1. ;[]-----------------------------------------------------------------[]
  2. ;|      CVTFAK.ASM -- abort when float isn't present                 |
  3. ;[]-----------------------------------------------------------------[]
  4.  
  5. ;
  6. ;       C/C++ Run Time Library - Version 5.0
  7. ;       Copyright (c) 1987, 1992 by Borland International
  8. ;       All Rights Reserved.
  9.  
  10.         INCLUDE RULES.ASI
  11.  
  12. ;       Segment and Group declarations
  13.  
  14. Header@
  15.  
  16. ;       External references
  17.  
  18. extrn           _abort:near
  19.  
  20. ;       Public references
  21.  
  22.                 public  __cvtfak
  23. __cvtfak        equ     0
  24.  
  25. _TEXT           segment
  26. ;-------------------------------------------------------------------------
  27. ;               Get printf() specific part of message
  28. ;-------------------------------------------------------------------------
  29. _FakRealCvt     proc near
  30.                 mov     dx, offset DGROUP: RealMSG      ; Message address
  31.                 jmp     short DisplayMessage            ; Display the message
  32.                 endp
  33.  
  34. ;-------------------------------------------------------------------------
  35. ;               Get scanf() specific part of message
  36. ;-------------------------------------------------------------------------
  37. _FakScanTod     proc near
  38.                 mov     dx, offset DGROUP: ScanMSG      ; Message address
  39. ;
  40. ; By letting the _FakScanTod PROC to 'fall into' the 'DisplayMessage' routine
  41. ; we save the cost of a JMP instruction.  This is a somewhat cheap trick but
  42. ; the purpose is quite clear here.
  43.  
  44. DisplayMessage  LABEL   NEAR
  45.  
  46. ;-------------------------------------------------------------------------
  47. ;               Display FLOAT not linked message
  48. ;-------------------------------------------------------------------------
  49. IFDEF   __HUGE__
  50. ExtSym@ DGROUP@, WORD, __PASCAL__
  51.                 mov     ds, cs:DGROUP@@                 ; Get DS if we're huge
  52. ENDIF
  53.  
  54.                 mov     cx, lgth_UNIQ                   ; Message length
  55.                 mov     ah, 040H                        ; Write
  56.                 mov     bx, 2                           ;   to
  57.                 int     021h                            ;      'stdout'
  58.  
  59.                 mov     cx, lgth_Common                 ; Common msg length
  60.                 mov     dx, offset DGROUP: CommonMSG    ; Common msg address
  61.                 mov     ah, 040H                        ; Write to
  62.                 int     021h                            ;      'stdout'
  63.                 jmp     _abort                          ; abort();
  64.  
  65.                 endp
  66.                 ends
  67.  
  68. DSeg@
  69. ;-------------------------------------------------------------------------
  70. ;               Message texts for 'float not linked' messages
  71. ;
  72. ; Note : by putting an 'extra' blank in the scanf unique message part we
  73. ; save some code space by having a common message length.
  74. ;-------------------------------------------------------------------------
  75. ;
  76. ; Message part unique to the printf() message.
  77. ;
  78. RealMSG         db      'print'         ; Unique part of 'printf' message
  79. lgth_UNIQ       equ     $ - RealMSG     ; Length of unique msg parts
  80. ;
  81. ; Message part unique to the scanf() message(this MUST be same len as print).
  82. ;
  83. ScanMSG         db      ' scan'         ; Unique part of 'scanf' message
  84. ;
  85. ; Message part common to the 'printf and 'scanf' messages.
  86. ; NOTE : the 'f' in printf and scanf is common too!.
  87. ;
  88. CommonMSG       db      'f : floating point formats not linked', 13, 10
  89. lgth_Common     equ     $ - CommonMSG
  90. DSegEnd@
  91.  
  92. _CVTSEG SEGMENT WORD PUBLIC 'DATA'
  93. _realcvt        dw      offset _FakRealCvt
  94. _CVTSEG ENDS
  95.  
  96. _SCNSEG SEGMENT WORD PUBLIC 'DATA'
  97. __scantod       dw      offset _FakScanTod
  98. __scanrslt      dw      offset _FakScanTod
  99. __scanpop       dw      offset _FakScanTod
  100. _SCNSEG ENDS
  101.         END
  102.