home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / oper_sys / emerald / emrldsys.lha / Kernel / h / replicant.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-08-17  |  1.0 KB  |  44 lines

  1. #ifndef replicant_h
  2. #define replicant_h
  3. /* replicant.h -- Emerald replicant definitions -- 4/28/88 cjeffery */
  4. /* the replicant structure replaces the logfile entry header */
  5.  
  6. #define REPSIGNATURE 0x42424242
  7.  
  8. typedef struct {
  9.   long rep_Signature, size, all, ptr;
  10.   OID  nextOID;
  11.   char *image;
  12. } replicant, *replicantPtr;
  13.  
  14. /* read replicant r data into buffer b */
  15. #define replicant_read(r,b,s) { \
  16.   if((r)->ptr+(*(s)) > (r)->size) \
  17.     (*(s)) = (r)->size - (r)->ptr; \
  18.   (void)bcopy((r)->image+(r)->ptr,(char *)(b),(*(s)));\
  19.   (r)->ptr += (*(s));\
  20. }
  21.  
  22. #define MINREPLICANTSIZE 512
  23.  
  24. #define replicant_create(rp) {\
  25.   (rp) = emalloc(sizeof(replicant));\
  26.   rp->image = emalloc(MINREPLICANTSIZE);\
  27.   rp->rep_Signature  = REPSIGNATURE; \
  28.   rp->size = rp->ptr = 0;\
  29.   rp->all = MINREPLICANTSIZE;\
  30. }
  31.  
  32. #define replicant_destroy(rp){\
  33.   emfree((rp)->image);\
  34.   emfree(rp);\
  35. }
  36.  
  37. extern CP_InitReplicant();
  38. extern replicantPtr replicant_diskread();
  39. extern long replicant_diskwrite();
  40. extern replicant_write();
  41. extern replicant_seek();
  42. extern replicantPtr CP_replicant;
  43. #endif
  44.