www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1997/12/01/09:03:26

Message-Id: <3.0.1.32.19971201080622.007f8100@yacker.xiotech.com>
Date: Mon, 01 Dec 1997 08:06:22 -0600
To: djgpp-workers AT delorie DOT com
From: Randy Maas <randym AT xiotech DOT com>
Subject: patch for fsext.txh
Mime-Version: 1.0

--=====================_881006782==_
Content-Type: text/plain; charset="us-ascii"

Sorry for all the posts---
This is a patch for the fsext.txh (relative to alpha971114).  Like the last
two posts, it differs from last week's
posting in the following way:
	* documents __FSEXT_fstat (slightly)
	* fixes the examples so the correspond with the changes.

One note: fstat doesn't really redirect to the extensions yet.  It is there
to help prepare for a fstat patch. 8-)

Randy Maas
randym AT acm DOT org
--=====================_881006782==_
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: attachment; filename="fsext-t.dif"

*** src/libc/fsext/fsext.txh	Sun Aug 31 16:39:52 1997
--- src/libc/fsext/fsext.txh	Mon Dec  1 08:01:22 1997
***************
*** 15,19 ****
  
  @example
!   int function(__FSEXT_Fnumber func_number, int *rv, va_list args);
  @end example
  
--- 15,19 ----
  
  @example
!   int function(__FSEXT_Fnumber func_number, int *rv, va_list args, void* state);
  @end example
  
***************
*** 73,76 ****
--- 73,108 ----
  A close handler.  Called when the ``file'' should be closed.
  
+ @item __FSEXT_fcntl
+ 
+ A file fcntl handler.
+ 
+ @item __FSEXT_ioctl
+ 
+ A file ioctl handler.
+ 
+ @item __FSEXT_lseek
+ 
+ A file lseek handler (@pxref{lseek}).
+ 
+ @item __FSEXT_link
+ 
+ A file link handler (@pxref{link}).  This is most relevant to
+ file system extensions that emulate a directory structure.
+ 
+ @item __FSEXT_unlink
+ 
+ A file unlink handler (@pxref{unlink}).  This is most relevant to
+ file system extensions that emulate a directory structure.
+ 
+ @item __FSEXT_dup2
+ 
+ A file dup2 handler (@pxref{dup2}).  This is called when two different
+ file descriptors are used to refer to the same open file.
+ 
+ @item __FSEXT_fstat
+ 
+ A file fstat handler (@pxref{fstat}).  The extension should fill in various
+ status information about the emulated file.
+ 
  @end table
  
***************
*** 118,122 ****
  #include <sys/fsext.h>
  
! int __FSEXT_alloc_fd(__FSEXT_Function *_function);
  @end example
  
--- 150,154 ----
  #include <sys/fsext.h>
  
! int __FSEXT_alloc_fd(__FSEXT_Function *_function, void *state);
  @end example
  
***************
*** 127,131 ****
  have a corresponding DOS file handle.  This function opens DOS's
  @samp{NUL} device, so as to allocate a handle that DOS won't then reuse.
! It also assigns the handler function for that descriptor.
  
  The module is responsible for calling @code{_close} on the descriptor
--- 159,164 ----
  have a corresponding DOS file handle.  This function opens DOS's
  @samp{NUL} device, so as to allocate a handle that DOS won't then reuse.
! It also assigns the handler function for that descriptor.  The @var{state} is
! an additional pointer to the handlers' specific data for the file descriptor.
  
  The module is responsible for calling @code{_close} on the descriptor
***************
*** 153,157 ****
  #include <sys/fsext.h>
  
! int __FSEXT_set_function(int _fd, __FSEXT_Function *_function);
  @end example
  
--- 186,190 ----
  #include <sys/fsext.h>
  
! int __FSEXT_set_function(int _fd, __FSEXT_Function *_function, void* state)
  @end example
  
***************
*** 162,166 ****
  for I/O.  One situation where you might need this is when you must catch
  output to the terminal and play some tricks with it, like colorize it or
! redirect it to another device.
  
  @subheading Return Value
--- 195,200 ----
  for I/O.  One situation where you might need this is when you must catch
  output to the terminal and play some tricks with it, like colorize it or
! redirect it to another device.  The @var{state} is an additional pointer to
! the handlers' specific data for the file descriptor.
  
  @subheading Return Value
***************
*** 179,183 ****
     screen into direct writes to video RAM.  */
  static int
! my_screen_write (__FSEXT_Fnumber func, int *retval, va_list rest_args)
  @{
    char *buf, *mybuf;
--- 213,217 ----
     screen into direct writes to video RAM.  */
  static int
! my_screen_write (__FSEXT_Fnumber func, int *retval, va_list rest_args, void* state)
  @{
    char *buf, *mybuf;
***************
*** 203,212 ****
  install_screen_write_handler (void)
  @{
!   __FSEXT_set_function (fileno (stdout), my_screen_write);
  @}
  
  @end example
  
- 
  @c ----------------------------------------------------------------------
  @node __FSEXT_get_function, file system
--- 237,245 ----
  install_screen_write_handler (void)
  @{
!   __FSEXT_set_function (fileno (stdout), my_screen_write, NULL);
  @}
  
  @end example
  
  @c ----------------------------------------------------------------------
  @node __FSEXT_get_function, file system
***************
*** 216,226 ****
  #include <sys/fsext.h>
  
! __FSEXT_Function *__FSEXT_get_function(int _fd);
  @end example
  
  This function is part of the @ref{File System Extensions}.  It is used
  internal to libc.a to redirect I/O requests to the appropriate
  extensions.
  
  @subheading Example
  
--- 249,264 ----
  #include <sys/fsext.h>
  
! int __FSEXT_get_function(int _fd, __FSEXT_Function** func, void** state)
  @end example
  
+ @subheading Description
+ 
  This function is part of the @ref{File System Extensions}.  It is used
  internal to libc.a to redirect I/O requests to the appropriate
  extensions.
  
+ @subheading Return Value
+ 1 if the file descriptor has a handler associated with it, 0 otherwise.
+ 
  @subheading Example
  
***************
*** 228,239 ****
  _read(int fd, void *buf, int len)
  @{
!   __FSEXT_Function *func = __FSEXT_get_function(fd);
!   if (func)
!   @{
!     int rv;
!     if (func(__FSEXT_read, &rv, &fd))
!       return rv;
!   @}
!   /* rest of read() */
  @}
  @end example
--- 266,278 ----
  _read(int fd, void *buf, int len)
  @{
!    void* state;
!    __FSEXT_Function *func;
! 
!    if (__FSEXT_get_function(fd, &func, &state) && func)
!     @{
!        int rv;
!        if (func(__FSEXT_read, &rv, &fd, state)) return rv;
!     @}
!    /@* rest of read() *@/
  @}
  @end example

--=====================_881006782==_
Content-Type: text/plain; charset="us-ascii"



--=====================_881006782==_--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019