1 /* This file Copyright 1992,1993 by Clifford A. Adams */
2 /* scan.h
3  *
4  * (Mostly scan context declarations.)
5  */
6 
7 /* return codes.  First two should be the same as article scan codes */
8 #define S_QUIT (-1)
9 #define S_ERR (-2)
10 /* command was not found in common scan subset */
11 #define S_NOTFOUND (-3)
12 
13 /* number of entries allocated for a page */
14 #define MAX_PAGE_SIZE 256
15 
16 /* different context types */
17 #define S_ART 1
18 #define S_GROUP 2
19 #define S_HELP 3
20 #define S_VIRT 4
21 
22 struct page_ent {
23     long entnum;	/* entry (article/message/newsgroup) number */
24     short lines;	/* how many screen lines to describe? */
25     short start_line;	/* screen line (0 = line under top status bar) */
26     char pageflags;	/* not currently used. */
27 };
28 
29 struct scontext {
30     int type;			/* context type */
31 
32     /* ordering information */
33     long* ent_sort;		/* sorted list of entries in the context */
34     long ent_sort_max;		/* maximum index of sorted array */
35     long ent_sorted_max;	/* maximum index *that is sorted* */
36     long* ent_index;		/* indexes into ent_sorted */
37     long ent_index_max;		/* maximum entry number added */
38 
39     int page_size;		/* number of entries allocated for page */
40 				/* (usually fixed, > max screen lines) */
41     PAGE_ENT* page_ents;	/* array of entries on page */
42     /* -1 means not initialized for top and bottom entry */
43     long top_ent;		/* top entry on page */
44     long bot_ent;		/* bottom entry (note change) */
45     bool refill;		/* does the page need refilling? */
46     /* refresh entries */
47     bool ref_all;		/* refresh all on page */
48     bool ref_top;		/* top status bar */
49     bool ref_bot;		/* bottom status bar */
50     /* -1 for the next two entries means don't refresh */
51     short ref_status;		/* line to start refreshing status from */
52     short ref_desc;		/* line to start refreshing descript. from */
53     /* screen sizes */
54     short top_lines;		/* lines for top status bar */
55     short bot_lines;		/* lines for bottom status bar */
56     short status_cols;		/* characters for status column */
57     short cursor_cols;		/* characters for cursor column */
58     short itemnum_cols;		/* characters for item number column */
59     short desc_cols;		/* characters for description column */
60     /* pointer info */
61     short ptr_page_line;	/* page_ent index */
62     long flags;
63 };
64 
65 /* the current values */
66 
67 EXT long* s_ent_sort;		/* sorted list of entries in the context */
68 EXT long s_ent_sort_max;	/* maximum index of sorted array */
69 EXT long s_ent_sorted_max;	/* maximum index *that is sorted* */
70 EXT long* s_ent_index;		/* indexes into ent_sorted */
71 EXT long s_ent_index_max;	/* maximum entry number added */
72 
73 EXT int s_page_size;		/* number of entries allocated for page */
74 				/* (usually fixed, > max screen lines) */
75 EXT PAGE_ENT* page_ents;	/* array of entries on page */
76 /* -1 means not initialized for top and bottom entry */
77 EXT long s_top_ent;		/* top entry on page */
78 EXT long s_bot_ent;		/* bottom entry (note change) */
79 EXT bool s_refill;		/* does the page need refilling? */
80 /* refresh entries */
81 EXT bool s_ref_all;		/* refresh all on page */
82 EXT bool s_ref_top;		/* top status bar */
83 EXT bool s_ref_bot;		/* bottom status bar */
84 /* -1 for the next two entries means don't refresh */
85 EXT short s_ref_status;		/* line to start refreshing status from */
86 EXT short s_ref_desc;		/* line to start refreshing descript. from */
87 /* screen sizes */
88 EXT short s_top_lines;		/* lines for top status bar */
89 EXT short s_bot_lines;		/* lines for bottom status bar */
90 EXT short s_status_cols;	/* characters for status column */
91 EXT short s_cursor_cols;	/* characters for cursor column */
92 EXT short s_itemnum_cols;	/* characters for item number column */
93 EXT short s_desc_cols;		/* characters for description column */
94 /* pointer info */
95 EXT short s_ptr_page_line;	/* page_ent index */
96 EXT long  s_flags;		/* misc. flags */
97 
98 EXT int s_num_contexts INIT(0);
99 /* array of context structures */
100 EXT SCONTEXT* s_contexts INIT((SCONTEXT*)NULL);
101 
102 /* current context number */
103 EXT int s_cur_context INIT(0);
104 /* current context type (for fast switching) */
105 EXT int s_cur_type;
106 
107 /* options */
108 /* show item numbers by default */
109 EXT int s_itemnum INIT(TRUE);
110 EXT int s_mode_vi INIT(0);
111 
112 /* DON'T EDIT BELOW THIS LINE OR YOUR CHANGES WILL BE LOST! */
113 
114 void s_init_context _((int,int));
115 int s_new_context _((int));
116 void s_save_context _((void));
117 void s_change_context _((int));
118 void s_clean_contexts _((void));
119 void s_delete_context _((int));
120