1 | // This file is part of SmallBASIC |
2 | // |
3 | // SmallBASIC RTL - STANDARD COMMANDS |
4 | // |
5 | // This program is distributed under the terms of the GPL v2.0 or later |
6 | // Download the GNU Public License (GPL) from www.gnu.org |
7 | // |
8 | // Copyright(C) 2000 Nicholas Christopoulos |
9 | |
10 | /** |
11 | * @defgroup date Date and Time |
12 | */ |
13 | |
14 | #if !defined(_blib_h) |
15 | #define _blib_h |
16 | |
17 | #include "common/sys.h" |
18 | #include "common/var.h" |
19 | |
20 | #if defined(__cplusplus) |
21 | extern "C" { |
22 | #endif |
23 | |
24 | void dump_stack(void); |
25 | |
26 | // first class |
27 | void cmd_udp(int); |
28 | bcip_t cmd_push_args(int cmd, bcip_t goto_addr, bcip_t rvid); |
29 | void cmd_call_unit_udp(int cmd, int udp_tid, bcip_t goto_addr, bcip_t rvid); |
30 | void cmd_udpret(void); |
31 | void cmd_crvar(void); |
32 | void cmd_param(void); |
33 | int cmd_exit(void); |
34 | void cmd_let(int); |
35 | void cmd_let_opt(); |
36 | void cmd_packed_let(); |
37 | void cmd_dim(int); |
38 | void cmd_redim(void); |
39 | void cmd_append(void); |
40 | void cmd_lins(void); |
41 | void cmd_ldel(void); |
42 | void cmd_erase(void); |
43 | void cmd_print(int output); |
44 | void logprint_var(var_t *var); |
45 | void cmd_input(int input); |
46 | void cmd_if(void); |
47 | void cmd_else(void); |
48 | void cmd_elif(void); |
49 | void cmd_endif(void); |
50 | void cmd_for(void); |
51 | void cmd_next(void); |
52 | void cmd_while(void); |
53 | void cmd_wend(void); |
54 | void cmd_until(void); |
55 | void cmd_repeat(void); |
56 | void cmd_select(void); |
57 | void cmd_case(void); |
58 | void cmd_case_else(void); |
59 | void cmd_end_select(void); |
60 | void cmd_gosub(void); |
61 | void cmd_return(void); |
62 | void cmd_on_go(void); |
63 | void cmd_read(void); |
64 | void cmd_data(void); |
65 | void cmd_restore(void); |
66 | void cmd_sort(void); |
67 | void cmd_search(void); |
68 | void cmd_swap(void); |
69 | void cmd_chain(void); |
70 | void cmd_run(int); |
71 | void cmd_try(); |
72 | void cmd_catch(); |
73 | void cmd_end_try(); |
74 | void cmd_call_vfunc(); |
75 | void cmd_timer(); |
76 | |
77 | var_num_t cmd_math0(long funcCode); |
78 | var_num_t cmd_math1(long funcCode, var_t *arg); |
79 | var_int_t cmd_imath0(long funcCode); |
80 | var_int_t cmd_imath1(long funcCode, var_t *arg); |
81 | void cmd_str1(long funcCode, var_t *arg, var_t *r); |
82 | void cmd_ns1(long funcCode, var_t *arg, var_t *r); |
83 | void cmd_str0(long funcCode, var_t *r); |
84 | void cmd_split(void); |
85 | void cmd_wsplit(void); |
86 | void cmd_wjoin(void); |
87 | void cmd_environ(void); |
88 | void cmd_datedmy(void); |
89 | void cmd_timehms(void); |
90 | void cmd_deriv(void); |
91 | void cmd_diffeq(void); |
92 | |
93 | // not basic, but speed is needed |
94 | void graph_reset(void); |
95 | void cmd_pset(void); |
96 | void cmd_line(void); |
97 | void cmd_rect(void); |
98 | void cmd_circle(void); |
99 | void cmd_arc(void); |
100 | char *draw_getval(const char *src, int *c); |
101 | void cmd_draw(void); |
102 | void cmd_paint(void); |
103 | void cmd_pen(void); |
104 | void cmd_view(void); |
105 | void cmd_window(void); |
106 | void chart_draw(int x1, int y1, int x2, int y2, |
107 | var_num_t *vals, |
108 | int count, var_num_t *xvals, int xcount, |
109 | int chart, int marks); |
110 | void cmd_chart_fstr(var_num_t v, char *buf); |
111 | void cmd_chart(void); |
112 | void cmd_drawpoly(void); |
113 | var_t *par_getm3(void); |
114 | void m3ident(var_num_t[3][3]); |
115 | void m3combine(var_t *, var_num_t[3][3]); |
116 | void cmd_m3ident(void); |
117 | void cmd_m3rotate(void); |
118 | void cmd_m3scale(void); |
119 | void cmd_m3translate(void); |
120 | void cmd_m3apply(void); |
121 | void cmd_intersect(void); |
122 | void cmd_polyext(void); |
123 | void cmd_exprseq(void); |
124 | void cmd_plot(void); |
125 | |
126 | // third class |
127 | void cmd_strN(long, var_t*); // its ok, i want all functions |
128 | // to BMATH |
129 | void cmd_intN(long, var_t*); |
130 | void cmd_numN(long, var_t*); |
131 | void cmd_genfunc(long, var_t*); |
132 | var_num_t line_length(var_num_t Ax, var_num_t Ay, var_num_t Bx, var_num_t By); |
133 | void cmd_integral(void); |
134 | void cmd_root(); |
135 | |
136 | void cmd_randomize(void); |
137 | void cmd_at(void); |
138 | void cmd_locate(void); |
139 | void cmd_color(void); |
140 | |
141 | void cmd_beep(void); |
142 | void cmd_sound(void); |
143 | void cmd_nosound(void); |
144 | void cmd_play_reset(void); |
145 | void cmd_play(void); |
146 | void cmd_pause(void); |
147 | void cmd_delay(void); |
148 | |
149 | // FILE I/O |
150 | void cmd_fopen(void); |
151 | void cmd_fclose(void); |
152 | void cmd_fwrite(void); |
153 | void cmd_fread(void); |
154 | void cmd_flineinput(void); |
155 | void cmd_fkill(void); |
156 | void cmd_fseek(void); |
157 | void cmd_filecp(int mv); |
158 | void cmd_chdir(void); |
159 | void cmd_mkdir(void); |
160 | void cmd_rmdir(void); |
161 | void cmd_floadln(void); |
162 | void cmd_fsaveln(void); |
163 | void cmd_flock(void); |
164 | void cmd_chmod(void); |
165 | void cmd_dirwalk(void); |
166 | void cmd_bputc(void); |
167 | void cmd_bload(void); |
168 | void cmd_bsave(void); |
169 | void cmd_definekey(void); |
170 | |
171 | /** |
172 | * @ingroup date |
173 | * |
174 | * returns the julian-date |
175 | * |
176 | * @param d is the day |
177 | * @param m is the month |
178 | * @param y is the year |
179 | * @return the julian-date |
180 | */ |
181 | long date_julian(long d, long m, long y); |
182 | |
183 | /** |
184 | * @ingroup date |
185 | * |
186 | * formats a date string |
187 | * |
188 | * format |
189 | @code |
190 | d = day |
191 | dd = day, zero-leaded if < 10 |
192 | ddd = the weekday with 3 chars |
193 | dddd = the weekday |
194 | |
195 | m = month |
196 | mm = month, zero-leaded if < 10 |
197 | mmm = the month-name with 3 chars |
198 | mmmm = the month-name |
199 | |
200 | yy = year in 2-digits |
201 | yyyy = year in 4-digits |
202 | @endcode |
203 | * |
204 | * @param fmt the format |
205 | * @param buf the destination buffer |
206 | * @param d is the day |
207 | * @param m is the month |
208 | * @param y is the year |
209 | * @return the julian-date |
210 | */ |
211 | char *date_fmt(char *fmt, long d, long m, long y); |
212 | |
213 | /** |
214 | * @ingroup date |
215 | * |
216 | * returns the day,month,year from a string-date |
217 | * |
218 | * @param str is the string that contains the date |
219 | * @param d is the day |
220 | * @param m is the month |
221 | * @param y is the year |
222 | */ |
223 | void date_str2dmy(char *str, long *d, long *m, long *y); |
224 | |
225 | /** |
226 | * @ingroup date |
227 | * |
228 | * returns the hour,minutes,seconds from a string-time |
229 | * |
230 | * @param str is the string that contains the date |
231 | * @param h is the hours |
232 | * @param m is the minutes |
233 | * @param s is the seconds |
234 | */ |
235 | void date_str2hms(char *str, long *h, long *m, long *s); |
236 | |
237 | /** |
238 | * @ingroup date |
239 | * |
240 | * returns the day,month,year from a julian date |
241 | * |
242 | * @param j is the julian-date |
243 | * @param d is the day |
244 | * @param m is the month |
245 | * @param y is the year |
246 | */ |
247 | void date_jul2dmy(long j, long *d, long *m, long *y); |
248 | |
249 | /** |
250 | * @ingroup date |
251 | * |
252 | * returns the hour,minutes,seconds from a timer (TIMER or time_t) |
253 | * |
254 | * @param t is the seconds from midnight |
255 | * @param h is the hours |
256 | * @param m is the minutes |
257 | * @param s is the seconds |
258 | */ |
259 | void date_tim2hms(long t, long *h, long *m, long *s); |
260 | |
261 | #if defined(__cplusplus) |
262 | } |
263 | #endif |
264 | #endif |
265 | |