2 * $XConsortium: AsciiSrcP.h,v 1.6 89/10/05 13:17:39 kit Exp $
6 /***********************************************************
7 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
8 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
12 Permission to use, copy, modify, and distribute this software and its
13 documentation for any purpose and without fee is hereby granted,
14 provided that the above copyright notice appear in all copies and that
15 both that copyright notice and this permission notice appear in
16 supporting documentation, and that the names of Digital or MIT not be
17 used in advertising or publicity pertaining to distribution of the
18 software without specific, written prior permission.
20 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
21 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
22 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
23 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
24 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
25 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
28 ******************************************************************/
31 * AsciiSrcP.h - Private Header for Ascii Text Source.
33 * This is the private header file for the Ascii Text Source.
34 * It is intended to be used with the Text widget, the simplest way to use
35 * this text source is to use the AsciiText Object.
39 * By: Chris D. Peterson
41 * kit@expo.lcs.mit.edu
45 * TextSrcP.h - Private definitions for AsciiSrc object
49 #ifndef _XawAsciiSrcP_h
50 #define _XawAsciiSrcP_h
52 #include <./Xaw3_1AsciiSrc.h>
53 #include <./Xaw3_1TextSrcP.h>
55 /************************************************************
57 * Private declarations.
59 ************************************************************/
61 #define TMPSIZ 32 /* bytes to allocate for tmpnam */
63 #define MAGIC_VALUE ((XawTextPosition) -1) /* Magic value. */
65 #define streq(a, b) ( strcmp((a), (b)) == 0 )
67 typedef struct _Piece
{ /* Piece of the text file of BUFSIZ allocated
69 char * text
; /* The text in this buffer. */
70 XawTextPosition used
; /* The number of characters of this buffer
71 that have been used. */
72 struct _Piece
*prev
, *next
; /* linked list pointers. */
75 /************************************************************
77 * New fields for the AsciiSrc object class record.
79 ************************************************************/
81 typedef struct _AsciiSrcClassPart
{ char foo
; } AsciiSrcClassPart
;
83 /* Full class record declaration */
84 typedef struct _AsciiSrcClassRec
{
85 ObjectClassPart object_class
;
86 TextSrcClassPart text_src_class
;
87 AsciiSrcClassPart ascii_src_class
;
90 extern AsciiSrcClassRec asciiSrcClassRec
;
92 /* New fields for the AsciiSrc object record */
94 typedef struct _AsciiSrcPart
{
98 char *string
; /* either the string, or the
99 file name, depending upon the type. */
100 XawAsciiType type
; /* either string or disk. */
101 XawTextPosition piece_size
; /* Size of text buffer for each piece. */
102 Boolean data_compression
; /* compress to minimum memory automatically
104 XtCallbackList callback
; /* A callback list to call when the source is
106 Boolean use_string_in_place
; /* Use the string passed in place. */
107 int ascii_length
; /* length field for ascii string emulation. */
110 String filename
; /* name of file for Compatability. */
111 #endif /* ASCII_DISK */
115 Boolean is_tempfile
; /* Is this a temporary file? */
116 Boolean changes
; /* Has this file been edited? */
117 Boolean allocated_string
; /* Have I allocated the
118 string in ascii_src->string? */
119 XawTextPosition length
; /* length of file */
120 Piece
* first_piece
; /* first piece of the text. */
123 /****************************************************************
125 * Full instance record declaration
127 ****************************************************************/
129 typedef struct _AsciiSrcRec
{
131 TextSrcPart text_src
;
132 AsciiSrcPart ascii_src
;
135 #endif /* _XawAsciiSrcP_h --- Don't add anything after this line. */