nightmaremail

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

bufmissing.h (816B)


      1 #ifndef   BUFMISSING_H
      2 #define   BUFMISSING_H
      3 
      4 #ifndef SKALIBS_CBUFFER_H
      5 // classic substdio buffer
      6 #define BUF_HEAD(b)	((b)->p)
      7 #define BUF_TAIL(b)	((b)->n)
      8 #define BUF_SIZ(b)	((b)->a)
      9 #define BUF_PTR(b)	((b)->x)
     10 #else
     11 // ska buffer - is this its last resort?
     12 #define BUF_HEAD(b)	((b)->c.p)
     13 #define BUF_TAIL(b)	((b)->c.n)
     14 #define BUF_SIZ(b)	((b)->c.a)
     15 #define BUF_PTR(b)	((b)->c.x)
     16 #endif
     17 
     18 #define buffer_fileno(s) ((s)->fd)
     19 
     20 #define buffer_PEEK(s) ( BUF_PTR(s) + BUF_TAIL(s) )
     21 #define buffer_SEEK(s,len) ( ( BUF_HEAD(s) -= (len) ) , ( BUF_TAIL(s) += (len) ) )
     22 // Query - why the redundancy? We have buffer_PEEK here and buffer_peek over in bufi.c
     23 // also: why are we using an fd? Why not use potentially any thunk? If we use any thunk,
     24 // we can target items that are not file descriptors.
     25 
     26 #endif // BUFMISSING_H