home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 303.lha / AssemTools / Include / buflib.i < prev    next >
Text File  |  1980-12-03  |  2KB  |  107 lines

  1. *
  2. *   include file for handling buffered files
  3. *   founded 07.08.89 tm of supervisor
  4. *
  5.  
  6. ; 09.08.89 -> 1.01 fbuflib added, buflib now always loads Dosbase
  7.  
  8. *T
  9. *T    BUFLIB.I * Metacc Include File
  10. *T         Version 1.01
  11. *T        Date 07.08.89
  12. *T
  13. *B
  14.  
  15. ;  fopen    (open a buffered file)
  16. ;  in:        a0=name, d0=mode (1005-1006)
  17. ;        [a6=dosbase];
  18. ;  call:    buflib    fopen [,Dos]
  19. ;  out:        d0=*buffile; /0=error/
  20.  
  21. ;  fclose    (close a buffered file)
  22. ;  in:        a0=*buffile;
  23. ;        [a6=dosbase];
  24. ;  call:    buflib    fclose [,Dos]
  25. ;  out:        d0=success;
  26.  
  27. ;  fflush    (flush the file buffers)
  28. ;  in:        a0=*buffile;
  29. ;        [a6=dosbase];
  30. ;  call:    buflib    fflush [,Dos]
  31. ;  out:        d0=success;
  32.  
  33. ;  fread    (read given number of bytes)
  34. ;  in:        a0=*buffile; a1=*buffer, d0=length
  35. ;        [a6=dosbase];
  36. ;  call:    buflib    fread [,Dos]
  37. ;  out:        d0=number_of_bytes_read; /-1=error/
  38.  
  39. ;  fwrite    (write given number of bytes)
  40. ;  in:        a0=*buffile; a1=*buffer, d0=length;
  41. ;        [a6=dosbase];
  42. ;  call:    buflib    fwrite [,Dos]
  43. ;  out:        d0=number_of_bytes_written; /-1=error/
  44.  
  45. ;  fseek    (move to a different position in file)
  46. ;  in:        a0=*buffile; d0=offset, d1=mode;
  47. ;        [a6=dosbase];
  48. ;  call:    buflib    fseek [,Dos]
  49. ;  out:        d0=success;
  50.  
  51. ;  fputc    (write a character)
  52. ;  in:        a0=*buffile; d0.b=char;
  53. ;        [a6=dosbase];
  54. ;  call:    buflib    fputc [,Dos]
  55. ;  out:        d0=success;
  56.  
  57. ;  fputs    (write a string)
  58. ;  in:        a0=*buffile; a1=*string;
  59. ;        [a6=dosbase];
  60. ;  call:    buflib    fputs [,Dos]
  61. ;  out:        d0=number_of_chars_written; /-1 = error/
  62.  
  63. ;  fgetc    (read a character)
  64. ;  in:        a0=*buffile;
  65. ;        [a6=dosbase];
  66. ;  call:    buflib    fgetc [,Dos]
  67. ;  out:        d0.l=char; /-1.l if error/
  68.  
  69. ;  fgets    (read a line /LF-terminated/)
  70. ;  in:        a0=*buffile; a1=*buffer;
  71. ;        [a6=dosbase];
  72. ;  call:    buflib    fgets [,Dos]
  73. ;  out:        d0=number_of_bytes_read; a1=*(NULL);
  74. ;  notes:    The LF is also included to the output string.
  75.  
  76. ;  feof        (check for end of file)
  77. ;  in:        a0=*buffile;
  78. ;        [a6=dosbase];
  79. ;  call:    buflib    feof [,Dos]
  80. ;  out:        d0=boolean; /-1 = eof/
  81.  
  82. *E
  83.  
  84.     xref    _BUFfopen
  85.     xref    _BUFfclose
  86.     xref    _BUFfflush
  87.     xref    _BUFfread
  88.     xref    _BUFfputc
  89.     xref    _BUFfgets
  90.     xref    _BUFfseek
  91.     xref    _BUFfgetc
  92.     xref    _BUFfeof
  93.     xref    _BUFfwrite
  94.     xref    _BUFfputs
  95.  
  96. buflib    macro    [name]
  97.     ifnc    '\1',''
  98.     lbase    Dos,a6
  99.     bsr    _BUF\1
  100.     endc
  101.     endm
  102.  
  103. fbuflib    macro    [name]
  104.     bsr    _BUF\1
  105.     endm
  106.  
  107.