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