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