Build fix for IBM support when X is disabled.
[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_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         OBJ_cpugauge,
71 #ifdef X11
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         OBJ_execgauge,
98         OBJ_execigauge,
99 #ifdef X11
100         OBJ_execgraph,
101         OBJ_execigraph,
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         OBJ_smapi_bat_bar,
144         OBJ_smapi_bat_perc,
145         OBJ_smapi_bat_temp,
146         OBJ_smapi_bat_power,
147         OBJ_if_smapi_bat_installed,
148 #endif /* IBM */
149         /* information from sony_laptop kernel module
150          * /sys/devices/platform/sony-laptop */
151         OBJ_sony_fanspeed,
152         OBJ_if_gw,
153         OBJ_ioscheduler,
154         OBJ_gw_iface,
155         OBJ_gw_ip,
156         OBJ_laptop_mode,
157         OBJ_pb_battery,
158         OBJ_voltage_mv,
159         OBJ_voltage_v,
160         OBJ_wireless_essid,
161         OBJ_wireless_mode,
162         OBJ_wireless_bitrate,
163         OBJ_wireless_ap,
164         OBJ_wireless_link_qual,
165         OBJ_wireless_link_qual_max,
166         OBJ_wireless_link_qual_perc,
167         OBJ_wireless_link_bar,
168 #endif /* __linux__ */
169 #if defined(__FreeBSD__) || defined(__linux__)
170         OBJ_if_up,
171 #endif
172         OBJ_if_empty,
173         OBJ_if_match,
174         OBJ_if_existing,
175         OBJ_if_mounted,
176         OBJ_if_running,
177         OBJ_if_updatenr,
178         OBJ_top,
179         OBJ_top_mem,
180         OBJ_top_time,
181 #ifdef IOSTATS
182         OBJ_top_io,
183 #endif
184         OBJ_tail,
185         OBJ_head,
186         OBJ_lines,
187         OBJ_words,
188         OBJ_kernel,
189         OBJ_loadavg,
190         OBJ_machine,
191         OBJ_mails,
192         OBJ_new_mails,
193         OBJ_seen_mails,
194         OBJ_unseen_mails,
195         OBJ_flagged_mails,
196         OBJ_unflagged_mails,
197         OBJ_format_time,
198         OBJ_forwarded_mails,
199         OBJ_unforwarded_mails,
200         OBJ_replied_mails,
201         OBJ_unreplied_mails,
202         OBJ_draft_mails,
203         OBJ_trashed_mails,
204         OBJ_mboxscan,
205         OBJ_mem,
206         OBJ_memeasyfree,
207         OBJ_memfree,
208         OBJ_memgauge,
209 #ifdef X11
210         OBJ_memgraph,
211 #endif /* X11 */
212         OBJ_membar,
213         OBJ_memmax,
214         OBJ_memperc,
215         OBJ_mixer,
216         OBJ_mixerl,
217         OBJ_mixerr,
218         OBJ_mixerbar,
219         OBJ_mixerlbar,
220         OBJ_mixerrbar,
221         OBJ_if_mixer_mute,
222 #ifdef X11
223         OBJ_monitor,
224         OBJ_monitor_number,
225         OBJ_desktop,
226         OBJ_desktop_number,
227         OBJ_desktop_name,
228 #endif /* X11 */
229         OBJ_nameserver,
230         OBJ_nodename,
231         OBJ_nodename_short,
232         OBJ_nvidia,
233         OBJ_pre_exec,
234         OBJ_cmdline_to_pid,
235         OBJ_pid_chroot,
236         OBJ_pid_cmdline,
237         OBJ_pid_cwd,
238         OBJ_pid_environ,
239         OBJ_pid_environ_list,
240         OBJ_pid_exe,
241         OBJ_pid_nice,
242         OBJ_pid_openfiles,
243         OBJ_pid_parent,
244         OBJ_pid_priority,
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_time_kernelmode,
253         OBJ_pid_time_usermode,
254         OBJ_pid_time,
255         OBJ_pid_uid,
256         OBJ_pid_euid,
257         OBJ_pid_suid,
258         OBJ_pid_fsuid,
259         OBJ_pid_gid,
260         OBJ_pid_egid,
261         OBJ_pid_sgid,
262         OBJ_pid_fsgid,
263         OBJ_pid_read,
264         OBJ_pid_vmpeak,
265         OBJ_pid_vmsize,
266         OBJ_pid_vmlck,
267         OBJ_pid_vmhwm,
268         OBJ_pid_vmrss,
269         OBJ_pid_vmdata,
270         OBJ_pid_vmstk,
271         OBJ_pid_vmexe,
272         OBJ_pid_vmlib,
273         OBJ_pid_vmpte,
274         OBJ_pid_write,
275         OBJ_gid_name,
276         OBJ_uid_name,
277         OBJ_processes,
278         OBJ_running_processes,
279         OBJ_shadecolor,
280         OBJ_outlinecolor,
281         OBJ_stippled_hr,
282         OBJ_swap,
283         OBJ_swapfree,
284         OBJ_swapbar,
285         OBJ_swapmax,
286         OBJ_swapperc,
287         OBJ_sysname,
288         OBJ_text,
289         OBJ_threads,
290         OBJ_running_threads,
291         OBJ_time,
292         OBJ_utime,
293         OBJ_tztime,
294         OBJ_totaldown,
295         OBJ_totalup,
296         OBJ_updates,
297         OBJ_upspeed,
298         OBJ_upspeedf,
299 #ifdef X11
300         OBJ_upspeedgraph,
301 #endif /* X11 */
302         OBJ_uptime,
303         OBJ_uptime_short,
304         OBJ_user_names,
305         OBJ_user_terms,
306         OBJ_user_times,
307         OBJ_user_time,
308         OBJ_user_number,
309         OBJ_imap_messages,
310         OBJ_imap_unseen,
311         OBJ_pop3_unseen,
312         OBJ_pop3_used,
313 #if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \
314                 || defined(__OpenBSD__)) && (defined(i386) || defined(__i386__))
315         OBJ_apm_adapter,
316         OBJ_apm_battery_time,
317         OBJ_apm_battery_life,
318 #endif /* __FreeBSD__ __OpenBSD__ */
319 #ifdef __OpenBSD__
320         OBJ_obsd_sensors_temp,
321         OBJ_obsd_sensors_fan,
322         OBJ_obsd_sensors_volt,
323         OBJ_obsd_vendor,
324         OBJ_obsd_product,
325 #endif /* __OpenBSD__ */
326 #ifdef MPD
327         OBJ_mpd_title,
328         OBJ_mpd_artist,
329         OBJ_mpd_album,
330         OBJ_mpd_random,
331         OBJ_mpd_repeat,
332         OBJ_mpd_vol,
333         OBJ_mpd_bitrate,
334         OBJ_mpd_status,
335         OBJ_mpd_bar,
336         OBJ_mpd_elapsed,
337         OBJ_mpd_length,
338         OBJ_mpd_track,
339         OBJ_mpd_name,
340         OBJ_mpd_file,
341         OBJ_mpd_percent,
342         OBJ_mpd_smart,
343         OBJ_if_mpd_playing,
344 #endif /* MPD */
345 #ifdef MOC
346         OBJ_moc_state,
347         OBJ_moc_file,
348         OBJ_moc_title,
349         OBJ_moc_artist,
350         OBJ_moc_song,
351         OBJ_moc_album,
352         OBJ_moc_totaltime,
353         OBJ_moc_timeleft,
354         OBJ_moc_curtime,
355         OBJ_moc_bitrate,
356         OBJ_moc_rate,
357 #endif /* MOC */
358 #ifdef XMMS2
359         OBJ_xmms2_artist,
360         OBJ_xmms2_album,
361         OBJ_xmms2_title,
362         OBJ_xmms2_genre,
363         OBJ_xmms2_comment,
364         OBJ_xmms2_url,
365         OBJ_xmms2_date,
366         OBJ_xmms2_tracknr,
367         OBJ_xmms2_bitrate,
368         OBJ_xmms2_id,
369         OBJ_xmms2_duration,
370         OBJ_xmms2_elapsed,
371         OBJ_xmms2_size,
372         OBJ_xmms2_percent,
373         OBJ_xmms2_status,
374 #ifdef X11
375         OBJ_xmms2_bar,
376 #endif /* X11 */
377         OBJ_xmms2_smart,
378         OBJ_xmms2_playlist,
379         OBJ_xmms2_timesplayed,
380         OBJ_if_xmms2_connected,
381 #endif /* XMMS2 */
382 #ifdef AUDACIOUS
383         OBJ_audacious_status,
384         OBJ_audacious_title,
385         OBJ_audacious_length,
386         OBJ_audacious_length_seconds,
387         OBJ_audacious_position,
388         OBJ_audacious_position_seconds,
389         OBJ_audacious_bitrate,
390         OBJ_audacious_frequency,
391         OBJ_audacious_channels,
392         OBJ_audacious_filename,
393         OBJ_audacious_playlist_length,
394         OBJ_audacious_playlist_position,
395         OBJ_audacious_main_volume,
396 #ifdef X11
397         OBJ_audacious_bar,
398 #endif /* X11 */
399 #endif /* AUDACIOUS */
400 #ifdef BMPX
401         OBJ_bmpx_title,
402         OBJ_bmpx_artist,
403         OBJ_bmpx_album,
404         OBJ_bmpx_track,
405         OBJ_bmpx_uri,
406         OBJ_bmpx_bitrate,
407 #endif /* BMPX */
408 #ifdef EVE
409         OBJ_eve,
410 #endif /* EVE */
411 #ifdef HAVE_CURL
412         OBJ_curl,
413 #endif /* HAVE_CURL */
414 #ifdef RSS
415         OBJ_rss,
416 #endif /* RSS */
417 #ifdef WEATHER
418         OBJ_weather,
419 #endif /* WEATHER */
420 #ifdef XOAP
421         OBJ_weather_forecast,
422 #endif /* XOAP */
423 #ifdef HAVE_LUA
424         OBJ_lua,
425         OBJ_lua_parse,
426         OBJ_lua_bar,
427         OBJ_lua_gauge,
428 #ifdef X11
429         OBJ_lua_graph,
430 #endif /* X11 */
431 #endif /* HAVE_LUA */
432 #ifdef TCP_PORT_MONITOR
433         OBJ_tcp_portmon,
434 #endif /* TCP_PORT_MONITOR */
435 #ifdef HAVE_ICONV
436         OBJ_iconv_start,
437         OBJ_iconv_stop,
438 #endif /* HAVE_ICONV */
439 #ifdef HDDTEMP
440         OBJ_hddtemp,
441 #endif /* HDDTEMP */
442         OBJ_include,
443         OBJ_blink,
444         OBJ_to_bytes,
445         OBJ_scroll,
446         OBJ_combine,
447         OBJ_entropy_avail,
448         OBJ_entropy_perc,
449         OBJ_entropy_poolsize,
450         OBJ_entropy_bar,
451 #ifdef APCUPSD
452         OBJ_apcupsd,
453         OBJ_apcupsd_name,
454         OBJ_apcupsd_model,
455         OBJ_apcupsd_upsmode,
456         OBJ_apcupsd_cable,
457         OBJ_apcupsd_status,
458         OBJ_apcupsd_linev,
459         OBJ_apcupsd_load,
460         OBJ_apcupsd_loadbar,
461         OBJ_apcupsd_loadgauge,
462 #ifdef X11
463         OBJ_apcupsd_loadgraph,
464 #endif /* X11 */
465         OBJ_apcupsd_charge,
466         OBJ_apcupsd_timeleft,
467         OBJ_apcupsd_temp,
468         OBJ_apcupsd_lastxfer,
469 #endif /* APCUPSD */
470 };
471
472 struct text_object {
473         struct text_object *next, *prev;        /* doubly linked list of text objects */
474         struct text_object *sub;                /* for objects parsing text into objects */
475         struct text_object *ifblock_next;       /* jump target for ifblock objects */
476         union {
477                 void *opaque;           /* new style generic per object data */
478                 char *s;                /* some string */
479                 int i;                  /* some integer */
480                 long l;                 /* some long integer */
481         } data;
482
483         void *special_data;
484         int type;
485         long line;
486 };
487
488 /* text object list helpers */
489 int append_object(struct text_object *root, struct text_object *obj);
490
491 /* ifblock helpers
492  *
493  * Opaque is a pointer to the address of the ifblock stack's top object.
494  * Calling clients should pass the address of a defined void pointer which
495  * was initialised to NULL (empty stack).
496  * */
497 int obj_be_ifblock_if(void **opaque, struct text_object *);
498 int obj_be_ifblock_else(void **opaque, struct text_object *);
499 int obj_be_ifblock_endif(void **opaque, struct text_object *);
500 int ifblock_stack_empty(void **opaque);
501
502 #endif /* _TEXT_OBJECT_H */