AsciiSrcP.h revision 7a84e134
17a84e134Smrg/*
27a84e134Smrg* $Xorg: AsciiSrcP.h,v 1.4 2001/02/09 02:03:42 xorgcvs Exp $
37a84e134Smrg*/
47a84e134Smrg
57a84e134Smrg
67a84e134Smrg/***********************************************************
77a84e134Smrg
87a84e134SmrgCopyright 1987, 1988, 1994, 1998  The Open Group
97a84e134Smrg
107a84e134SmrgPermission to use, copy, modify, distribute, and sell this software and its
117a84e134Smrgdocumentation for any purpose is hereby granted without fee, provided that
127a84e134Smrgthe above copyright notice appear in all copies and that both that
137a84e134Smrgcopyright notice and this permission notice appear in supporting
147a84e134Smrgdocumentation.
157a84e134Smrg
167a84e134SmrgThe above copyright notice and this permission notice shall be included in
177a84e134Smrgall copies or substantial portions of the Software.
187a84e134Smrg
197a84e134SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
207a84e134SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
217a84e134SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
227a84e134SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
237a84e134SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
247a84e134SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
257a84e134Smrg
267a84e134SmrgExcept as contained in this notice, the name of The Open Group shall not be
277a84e134Smrgused in advertising or otherwise to promote the sale, use or other dealings
287a84e134Smrgin this Software without prior written authorization from The Open Group.
297a84e134Smrg
307a84e134Smrg
317a84e134SmrgCopyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
327a84e134Smrg
337a84e134Smrg                        All Rights Reserved
347a84e134Smrg
357a84e134SmrgPermission to use, copy, modify, and distribute this software and its
367a84e134Smrgdocumentation for any purpose and without fee is hereby granted,
377a84e134Smrgprovided that the above copyright notice appear in all copies and that
387a84e134Smrgboth that copyright notice and this permission notice appear in
397a84e134Smrgsupporting documentation, and that the name of Digital not be
407a84e134Smrgused in advertising or publicity pertaining to distribution of the
417a84e134Smrgsoftware without specific, written prior permission.
427a84e134Smrg
437a84e134SmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
447a84e134SmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
457a84e134SmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
467a84e134SmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
477a84e134SmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
487a84e134SmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
497a84e134SmrgSOFTWARE.
507a84e134Smrg
517a84e134Smrg******************************************************************/
527a84e134Smrg/* $XFree86: xc/lib/Xaw/AsciiSrcP.h,v 1.8 2001/01/17 19:42:25 dawes Exp $ */
537a84e134Smrg
547a84e134Smrg/*
557a84e134Smrg * AsciiSrcP.h - Private Header for Ascii Text Source.
567a84e134Smrg *
577a84e134Smrg * This is the private header file for the Ascii Text Source.
587a84e134Smrg * It is intended to be used with the Text widget, the simplest way to use
597a84e134Smrg * this text source is to use the AsciiText Object.
607a84e134Smrg *
617a84e134Smrg * Date:    June 29, 1989
627a84e134Smrg *
637a84e134Smrg * By:      Chris D. Peterson
647a84e134Smrg *          MIT X Consortium
657a84e134Smrg *          kit@expo.lcs.mit.edu
667a84e134Smrg */
677a84e134Smrg
687a84e134Smrg#ifndef _XawAsciiSrcP_h
697a84e134Smrg#define _XawAsciiSrcP_h
707a84e134Smrg
717a84e134Smrg#include <X11/Xaw/TextSrcP.h>
727a84e134Smrg#include <X11/Xaw/AsciiSrc.h>
737a84e134Smrg
747a84e134Smrg#ifdef L_tmpnam
757a84e134Smrg#define TMPSIZ L_tmpnam
767a84e134Smrg#else
777a84e134Smrg#ifdef PATH_MAX
787a84e134Smrg#define TMPSIZ PATH_MAX
797a84e134Smrg#else
807a84e134Smrg#define TMPSIZ 1024		/* bytes to allocate for tmpnam */
817a84e134Smrg#endif
827a84e134Smrg#endif
837a84e134Smrg
847a84e134Smrgtypedef struct _Piece {		/* Piece of the text file of BUFSIZ allocated
857a84e134Smrg				   characters */
867a84e134Smrg    char *text;			/* The text in this buffer */
877a84e134Smrg    XawTextPosition used;	/* The number of characters of this buffer
887a84e134Smrg				   that have been used */
897a84e134Smrg    struct _Piece *prev, *next;	/* linked list pointers */
907a84e134Smrg} Piece;
917a84e134Smrg
927a84e134Smrgtypedef struct _AsciiSrcClassPart {
937a84e134Smrg    XtPointer extension;
947a84e134Smrg} AsciiSrcClassPart;
957a84e134Smrg
967a84e134Smrg/* Full class record */
977a84e134Smrgtypedef struct _AsciiSrcClassRec {
987a84e134Smrg    ObjectClassPart     object_class;
997a84e134Smrg    TextSrcClassPart	text_src_class;
1007a84e134Smrg    AsciiSrcClassPart	ascii_src_class;
1017a84e134Smrg} AsciiSrcClassRec;
1027a84e134Smrg
1037a84e134Smrgextern AsciiSrcClassRec asciiSrcClassRec;
1047a84e134Smrg
1057a84e134Smrg/* New fields for the AsciiSrc object */
1067a84e134Smrgtypedef struct _AsciiSrcPart {
1077a84e134Smrg    /* resources */
1087a84e134Smrg    char *string;		/* either the string, or the
1097a84e134Smrg				   file name, depending upon the type */
1107a84e134Smrg    XawAsciiType type;		/* either string or disk */
1117a84e134Smrg    XawTextPosition piece_size;	/* Size of text buffer for each piece */
1127a84e134Smrg    Boolean data_compression;	/* compress to minimum memory automatically
1137a84e134Smrg				   on save? */
1147a84e134Smrg#ifdef OLDXAW
1157a84e134Smrg    XtCallbackList callback;
1167a84e134Smrg#endif
1177a84e134Smrg    Boolean use_string_in_place;/* Use the string passed in place */
1187a84e134Smrg    int ascii_length;		/* length field for ascii string emulation */
1197a84e134Smrg
1207a84e134Smrg#ifdef ASCII_DISK
1217a84e134Smrg    String filename;		/* name of file for Compatability */
1227a84e134Smrg#endif /* ASCII_DISK */
1237a84e134Smrg
1247a84e134Smrg    /* private */
1257a84e134Smrg    Boolean is_tempfile;	/* Is this a temporary file? */
1267a84e134Smrg#ifdef OLDXAW
1277a84e134Smrg    Boolean changes;
1287a84e134Smrg#endif
1297a84e134Smrg    Boolean allocated_string;	/* Have I allocated the
1307a84e134Smrg				   string in ascii_src->string? */
1317a84e134Smrg    XawTextPosition length; 	/* length of file */
1327a84e134Smrg    Piece *first_piece;		/* first piece of the text */
1337a84e134Smrg#ifndef OLDXAW
1347a84e134Smrg    XtPointer pad[4];	/* for future use and keep binary compatability */
1357a84e134Smrg#endif
1367a84e134Smrg} AsciiSrcPart;
1377a84e134Smrg
1387a84e134Smrg/* instance record */
1397a84e134Smrgtypedef struct _AsciiSrcRec {
1407a84e134Smrg    ObjectPart    object;
1417a84e134Smrg    TextSrcPart   text_src;
1427a84e134Smrg    AsciiSrcPart  ascii_src;
1437a84e134Smrg} AsciiSrcRec;
1447a84e134Smrg
1457a84e134Smrg#endif /* _XawAsciiSrcP_h */
146