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