home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / trn_12.zip / src / bits.h < prev    next >
C/C++ Source or Header  |  1991-12-04  |  3KB  |  81 lines

  1. /* $Id: bits.h,v 4.4 1991/09/09 20:18:23 sob Exp sob $
  2.  *
  3.  * $Log: bits.h,v $
  4.  * Revision 4.4  1991/09/09  20:18:23  sob
  5.  * release 4.4
  6.  *
  7.  *
  8.  * 
  9.  */
  10. /* This software is Copyright 1991 by Stan Barber. 
  11.  *
  12.  * Permission is hereby granted to copy, reproduce, redistribute or otherwise
  13.  * use this software as long as: there is no monetary profit gained
  14.  * specifically from the use or reproduction of this software, it is not
  15.  * sold, rented, traded or otherwise marketed, and this copyright notice is
  16.  * included prominently in any copy made. 
  17.  *
  18.  * The author make no claims as to the fitness or correctness of this software
  19.  * for any use whatsoever, and it is provided as is. Any use of this software
  20.  * is at the user's own risk. 
  21.  */
  22.  
  23. EXT char *ctlarea INIT(Nullch);    /* one bit for each article in current newsgroup */
  24.             /* with the following interpretation: */
  25.             /*    0 => unread  */
  26.             /*    1 => read    */
  27.  
  28. /* if subscripting is faster than shifting on your machine, define this */
  29. #undef USESUBSCRIPT
  30. #ifdef USESUBSCRIPT
  31. EXT char powerof2[] INIT({1,2,4,8,16,32,64,128});
  32. #define pow2(x) powerof2[x]
  33. #else
  34. #define pow2(x) (1 << (x))
  35. #endif
  36.  
  37. #ifdef lint
  38. EXT bool nonesuch INIT(FALSE);
  39. #define ctl_set(a)
  40. #define ctl_clear(a)
  41. #define ctl_read(a) nonesuch
  42. #define was_read(a) nonesuch
  43. #else
  44. #define ctl_set(a) (ctlarea[(OFFSET(a)) / BITSPERBYTE] |= pow2((OFFSET(a)) % BITSPERBYTE))
  45. #define ctl_clear(a) (ctlarea[(OFFSET(a)) / BITSPERBYTE] &= ~pow2((OFFSET(a)) % BITSPERBYTE))
  46. #define ctl_read(a) ((ctlarea[(OFFSET(a)) / BITSPERBYTE] & pow2((OFFSET(a)) % BITSPERBYTE)) != 0)
  47.  
  48. #define was_read(a) ((a)<firstbit || ctl_read(a))
  49. #endif /* lint */
  50.  
  51. EXT ART_NUM absfirst INIT(0);    /* 1st real article in current newsgroup */
  52. EXT ART_NUM firstart INIT(0);    /* minimum unread article number in newsgroup */
  53. EXT ART_NUM firstbit INIT(0);    /* minimum valid bit, usually == firstart */
  54. EXT ART_NUM lastart INIT(0);    /* maximum article number in newsgroup */
  55.  
  56. #ifdef DELAYMARK
  57. EXT FILE *dmfp INIT(Nullfp);
  58. EXT char *dmname INIT(Nullch);
  59. EXT int dmcount INIT(0);
  60. #endif
  61.  
  62. void    bits_init ANSI((void));
  63. void    checkpoint_rc ANSI((void));
  64. void    restore_ng ANSI((void));
  65. void    onemore ANSI((ART_NUM));
  66. void    oneless ANSI((ART_NUM));
  67. void    unmark_as_read ANSI((void));
  68. #ifdef USETHREADS
  69. void    set_read ANSI((ART_NUM,int,bool_int));
  70. void    set_unread ANSI((ART_NUM,int));
  71. #endif
  72. void    delay_unmark ANSI((ART_NUM));
  73. void    mark_as_read ANSI((void));
  74. void    check_first ANSI((ART_NUM));
  75. #ifdef DELAYMARK
  76.     void    yankback ANSI((void));
  77. #endif
  78. int    chase_xrefs ANSI((ART_NUM,int));
  79. int    initctl ANSI((void));
  80. void    grow_ctl ANSI((ART_NUM));
  81.