1/***********************************************************
2
3Copyright 1987, 1988, 1994, 1998  The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21Except as contained in this notice, the name of The Open Group shall not be
22used in advertising or otherwise to promote the sale, use or other dealings
23in this Software without prior written authorization from The Open Group.
24
25
26Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
27
28                        All Rights Reserved
29
30Permission to use, copy, modify, and distribute this software and its
31documentation for any purpose and without fee is hereby granted,
32provided that the above copyright notice appear in all copies and that
33both that copyright notice and this permission notice appear in
34supporting documentation, and that the name of Digital not be
35used in advertising or publicity pertaining to distribution of the
36software without specific, written prior permission.
37
38DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
39ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
40DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
41ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
42WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
44SOFTWARE.
45
46******************************************************************/
47
48/*
49 * AsciiSrcP.h - Private Header for Ascii Text Source.
50 *
51 * This is the private header file for the Ascii Text Source.
52 * It is intended to be used with the Text widget, the simplest way to use
53 * this text source is to use the AsciiText Object.
54 *
55 * Date:    June 29, 1989
56 *
57 * By:      Chris D. Peterson
58 *          MIT X Consortium
59 *          kit@expo.lcs.mit.edu
60 */
61
62#ifndef _XawAsciiSrcP_h
63#define _XawAsciiSrcP_h
64
65#include <X11/Xaw/TextSrcP.h>
66#include <X11/Xaw/AsciiSrc.h>
67
68#ifdef L_tmpnam
69#define TMPSIZ L_tmpnam
70#else
71#ifdef PATH_MAX
72#define TMPSIZ PATH_MAX
73#else
74#define TMPSIZ 1024		/* bytes to allocate for tmpnam */
75#endif
76#endif
77
78typedef struct _Piece {		/* Piece of the text file of BUFSIZ allocated
79				   characters */
80    char *text;			/* The text in this buffer */
81    XawTextPosition used;	/* The number of characters of this buffer
82				   that have been used */
83    struct _Piece *prev, *next;	/* linked list pointers */
84} Piece;
85
86typedef struct _AsciiSrcClassPart {
87    XtPointer extension;
88} AsciiSrcClassPart;
89
90/* Full class record */
91typedef struct _AsciiSrcClassRec {
92    ObjectClassPart     object_class;
93    TextSrcClassPart	text_src_class;
94    AsciiSrcClassPart	ascii_src_class;
95} AsciiSrcClassRec;
96
97extern AsciiSrcClassRec asciiSrcClassRec;
98
99/* New fields for the AsciiSrc object */
100typedef struct _AsciiSrcPart {
101    /* resources */
102    char *string;		/* either the string, or the
103				   file name, depending upon the type */
104    XawAsciiType type;		/* either string or disk */
105    XawTextPosition piece_size;	/* Size of text buffer for each piece */
106    Boolean data_compression;	/* compress to minimum memory automatically
107				   on save? */
108#ifdef OLDXAW
109    XtCallbackList callback;
110#endif
111    Boolean use_string_in_place;/* Use the string passed in place */
112    int ascii_length;		/* length field for ascii string emulation */
113
114#ifdef ASCII_DISK
115    String filename;		/* name of file for Compatibility */
116#endif /* ASCII_DISK */
117
118    /* private */
119    Boolean is_tempfile;	/* Is this a temporary file? */
120#ifdef OLDXAW
121    Boolean changes;
122#endif
123    Boolean allocated_string;	/* Have I allocated the
124				   string in ascii_src->string? */
125    XawTextPosition length;	/* length of file */
126    Piece *first_piece;		/* first piece of the text */
127#ifndef OLDXAW
128    XtPointer pad[4];	/* for future use and keep binary compatibility */
129#endif
130} AsciiSrcPart;
131
132/* instance record */
133typedef struct _AsciiSrcRec {
134    ObjectPart    object;
135    TextSrcPart   text_src;
136    AsciiSrcPart  ascii_src;
137} AsciiSrcRec;
138
139#endif /* _XawAsciiSrcP_h */
140