1 /* 2 * $XConsortium: AsciiSrcP.h,v 1.8 91/02/20 17:58:15 converse Exp $ 3 */ 4 5 6 /*********************************************************** 7 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, 8 and the Massachusetts Institute of Technology, Cambridge, Massachusetts. 9 10 All Rights Reserved 11 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. 19 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 26 SOFTWARE. 27 28 ******************************************************************/ 29 30 /* 31 * AsciiSrcP.h - Private Header for Ascii Text Source. 32 * 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. 36 * 37 * Date: June 29, 1989 38 * 39 * By: Chris D. Peterson 40 * MIT X Consortium 41 * kit@expo.lcs.mit.edu 42 */ 43 44 /* 45 * TextSrcP.h - Private definitions for AsciiSrc object 46 * 47 */ 48 49 #ifndef _XawAsciiSrcP_h 50 #define _XawAsciiSrcP_h 51 52 #include <X11/Xaw/TextSrcP.h> 53 #include <X11/Xaw/AsciiSrc.h> 54 55 /************************************************************ 56 * 57 * Private declarations. 58 * 59 ************************************************************/ 60 61 #ifdef L_tmpnam 62 #define TMPSIZ L_tmpnam 63 #else 64 #define TMPSIZ 32 /* bytes to allocate for tmpnam */ 65 #endif 66 67 #define MAGIC_VALUE ((XawTextPosition) -1) /* Magic value. */ 68 69 #define streq(a, b) ( strcmp((a), (b)) == 0 ) 70 71 typedef struct _Piece { /* Piece of the text file of BUFSIZ allocated 72 characters. */ 73 char * text; /* The text in this buffer. */ 74 XawTextPosition used; /* The number of characters of this buffer 75 that have been used. */ 76 struct _Piece *prev, *next; /* linked list pointers. */ 77 } Piece; 78 79 /************************************************************ 80 * 81 * New fields for the AsciiSrc object class record. 82 * 83 ************************************************************/ 84 85 typedef struct _AsciiSrcClassPart { char foo; } AsciiSrcClassPart; 86 87 /* Full class record declaration */ 88 typedef struct _AsciiSrcClassRec { 89 ObjectClassPart object_class; 90 TextSrcClassPart text_src_class; 91 AsciiSrcClassPart ascii_src_class; 92 } AsciiSrcClassRec; 93 94 extern AsciiSrcClassRec asciiSrcClassRec; 95 96 /* New fields for the AsciiSrc object record */ 97 98 typedef struct _AsciiSrcPart { 99 100 /* Resources. */ 101 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 XtCallbackList callback; /* A callback list to call when the source is 109 changed. */ 110 Boolean use_string_in_place; /* Use the string passed in place. */ 111 int ascii_length; /* length field for ascii string emulation. */ 112 113 #ifdef ASCII_DISK 114 String filename; /* name of file for Compatability. */ 115 #endif /* ASCII_DISK */ 116 117 /* Private data. */ 118 119 Boolean is_tempfile; /* Is this a temporary file? */ 120 Boolean changes; /* Has this file been edited? */ 121 Boolean allocated_string; /* Have I allocated the 122 string in ascii_src->string? */ 123 XawTextPosition length; /* length of file */ 124 Piece * first_piece; /* first piece of the text. */ 125 } AsciiSrcPart; 126 127 /**************************************************************** 128 * 129 * Full instance record declaration 130 * 131 ****************************************************************/ 132 133 typedef struct _AsciiSrcRec { 134 ObjectPart object; 135 TextSrcPart text_src; 136 AsciiSrcPart ascii_src; 137 } AsciiSrcRec; 138 139 #endif /* _XawAsciiSrcP_h --- Don't add anything after this line. */ 140