MultiSrcP.h revision 421c997b
1/*
2 * Copyright 1991 by OMRON Corporation
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name OMRON not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission.  OMRON make no representations
11 * about the suitability of this software for any purpose.  It is provided
12 * "as is" without express or implied warranty.
13 *
14 * OMRON DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
21 *
22 *      Author: Li Yuhong	 OMRON Corporation
23 */
24
25
26/***********************************************************
27
28Copyright 1987, 1988, 1991, 1994, 1998  The Open Group
29
30Permission to use, copy, modify, distribute, and sell this software and its
31documentation for any purpose is hereby granted without fee, provided that
32the above copyright notice appear in all copies and that both that
33copyright notice and this permission notice appear in supporting
34documentation.
35
36The above copyright notice and this permission notice shall be included in
37all copies or substantial portions of the Software.
38
39THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
40IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
41FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
42OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
43AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
44CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45
46Except as contained in this notice, the name of The Open Group shall not be
47used in advertising or otherwise to promote the sale, use or other dealings
48in this Software without prior written authorization from The Open Group.
49
50
51Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
52
53                        All Rights Reserved
54
55Permission to use, copy, modify, and distribute this software and its
56documentation for any purpose and without fee is hereby granted,
57provided that the above copyright notice appear in all copies and that
58both that copyright notice and this permission notice appear in
59supporting documentation, and that the name of Digital not be
60used in advertising or publicity pertaining to distribution of the
61software without specific, written prior permission.
62
63DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
64ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
65DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
66ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
67WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
68ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
69SOFTWARE.
70
71******************************************************************/
72
73/*
74 * MultiSrcP.h - Private Header for Multi Text Source.
75 *
76 * This is the private header file for the Multi Text Source.
77 * It is intended to be used with the Text widget, the simplest way to use
78 * this text source is to use the MultiText Object.
79 *
80 * Date:    June 29, 1989
81 *
82 * By:      Chris D. Peterson
83 *          MIT X Consortium
84 *          kit@expo.lcs.mit.edu
85 */
86
87/*
88 * This file was changed from AsciiSrcP.h.
89 *
90 * By Li Yuhong, Sept. 18, 1990
91 */
92
93#ifndef _XawMultiSrcP_h
94#define _XawMultiSrcP_h
95
96#include <X11/Xfuncproto.h>
97#include <X11/Xaw/TextSrcP.h>
98#include <X11/Xaw/MultiSrc.h>
99
100#ifdef L_tmpnam
101#define TMPSIZ L_tmpnam
102#else
103#ifdef PATH_MAX
104#define TMPSIZ PATH_MAX
105#else
106#define TMPSIZ 1024		/* bytes to allocate for tmpnam */
107#endif
108#endif
109
110typedef struct _MultiPiece {	/* Piece of the text file of BUFSIZ allocated
111				   characters */
112    wchar_t* text;		/* The text in this buffer */
113    XawTextPosition used;	/* The number of characters of this buffer
114				   that have been used */
115    struct _MultiPiece *prev, *next;	/* linked list pointers */
116} MultiPiece;
117
118/* New fields for the MultiSrc object class */
119typedef struct _MultiSrcClassPart {
120    XtPointer extension;
121} MultiSrcClassPart;
122
123/* Full class record */
124typedef struct _MultiSrcClassRec {
125    ObjectClassPart     object_class;
126    TextSrcClassPart	text_src_class;
127    MultiSrcClassPart	multi_src_class;
128} MultiSrcClassRec;
129
130extern MultiSrcClassRec multiSrcClassRec;
131
132/* New fields for the MultiSrc object */
133typedef struct _MultiSrcPart {
134    /* resources */
135    XIC ic;			/* for X Input Method */
136    XtPointer string;		/* either the string, or the file name, depend-
137				   ing upon the `type'.  ALWAYS IN MB FORMAT */
138    XawAsciiType type;		/* either string or disk */
139    XawTextPosition piece_size;	/* Size of text buffer for each piece */
140    Boolean data_compression;	/* compress to minimum memory automatically
141				   on save? */
142#ifdef OLDXAW
143    XtCallbackList callback;
144#endif
145    Boolean use_string_in_place;/* Use the string passed in place */
146    int multi_length;		/* length field for multi string emulation */
147
148    /* private */
149
150    Boolean is_tempfile;	  /* Is this a temporary file? */
151#ifdef OLDXAW
152    Boolean changes;
153#endif
154    Boolean allocated_string;	/* Have I allocated the
155				   string in multi_src->string? */
156    XawTextPosition length;	/* length of file - IN CHARACTERS, NOT BYTES */
157    MultiPiece *first_piece;	/* first piece of the text */
158#ifndef OLDXAW
159    XtPointer pad[4];	/* for future use and keep binary compatability */
160#endif
161} MultiSrcPart;
162
163/* Full instance record */
164typedef struct _MultiSrcRec {
165  ObjectPart    object;
166  TextSrcPart	text_src;
167  MultiSrcPart	multi_src;
168} MultiSrcRec;
169
170_XFUNCPROTOBEGIN
171
172void _XawMultiSourceFreeString
173(
174 Widget		w
175 );
176
177_XFUNCPROTOEND
178
179#endif /* _XawMultiSrcP_h */
180