home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume23 / trn / part11 / bits.h next >
Encoding:
C/C++ Source or Header  |  1991-08-22  |  2.4 KB  |  82 lines

  1. /* $Header: bits.h,v 4.3.3.2 91/01/16 02:29:50 davison Trn $
  2.  *
  3.  * $Log:    bits.h,v $
  4.  * Revision 4.3.3.2  91/01/16  02:29:50  davison
  5.  * Added optional prototyping.
  6.  * 
  7.  * Revision 4.3.3.1  90/06/20  22:36:35  davison
  8.  * Initial Trn Release
  9.  * 
  10.  * Revision 4.3.2.1  90/11/22  15:46:42  sob
  11.  * Made changes to make pickly preprocessors happier.
  12.  * 
  13.  * Revision 4.3.1.2  86/11/03  09:49:58  lwall
  14.  * Added firstbit variable.
  15.  * 
  16.  * Revision 4.3.1.1  85/05/10  11:31:52  lwall
  17.  * Branch for patches.
  18.  * 
  19.  * Revision 4.3  85/05/01  11:36:39  lwall
  20.  * Baseline for release with 4.3bsd.
  21.  * 
  22.  */
  23.  
  24. EXT char *ctlarea INIT(Nullch);    /* one bit for each article in current newsgroup */
  25.             /* with the following interpretation: */
  26.             /*    0 => unread  */
  27.             /*    1 => read    */
  28.  
  29. /* if subscripting is faster than shifting on your machine, define this */
  30. #undef USESUBSCRIPT
  31. #ifdef USESUBSCRIPT
  32. EXT char powerof2[] INIT({1,2,4,8,16,32,64,128});
  33. #define pow2(x) powerof2[x]
  34. #else
  35. #define pow2(x) (1 << (x))
  36. #endif
  37.  
  38. #ifdef lint
  39. EXT bool nonesuch INIT(FALSE);
  40. #define ctl_set(a)
  41. #define ctl_clear(a)
  42. #define ctl_read(a) nonesuch
  43. #define was_read(a) nonesuch
  44. #else
  45. #define ctl_set(a) (ctlarea[(OFFSET(a)) / BITSPERBYTE] |= pow2((OFFSET(a)) % BITSPERBYTE))
  46. #define ctl_clear(a) (ctlarea[(OFFSET(a)) / BITSPERBYTE] &= ~pow2((OFFSET(a)) % BITSPERBYTE))
  47. #define ctl_read(a) ((ctlarea[(OFFSET(a)) / BITSPERBYTE] & pow2((OFFSET(a)) % BITSPERBYTE)) != 0)
  48.  
  49. #define was_read(a) ((a)<firstbit || ctl_read(a))
  50. #endif /* lint */
  51.  
  52. EXT ART_NUM absfirst INIT(0);    /* 1st real article in current newsgroup */
  53. EXT ART_NUM firstart INIT(0);    /* minimum unread article number in newsgroup */
  54. EXT ART_NUM firstbit INIT(0);    /* minimum valid bit, usually == firstart */
  55. EXT ART_NUM lastart INIT(0);    /* maximum article number in newsgroup */
  56.  
  57. #ifdef DELAYMARK
  58. EXT FILE *dmfp INIT(Nullfp);
  59. EXT char *dmname INIT(Nullch);
  60. EXT int dmcount INIT(0);
  61. #endif
  62.  
  63. void    bits_init ANSI((void));
  64. void    checkpoint_rc ANSI((void));
  65. void    restore_ng ANSI((void));
  66. void    onemore ANSI((ART_NUM));
  67. void    oneless ANSI((ART_NUM));
  68. void    unmark_as_read ANSI((void));
  69. #ifdef USETHREADS
  70. void    set_read ANSI((ART_NUM,int));
  71. void    set_unread ANSI((ART_NUM,int));
  72. #endif
  73. void    delay_unmark ANSI((ART_NUM));
  74. void    mark_as_read ANSI((void));
  75. void    check_first ANSI((ART_NUM));
  76. #ifdef DELAYMARK
  77.     void    yankback ANSI((void));
  78. #endif
  79. int    chase_xrefs ANSI((ART_NUM,int));
  80. int    initctl ANSI((void));
  81. void    grow_ctl ANSI((ART_NUM));
  82.