dtcm: Resolve CID 87822
[oweals/cde.git] / cde / programs / dtcm / libDtCmP / cm_tty.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 /*******************************************************************************
24 **
25 **  cm_tty.h
26 **
27 **  static char sccsid[] = "@(#)cm_tty.h 1.35 95/07/27 Copyr 1991 Sun Microsystems, Inc."; 
28 **
29 **  $XConsortium: cm_tty.h /main/5 1996/10/10 14:49:30 barstow $
30 **
31 **  RESTRICTED CONFIDENTIAL INFORMATION:
32 **
33 **  The information in this document is subject to special
34 **  restrictions in a confidential disclosure agreement between
35 **  HP, IBM, Sun, USL, SCO and Univel.  Do not distribute this
36 **  document outside HP, IBM, Sun, USL, SCO, or Univel without
37 **  Sun's specific written approval.  This document and all copies
38 **  and derivative works thereof must be returned or destroyed at
39 **  Sun's request.
40 **
41 **  Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
42 **
43 *******************************************************************************/
44
45 /*                                                                      *
46  * (c) Copyright 1993, 1994 Hewlett-Packard Company                     *
47  * (c) Copyright 1993, 1994 International Business Machines Corp.       *
48  * (c) Copyright 1993, 1994 Sun Microsystems, Inc.                      *
49  * (c) Copyright 1993, 1994 Novell, Inc.                                *
50  */
51
52 #ifndef CM_TTY_H
53 #define CM_TTY_H
54
55 #include <csa.h>
56 #include <nl_types.h>
57 #include "ansi_c.h"
58 #include "timeops.h"
59 #include "util.h"
60 #include "props.h"
61
62 #define DTCM_CAT        "dtcm"
63
64 /*
65  * Enumerated type for use with appointment file parsing routines.  For text,
66  * case is ignored!
67  */
68 typedef enum {
69         NOT_A_KEY,
70         APPOINTMENT_START,      /* "** Calendar Appointment **" */
71         DATE_KEY,               /* "Date:" */
72         START_KEY,              /* "Time:", "Start:", "From:" */
73         STOP_KEY,               /* "Until:", "Stop:", "To:" */
74         DURATION_KEY,           /* "Duration:" */
75         WHAT_KEY,               /* "What:" */
76         REPEAT_KEY,             /* "Repeat:" */
77         FOR_KEY,                /* "For:" */
78         NEW_APPT_KEY            /* "cm_appt_def:string:begin" */
79 } Parse_key_op;
80
81 /*
82  * Types used in the validation process for each appointment
83  */
84 typedef enum {
85         COULD_NOT_OPEN_FILE,
86         CANCEL_APPT,
87         INVALID_DATE,
88         INVALID_START,
89         INVALID_STOP,
90         MISSING_DATE,
91         MISSING_START,
92         MISSING_WHAT,
93         INVALID_NOTIME_APPT,
94         REPEAT_FOR_MISMATCH,
95         INVALID_TIME_DUE,
96         INVALID_TIME,
97         MISSING_TIME,
98         VALID_APPT
99 } Validate_op;
100
101 /*
102  * Enumerated types used to access static strings for appointment information.
103  */
104 typedef enum {
105         ONE_TIME,
106         DAILY,
107         WEEKLY,
108         EVERY_TWO_WEEKS,
109         MONTHLY_BY_DATE,
110         MONTHLY_BY_WEEKDAY,
111         YEARLY,
112         MONDAY_THRU_FRIDAY,
113         MON_WED_FRI,
114         TUESDAY_THURSDAY,
115         REPEAT_EVERY
116 } Repeat_menu_op;
117
118 typedef enum {
119         TWO,
120         THREE,
121         FOUR,
122         FIVE,
123         SIX,
124         SEVEN,
125         EIGHT,
126         NINE,
127         TEN,
128         ELEVEN,
129         TWELVE,
130         THIRTEEN,
131         FOURTEEN,
132         FOR_EVER
133 } For_menu_op;
134
135 typedef enum {
136         TIME_MINS,
137         TIME_HRS,
138         TIME_DAYS
139 } Time_scope_menu_op;
140
141 typedef enum {
142         REPEAT_DAYS,
143         REPEAT_WEEKS,
144         REPEAT_MONTHS
145 } Repeat_scope_menu_op;
146
147 typedef enum {
148         SUNDAY,
149         MONDAY,
150         TUESDAY,
151         WEDNESDAY,
152         THURSDAY,
153         FRIDAY,
154         SATURDAY
155 } Days_op;
156
157 typedef enum {
158         JANUARY,
159         FEBRUARY,
160         MARCH,
161         APRIL,
162         MAY,
163         JUNE,
164         JULY,
165         AUGUST,
166         SEPTEMBER,
167         OCTOBER,
168         NOVEMBER,
169         DECEMBER
170 } Months_op;
171
172 static const int        NO_TIME = -1;
173 static const int        ALL_DAY = -2;
174
175 /*
176  * External function definitions
177  */
178 extern char             *boolean_str            P((boolean_t));
179 extern int              cm_tty_delete           P((nl_catd, CSA_session_handle, int, int, CSA_entry_handle*));
180 extern void             cm_tty_format_header    P((Props*, Tick, char*));
181 extern int              cm_tty_insert           P((nl_catd, CSA_session_handle, int, char*, char*,
182                                                    char*, char*, char*, char*,
183                                                    char*, Props*));
184 extern void             cm_tty_load_props       P((Props**));
185 extern int              cm_tty_lookup           P((nl_catd, CSA_session_handle, int, char*, char*,
186                                                    CSA_entry_handle**, Props*));
187 extern boolean_t        convert_boolean_str     P((char*));
188 extern CSA_sint32       convert_privacy_str     P((char*));
189 extern int              convert_privacy_str_to_op P((char*));
190 extern SeparatorType    convert_separator_str   P((char*));
191 extern Time_scope_menu_op convert_time_scope_str P((char*));
192 extern char             *day_str                P((Days_op));
193 extern char             *default_repeat_cnt_str P((Repeat_menu_op));
194 extern char             *default_repeat_scope_str P((nl_catd, Repeat_menu_op));
195 extern char             *for_str                P((For_menu_op));
196 extern char             *get_datemsg            P((OrderingType,
197                                                    SeparatorType));
198 extern Parse_key_op     identify_parse_key      P((char*));
199 extern void             load_appt_defaults      P((Dtcm_appointment*, Props*));
200 extern void             load_reminder_props     P((Dtcm_appointment*, Props*));
201 extern char             *month_str              P((Months_op));
202 extern Validate_op      parse_appt_from_file    P((nl_catd, char*, CmDataList*,
203                                                    Props*, boolean_t(*)(void*), 
204                                                    void*, int));
205 extern char             *parse_attrs_to_string  P((Dtcm_appointment*, Props*,
206                                                    char*));
207 extern char             *attrs_to_string        P((CSA_attribute *, int));
208 extern char             *create_rfc_message     P((char *, char *, char**, int));
209 extern char             *parse_appt_to_string   P((CSA_session_handle, CSA_entry_handle, Props*, int));
210 extern char             *periodstr_from_period  P((CSA_sint32, int));
211 extern char             *privacy_str            P((int));
212 extern char             *privacy_str_old        P((int));
213 extern char             *repeat_str             P((nl_catd, Repeat_menu_op));
214 extern char             *repeat_scope_str       P((nl_catd, Repeat_scope_menu_op));
215 extern char             *privacy_str_411        P((int));
216 extern char             *separator_str          P((SeparatorType));
217 extern void             str_to_period           P((char*, CSA_sint32*, int*));
218 extern int              timescopestring_to_tick P((char*));
219 extern char             *time_scope_str         P((Time_scope_menu_op));
220 extern char             *time_scope_str_i18n    P((nl_catd, Time_scope_menu_op));
221 extern boolean_t        valid_time              P((Props*, char*));
222 extern Validate_op      validate_appt           P((nl_catd, Dtcm_appointment*, 
223                                                    char*, char*, char*, int, 
224                                                    char*, char*, char*,
225                                                    boolean_t(*)(void*), void*,
226                                                    int));
227 extern Validate_op      validate_dssw           P((Dtcm_appointment*, char*,
228                                                    char*, char*, int, char*,
229                                                    boolean_t(*)(void*), void*));
230 extern Validate_op      validate_rfp            P((nl_catd, Dtcm_appointment*, 
231                                                    char*, char*, int));
232 extern Validate_op      validate_reminders      P((Dtcm_appointment*));
233
234 #endif