Module func.pkg
1// FUNC.PKG
2// New global DataFlex functions
3// Doug Goldner 2/25/91
4
5//
6// OBSOLETE - This package is included for backwards compatibility .
7// Do not use these for new programs and attempt to replace these
8// with your own package as soon as possible.
9//
10Use LanguageText.pkg
11#CHKSUB 1 1 // Verify the UI subsystem.
12
13use VDFBase.pkg
14
15{ Visibility=Private Obsolete=True }
16function get_month global string our_date$ returns integer
17 function_return (left(our_date$,2))
18end_function
19
20{ Visibility=Private Obsolete=True }
21function get_day global string our_date$ returns integer
22 function_return (mid(our_date$,2,4))
23end_function
24
25{ Visibility=Private Obsolete=True }
26function get_year global string our_date$ returns integer
27 function_return (mid(our_date$,4,7))
28end_function
29
30{ Visibility=Private Obsolete=True }
31function get_current_hour global returns string
32 date tdate$
33 string our_hour$
34
35 sysdate tdate$ our_hour$
36 if our_hour$ lt 10 insert "0" in our_hour$ at 0
37 function_return our_hour$
38end_function
39
40{ Visibility=Private Obsolete=True }
41function get_current_minute global returns string
42 date tdate$
43 string our_hour$ our_minute$
44
45 sysdate tdate$ our_hour$ our_minute$
46 if our_minute$ lt 10 insert "0" in our_minute$ at 0
47 function_return our_minute$
48end_function
49
50{ Visibility=Private Obsolete=True }
51function get_current_second global returns string
52 date tdate$
53 String our_hour$ our_minute$ our_second$
54
55 sysdate tdate$ our_hour$ our_minute$ our_second$
56 if our_second$ lt 10 insert "0" in our_second$ at 0
57 function_return our_second$
58end_function
59
60{ Visibility=Private Obsolete=True }
61function get_hour global string our_time$ returns string
62 function_return (left(our_time$,2))
63end_function
64
65{ Visibility=Private Obsolete=True }
66function get_minute global string our_time$ returns string
67 function_return (mid(our_time$,2,4))
68end_function
69
70{ Visibility=Private Obsolete=True }
71function get_second global string our_time$ returns string
72 function_return (mid(our_time$,2,7))
73end_function
74
75{ Visibility=Private Obsolete=True }
76function get_time global string hr$ string min$ string sec$ integer am_pm_wanted$ returns string
77 String am_pm$ time_string$
78
79 move C_$AM to am_pm$
80
81 if hr$ gt 11 move C_$PM to am_pm$
82 if hr$ lt 1 begin
83 move 12 to hr$
84 move C_$AM to am_pm$
85 end
86 if am_pm_wanted$ eq 1 if hr$ gt 12 move (hr$ - 12) to hr$
87 if hr$ lt 10 insert "0" in hr$ at 0
88 if min$ lt 10 insert "0" in min$ at 0
89 if sec$ lt 10 insert "0" in sec$ at 0
90 move hr$ to time_string$
91 append time_string$ ":" min$ ":" sec$
92 if am_pm_wanted$ eq 1 append time_string$ " " am_pm$
93 function_return time_string$
94end_function
95
96{ Visibility=Private Obsolete=True }
97function get_time_no_sec global string hr$ string min$ integer am_pm_wanted$ returns string
98 String am_pm$ time_string$
99
100 move C_$AM to am_pm$
101
102 if hr$ gt 11 move C_$PM to am_pm$
103 if hr$ lt 1 begin
104 move 12 to hr$
105 move C_$AM to am_pm$
106 end
107 if am_pm_wanted$ eq 1 if hr$ gt 12 move (hr$ - 12) to hr$
108 if hr$ lt 10 insert "0" in hr$ at 0
109 if min$ lt 10 insert "0" in min$ at 0
110 move hr$ to time_string$
111 append time_string$ ":" min$
112 if am_pm_wanted$ eq 1 append time_string$ " " am_pm$
113 function_return time_string$
114end_function
115
116{ Visibility=Private Obsolete=True }
117function get_current_time global integer am_pm_wanted$ returns string
118 date tdate$
119 string hr$ min$ sec$
120
121 sysdate tdate$ hr$ min$ sec$
122 function_return (get_time(hr$,min$,sec$,am_pm_wanted$))
123end_function
124
125
126
127{ Visibility=Private Obsolete=True }
128function get_current_time_no_sec global integer am_pm_wanted$ returns string
129 date tdate$
130 String hr$ min$
131
132 sysdate tdate$ hr$ min$
133 function_return (get_time_no_sec(hr$,min$,am_pm_wanted$))
134end_function
135
136{ Visibility=Private Obsolete=True }
137function get_word_date global string our_date$ returns string
138 integer month$
139 string month_name$
140 string total_date$
141 String our_year$
142 move (get_month(our_date$)) to month$
143 if month$ eq 1 move C_$January to month_name$
144 if month$ eq 2 move C_$February to month_name$
145 if month$ eq 3 move C_$March to month_name$
146 if month$ eq 4 move C_$April to month_name$
147 if month$ eq 5 move C_$May to month_name$
148 if month$ eq 6 move C_$June to month_name$
149 if month$ eq 7 move C_$July to month_name$
150 if month$ eq 8 move C_$August to month_name$
151 if month$ eq 9 move C_$September to month_name$
152 if month$ eq 10 move C_$October to month_name$
153 if month$ eq 11 move C_$November to month_name$
154 if month$ eq 12 move C_$December to month_name$
155 move month_name$ to total_date$
156 append total_date$ " " (get_day(our_date$)) ", "
157 move (get_year(our_date$)) to our_year$
158 if (length(our_year$)) lt 2 insert "0" in our_year$ at 0
159 if (length(our_year$)) lt 4 insert "19" in our_year$ at 0
160 append total_date$ our_year$
161 function_return total_date$
162
163end_function
164
165{ Visibility=Private Obsolete=True }
166function get_title global string our_word$ returns string
167 integer lvar$
168 string title_word$
169 integer upper_next$
170 String our_letter$
171
172 move 1 to upper_next$
173 move "" to title_word$
174
175 for lvar$ from 1 to (length(our_word$))
176 mid our_word$ to our_letter$ 1 lvar$
177 if our_letter$ eq " " begin
178 append title_word$ " "
179 move 1 to upper_next$
180 end
181 else begin
182 if upper_next$ eq 1 append title_word$ (uppercase(our_letter$))
183 else append title_word$ our_letter$
184 move 0 to upper_next$
185 end
186 loop
187 function_return title_word$
188end_function
189
190{ Visibility=Private Obsolete=True }
191function get_file_exists global string filename$ returns integer
192 Integer exists$
193 direct_input channel 9 filename$
194 [seqeof] move 0 to exists$
195 [not seqeof] move 1 to exists$
196 close_input channel 9
197 function_return exists$
198end_function
199
200{ Visibility=Private Obsolete=True }
201function get_time_difference_no_sec global integer hr1$ integer min1$ integer hr2$ integer min2$ ;
202 returns string
203
204 function_return (get_time_no_sec(abs(hr1$ - hr2$),abs(min1$ - min2$),0))
205end_function
206
207{ Visibility=Private Obsolete=True }
208function get_time_difference global integer hr1$ integer min1$ integer sec1$ integer hr2$ integer min2$ integer sec2$ returns string
209
210 function_return (get_time(abs(hr1$ - hr2$),abs(min1$ - min2$),abs(sec1$ - sec2$),0))
211end_function
212
213// Set date to current window if the window is blank
214// this is very, very obsolete. Avoid!
215{ Visibility=Private Obsolete=True }
216procedure default_date for cUIObject integer item#
217 String dte
218 if ( (not(item_changed_state(self,item#)) and ;
219 value(self,item#)=0)) begin
220 sysdate dte
221 set value item item# to dte
222 set item_changed_state item item# to true
223 end
224end_procedure
225
226
227
228
229