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