Home | History | Annotate | Line # | Download | only in Xaw
      1 /***********************************************************
      2 
      3 Copyright 1987, 1988, 1994, 1998  The Open Group
      4 
      5 Permission to use, copy, modify, distribute, and sell this software and its
      6 documentation for any purpose is hereby granted without fee, provided that
      7 the above copyright notice appear in all copies and that both that
      8 copyright notice and this permission notice appear in supporting
      9 documentation.
     10 
     11 The above copyright notice and this permission notice shall be included in
     12 all copies or substantial portions of the Software.
     13 
     14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
     17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
     18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
     19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     20 
     21 Except as contained in this notice, the name of The Open Group shall not be
     22 used in advertising or otherwise to promote the sale, use or other dealings
     23 in this Software without prior written authorization from The Open Group.
     24 
     25 
     26 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
     27 
     28                         All Rights Reserved
     29 
     30 Permission to use, copy, modify, and distribute this software and its
     31 documentation for any purpose and without fee is hereby granted,
     32 provided that the above copyright notice appear in all copies and that
     33 both that copyright notice and this permission notice appear in
     34 supporting documentation, and that the name of Digital not be
     35 used in advertising or publicity pertaining to distribution of the
     36 software without specific, written prior permission.
     37 
     38 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
     39 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
     40 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
     41 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
     42 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
     43 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
     44 SOFTWARE.
     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 (at) 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 
     78 typedef 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 
     86 typedef struct _AsciiSrcClassPart {
     87     XtPointer extension;
     88 } AsciiSrcClassPart;
     89 
     90 /* Full class record */
     91 typedef struct _AsciiSrcClassRec {
     92     ObjectClassPart     object_class;
     93     TextSrcClassPart	text_src_class;
     94     AsciiSrcClassPart	ascii_src_class;
     95 } AsciiSrcClassRec;
     96 
     97 extern AsciiSrcClassRec asciiSrcClassRec;
     98 
     99 /* New fields for the AsciiSrc object */
    100 typedef 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 */
    133 typedef struct _AsciiSrcRec {
    134     ObjectPart    object;
    135     TextSrcPart   text_src;
    136     AsciiSrcPart  ascii_src;
    137 } AsciiSrcRec;
    138 
    139 #endif /* _XawAsciiSrcP_h */
    140