[5416] | 1 | /* |
---|
| 2 | * |
---|
| 3 | * Copyright (C) 1989 by the Massachusetts Institute of Technology |
---|
| 4 | * Developed by the MIT Student Information Processing Board (SIPB). |
---|
| 5 | * For copying information, see the file mit-copyright.h in this release. |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | /* |
---|
| 10 | * edsc.h --- include file for the emacs discuss back-end program |
---|
| 11 | */ |
---|
| 12 | |
---|
| 13 | #include <discuss/discuss.h> |
---|
[19062] | 14 | #include <errno.h> |
---|
[22404] | 15 | #include <stdlib.h> |
---|
[5416] | 16 | |
---|
| 17 | extern char *user_id; |
---|
| 18 | extern tfile stdout_tf; |
---|
| 19 | extern int bit_bucket(); |
---|
| 20 | extern char *do_quote(); |
---|
| 21 | tfile unix_tfile(); |
---|
| 22 | extern int cache_activated, cache_working; |
---|
| 23 | extern int use_vectors; |
---|
| 24 | |
---|
| 25 | extern int do_quit(), do_gmi(), do_gti(), do_gcm(), do_gml(), do_gt(); |
---|
| 26 | extern int do_gtf(), do_grt(), do_grtn(), do_ss(), do_at(), do_nut(); |
---|
| 27 | extern int do_sfl(), do_am(), do_dm(), do_gpv(); |
---|
| 28 | extern int do_pacl(), do_sacl(), do_dacl(); |
---|
| 29 | extern int do_dt(), do_rt(), do_ls(); |
---|
| 30 | |
---|
[12267] | 31 | extern char *short_time(); |
---|
| 32 | |
---|
[5416] | 33 | /* selection flags */ |
---|
| 34 | #define flag_AREF 8 |
---|
| 35 | |
---|
| 36 | /* filtering flags */ |
---|
| 37 | #define filter_INCLUDE_DELETED 1 |
---|
| 38 | #define filter_ONLY_DELETED 2 |
---|
| 39 | #define filter_ONLY_INITIAL 4 |
---|
| 40 | #define filter_ONLY_TERMINAL 16 |
---|
| 41 | #define filter_FLAG_SET 32 |
---|
| 42 | #define filter_FLAG_RESET 64 |
---|
| 43 | |
---|
| 44 | /* |
---|
| 45 | * Here is the cache information..... |
---|
| 46 | */ |
---|
| 47 | |
---|
| 48 | /* |
---|
| 49 | * The caching is only enabled if EDSC_CACHE is defined.... |
---|
| 50 | */ |
---|
[5424] | 51 | #define EDSC_CACHE |
---|
[5416] | 52 | |
---|
| 53 | #ifdef EDSC_CACHE |
---|
| 54 | #define CACHE_DIR "/tmp" |
---|
| 55 | #define CACHE_FN_SIZE 80 |
---|
| 56 | #define CACHE_STRATEGY_SIZE 256 |
---|
| 57 | #define CACHE_DEFAULT_SIZE 50 |
---|
| 58 | |
---|
| 59 | #define CACHE_FLG_INFO 1 |
---|
| 60 | #define CACHE_FLG_TEXT 2 |
---|
| 61 | |
---|
| 62 | struct cache_meeting { |
---|
| 63 | int ref_count; |
---|
| 64 | name_blk nb; |
---|
| 65 | mtg_info m_info; |
---|
| 66 | int meeting_code; /* Error code when fetching */ |
---|
| 67 | /* meeting info */ |
---|
| 68 | struct cache_meeting *next; |
---|
| 69 | struct cache_meeting *prev; |
---|
| 70 | }; |
---|
| 71 | |
---|
| 72 | struct cache_info { |
---|
| 73 | trn_nums trn_num; |
---|
| 74 | struct cache_meeting *meeting; |
---|
| 75 | int flags; |
---|
| 76 | char filename[CACHE_FN_SIZE]; |
---|
| 77 | trn_info3 t_info; |
---|
| 78 | int info_code; /* Error code when fetching info */ |
---|
| 79 | int text_code; /* Error code when fetch the text */ |
---|
| 80 | struct cache_info *next; /* Used to keep LRU list */ |
---|
| 81 | /* Also used for empty list */ |
---|
| 82 | struct cache_info *prev; |
---|
| 83 | }; |
---|
| 84 | |
---|
| 85 | /* |
---|
| 86 | * The cache work instructions are divided into two fields: |
---|
| 87 | * |
---|
| 88 | * The upper 4 bits define the opcode, the lower 4 bites define the |
---|
| 89 | * direction, if any. |
---|
| 90 | * |
---|
| 91 | * OPCODES: |
---|
| 92 | * STOP --- Stop doing any cache work. |
---|
| 93 | * GET_CUR --- Get the current transaction |
---|
| 94 | * FETCH_CUR --- Fetch the article one away in the indicated direction |
---|
| 95 | * from the current article. |
---|
| 96 | * SET_PTR --- Set the pointer to the current article |
---|
| 97 | * MFETCH_PTR --- Move the pointer one in the indicated direction and |
---|
| 98 | * fetch that article |
---|
| 99 | */ |
---|
| 100 | |
---|
| 101 | typedef char cache_dir; |
---|
| 102 | |
---|
| 103 | #define CACHE_OP_MASK 0xF0 |
---|
| 104 | #define CACHE_OP_STOP (0 << 4) |
---|
| 105 | #define CACHE_OP_GET_CUR (1 << 4) |
---|
| 106 | #define CACHE_OP_FETCH_CUR (2 << 4) |
---|
| 107 | #define CACHE_OP_SET_PTR (3 << 4) |
---|
| 108 | #define CACHE_OP_MFETCH_PTR (4 << 4) |
---|
| 109 | |
---|
| 110 | #define CACHE_DIR_MASK 0x0F |
---|
| 111 | #define CACHE_DIR_CURRENT 0 |
---|
| 112 | #define CACHE_DIR_NEXT 1 |
---|
| 113 | #define CACHE_DIR_PREV 2 |
---|
| 114 | #define CACHE_DIR_NREF 3 |
---|
| 115 | #define CACHE_DIR_PREF 4 |
---|
| 116 | #define CACHE_DIR_FREF 5 |
---|
| 117 | #define CACHE_DIR_LREF 6 |
---|
| 118 | |
---|
| 119 | |
---|
| 120 | /* |
---|
| 121 | * Function declarations |
---|
| 122 | */ |
---|
| 123 | |
---|
| 124 | struct cache_info *cache_empty(), *cache_search(); |
---|
| 125 | struct cache_meeting *get_cache_meeting(), *search_cache_meetings(); |
---|
| 126 | |
---|
| 127 | void cache_get_transaction_text(), cache_flush(), free_cache_entry(); |
---|
| 128 | void free_cache_meeting(), do_cache_work(), cache_init(); |
---|
| 129 | |
---|
| 130 | extern int do_scd(), do_gtfc(), do_it(), do_itn(), do_im(); |
---|
| 131 | extern int cache_pc; |
---|
| 132 | extern struct cache_info *cache_current; |
---|
| 133 | extern cache_dir cache_current_direction; |
---|
| 134 | |
---|
| 135 | |
---|
| 136 | #endif /* EDSC_CACHE */ |
---|
| 137 | |
---|