Link with C++ linker
[oweals/cde.git] / cde / programs / dtstyle / I18nEnv.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: I18nEnv.h /main/1 1996/03/25 00:51:43 pascale $ */
24 /************************************<+>*************************************
25  ****************************************************************************
26  **
27  **   File:        I18nEnv.h
28  **
29  **
30  **  This file contains function definitions for the corresponding .c
31  **  file
32  **
33  **
34  ****************************************************************************
35  ************************************<+>*************************************/
36 /*
37  * (c) Copyright 1996 Digital Equipment Corporation.
38  * (c) Copyright 1996 Hewlett-Packard Company.
39  * (c) Copyright 1996 International Business Machines Corp.
40  * (c) Copyright 1996 Sun Microsystems, Inc.
41  * (c) Copyright 1996 Novell, Inc. 
42  * (c) Copyright 1996 FUJITSU LIMITED.
43  * (c) Copyright 1996 Hitachi.
44  */
45
46 #ifndef _i18nEnv_h
47 #define _i18nEnv_h
48
49 #include <stdio.h>
50 #include <ctype.h>
51 #include <unistd.h>
52 #include <stdlib.h>
53 #include <sys/stat.h>
54 #include <sys/param.h>
55 #include <sys/socket.h>
56 #include <netdb.h>
57
58 #ifndef MAXPATHLEN
59 #define MAXPATHLEN              1024
60 #endif
61
62 #define DtUSER_TMP_DIR          "./dt/tmp"
63 #define DtUSER_IMSFS_DIR        "/.dt/ims"
64
65 #define NAME_NONE               "none"
66 #define NAME_LOCAL              "local"
67 #define NAME_BUILTIN            "builtin"
68
69 #define STR_PREFIX_CHAR         '@'
70 #define STR_DEFAULTIMS          "DefaultIms"
71 #define STR_SELECTMODE          "SelectMode"
72 #define STR_IMSNAME             "ImsName"
73 #define STR_HOSTNAME            "HostName"
74 #define  TAG_END_CHAR           ':'
75
76     /* host type */
77 #define HOST_LOCAL              0
78 #define HOST_REMOTE             1
79 #define HOST_UNKNOWN            2
80
81 typedef struct _FileSel {
82     char        *fname;         /* IM selection file full path name */
83     char        *hostname;      /* User selected hostname */
84     char        *im_name;       /* User selected Input Method */
85     int         start_mode;     /* User selected start mode */
86 } FileSel;
87
88 typedef struct {
89     int         inactive;       /* Status of the IM */
90     char        *im_name;       /* File name of the IM as found in the locale
91                                    entry file */
92     char        *im_label;      /* Label to present to the user */
93     Boolean     im_default;     /* Is this the default one? */
94 } ImsEnt;
95
96
97 typedef struct {
98     char       *host_name;       /* hostname selected in the ComboBox */
99     ImsEnt     *ims_list ;       /* list of IMS entities on this host */
100     int        ims_list_size ;   /* number of IMS entities */
101 } ImsSel;
102
103 typedef struct _UserEnv {
104     char        *localhostname;   /* hostname the user has started dtstyle */
105     char        *username;        /* user name */
106     char        *displayname;     /* display dtstyle is running on */
107     char        *locale;          /* system-specific locale from $LANG */
108     char        *CDE_locale;      /* CDE generic locale name */
109     char        *homedir;         
110 } UserEnv;
111
112 typedef struct _PipeRec {
113     FILE  *pipe ;
114     XtInputId input_id ;
115     XtIntervalId timer_id ;
116 } PipeRec;
117
118 typedef struct _I18nEnv {
119     UserEnv        *user_env;     /* User environmnet */
120     ImsSel         *ims_sel;      /* Available IMS */
121     FileSel        *file_sel;     /* User IMS Selection File values */
122     PipeRec        *pipe_info;    /* Info needed for the pipe execution */
123     Widget         shell;
124 } I18nEnv;
125
126
127     /* Error Codes */
128 #define NO_ERROR                0
129
130 typedef enum {
131     NoError = 0,
132     ErrNoHome,                  
133     ErrNoLocale,        
134     ErrNoCDELocale,
135
136         /* File I/O */
137     ErrFileCreate,              
138
139         /* Selection */
140     ErrNoSelectionFile,         
141     ErrSaveSelection,           
142
143         /* Remote */
144     ErrUnknownHost,             
145     ErrNoDtimsstart,    
146     ErrRemoteFailed,
147
148         /* Pipe */
149     ErrNoPopen,
150     ErrTimeOut,
151     ErrUnknown,
152
153     LastErrorCode              
154 } ximsError;
155
156
157 /* External declarations */
158 extern I18nEnv i18n_env;
159
160 extern int _DtI18nGetEnvValues(I18nEnv *env);
161 extern int _DtI18nGetImList(I18nEnv *env, char *hostname);
162 extern void _DtI18nSetSensitiveImTB(I18nEnv *env, Boolean sensitivity);
163 extern int  _DtI18nWriteImSelectionFile(I18nEnv *env);
164 extern void _DtI18nErrorDialog(int err) ;
165
166 #include "I18nUtil.h"
167
168 #endif /* _i18nEnv_h */
169 /* DON'T ADD ANYTHING AFTER THIS #endif */