read some more battery data using new bme.c file but not stable, crashes after 23...
[monky] / src / text_object.h
1 /* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
2  *
3  * Conky, a system monitor, based on torsmo
4  *
5  * Any original torsmo code is licensed under the BSD license
6  *
7  * All code written since the fork of torsmo is licensed under the GPL
8  *
9  * Please see COPYING for details
10  *
11  * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
12  * Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al.
13  *      (see AUTHORS)
14  * All rights reserved.
15  *
16  * This program is free software: you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation, either version 3 of the License, or
19  * (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24  * GNU General Public License for more details.
25  * You should have received a copy of the GNU General Public License
26  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
27  *
28  */
29 #ifndef _TEXT_OBJECT_H
30 #define _TEXT_OBJECT_H
31
32 #include "config.h"             /* for the defines */
33 #include "specials.h"           /* enum special_types */
34
35 enum text_object_type {
36         OBJ_read_tcp,
37         OBJ_addr,
38 #if defined(__linux__)
39         OBJ_addrs,
40 #endif /* __linux__ */
41 #ifndef __OpenBSD__
42         OBJ_acpiacadapter,
43         OBJ_acpifan,
44         OBJ_acpitemp,
45         OBJ_battery,
46         OBJ_battery_time,
47         OBJ_battery_temp,
48         OBJ_battery_volts,
49         OBJ_battery_percent,
50         OBJ_battery_bar,
51         OBJ_battery_short,
52         OBJ_battery_rate,
53         OBJ_cell_radio_dbm,
54         OBJ_cell_radio_percent,
55 #endif /* !__OpenBSD__ */
56         OBJ_buffers,
57         OBJ_cached,
58         OBJ_color,
59         OBJ_color0,
60         OBJ_color1,
61         OBJ_color2,
62         OBJ_color3,
63         OBJ_color4,
64         OBJ_color5,
65         OBJ_color6,
66         OBJ_color7,
67         OBJ_color8,
68         OBJ_color9,
69         OBJ_conky_version,
70         OBJ_conky_build_date,
71         OBJ_conky_build_arch,
72         OBJ_font,
73         OBJ_cpu,
74         OBJ_cpubar,
75         OBJ_cpugauge,
76 #ifdef X11
77         OBJ_cpugraph,
78         OBJ_loadgraph,
79 #endif /* X11 */
80         OBJ_diskio,
81         OBJ_diskio_read,
82         OBJ_diskio_write,
83 #ifdef X11
84         OBJ_diskiograph,
85         OBJ_diskiograph_read,
86         OBJ_diskiograph_write,
87 #endif /* X11 */
88         OBJ_downspeed,
89         OBJ_downspeedf,
90 #ifdef X11
91         OBJ_downspeedgraph,
92 #endif /* X11 */
93         OBJ_else,
94         OBJ_endif,
95         OBJ_eval,
96         OBJ_image,
97         OBJ_exec,
98         OBJ_execi,
99         OBJ_texeci,
100         OBJ_execbar,
101         OBJ_execibar,
102         OBJ_execgauge,
103         OBJ_execigauge,
104 #ifdef X11
105         OBJ_execgraph,
106         OBJ_execigraph,
107 #endif /* X11 */
108         OBJ_execp,
109         OBJ_execpi,
110         OBJ_freq,
111         OBJ_freq_g,
112         OBJ_fs_bar,
113         OBJ_fs_bar_free,
114         OBJ_fs_free,
115         OBJ_fs_free_perc,
116         OBJ_fs_size,
117         OBJ_fs_type,
118         OBJ_fs_used,
119         OBJ_fs_used_perc,
120         OBJ_goto,
121         OBJ_tab,
122         OBJ_hr,
123         OBJ_offset,
124         OBJ_voffset,
125         OBJ_alignr,
126         OBJ_alignc,
127         OBJ_i2c,
128         OBJ_platform,
129         OBJ_hwmon,
130 #if defined(__linux__)
131         OBJ_disk_protect,
132         OBJ_i8k_version,
133         OBJ_i8k_bios,
134         OBJ_i8k_serial,
135         OBJ_i8k_cpu_temp,
136         OBJ_i8k_left_fan_status,
137         OBJ_i8k_right_fan_status,
138         OBJ_i8k_left_fan_rpm,
139         OBJ_i8k_right_fan_rpm,
140         OBJ_i8k_ac_status,
141         OBJ_i8k_buttons_status,
142 #if defined(IBM)
143         OBJ_ibm_fan,
144         OBJ_ibm_temps,
145         OBJ_ibm_volume,
146         OBJ_ibm_brightness,
147         OBJ_smapi,
148         OBJ_smapi_bat_bar,
149         OBJ_smapi_bat_perc,
150         OBJ_smapi_bat_temp,
151         OBJ_smapi_bat_power,
152         OBJ_if_smapi_bat_installed,
153 #endif /* IBM */
154         /* information from sony_laptop kernel module
155          * /sys/devices/platform/sony-laptop */
156         OBJ_sony_fanspeed,
157         OBJ_if_gw,
158         OBJ_ioscheduler,
159         OBJ_gw_iface,
160         OBJ_gw_ip,
161         OBJ_laptop_mode,
162         OBJ_pb_battery,
163         OBJ_voltage_mv,
164         OBJ_voltage_v,
165         OBJ_wireless_essid,
166         OBJ_wireless_mode,
167         OBJ_wireless_bitrate,
168         OBJ_wireless_ap,
169         OBJ_wireless_link_qual,
170         OBJ_wireless_link_qual_max,
171         OBJ_wireless_link_qual_perc,
172         OBJ_wireless_link_bar,
173 #endif /* __linux__ */
174 #if defined(__FreeBSD__) || defined(__linux__)
175         OBJ_if_up,
176 #endif
177         OBJ_if_empty,
178         OBJ_if_match,
179         OBJ_if_existing,
180         OBJ_if_mounted,
181         OBJ_if_running,
182         OBJ_if_updatenr,
183         OBJ_top,
184         OBJ_top_mem,
185         OBJ_top_time,
186 #ifdef IOSTATS
187         OBJ_top_io,
188 #endif
189         OBJ_tail,
190         OBJ_head,
191         OBJ_lines,
192         OBJ_words,
193         OBJ_kernel,
194         OBJ_loadavg,
195         OBJ_machine,
196         OBJ_mails,
197         OBJ_new_mails,
198         OBJ_seen_mails,
199         OBJ_unseen_mails,
200         OBJ_flagged_mails,
201         OBJ_unflagged_mails,
202         OBJ_format_time,
203         OBJ_forwarded_mails,
204         OBJ_unforwarded_mails,
205         OBJ_replied_mails,
206         OBJ_unreplied_mails,
207         OBJ_draft_mails,
208         OBJ_trashed_mails,
209         OBJ_mboxscan,
210         OBJ_mem,
211         OBJ_memeasyfree,
212         OBJ_memfree,
213         OBJ_memgauge,
214 #ifdef X11
215         OBJ_memgraph,
216 #endif /* X11 */
217         OBJ_membar,
218         OBJ_memmax,
219         OBJ_memperc,
220         OBJ_mixer,
221         OBJ_mixerl,
222         OBJ_mixerr,
223         OBJ_mixerbar,
224         OBJ_mixerlbar,
225         OBJ_mixerrbar,
226         OBJ_if_mixer_mute,
227 #ifdef X11
228         OBJ_monitor,
229         OBJ_monitor_number,
230         OBJ_desktop,
231         OBJ_desktop_number,
232         OBJ_desktop_name,
233 #endif /* X11 */
234         OBJ_nameserver,
235         OBJ_nodename,
236         OBJ_nodename_short,
237         OBJ_nvidia,
238         OBJ_pre_exec,
239         OBJ_cmdline_to_pid,
240         OBJ_pid_chroot,
241         OBJ_pid_cmdline,
242         OBJ_pid_cwd,
243         OBJ_pid_environ,
244         OBJ_pid_environ_list,
245         OBJ_pid_exe,
246         OBJ_pid_nice,
247         OBJ_pid_openfiles,
248         OBJ_pid_parent,
249         OBJ_pid_priority,
250         OBJ_pid_state,
251         OBJ_pid_state_short,
252         OBJ_pid_stderr,
253         OBJ_pid_stdin,
254         OBJ_pid_stdout,
255         OBJ_pid_threads,
256         OBJ_pid_thread_list,
257         OBJ_pid_time_kernelmode,
258         OBJ_pid_time_usermode,
259         OBJ_pid_time,
260         OBJ_pid_uid,
261         OBJ_pid_euid,
262         OBJ_pid_suid,
263         OBJ_pid_fsuid,
264         OBJ_pid_gid,
265         OBJ_pid_egid,
266         OBJ_pid_sgid,
267         OBJ_pid_fsgid,
268         OBJ_pid_read,
269         OBJ_pid_vmpeak,
270         OBJ_pid_vmsize,
271         OBJ_pid_vmlck,
272         OBJ_pid_vmhwm,
273         OBJ_pid_vmrss,
274         OBJ_pid_vmdata,
275         OBJ_pid_vmstk,
276         OBJ_pid_vmexe,
277         OBJ_pid_vmlib,
278         OBJ_pid_vmpte,
279         OBJ_pid_write,
280         OBJ_gid_name,
281         OBJ_uid_name,
282         OBJ_processes,
283         OBJ_running_processes,
284         OBJ_shadecolor,
285         OBJ_outlinecolor,
286         OBJ_stippled_hr,
287         OBJ_swap,
288         OBJ_swapfree,
289         OBJ_swapbar,
290         OBJ_swapmax,
291         OBJ_swapperc,
292         OBJ_sysname,
293         OBJ_text,
294         OBJ_threads,
295         OBJ_running_threads,
296         OBJ_time,
297         OBJ_utime,
298         OBJ_tztime,
299         OBJ_totaldown,
300         OBJ_totalup,
301         OBJ_updates,
302         OBJ_upspeed,
303         OBJ_upspeedf,
304 #ifdef X11
305         OBJ_upspeedgraph,
306 #endif /* X11 */
307         OBJ_uptime,
308         OBJ_uptime_short,
309         OBJ_user_names,
310         OBJ_user_terms,
311         OBJ_user_times,
312         OBJ_user_time,
313         OBJ_user_number,
314         OBJ_imap_messages,
315         OBJ_imap_unseen,
316         OBJ_pop3_unseen,
317         OBJ_pop3_used,
318 #if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \
319                 || defined(__OpenBSD__)) && (defined(i386) || defined(__i386__))
320         OBJ_apm_adapter,
321         OBJ_apm_battery_time,
322         OBJ_apm_battery_life,
323 #endif /* __FreeBSD__ __OpenBSD__ */
324 #ifdef __OpenBSD__
325         OBJ_obsd_sensors_temp,
326         OBJ_obsd_sensors_fan,
327         OBJ_obsd_sensors_volt,
328         OBJ_obsd_vendor,
329         OBJ_obsd_product,
330 #endif /* __OpenBSD__ */
331 #ifdef MPD
332         OBJ_mpd_title,
333         OBJ_mpd_artist,
334         OBJ_mpd_album,
335         OBJ_mpd_random,
336         OBJ_mpd_repeat,
337         OBJ_mpd_vol,
338         OBJ_mpd_bitrate,
339         OBJ_mpd_status,
340         OBJ_mpd_bar,
341         OBJ_mpd_elapsed,
342         OBJ_mpd_length,
343         OBJ_mpd_track,
344         OBJ_mpd_name,
345         OBJ_mpd_file,
346         OBJ_mpd_percent,
347         OBJ_mpd_smart,
348         OBJ_if_mpd_playing,
349 #endif /* MPD */
350 #ifdef MOC
351         OBJ_moc_state,
352         OBJ_moc_file,
353         OBJ_moc_title,
354         OBJ_moc_artist,
355         OBJ_moc_song,
356         OBJ_moc_album,
357         OBJ_moc_totaltime,
358         OBJ_moc_timeleft,
359         OBJ_moc_curtime,
360         OBJ_moc_bitrate,
361         OBJ_moc_rate,
362 #endif /* MOC */
363 #ifdef XMMS2
364         OBJ_xmms2_artist,
365         OBJ_xmms2_album,
366         OBJ_xmms2_title,
367         OBJ_xmms2_genre,
368         OBJ_xmms2_comment,
369         OBJ_xmms2_url,
370         OBJ_xmms2_date,
371         OBJ_xmms2_tracknr,
372         OBJ_xmms2_bitrate,
373         OBJ_xmms2_id,
374         OBJ_xmms2_duration,
375         OBJ_xmms2_elapsed,
376         OBJ_xmms2_size,
377         OBJ_xmms2_percent,
378         OBJ_xmms2_status,
379 #ifdef X11
380         OBJ_xmms2_bar,
381 #endif /* X11 */
382         OBJ_xmms2_smart,
383         OBJ_xmms2_playlist,
384         OBJ_xmms2_timesplayed,
385         OBJ_if_xmms2_connected,
386 #endif /* XMMS2 */
387 #ifdef AUDACIOUS
388         OBJ_audacious_status,
389         OBJ_audacious_title,
390         OBJ_audacious_length,
391         OBJ_audacious_length_seconds,
392         OBJ_audacious_position,
393         OBJ_audacious_position_seconds,
394         OBJ_audacious_bitrate,
395         OBJ_audacious_frequency,
396         OBJ_audacious_channels,
397         OBJ_audacious_filename,
398         OBJ_audacious_playlist_length,
399         OBJ_audacious_playlist_position,
400         OBJ_audacious_main_volume,
401 #ifdef X11
402         OBJ_audacious_bar,
403 #endif /* X11 */
404 #endif /* AUDACIOUS */
405 #ifdef BMPX
406         OBJ_bmpx_title,
407         OBJ_bmpx_artist,
408         OBJ_bmpx_album,
409         OBJ_bmpx_track,
410         OBJ_bmpx_uri,
411         OBJ_bmpx_bitrate,
412 #endif /* BMPX */
413 #ifdef EVE
414         OBJ_eve,
415 #endif /* EVE */
416 #ifdef HAVE_CURL
417         OBJ_curl,
418 #endif /* HAVE_CURL */
419 #ifdef RSS
420         OBJ_rss,
421 #endif /* RSS */
422 #ifdef WEATHER
423         OBJ_weather,
424 #endif /* WEATHER */
425 #ifdef XOAP
426         OBJ_weather_forecast,
427 #endif /* XOAP */
428 #ifdef HAVE_LUA
429         OBJ_lua,
430         OBJ_lua_parse,
431         OBJ_lua_bar,
432         OBJ_lua_gauge,
433 #ifdef X11
434         OBJ_lua_graph,
435 #endif /* X11 */
436 #endif /* HAVE_LUA */
437 #ifdef TCP_PORT_MONITOR
438         OBJ_tcp_portmon,
439 #endif /* TCP_PORT_MONITOR */
440 #ifdef HAVE_ICONV
441         OBJ_iconv_start,
442         OBJ_iconv_stop,
443 #endif /* HAVE_ICONV */
444 #ifdef HDDTEMP
445         OBJ_hddtemp,
446 #endif /* HDDTEMP */
447         OBJ_include,
448         OBJ_blink,
449         OBJ_to_bytes,
450         OBJ_scroll,
451         OBJ_combine,
452         OBJ_entropy_avail,
453         OBJ_entropy_perc,
454         OBJ_entropy_poolsize,
455         OBJ_entropy_bar,
456 #ifdef APCUPSD
457         OBJ_apcupsd,
458         OBJ_apcupsd_name,
459         OBJ_apcupsd_model,
460         OBJ_apcupsd_upsmode,
461         OBJ_apcupsd_cable,
462         OBJ_apcupsd_status,
463         OBJ_apcupsd_linev,
464         OBJ_apcupsd_load,
465         OBJ_apcupsd_loadbar,
466         OBJ_apcupsd_loadgauge,
467 #ifdef X11
468         OBJ_apcupsd_loadgraph,
469 #endif /* X11 */
470         OBJ_apcupsd_charge,
471         OBJ_apcupsd_timeleft,
472         OBJ_apcupsd_temp,
473         OBJ_apcupsd_lastxfer,
474 #endif /* APCUPSD */
475 };
476
477 struct text_object {
478         struct text_object *next, *prev;        /* doubly linked list of text objects */
479         struct text_object *sub;                /* for objects parsing text into objects */
480         struct text_object *ifblock_next;       /* jump target for ifblock objects */
481         union {
482                 void *opaque;           /* new style generic per object data */
483                 char *s;                /* some string */
484                 int i;                  /* some integer */
485                 long l;                 /* some long integer */
486         } data;
487
488         void *special_data;
489         int type;
490         long line;
491 };
492
493 /* text object list helpers */
494 int append_object(struct text_object *root, struct text_object *obj);
495
496 /* ifblock helpers
497  *
498  * Opaque is a pointer to the address of the ifblock stack's top object.
499  * Calling clients should pass the address of a defined void pointer which
500  * was initialised to NULL (empty stack).
501  * */
502 int obj_be_ifblock_if(void **opaque, struct text_object *);
503 int obj_be_ifblock_else(void **opaque, struct text_object *);
504 int obj_be_ifblock_endif(void **opaque, struct text_object *);
505 int ifblock_stack_empty(void **opaque);
506
507 #endif /* _TEXT_OBJECT_H */