Added support for $pid_openfiles
[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-2009 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_adt746xcpu,
44         OBJ_adt746xfan,
45         OBJ_acpifan,
46         OBJ_acpitemp,
47         OBJ_battery,
48         OBJ_battery_time,
49         OBJ_battery_percent,
50         OBJ_battery_bar,
51         OBJ_battery_short,
52 #endif /* !__OpenBSD__ */
53         OBJ_buffers,
54         OBJ_cached,
55         OBJ_color,
56         OBJ_color0,
57         OBJ_color1,
58         OBJ_color2,
59         OBJ_color3,
60         OBJ_color4,
61         OBJ_color5,
62         OBJ_color6,
63         OBJ_color7,
64         OBJ_color8,
65         OBJ_color9,
66         OBJ_conky_version,
67         OBJ_conky_build_date,
68         OBJ_conky_build_arch,
69         OBJ_font,
70         OBJ_cpu,
71         OBJ_cpubar,
72 #ifdef X11
73         OBJ_cpugauge,
74         OBJ_cpugraph,
75         OBJ_loadgraph,
76 #endif /* X11 */
77         OBJ_diskio,
78         OBJ_diskio_read,
79         OBJ_diskio_write,
80 #ifdef X11
81         OBJ_diskiograph,
82         OBJ_diskiograph_read,
83         OBJ_diskiograph_write,
84 #endif /* X11 */
85         OBJ_downspeed,
86         OBJ_downspeedf,
87 #ifdef X11
88         OBJ_downspeedgraph,
89 #endif /* X11 */
90         OBJ_else,
91         OBJ_endif,
92         OBJ_eval,
93         OBJ_image,
94         OBJ_exec,
95         OBJ_execi,
96         OBJ_texeci,
97         OBJ_execbar,
98         OBJ_execibar,
99 #ifdef X11
100         OBJ_execgauge,
101         OBJ_execgraph,
102         OBJ_execigraph,
103         OBJ_execigauge,
104 #endif /* X11 */
105         OBJ_execp,
106         OBJ_execpi,
107         OBJ_freq,
108         OBJ_freq_g,
109         OBJ_fs_bar,
110         OBJ_fs_bar_free,
111         OBJ_fs_free,
112         OBJ_fs_free_perc,
113         OBJ_fs_size,
114         OBJ_fs_type,
115         OBJ_fs_used,
116         OBJ_fs_used_perc,
117         OBJ_goto,
118         OBJ_tab,
119         OBJ_hr,
120         OBJ_offset,
121         OBJ_voffset,
122         OBJ_alignr,
123         OBJ_alignc,
124         OBJ_i2c,
125         OBJ_platform,
126         OBJ_hwmon,
127 #if defined(__linux__)
128         OBJ_disk_protect,
129         OBJ_i8k_version,
130         OBJ_i8k_bios,
131         OBJ_i8k_serial,
132         OBJ_i8k_cpu_temp,
133         OBJ_i8k_left_fan_status,
134         OBJ_i8k_right_fan_status,
135         OBJ_i8k_left_fan_rpm,
136         OBJ_i8k_right_fan_rpm,
137         OBJ_i8k_ac_status,
138         OBJ_i8k_buttons_status,
139 #if defined(IBM)
140         OBJ_ibm_fan,
141         OBJ_ibm_temps,
142         OBJ_ibm_volume,
143         OBJ_ibm_brightness,
144         OBJ_smapi,
145 #ifdef X11
146         OBJ_smapi_bat_bar,
147 #endif /* X11 */
148         OBJ_smapi_bat_perc,
149         OBJ_smapi_bat_temp,
150         OBJ_smapi_bat_power,
151         OBJ_if_smapi_bat_installed,
152 #endif /* IBM */
153         /* information from sony_laptop kernel module
154          * /sys/devices/platform/sony-laptop */
155         OBJ_sony_fanspeed,
156         OBJ_if_gw,
157         OBJ_ioscheduler,
158         OBJ_gw_iface,
159         OBJ_gw_ip,
160         OBJ_laptop_mode,
161         OBJ_pb_battery,
162         OBJ_voltage_mv,
163         OBJ_voltage_v,
164         OBJ_wireless_essid,
165         OBJ_wireless_mode,
166         OBJ_wireless_bitrate,
167         OBJ_wireless_ap,
168         OBJ_wireless_link_qual,
169         OBJ_wireless_link_qual_max,
170         OBJ_wireless_link_qual_perc,
171         OBJ_wireless_link_bar,
172 #endif /* __linux__ */
173 #if defined(__FreeBSD__) || defined(__linux__)
174         OBJ_if_up,
175 #endif
176         OBJ_if_empty,
177         OBJ_if_match,
178         OBJ_if_existing,
179         OBJ_if_mounted,
180         OBJ_if_running,
181         OBJ_if_updatenr,
182         OBJ_top,
183         OBJ_top_mem,
184         OBJ_top_time,
185 #ifdef IOSTATS
186         OBJ_top_io,
187 #endif
188         OBJ_tail,
189         OBJ_head,
190         OBJ_lines,
191         OBJ_words,
192         OBJ_kernel,
193         OBJ_loadavg,
194         OBJ_machine,
195         OBJ_mails,
196         OBJ_new_mails,
197         OBJ_seen_mails,
198         OBJ_unseen_mails,
199         OBJ_flagged_mails,
200         OBJ_unflagged_mails,
201         OBJ_forwarded_mails,
202         OBJ_unforwarded_mails,
203         OBJ_replied_mails,
204         OBJ_unreplied_mails,
205         OBJ_draft_mails,
206         OBJ_trashed_mails,
207         OBJ_mboxscan,
208         OBJ_mem,
209         OBJ_memeasyfree,
210         OBJ_memfree,
211 #ifdef X11
212         OBJ_memgauge,
213         OBJ_memgraph,
214 #endif /* X11 */
215         OBJ_membar,
216         OBJ_memmax,
217         OBJ_memperc,
218         OBJ_mixer,
219         OBJ_mixerl,
220         OBJ_mixerr,
221 #ifdef X11
222         OBJ_mixerbar,
223         OBJ_mixerlbar,
224         OBJ_mixerrbar,
225 #endif /* X11 */
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_nvidia,
237         OBJ_pre_exec,
238         OBJ_pid_cmdline,
239         OBJ_pid_cwd,
240         OBJ_pid_environ,
241         OBJ_pid_environ_list,
242         OBJ_pid_exe,
243         OBJ_pid_openfiles,
244         OBJ_pid_stderr,
245         OBJ_pid_stdin,
246         OBJ_pid_stdout,
247         OBJ_processes,
248         OBJ_running_processes,
249         OBJ_shadecolor,
250         OBJ_outlinecolor,
251         OBJ_stippled_hr,
252         OBJ_swap,
253         OBJ_swapfree,
254         OBJ_swapbar,
255         OBJ_swapmax,
256         OBJ_swapperc,
257         OBJ_sysname,
258         OBJ_text,
259         OBJ_threads,
260         OBJ_time,
261         OBJ_utime,
262         OBJ_tztime,
263         OBJ_totaldown,
264         OBJ_totalup,
265         OBJ_updates,
266         OBJ_upspeed,
267         OBJ_upspeedf,
268 #ifdef X11
269         OBJ_upspeedgraph,
270 #endif /* X11 */
271         OBJ_uptime,
272         OBJ_uptime_short,
273         OBJ_user_names,
274         OBJ_user_terms,
275         OBJ_user_times,
276         OBJ_user_number,
277         OBJ_imap_messages,
278         OBJ_imap_unseen,
279         OBJ_pop3_unseen,
280         OBJ_pop3_used,
281 #if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \
282                 || defined(__OpenBSD__)) && (defined(i386) || defined(__i386__))
283         OBJ_apm_adapter,
284         OBJ_apm_battery_time,
285         OBJ_apm_battery_life,
286 #endif /* __FreeBSD__ __OpenBSD__ */
287 #ifdef __OpenBSD__
288         OBJ_obsd_sensors_temp,
289         OBJ_obsd_sensors_fan,
290         OBJ_obsd_sensors_volt,
291         OBJ_obsd_vendor,
292         OBJ_obsd_product,
293 #endif /* __OpenBSD__ */
294 #ifdef MPD
295         OBJ_mpd_title,
296         OBJ_mpd_artist,
297         OBJ_mpd_album,
298         OBJ_mpd_random,
299         OBJ_mpd_repeat,
300         OBJ_mpd_vol,
301         OBJ_mpd_bitrate,
302         OBJ_mpd_status,
303         OBJ_mpd_bar,
304         OBJ_mpd_elapsed,
305         OBJ_mpd_length,
306         OBJ_mpd_track,
307         OBJ_mpd_name,
308         OBJ_mpd_file,
309         OBJ_mpd_percent,
310         OBJ_mpd_smart,
311         OBJ_if_mpd_playing,
312 #endif /* MPD */
313 #ifdef MOC
314         OBJ_moc_state,
315         OBJ_moc_file,
316         OBJ_moc_title,
317         OBJ_moc_artist,
318         OBJ_moc_song,
319         OBJ_moc_album,
320         OBJ_moc_totaltime,
321         OBJ_moc_timeleft,
322         OBJ_moc_curtime,
323         OBJ_moc_bitrate,
324         OBJ_moc_rate,
325 #endif /* MOC */
326 #ifdef XMMS2
327         OBJ_xmms2_artist,
328         OBJ_xmms2_album,
329         OBJ_xmms2_title,
330         OBJ_xmms2_genre,
331         OBJ_xmms2_comment,
332         OBJ_xmms2_url,
333         OBJ_xmms2_date,
334         OBJ_xmms2_tracknr,
335         OBJ_xmms2_bitrate,
336         OBJ_xmms2_id,
337         OBJ_xmms2_duration,
338         OBJ_xmms2_elapsed,
339         OBJ_xmms2_size,
340         OBJ_xmms2_percent,
341         OBJ_xmms2_status,
342 #ifdef X11
343         OBJ_xmms2_bar,
344 #endif /* X11 */
345         OBJ_xmms2_smart,
346         OBJ_xmms2_playlist,
347         OBJ_xmms2_timesplayed,
348         OBJ_if_xmms2_connected,
349 #endif /* XMMS2 */
350 #ifdef AUDACIOUS
351         OBJ_audacious_status,
352         OBJ_audacious_title,
353         OBJ_audacious_length,
354         OBJ_audacious_length_seconds,
355         OBJ_audacious_position,
356         OBJ_audacious_position_seconds,
357         OBJ_audacious_bitrate,
358         OBJ_audacious_frequency,
359         OBJ_audacious_channels,
360         OBJ_audacious_filename,
361         OBJ_audacious_playlist_length,
362         OBJ_audacious_playlist_position,
363         OBJ_audacious_main_volume,
364 #ifdef X11
365         OBJ_audacious_bar,
366 #endif /* X11 */
367 #endif /* AUDACIOUS */
368 #ifdef BMPX
369         OBJ_bmpx_title,
370         OBJ_bmpx_artist,
371         OBJ_bmpx_album,
372         OBJ_bmpx_track,
373         OBJ_bmpx_uri,
374         OBJ_bmpx_bitrate,
375 #endif /* BMPX */
376 #ifdef EVE
377         OBJ_eve,
378 #endif /* EVE */
379 #ifdef HAVE_CURL
380         OBJ_curl,
381 #endif /* HAVE_CURL */
382 #ifdef RSS
383         OBJ_rss,
384 #endif /* RSS */
385 #ifdef WEATHER
386         OBJ_weather,
387 #endif /* WEATHER */
388 #ifdef XOAP
389         OBJ_weather_forecast,
390 #endif /* XOAP */
391 #ifdef HAVE_LUA
392         OBJ_lua,
393         OBJ_lua_parse,
394         OBJ_lua_bar,
395 #ifdef X11
396         OBJ_lua_graph,
397         OBJ_lua_gauge,
398 #endif /* X11 */
399 #endif /* HAVE_LUA */
400 #ifdef TCP_PORT_MONITOR
401         OBJ_tcp_portmon,
402 #endif /* TCP_PORT_MONITOR */
403 #ifdef HAVE_ICONV
404         OBJ_iconv_start,
405         OBJ_iconv_stop,
406 #endif /* HAVE_ICONV */
407 #ifdef HDDTEMP
408         OBJ_hddtemp,
409 #endif /* HDDTEMP */
410         OBJ_include,
411         OBJ_blink,
412         OBJ_to_bytes,
413         OBJ_scroll,
414         OBJ_combine,
415         OBJ_entropy_avail,
416         OBJ_entropy_perc,
417         OBJ_entropy_poolsize,
418         OBJ_entropy_bar,
419 #ifdef APCUPSD
420         OBJ_apcupsd,
421         OBJ_apcupsd_name,
422         OBJ_apcupsd_model,
423         OBJ_apcupsd_upsmode,
424         OBJ_apcupsd_cable,
425         OBJ_apcupsd_status,
426         OBJ_apcupsd_linev,
427         OBJ_apcupsd_load,
428         OBJ_apcupsd_loadbar,
429 #ifdef X11
430         OBJ_apcupsd_loadgraph,
431         OBJ_apcupsd_loadgauge,
432 #endif /* X11 */
433         OBJ_apcupsd_charge,
434         OBJ_apcupsd_timeleft,
435         OBJ_apcupsd_temp,
436         OBJ_apcupsd_lastxfer,
437 #endif /* APCUPSD */
438 };
439
440 struct text_object {
441         struct text_object *next, *prev;        /* doubly linked list of text objects */
442         struct text_object *sub;                /* for objects parsing text into objects */
443         union {
444                 void *opaque;           /* new style generic per object data */
445                 char *s;                /* some string */
446                 int i;                  /* some integer */
447                 long l;                 /* some long integer */
448         } data;
449
450         void *special_data;
451         int type;
452         long line;
453 };
454
455 /* text object list helpers */
456 int append_object(struct text_object *root, struct text_object *obj);
457
458 /* ifblock helpers
459  *
460  * Opaque is a pointer to the address of the ifblock stack's top object.
461  * Calling clients should pass the address of a defined void pointer which
462  * was initialised to NULL (empty stack).
463  * */
464 int obj_be_ifblock_if(void **opaque, struct text_object *);
465 int obj_be_ifblock_else(void **opaque, struct text_object *);
466 int obj_be_ifblock_endif(void **opaque, struct text_object *);
467 int ifblock_stack_empty(void **opaque);
468
469 #endif /* _TEXT_OBJECT_H */