Update NEWS for 1.6.22
[pkg-k5-afs_openafs.git] / src / gtx / gtxtextcb.h
blobe379f63bbdb92ea1239e150cb1b3ce85c6f871f1
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
8 */
10 #ifndef __gator_textcb_h
11 #define __gator_textcb_h 1
13 /*------------------------------------------------------------------------
14 * gator_textcb.h
16 * Definitions and interface for the gator circular buffer package for
17 * its scrollable text object.
19 *------------------------------------------------------------------------*/
21 #include <lock.h> /*AFS locks */
23 #define GATOR_TEXTCB_MAXINVERSIONS 10 /*Max highlight inversions */
26 * Description of the text hanging off each circular buffer entry.
28 struct gator_textcb_entry {
29 int ID; /*Overall ID (number) */
30 int highlight; /*(Starting) highlight value */
31 int inversion[GATOR_TEXTCB_MAXINVERSIONS]; /*Highlighting inversions */
32 int numInversions; /*Num of above inversions */
33 int charsUsed; /*Num chars used */
34 char *textp; /*Ptr to text buffer itself */
38 * Circular buffer header. Note: we actually allocate one more char
39 * per line than we admit, to make sure we can always null-
40 * terminate each line.
42 struct gator_textcb_hdr {
43 struct Lock cbLock; /*Lock for this circular buffer */
44 int maxEntriesStored; /*Max num. text entries we store */
45 int maxCharsPerEntry; /*Max characters in each entry */
46 int currEnt; /*Entry currently being written */
47 int currEntIdx; /*Index of current entry */
48 int oldestEnt; /*Oldest entry stored */
49 int oldestEntIdx; /*Index of oldest entry */
50 struct gator_textcb_entry *entry; /*Ptr to array of text entries */
51 char *blankLine; /*Ptr to blank line */
55 * Operations for text circular buffers.
57 extern int gator_textcb_Init(int);
59 * Summary:
60 * Initialize this package. MUST BE THE FIRST ROUTINE CALLED!
62 * Args:
63 * int a_debug : Should debugging output be turned on?
65 * Returns:
66 * Zero if successful,
67 * Error code otherwise.
70 extern struct gator_textcb_hdr *gator_textcb_Create(int, int);
72 * Summary:
73 * Create a new text circular buffer.
75 * Args:
76 * int a_maxEntriesStored : How many entries should it have?
77 * int a_maxCharsPerEntry : Max chars in each entry.
79 * Returns:
80 * Ptr to the fully-initialized circular buffer hdr if successful,
81 * Null pointer otherwise.
84 extern int gator_textcb_Write(struct gator_textcb_hdr *, char *a_textToWrite,
85 int, int, int);
87 * Summary:
88 * Write the given string to the text circular buffer. Line
89 * breaks are caused either by overflowing the current text
90 * line or via explicit '\n's.
92 * Args:
93 * struct gator_textcb_hdr *a_cbhdr : Ptr to circ buff hdr.
94 * char *a_textToWrite : Ptr to text to insert.
95 * int a_numChars : Number of chars to write.
96 * int a_highlight : Use highlighting?
97 * int a_skip; : Force a skip to the next line?
99 * Returns:
100 * Zero if successful,
101 * Error code otherwise.
104 extern int gator_textcb_BlankLine(struct gator_textcb_hdr *, int);
106 * Summary:
107 * Write out some number of blank lines to the given circular
108 * buffer.
110 * Args:
111 * struct gator_textcb_hdr *a_cbhdr : Ptr to circ buff hdr.
112 * int a_numBlanks : Num. blank lines to write.
114 * Returns:
115 * Zero if successful,
116 * Error code otherwise.
119 extern int gator_textcb_Delete(struct gator_textcb_hdr *a_cbhdr);
121 * Summary:
122 * Delete the storage used by the given circular buffer, including
123 * the header itself.
125 * Args:
126 * struct gator_textcb_hdr *a_cbhdr : Ptr to the header of the
127 * circ buffer to reap.
129 * Returns:
130 * Zero if successful,
131 * Error code otherwise.
134 #endif /* __gator_textcb_h */