Initial import of the CDE 2.1.30 sources from the Open Group.
[oweals/cde.git] / cde / programs / dtstyle / I18nEnv.h
1 /* $XConsortium: I18nEnv.h /main/1 1996/03/25 00:51:43 pascale $ */
2 /************************************<+>*************************************
3  ****************************************************************************
4  **
5  **   File:        I18nEnv.h
6  **
7  **
8  **  This file contains function definitions for the corresponding .c
9  **  file
10  **
11  **
12  ****************************************************************************
13  ************************************<+>*************************************/
14 /*
15  * (c) Copyright 1996 Digital Equipment Corporation.
16  * (c) Copyright 1996 Hewlett-Packard Company.
17  * (c) Copyright 1996 International Business Machines Corp.
18  * (c) Copyright 1996 Sun Microsystems, Inc.
19  * (c) Copyright 1996 Novell, Inc. 
20  * (c) Copyright 1996 FUJITSU LIMITED.
21  * (c) Copyright 1996 Hitachi.
22  */
23
24 #ifndef _i18nEnv_h
25 #define _i18nEnv_h
26
27 #include <stdio.h>
28 #include <ctype.h>
29 #include <unistd.h>
30 #include <stdlib.h>
31 #include <sys/stat.h>
32 #include <sys/param.h>
33 #include <sys/socket.h>
34 #include <netdb.h>
35
36 #ifndef MAXPATHLEN
37 #define MAXPATHLEN              1024
38 #endif
39
40 #define DtUSER_TMP_DIR          "./dt/tmp"
41 #define DtUSER_IMSFS_DIR        "/.dt/ims"
42
43 #define NAME_NONE               "none"
44 #define NAME_LOCAL              "local"
45 #define NAME_BUILTIN            "builtin"
46
47 #define STR_PREFIX_CHAR         '@'
48 #define STR_DEFAULTIMS          "DefaultIms"
49 #define STR_SELECTMODE          "SelectMode"
50 #define STR_IMSNAME             "ImsName"
51 #define STR_HOSTNAME            "HostName"
52 #define  TAG_END_CHAR           ':'
53
54     /* host type */
55 #define HOST_LOCAL              0
56 #define HOST_REMOTE             1
57 #define HOST_UNKNOWN            2
58
59 typedef struct _FileSel {
60     char        *fname;         /* IM selection file full path name */
61     char        *hostname;      /* User selected hostname */
62     char        *im_name;       /* User selected Input Method */
63     int         start_mode;     /* User selected start mode */
64 } FileSel;
65
66 typedef struct {
67     int         inactive;       /* Status of the IM */
68     char        *im_name;       /* File name of the IM as found in the locale
69                                    entry file */
70     char        *im_label;      /* Label to present to the user */
71     Boolean     im_default;     /* Is this the default one? */
72 } ImsEnt;
73
74
75 typedef struct {
76     char       *host_name;       /* hostname selected in the ComboBox */
77     ImsEnt     *ims_list ;       /* list of IMS entities on this host */
78     int        ims_list_size ;   /* number of IMS entities */
79 } ImsSel;
80
81 typedef struct _UserEnv {
82     char        *localhostname;   /* hostname the user has started dtstyle */
83     char        *username;        /* user name */
84     char        *displayname;     /* display dtstyle is running on */
85     char        *locale;          /* system-specific locale from $LANG */
86     char        *CDE_locale;      /* CDE generic locale name */
87     char        *homedir;         
88 } UserEnv;
89
90 typedef struct _PipeRec {
91     FILE  *pipe ;
92     XtInputId input_id ;
93     XtIntervalId timer_id ;
94 } PipeRec;
95
96 typedef struct _I18nEnv {
97     UserEnv        *user_env;     /* User environmnet */
98     ImsSel         *ims_sel;      /* Available IMS */
99     FileSel        *file_sel;     /* User IMS Selection File values */
100     PipeRec        *pipe_info;    /* Info needed for the pipe execution */
101     Widget         shell;
102 } I18nEnv;
103
104
105     /* Error Codes */
106 #define NO_ERROR                0
107
108 typedef enum {
109     NoError = 0,
110     ErrNoHome,                  
111     ErrNoLocale,        
112     ErrNoCDELocale,
113
114         /* File I/O */
115     ErrFileCreate,              
116
117         /* Selection */
118     ErrNoSelectionFile,         
119     ErrSaveSelection,           
120
121         /* Remote */
122     ErrUnknownHost,             
123     ErrNoDtimsstart,    
124     ErrRemoteFailed,
125
126         /* Pipe */
127     ErrNoPopen,
128     ErrTimeOut,
129     ErrUnknown,
130
131     LastErrorCode              
132 } ximsError;
133
134
135 /* External declarations */
136 extern I18nEnv i18n_env;
137
138 extern int _DtI18nGetEnvValues(I18nEnv *env);
139 extern int _DtI18nGetImList(I18nEnv *env, char *hostname);
140 extern void _DtI18nSetSensitiveImTB(I18nEnv *env, Boolean sensitivity);
141 extern int  _DtI18nWriteImSelectionFile(I18nEnv *env);
142 extern void _DtI18nErrorDialog(int err) ;
143
144 #include "I18nUtil.h"
145
146 #endif /* _i18nEnv_h */
147 /* DON'T ADD ANYTHING AFTER THIS #endif */