home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR13 / OS2ASM.ZIP / STDIO.ASM < prev    next >
Assembly Source File  |  1991-08-10  |  2KB  |  103 lines

  1. ;_ stdio.asm   Thu Mar  8 1990   Modified by: Walter Bright */
  2. ; Copyright (C) 1985-1990 by Walter Bright    */
  3. ; All rights reserved.                */
  4.  
  5. ; Standard I/O header file    */
  6.  
  7. EOF    equ    -1
  8.  
  9. BUFSIZ        equ    4096
  10.  
  11. _ptr    equ    0
  12. _cnt    equ    _ptr + SIZEPTR
  13. _base    equ    _cnt + 4
  14. _flag    equ    _base + SIZEPTR
  15. _file    equ    _flag + 4
  16. _bufsiz    equ    _file + 4
  17.  
  18. _IOREAD        equ    1
  19. _IOWRT        equ    2
  20. _IONBF        equ    4
  21. _IOMYBUF    equ    8
  22. _IOEOF        equ    10h
  23. _IOERR        equ    20h
  24. _IOLBF        equ    40h
  25. _IORW        equ    80h
  26. _IOTRAN        equ    100h
  27.  
  28. ;Values for errno
  29. ENOENT        equ    2
  30. EACCES        equ    5
  31. ENOMEM        equ    8
  32. EINVAL        equ    22
  33. EDEADLOCK    equ    24h
  34. EEXIST        equ    80
  35. ERANGE        equ    1003
  36.  
  37. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  38. ;Thread data structure (one is allocated per thread)
  39. ;Must match __thread1 in cinit.asm and struct THREAD in mt.h
  40.  
  41. thread_t struc
  42.     t_stackoff    dd    0
  43. ;    t_stackseg    dw    0
  44.     t_stacktop    dd    0
  45.     t_errno        dd    0
  46.     if SPTR
  47.     t_strtok    dd    0
  48.     else
  49.     t_strtok    df    0
  50.     endif
  51.     t_tm        dd    9 dup (0)    ;struct tm
  52.  
  53.     ;Actually fenv_t
  54.     t_fe_status    dw    0
  55.     t_fe_control    dw    0
  56.     t_fe_round    dw    0
  57.     t_fe_res1    dw    0
  58.     t_fe_res2    dw    0
  59.  
  60.     t_asctime    db    26 dup (0)
  61.     t_digstr    db    32 dup (0)    ;DBL_DIG*2+2
  62. thread_t ends
  63.  
  64. THDSIZE    equ    (size thread_t)
  65.  
  66. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  67.  
  68. ifdef _MT
  69.  
  70.   ifndef noerrno
  71.     if LCODE
  72.     extrn    __errno_set:far
  73.     else
  74.     extrn    __errno_set:near
  75.     endif
  76.   endif
  77.  
  78. errno_set macro    value
  79.     ifnb <value>
  80.     mov    EAX,value
  81.     endif
  82.     call    __errno_set
  83.     endm
  84.  
  85. else
  86.  
  87.  ifndef noerrno
  88.     begdata
  89.     extrn    _errno:dword
  90.     enddata
  91.  endif
  92.  
  93. errno_set macro    value
  94.     ifnb <value>
  95.     mov    _errno,value
  96.     else
  97.     mov    _errno,EAX
  98.     endif
  99.     endm
  100.  
  101. endif
  102.  
  103.