From b6331b4eb67bc943b9ebd81dc26acd22731faf93 Mon Sep 17 00:00:00 2001 From: Brenden Matthews Date: Wed, 9 Dec 2009 20:05:32 -0800 Subject: [PATCH] Switch some more bits to C++, more CMake changes. --- src/CMakeLists.txt | 46 ++++++++++----------- src/Makefile.am | 4 +- src/algebra.h | 8 ++++ src/apcupsd.h | 8 ++++ src/audacious.h | 8 ++++ src/bmpx.h | 8 ++++ src/bsdapm.h | 8 ++++ src/ccurl_thread.h | 7 ++++ src/colours.h | 8 ++++ src/combine.h | 8 ++++ src/common.h | 8 ++++ src/conf_cookie.h | 8 ++++ src/{conky.c => conky.cc} | 31 +++++++------- src/conky.h | 59 ++++++++++++++++----------- src/{core.c => core.cc} | 14 +++---- src/core.h | 8 ++++ src/diskio.h | 8 ++++ src/entropy.h | 8 ++++ src/eve.h | 8 ++++ src/exec.h | 8 ++++ src/fonts.h | 8 ++++ src/freebsd.h | 8 ++++ src/fs.h | 8 ++++ src/hddtemp.h | 8 ++++ src/i8k.h | 8 ++++ src/ibm.h | 8 ++++ src/iconv_tools.h | 8 ++++ src/imlib2.h | 8 ++++ src/libmpdclient.h | 8 ++++ src/libtcp-portmon.h | 8 ---- src/linux.h | 8 ++++ src/llua.h | 8 ++++ src/logging.h | 8 ++++ src/mail.h | 8 ++++ src/mboxscan.h | 8 ++++ src/mixer.h | 8 ++++ src/moc.h | 8 ++++ src/mpd.h | 8 ++++ src/net_stat.h | 8 ++++ src/netbsd.h | 8 ++++ src/nvidia.h | 8 ++++ src/openbsd.h | 8 ++++ src/proc.h | 8 ++++ src/prss.h | 8 ++++ src/read_tcp.h | 8 ++++ src/rss.h | 8 ++++ src/scroll.h | 8 ++++ src/smapi.h | 8 ++++ src/sony.h | 8 ++++ src/specials.h | 8 ++++ src/tailhead.h | 8 ++++ src/{tcp-portmon.c => tcp-portmon.cc} | 4 +- src/tcp-portmon.h | 2 - src/temphelper.h | 8 ++++ src/template.h | 8 ++++ src/text_object.h | 8 ++++ src/timed_thread.h | 7 ++++ src/timeinfo.h | 8 ++++ src/top.h | 8 ++++ src/user.h | 8 ++++ src/users.h | 8 ++++ src/weather.h | 8 ++++ src/x11.h | 8 ++++ 63 files changed, 523 insertions(+), 83 deletions(-) rename src/{conky.c => conky.cc} (99%) rename src/{core.c => core.cc} (99%) rename src/{tcp-portmon.c => tcp-portmon.cc} (96%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6ce9a020..fcf09660 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,24 +10,24 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/build.h) message(FATAL_ERROR "You must remove the autotools generated file '${CMAKE_CURRENT_SOURCE_DIR}/build.h' in order to build with CMake.") endif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/build.h) -set(conky_sources colours.c combine.c common.c conky.c core.c diskio.c +set(conky_sources colours.c combine.c common.c conky.cc core.cc diskio.c entropy.c exec.c fs.c mail.c mixer.c net_stat.c template.c timed_thread.c mboxscan.c read_tcp.c scroll.c specials.c tailhead.c temphelper.c text_object.c timeinfo.c top.c algebra.c proc.c user.c) # Platform specific sources if(OS_LINUX) - set(linux linux.c linux.h users.c users.h sony.c sony.h i8k.c i8k.h) + set(linux linux.c users.c sony.c i8k.c) set(optional_sources ${optional_sources} ${linux}) endif(OS_LINUX) if(OS_FREEBSD) - set(freebsd freebsd.c freebsd.h bsdapm.c bsdapm.h) + set(freebsd freebsd.c bsdapm.c) set(optional_sources ${optional_sources} ${freebsd}) endif(OS_FREEBSD) if(OS_OPENBSD) - set(openbsd openbsd.c openbsd.h bsdapm.c bsdapm.h) + set(openbsd openbsd.c bsdapm.c) set(optional_sources ${optional_sources} ${openbsd}) endif(OS_OPENBSD) @@ -38,99 +38,99 @@ if(OS_SOLARIS) endif(OS_SOLARIS) if(OS_NETBSD) - set(netbsd netbsd.c netbsd.h) + set(netbsd netbsd.c) set(optional_sources ${optional_sources} ${netbsd}) endif(OS_NETBSD) # Optional sources if(BUILD_AUDACIOUS) - set(audacious audacious.c audacious.h) + set(audacious audacious.c) set(optional_sources ${optional_sources} ${audacious}) endif(BUILD_AUDACIOUS) if(BUILD_BMPX) - set(bmpx bmpx.c bmpx.h) + set(bmpx bmpx.c) set(optional_sources ${optional_sources} ${bmpx}) endif(BUILD_BMPX) if(BUILD_IBM) - set(ibm ibm.c ibm.h smapi.c smapi.h) + set(ibm ibm.c smapi.c) set(optional_sources ${optional_sources} ${ibm}) endif(BUILD_IBM) if(BUILD_MPD) - set(mpd mpd.c mpd.h libmpdclient.c libmpdclient.h) + set(mpd mpd.c libmpdclient.c) set(optional_sources ${optional_sources} ${mpd}) endif(BUILD_MPD) if(BUILD_MOC) - set(moc moc.c moc.h) + set(moc moc.c) set(optional_sources ${optional_sources} ${moc}) endif(BUILD_MOC) if(BUILD_XMMS2) - set(xmms2 xmms2.c xmms2.h) + set(xmms2 xmms2.c) set(optional_sources ${optional_sources} ${xmms2}) endif(BUILD_XMMS2) if(BUILD_PORT_MONITORS) - set(port_monitors libtcp-portmon.cc libtcp-portmon.h tcp-portmon.c tcp-portmon.h) + set(port_monitors libtcp-portmon.cc tcp-portmon.cc) set(optional_sources ${optional_sources} ${port_monitors}) endif(BUILD_PORT_MONITORS) if(BUILD_X11) - set(x11 x11.c x11.h fonts.c fonts.h) + set(x11 x11.c fonts.c) set(optional_sources ${optional_sources} ${x11}) endif(BUILD_X11) if(BUILD_HDDTEMP) - set(hddtemp hddtemp.c hddtemp.h) + set(hddtemp hddtemp.c) set(optional_sources ${optional_sources} ${hddtemp}) endif(BUILD_HDDTEMP) if(BUILD_EVE) - set(eve eve.c eve.h) + set(eve eve.c) set(optional_sources ${optional_sources} ${eve}) endif(BUILD_EVE) if(BUILD_CURL) - set(ccurl_thread ccurl_thread.c ccurl_thread.h) + set(ccurl_thread ccurl_thread.c) set(optional_sources ${optional_sources} ${ccurl_thread}) endif(BUILD_CURL) if(BUILD_RSS) - set(rss rss.c rss.h prss.c prss.h) + set(rss rss.c prss.c) set(optional_sources ${optional_sources} ${rss}) endif(BUILD_RSS) if(BUILD_WEATHER) - set(weather weather.c weather.h) + set(weather weather.c) set(optional_sources ${optional_sources} ${weather}) endif(BUILD_WEATHER) if(BUILD_LUA) - set(lua llua.c llua.h) + set(lua llua.c) set(optional_sources ${optional_sources} ${lua}) endif(BUILD_LUA) if(BUILD_NVIDIA) - set(nvidia nvidia.c nvidia.h) + set(nvidia nvidia.c) set(optional_sources ${optional_sources} ${nvidia}) endif(BUILD_NVIDIA) if(BUILD_IMLIB2) - set(imlib2 imlib2.c imlib2.h) + set(imlib2 imlib2.c) set(optional_sources ${optional_sources} ${imlib2}) endif(BUILD_IMLIB2) if(BUILD_APCUPSD) - set(apcupsd apcupsd.c apcupsd.h) + set(apcupsd apcupsd.c) set(optional_sources ${optional_sources} ${apcupsd}) endif(BUILD_APCUPSD) if(BUILD_ICONV) - set(iconv iconv_tools.c iconv_tools.h) + set(iconv iconv_tools.c) set(optional_sources ${optional_sources} ${iconv}) endif(BUILD_ICONV) diff --git a/src/Makefile.am b/src/Makefile.am index 9fd43646..397ffb08 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -50,7 +50,7 @@ endif # BUILD_CONFIG_OUTPUT # source files always needed for compiling mandatory_sources = colours.c colours.h combine.c combine.h common.c common.h \ - conky.c conky.h core.c core.h diskio.c diskio.h entropy.c entropy.h \ + conky.cc conky.h core.cc core.h diskio.c diskio.h entropy.c entropy.h \ exec.c exec.h fs.c fs.h logging.h mail.c mail.h mixer.c mixer.h net_stat.c \ net_stat.h template.c template.h timed_thread.c timed_thread.h mboxscan.c \ mboxscan.h read_tcp.c read_tcp.h scroll.c scroll.h specials.c \ @@ -71,7 +71,7 @@ freebsd = freebsd.c freebsd.h bsdapm.c bsdapm.h netbsd = netbsd.c netbsd.h openbsd = openbsd.c openbsd.h bsdapm.c bsdapm.h port_monitors = libtcp-portmon.cc libtcp-portmon.h \ - tcp-portmon.c tcp-portmon.h + tcp-portmon.cc tcp-portmon.h x11 = x11.c x11.h fonts.c fonts.h hddtemp = hddtemp.c hddtemp.h eve = eve.c eve.h diff --git a/src/algebra.h b/src/algebra.h index eb142dba..2350a77b 100644 --- a/src/algebra.h +++ b/src/algebra.h @@ -30,6 +30,10 @@ #ifndef _ALGEBRA_H #define _ALGEBRA_H +#ifdef __cplusplus +extern "C" { +#endif + enum match_type { OP_LT = 1, /* < */ OP_GT = 2, /* > */ @@ -48,4 +52,8 @@ enum arg_type { int compare(const char *); int check_if_match(struct text_object *); +#ifdef __cplusplus +} +#endif + #endif /* _ALGEBRA_H */ diff --git a/src/apcupsd.h b/src/apcupsd.h index 5e2a2db3..ab2fcb62 100644 --- a/src/apcupsd.h +++ b/src/apcupsd.h @@ -25,6 +25,10 @@ #ifndef APCUPSD_H_ #define APCUPSD_H_ +#ifdef __cplusplus +extern "C" { +#endif + enum _apcupsd_items { APCUPSD_NAME, APCUPSD_MODEL, @@ -65,4 +69,8 @@ void print_apcupsd_timeleft(struct text_object *, char *, int); void print_apcupsd_temp(struct text_object *, char *, int); void print_apcupsd_lastxfer(struct text_object *, char *, int); +#ifdef __cplusplus +} +#endif + #endif /*APCUPSD_H_*/ diff --git a/src/audacious.h b/src/audacious.h index 69c0df83..8fea119f 100644 --- a/src/audacious.h +++ b/src/audacious.h @@ -27,6 +27,10 @@ #include "timed_thread.h" +#ifdef __cplusplus +extern "C" { +#endif + enum _audacious_items { AUDACIOUS_STATUS = 0, AUDACIOUS_TITLE, @@ -80,4 +84,8 @@ void print_audacious_playlist_position(struct text_object *, char *, int); void print_audacious_main_volume(struct text_object *, char *, int); double audacious_barval(struct text_object *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bmpx.h b/src/bmpx.h index 71f9ed0d..6cc70397 100644 --- a/src/bmpx.h +++ b/src/bmpx.h @@ -26,6 +26,10 @@ #ifndef BMPX_H_ #define BMPX_H_ +#ifdef __cplusplus +extern "C" { +#endif + void update_bmpx(void); struct bmpx_s { char *title; @@ -43,4 +47,8 @@ void print_bmpx_uri(struct text_object *, char *, int); void print_bmpx_track(struct text_object *, char *, int); void print_bmpx_bitrate(struct text_object *, char *, int); +#ifdef __cplusplus +} +#endif + #endif /*BMPX_H_*/ diff --git a/src/bsdapm.h b/src/bsdapm.h index afbb7cbf..4962f1a2 100644 --- a/src/bsdapm.h +++ b/src/bsdapm.h @@ -30,8 +30,16 @@ #ifndef _BSDAPM_H #define _BSDAPM_H +#ifdef __cplusplus +extern "C" { +#endif + void print_apm_adapter(struct text_object *, char *, int); void print_apm_battery_life(struct text_object *, char *, int); void print_apm_battery_time(struct text_object *, char *, int); +#ifdef __cplusplus +} +#endif + #endif /* _BSDAPM_H */ diff --git a/src/ccurl_thread.h b/src/ccurl_thread.h index 14490754..b84ecfdf 100644 --- a/src/ccurl_thread.h +++ b/src/ccurl_thread.h @@ -27,6 +27,9 @@ #include "timed_thread.h" +#ifdef __cplusplus +extern "C" { +#endif /* curl thread lib exports begin */ @@ -72,5 +75,9 @@ void curl_obj_free(struct text_object *); /* $curl exports end */ +#ifdef __cplusplus +} +#endif + #endif /* _CURL_THREAD_H_ */ diff --git a/src/colours.h b/src/colours.h index 203a8888..977ebb43 100644 --- a/src/colours.h +++ b/src/colours.h @@ -29,9 +29,17 @@ #ifndef _COLOURS_H #define _COLOURS_H +#ifdef __cplusplus +extern "C" { +#endif + unsigned int adjust_colours(unsigned int); unsigned long *do_gradient(int, unsigned long, unsigned long); long get_x11_color(const char *); +#ifdef __cplusplus +} +#endif + #endif /* _COLOURS_H */ diff --git a/src/combine.h b/src/combine.h index b478a33b..4c1c0c5f 100644 --- a/src/combine.h +++ b/src/combine.h @@ -30,8 +30,16 @@ #ifndef _COMBINE_H #define _COMBINE_H +#ifdef __cplusplus +extern "C" { +#endif + void parse_combine_arg(struct text_object *, const char *, void *); void print_combine(struct text_object *, char *, int); void free_combine(struct text_object *); +#ifdef __cplusplus +} +#endif + #endif /* _COMBINE_H */ diff --git a/src/common.h b/src/common.h index bfd19919..e94e67e3 100644 --- a/src/common.h +++ b/src/common.h @@ -11,6 +11,10 @@ #include #include "text_object.h" +#ifdef __cplusplus +extern "C" { +#endif + void add_update_callback(void (*func)(void)); void free_update_callbacks(void); void start_update_threading(void); @@ -131,4 +135,8 @@ void print_include(struct text_object *, char *, int); void print_updates(struct text_object *, char *, int); int updatenr_iftest(struct text_object *); +#ifdef __cplusplus +} +#endif + #endif /* _COMMON_H */ diff --git a/src/conf_cookie.h b/src/conf_cookie.h index 5458b465..b58606fd 100644 --- a/src/conf_cookie.h +++ b/src/conf_cookie.h @@ -3,6 +3,14 @@ #ifndef _CONF_COOKIE_H #define _CONF_COOKIE_H +#ifdef __cplusplus +extern "C" { +#endif + FILE *conf_cookie_open(void); +#ifdef __cplusplus +} +#endif + #endif /* _CONF_COOKIE_H */ diff --git a/src/conky.c b/src/conky.cc similarity index 99% rename from src/conky.c rename to src/conky.cc index 9133ecbf..8cc21c80 100644 --- a/src/conky.c +++ b/src/conky.cc @@ -163,6 +163,7 @@ double update_interval_old; double update_interval_bat; void *global_cpu = NULL; unsigned int max_text_width = 0; +int ifup_strictness = IFUP_UP; int argc_copy; char** argv_copy; @@ -518,7 +519,7 @@ int spaced_print(char *buf, int size, const char *format, int width, ...) if (size < 1) { return 0; } - tempbuf = malloc(size * sizeof(char)); + tempbuf = (char*)malloc(size * sizeof(char)); // Passes the varargs along to vsnprintf va_start(argp, width); @@ -640,7 +641,7 @@ struct conftree* conftree_add(struct conftree* previous, const char* newstring) return NULL; } } - node = malloc(sizeof(struct conftree)); + node = (struct conftree*)malloc(sizeof(struct conftree)); if (previous != NULL) { if(previous->vert_next == NULL) { previous->vert_next = node; @@ -1800,7 +1801,7 @@ static void draw_stuff(void) fclose(overwrite_fpointer); overwrite_fpointer = 0; } - if(append_fpointer) { + if (append_fpointer) { fclose(append_fpointer); append_fpointer = 0; } @@ -2679,25 +2680,25 @@ static void set_default_configurations(void) } /* returns 1 if you can overwrite or create the file at 'path' */ -static _Bool overwrite_works(const char *path) +static bool overwrite_works(const char *path) { FILE *filepointer; if (!(filepointer = fopen(path, "w"))) - return 0; + return false; fclose(filepointer); - return 1; + return true; } /* returns 1 if you can append or create the file at 'path' */ -static _Bool append_works(const char *path) +static bool append_works(const char *path) { FILE *filepointer; if (!(filepointer = fopen(path, "a"))) - return 0; + return false; fclose(filepointer); - return 1; + return true; } #ifdef X11 @@ -3169,7 +3170,7 @@ char load_config_file(const char *f) free(overwrite_file); overwrite_file = 0; } - if(overwrite_works(value)) { + if (overwrite_works(value)) { overwrite_file = strdup(value); output_methods |= OVERWRITE_FILE; } else @@ -3195,7 +3196,7 @@ char load_config_file(const char *f) } else if (strcasecmp(value, "none") == EQUAL) { use_spacer = NO_SPACER; } else { - use_spacer = string_to_bool(value); + use_spacer = string_to_bool(value) ? RIGHT_SPACER : NO_SPACER; NORM_ERR("use_spacer should have an argument of left, right, or" " none. '%s' seems to be some form of '%s', so" " defaulting to %s.", value, @@ -3936,7 +3937,7 @@ void initialisation(int argc, char **argv) { currentconffile = conftree_add(currentconffile, current_config); /* init specials array */ - if ((specials = calloc(sizeof(struct special_t), max_specials)) == 0) { + if ((specials = (special_t*)calloc(sizeof(struct special_t), max_specials)) == 0) { NORM_ERR("failed to create specials array"); } @@ -4084,11 +4085,11 @@ void initialisation(int argc, char **argv) { start_update_threading(); - text_buffer = malloc(max_user_text); + text_buffer = (char*)malloc(max_user_text); memset(text_buffer, 0, max_user_text); - tmpstring1 = malloc(text_buffer_size); + tmpstring1 = (char*)malloc(text_buffer_size); memset(tmpstring1, 0, text_buffer_size); - tmpstring2 = malloc(text_buffer_size); + tmpstring2 = (char*)malloc(text_buffer_size); memset(tmpstring2, 0, text_buffer_size); #ifdef X11 diff --git a/src/conky.h b/src/conky.h index d1a83333..d4f60c1c 100644 --- a/src/conky.h +++ b/src/conky.h @@ -159,23 +159,12 @@ struct x11_info { struct desktop_info desktop; }; -int get_stippled_borders(void); - #endif /* X11 */ /* defined in conky.c */ extern long default_fg_color, default_bg_color, default_out_color; extern long color0, color1, color2, color3, color4, color5, color6, color7, color8, color9; -void set_current_text_color(long colour); -long get_current_text_color(void); - -void set_updatereset(int); -int get_updatereset(void); -int get_total_updates(void); - -int percent_print(char *, int, unsigned); -void human_readable(long long, char *, int); struct conftree { char* string; @@ -205,14 +194,6 @@ enum { BATTERY_TIME }; -/* if_up strictness selector - * needed by conky.c and linux.c (and potentially others) */ -enum { - IFUP_UP, - IFUP_LINK, - IFUP_ADDR -} ifup_strictness; - struct information { unsigned int mask; @@ -309,6 +290,28 @@ extern struct information info; /* defined in conky.c */ extern double current_update_time, last_update_time, update_interval; +#ifdef __cplusplus +extern "C" { +#endif + +/* if_up strictness selector + * needed by conky.c and linux.c (and potentially others) */ +enum _ifup_strictness { + IFUP_UP, + IFUP_LINK, + IFUP_ADDR +}; +extern int ifup_strictness; + +int get_stippled_borders(void); + +void set_current_text_color(long colour); +long get_current_text_color(void); + +void set_updatereset(int); +int get_updatereset(void); +int get_total_updates(void); + /* defined in conky.c */ int spaced_print(char *, int, const char *, int, ...) __attribute__((format(printf, 3, 5))); @@ -319,6 +322,19 @@ extern int inotify_fd; */ void evaluate(const char *text, char *p, int p_max_size); +void set_update_interval(double interval); + +void parse_conky_vars(struct text_object *, const char *, char *, int); + +void generate_text_internal(char *, int, struct text_object); + +int percent_print(char *, int, unsigned); +void human_readable(long long, char *, int); + +#ifdef __cplusplus +} +#endif + /* maximum size of config TEXT buffer, i.e. below TEXT line. */ extern unsigned int max_user_text; @@ -343,8 +359,6 @@ enum x_initialiser_state { extern int output_methods; extern enum x_initialiser_state x_initialised; -void set_update_interval(double interval); - #define DEFAULT_TEXT_BUFFER_SIZE_S "##DEFAULT_TEXT_BUFFER_SIZE" #define NOBATTERY 0 @@ -353,7 +367,4 @@ void set_update_interval(double interval); #define UNUSED(a) (void)a #define UNUSED_ATTR __attribute__ ((unused)) -void parse_conky_vars(struct text_object *, const char *, char *, int); - -void generate_text_internal(char *, int, struct text_object); #endif /* _conky_h_ */ diff --git a/src/core.c b/src/core.cc similarity index 99% rename from src/core.c rename to src/core.cc index 1ddf0333..c1b33382 100644 --- a/src/core.c +++ b/src/core.cc @@ -109,7 +109,7 @@ const char *dev_name(const char *path) static struct text_object *new_text_object_internal(void) { - struct text_object *obj = malloc(sizeof(struct text_object)); + struct text_object *obj = (text_object*)malloc(sizeof(struct text_object)); memset(obj, 0, sizeof(struct text_object)); return obj; } @@ -715,11 +715,11 @@ struct text_object *construct_text_object(const char *s, const char *arg, long scan_loadavg_arg(obj, arg); obj->callbacks.print = &print_loadavg; END OBJ_IF_ARG(if_empty, 0, "if_empty needs an argument") - obj->sub = malloc(sizeof(struct text_object)); + obj->sub = (text_object*)malloc(sizeof(struct text_object)); extract_variable_text_internal(obj->sub, arg); obj->callbacks.iftest = &if_empty_iftest; END OBJ_IF_ARG(if_match, 0, "if_match needs arguments") - obj->sub = malloc(sizeof(struct text_object)); + obj->sub = (text_object*)malloc(sizeof(struct text_object)); extract_variable_text_internal(obj->sub, arg); obj->callbacks.iftest = &check_if_match; END OBJ_IF_ARG(if_existing, 0, "if_existing needs an argument or two") @@ -859,7 +859,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long obj->callbacks.print = &print_desktop_name; #endif END OBJ_ARG(format_time, 0, "format_time needs a pid as argument") - obj->sub = malloc(sizeof(struct text_object)); + obj->sub = (text_object*)malloc(sizeof(struct text_object)); extract_variable_text_internal(obj->sub, arg); obj->callbacks.print = &print_format_time; END OBJ(nodename, 0) @@ -1505,7 +1505,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long struct conftree *leaf = conftree_add(currentconffile, arg); if(leaf) { if (load_config_file(arg) == TRUE) { - obj->sub = malloc(sizeof(struct text_object)); + obj->sub = (text_object*)malloc(sizeof(struct text_object)); currentconffile = leaf; extract_variable_text_internal(obj->sub, get_global_text()); currentconffile = leaf->back; @@ -1517,11 +1517,11 @@ struct text_object *construct_text_object(const char *s, const char *arg, long NORM_ERR("You are trying to load '%s' recursively, I'm only going to load it once to prevent an infinite loop.", arg); } END OBJ_ARG(blink, 0, "blink needs a argument") - obj->sub = malloc(sizeof(struct text_object)); + obj->sub = (text_object*)malloc(sizeof(struct text_object)); extract_variable_text_internal(obj->sub, arg); obj->callbacks.print = &print_blink; END OBJ_ARG(to_bytes, 0, "to_bytes needs a argument") - obj->sub = malloc(sizeof(struct text_object)); + obj->sub = (text_object*)malloc(sizeof(struct text_object)); extract_variable_text_internal(obj->sub, arg); obj->callbacks.print = &print_to_bytes; END OBJ(scroll, 0) diff --git a/src/core.h b/src/core.h index 512be62f..b4c09d06 100644 --- a/src/core.h +++ b/src/core.h @@ -38,10 +38,18 @@ struct text_object *construct_text_object(const char *s, const char *arg, long size_t remove_comments(char *string); +#ifdef __cplusplus +extern "C" { +#endif + int extract_variable_text_internal(struct text_object *retval, const char *const_p); void free_text_objects(struct text_object *root); const char *dev_name(const char *); +#ifdef __cplusplus +} +#endif + #endif /* _CONKY_CORE_H_ */ diff --git a/src/diskio.h b/src/diskio.h index 1c379fe9..3b7cc950 100644 --- a/src/diskio.h +++ b/src/diskio.h @@ -30,6 +30,10 @@ #ifndef DISKIO_H_ #define DISKIO_H_ +#ifdef __cplusplus +extern "C" { +#endif + struct diskio_stat { struct diskio_stat *next; char *dev; @@ -62,4 +66,8 @@ double diskiographval_read(struct text_object *); double diskiographval_write(struct text_object *); #endif /* X11 */ +#ifdef __cplusplus +} +#endif + #endif /* DISKIO_H_ */ diff --git a/src/entropy.h b/src/entropy.h index eaacf455..b992156e 100644 --- a/src/entropy.h +++ b/src/entropy.h @@ -31,6 +31,10 @@ #ifndef _ENTROPY_H #define _ENTROPY_H +#ifdef __cplusplus +extern "C" { +#endif + void update_entropy(void); void print_entropy_avail(struct text_object *, char *, int); @@ -38,4 +42,8 @@ uint8_t entropy_percentage(struct text_object *); void print_entropy_poolsize(struct text_object *, char *, int); double entropy_barval(struct text_object *); +#ifdef __cplusplus +} +#endif + #endif /* _ENTROPY_H */ diff --git a/src/eve.h b/src/eve.h index 9382117f..8fa0a28a 100644 --- a/src/eve.h +++ b/src/eve.h @@ -24,8 +24,16 @@ #ifndef _EVE_H #define _EVE_H +#ifdef __cplusplus +extern "C" { +#endif + void scan_eve(struct text_object *, const char *); void print_eve(struct text_object *, char *, int); void free_eve(struct text_object *); +#ifdef __cplusplus +} +#endif + #endif /* _EVE_H */ diff --git a/src/exec.h b/src/exec.h index ffb00e29..7942e618 100644 --- a/src/exec.h +++ b/src/exec.h @@ -31,6 +31,10 @@ #ifndef _EXEC_H #define _EXEC_H +#ifdef __cplusplus +extern "C" { +#endif + extern pid_t childpid; void scan_exec_arg(struct text_object *, const char *); @@ -48,4 +52,8 @@ double execbarval(struct text_object *); double execi_barval(struct text_object *); void free_exec(struct text_object *); void free_execi(struct text_object *); +#ifdef __cplusplus +} +#endif + #endif /* _EXEC_H */ diff --git a/src/fonts.h b/src/fonts.h index 22d92787..18dd1116 100644 --- a/src/fonts.h +++ b/src/fonts.h @@ -32,6 +32,10 @@ #include "x11.h" +#ifdef __cplusplus +extern "C" { +#endif + /* for fonts */ struct font_list { @@ -79,5 +83,9 @@ void set_first_font(const char *); void free_fonts(void); void load_fonts(void); +#ifdef __cplusplus +} +#endif + #endif /* _FONTS_H */ #endif /* X11 */ diff --git a/src/freebsd.h b/src/freebsd.h index 063b1317..c7ce372c 100644 --- a/src/freebsd.h +++ b/src/freebsd.h @@ -13,9 +13,17 @@ #include #endif /* i386 || __i386__ */ +#ifdef __cplusplus +extern "C" { +#endif + kvm_t *kd; int get_entropy_avail(unsigned int *); int get_entropy_poolsize(unsigned int *); +#ifdef __cplusplus +} +#endif + #endif /*FREEBSD_H_*/ diff --git a/src/fs.h b/src/fs.h index 81d6322b..ff9c0225 100644 --- a/src/fs.h +++ b/src/fs.h @@ -5,6 +5,10 @@ #include "conky.h" /* DEFAULT_TEXT_BUFFER_SIZE */ +#ifdef __cplusplus +extern "C" { +#endif + /* needed here and by fs.c */ struct fs_stat { char path[DEFAULT_TEXT_BUFFER_SIZE]; @@ -34,4 +38,8 @@ void update_fs_stats(void); struct fs_stat *prepare_fs_stat(const char *path); void clear_fs_stats(void); +#ifdef __cplusplus +} +#endif + #endif /* _FS_H */ diff --git a/src/hddtemp.h b/src/hddtemp.h index 8b4941b8..bbb7db51 100644 --- a/src/hddtemp.h +++ b/src/hddtemp.h @@ -3,10 +3,18 @@ #ifndef HDDTEMP_H_ #define HDDTEMP_H_ +#ifdef __cplusplus +extern "C" { +#endif + void set_hddtemp_host(const char *); void set_hddtemp_port(const char *); void update_hddtemp(void); void free_hddtemp(struct text_object *); void print_hddtemp(struct text_object *, char *, int); +#ifdef __cplusplus +} +#endif + #endif /*HDDTEMP_H_*/ diff --git a/src/i8k.h b/src/i8k.h index 0e1bf422..1ebfffe5 100644 --- a/src/i8k.h +++ b/src/i8k.h @@ -32,6 +32,10 @@ #ifndef _I8K_H #define _I8K_H +#ifdef __cplusplus +extern "C" { +#endif + void update_i8k(void); void print_i8k_left_fan_status(struct text_object *, char *, int); void print_i8k_cpu_temp(struct text_object *, char *, int); @@ -44,4 +48,8 @@ void print_i8k_left_fan_rpm(struct text_object *, char *, int); void print_i8k_right_fan_rpm(struct text_object *, char *, int); void print_i8k_buttons_status(struct text_object *, char *, int); +#ifdef __cplusplus +} +#endif + #endif /* _I8K_H */ diff --git a/src/ibm.h b/src/ibm.h index eed3595f..1029969c 100644 --- a/src/ibm.h +++ b/src/ibm.h @@ -5,6 +5,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + void get_ibm_acpi_fan(struct text_object *, char *, int); void get_ibm_acpi_temps(void); void get_ibm_acpi_volume(struct text_object *, char *, int); @@ -12,4 +16,8 @@ void get_ibm_acpi_brightness(struct text_object *, char *, int); void parse_ibm_temps_arg(struct text_object *, const char *); void print_ibm_temps(struct text_object *, char *, int); +#ifdef __cplusplus +} +#endif + #endif /* _IBM_H */ diff --git a/src/iconv_tools.h b/src/iconv_tools.h index 41154d75..f04886b3 100644 --- a/src/iconv_tools.h +++ b/src/iconv_tools.h @@ -31,6 +31,10 @@ #ifndef _ICONV_TOOLS_H #define _ICONV_TOOLS_H +#ifdef __cplusplus +extern "C" { +#endif + void free_iconv(struct text_object *); void iconv_convert(size_t *, char *, char *, size_t); void init_iconv_start(struct text_object *, void *, const char *); @@ -39,4 +43,8 @@ void init_iconv_stop(void); void print_iconv_start(struct text_object *, char *, int); void print_iconv_stop(struct text_object *, char *, int); +#ifdef __cplusplus +} +#endif + #endif /* _ICONV_TOOLS_H */ diff --git a/src/imlib2.h b/src/imlib2.h index 8c5f7c6e..6879416b 100644 --- a/src/imlib2.h +++ b/src/imlib2.h @@ -26,6 +26,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + void cimlib_add_image(const char *name); void cimlib_set_cache_size(long size); void cimlib_set_cache_flush_interval(long interval); @@ -36,4 +40,8 @@ void cimlib_cleanup(void); void print_image_callback(struct text_object *, char *, int); +#ifdef __cplusplus +} +#endif + #endif /* _CONKY_IMBLI2_H_ */ diff --git a/src/libmpdclient.h b/src/libmpdclient.h index eef40cda..9696cbaf 100644 --- a/src/libmpdclient.h +++ b/src/libmpdclient.h @@ -72,6 +72,10 @@ #define MPD_ACK_ERROR_PLAYER_SYNC 55 #define MPD_ACK_ERROR_EXIST 56 +#ifdef __cplusplus +extern "C" { +#endif + typedef enum mpd_TagItems { MPD_TAG_ITEM_ARTIST, MPD_TAG_ITEM_ALBUM, @@ -628,4 +632,8 @@ void mpd_sendPlaylistMoveCommand(mpd_Connection *connection, char *playlist, void mpd_sendPlaylistDeleteCommand(mpd_Connection *connection, char *playlist, int pos); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/libtcp-portmon.h b/src/libtcp-portmon.h index a4a5d71e..3f66b618 100644 --- a/src/libtcp-portmon.h +++ b/src/libtcp-portmon.h @@ -32,10 +32,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - /* connection deleted if unseen again after this # of refreshes */ #define TCP_CONNECTION_STARTING_AGE 1 #define TCP_PORT_MONITOR_HASH_KEY_SIZE 12 @@ -135,8 +131,4 @@ tcp_port_monitor_t *find_tcp_port_monitor( tcp_port_monitor_collection_t *p_collection, in_port_t port_range_begin, in_port_t port_range_end); -#ifdef __cplusplus -} -#endif - #endif diff --git a/src/linux.h b/src/linux.h index f3c8e8b7..7716b16d 100644 --- a/src/linux.h +++ b/src/linux.h @@ -5,6 +5,10 @@ #include "common.h" +#ifdef __cplusplus +extern "C" { +#endif + void print_disk_protect_queue(struct text_object *, char *, int); void print_ioscheduler(struct text_object *, char *, int); @@ -30,4 +34,8 @@ int get_entropy_poolsize(unsigned int *); void update_stat(void); +#ifdef __cplusplus +} +#endif + #endif /* _LINUX_H */ diff --git a/src/llua.h b/src/llua.h index bb763c7c..d956d6b7 100644 --- a/src/llua.h +++ b/src/llua.h @@ -36,6 +36,10 @@ #define LUAPREFIX "conky_" +#ifdef __cplusplus +extern "C" { +#endif + /* load a lua script */ void llua_load(const char *script); /* close lua stuff */ @@ -69,4 +73,8 @@ void print_lua(struct text_object *, char *, int); void print_lua_parse(struct text_object *, char *, int); double lua_barval(struct text_object *); +#ifdef __cplusplus +} +#endif + #endif /* LUA_H_*/ diff --git a/src/logging.h b/src/logging.h index 8916ff90..3e0a6a1c 100644 --- a/src/logging.h +++ b/src/logging.h @@ -27,6 +27,10 @@ * */ +#ifdef __cplusplus +extern "C" { +#endif + void clean_up(void *memtofree1, void* memtofree2); #ifndef _LOGGING_H @@ -53,4 +57,8 @@ extern int global_debug_level; #define DBGP(...) __DBGP(0, __VA_ARGS__) #define DBGP2(...) __DBGP(1, __VA_ARGS__) +#ifdef __cplusplus +} +#endif + #endif /* _LOGGING_H */ diff --git a/src/mail.h b/src/mail.h index c4a4e5e6..4d60a45b 100644 --- a/src/mail.h +++ b/src/mail.h @@ -3,6 +3,10 @@ #ifndef _MAIL_H #define _MAIL_H +#ifdef __cplusplus +extern "C" { +#endif + extern char *current_mail_spool; void parse_local_mail_args(struct text_object *, const char *); @@ -36,4 +40,8 @@ void print_imap_messages(struct text_object *, char *, int); void print_pop3_unseen(struct text_object *, char *, int); void print_pop3_used(struct text_object *, char *, int); +#ifdef __cplusplus +} +#endif + #endif /* _MAIL_H */ diff --git a/src/mboxscan.h b/src/mboxscan.h index 76387ee9..0bee8667 100644 --- a/src/mboxscan.h +++ b/src/mboxscan.h @@ -30,8 +30,16 @@ #ifndef _MBOXSCAN_H_ #define _MBOXSCAN_H_ +#ifdef __cplusplus +extern "C" { +#endif + void parse_mboxscan_arg(struct text_object *, const char *); void print_mboxscan(struct text_object *, char *, int); void free_mboxscan(struct text_object *); +#ifdef __cplusplus +} +#endif + #endif /* _MBOXSCAN_H_ */ diff --git a/src/mixer.h b/src/mixer.h index ee730bc0..f1cb188e 100644 --- a/src/mixer.h +++ b/src/mixer.h @@ -3,6 +3,10 @@ #ifndef MIXER_H_ #define MIXER_H_ +#ifdef __cplusplus +extern "C" { +#endif + void parse_mixer_arg(struct text_object *, const char *); uint8_t mixer_percentage(struct text_object *obj); uint8_t mixerl_percentage(struct text_object *obj); @@ -14,4 +18,8 @@ double mixer_barval(struct text_object *); double mixerl_barval(struct text_object *); double mixerr_barval(struct text_object *); +#ifdef __cplusplus +} +#endif + #endif /*MIXER_H_*/ diff --git a/src/moc.h b/src/moc.h index 68e606f6..1f54993e 100644 --- a/src/moc.h +++ b/src/moc.h @@ -23,6 +23,10 @@ #ifndef MOC_H_ #define MOC_H_ +#ifdef __cplusplus +extern "C" { +#endif + void update_moc(void); void free_moc(struct text_object *); @@ -38,5 +42,9 @@ void print_moc_curtime(struct text_object *, char *, int); void print_moc_bitrate(struct text_object *, char *, int); void print_moc_rate(struct text_object *, char *, int); +#ifdef __cplusplus +} +#endif + #endif /* MOC_H_ */ diff --git a/src/mpd.h b/src/mpd.h index 790dfffd..e8e64852 100644 --- a/src/mpd.h +++ b/src/mpd.h @@ -3,6 +3,10 @@ #ifndef MPD_H_ #define MPD_H_ +#ifdef __cplusplus +extern "C" { +#endif + /* functions for setting the configuration values */ void mpd_set_host(const char *); void mpd_set_password(const char *, int); @@ -32,4 +36,8 @@ void print_mpd_bitrate(struct text_object *, char *, int); void print_mpd_status(struct text_object *, char *, int); int check_mpd_playing(struct text_object *); +#ifdef __cplusplus +} +#endif + #endif /*MPD_H_*/ diff --git a/src/net_stat.h b/src/net_stat.h index 156b4d08..9a4b9515 100644 --- a/src/net_stat.h +++ b/src/net_stat.h @@ -33,6 +33,10 @@ #include /* struct sockaddr */ +#ifdef __cplusplus +extern "C" { +#endif + struct net_stat { char *dev; int up; @@ -98,4 +102,8 @@ void update_dns_data(void); void parse_nameserver_arg(struct text_object *, const char *); void print_nameserver(struct text_object *, char *, int); +#ifdef __cplusplus +} +#endif + #endif /* _NET_STAT_H */ diff --git a/src/netbsd.h b/src/netbsd.h index 908bf55e..523cf144 100644 --- a/src/netbsd.h +++ b/src/netbsd.h @@ -30,7 +30,15 @@ #include "conky.h" #include "common.h" +#ifdef __cplusplus +extern "C" { +#endif + int get_entropy_avail(unsigned int *); int get_entropy_poolsize(unsigned int *); +#ifdef __cplusplus +} +#endif + #endif /*NETBSD_H_*/ diff --git a/src/nvidia.h b/src/nvidia.h index b04b7d25..70d4510e 100644 --- a/src/nvidia.h +++ b/src/nvidia.h @@ -31,8 +31,16 @@ #ifndef NVIDIA_CONKY_H #define NVIDIA_CONKY_H +#ifdef __cplusplus +extern "C" { +#endif + int set_nvidia_type(struct text_object *, const char *); void print_nvidia_value(struct text_object *, char *, int); void free_nvidia(struct text_object *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/openbsd.h b/src/openbsd.h index cd46f27d..6d8f68be 100644 --- a/src/openbsd.h +++ b/src/openbsd.h @@ -9,6 +9,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + void parse_obsd_sensor(struct text_object *, const char *); void print_obsd_sensors_temp(struct text_object *, char *, int); void print_obsd_sensors_fan(struct text_object *, char *, int); @@ -23,4 +27,8 @@ typedef struct apm_power_info *apm_info_t; int get_entropy_avail(unsigned int *); int get_entropy_poolsize(unsigned int *); +#ifdef __cplusplus +} +#endif + #endif /*OPENBSD_H_*/ diff --git a/src/proc.h b/src/proc.h index e600c37a..8adeda82 100644 --- a/src/proc.h +++ b/src/proc.h @@ -32,6 +32,10 @@ #define READERR "Can't read '%s'" #define READSIZE 128 +#ifdef __cplusplus +extern "C" { +#endif + /* XXX: this should go global */ void extract_object_args_to_sub(struct text_object *, const char *); @@ -78,3 +82,7 @@ void print_pid_write(struct text_object *obj, char *p, int p_max_size); void scan_cmdline_to_pid_arg(struct text_object *obj, const char *arg, void* free_at_crash); void print_cmdline_to_pid(struct text_object *obj, char *p, int p_max_size); +#ifdef __cplusplus +} +#endif + diff --git a/src/prss.h b/src/prss.h index 4da4cbb5..e202019c 100644 --- a/src/prss.h +++ b/src/prss.h @@ -20,6 +20,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + typedef struct PRSS_Item_ { char *title; char *link; @@ -60,4 +64,8 @@ PRSS *prss_parse_doc(xmlDocPtr doc); */ * after call to this function. */ void prss_free(PRSS *data); +#ifdef __cplusplus +} +#endif + #endif /* PRSS_H */ diff --git a/src/read_tcp.h b/src/read_tcp.h index 79f81e1f..1e190c9b 100644 --- a/src/read_tcp.h +++ b/src/read_tcp.h @@ -31,8 +31,16 @@ #ifndef _READ_TCP_H #define _READ_TCP_H +#ifdef __cplusplus +extern "C" { +#endif + void parse_read_tcp_arg(struct text_object *, const char *, void *); void print_read_tcp(struct text_object *, char *, int); void free_read_tcp(struct text_object *); +#ifdef __cplusplus +} +#endif + #endif /* _READ_TCP_H */ diff --git a/src/rss.h b/src/rss.h index c9904814..be5529ac 100644 --- a/src/rss.h +++ b/src/rss.h @@ -3,10 +3,18 @@ #ifndef RSS_H_ #define RSS_H_ +#ifdef __cplusplus +extern "C" { +#endif + void rss_scan_arg(struct text_object *, const char *); void rss_print_info(struct text_object *, char *, int); void rss_free_obj_info(struct text_object *); void rss_free_info(void); +#ifdef __cplusplus +} +#endif + #endif /*RSS_H_*/ diff --git a/src/scroll.h b/src/scroll.h index baf6c3f4..91c79466 100644 --- a/src/scroll.h +++ b/src/scroll.h @@ -29,8 +29,16 @@ #ifndef _SCROLL_H #define _SCROLL_H +#ifdef __cplusplus +extern "C" { +#endif + void parse_scroll_arg(struct text_object *, const char *, void *); void print_scroll(struct text_object *, char *, int); void free_scroll(struct text_object *); +#ifdef __cplusplus +} +#endif + #endif /* _SCROLL_H */ diff --git a/src/smapi.h b/src/smapi.h index fe9254d5..138749dc 100644 --- a/src/smapi.h +++ b/src/smapi.h @@ -24,6 +24,10 @@ #ifndef _SMAPI_H #define _SMAPI_H +#ifdef __cplusplus +extern "C" { +#endif + int smapi_bat_installed_internal(int); char *smapi_read_str(const char *); @@ -43,4 +47,8 @@ void print_smapi_bat_power(struct text_object *, char *, int); double smapi_bat_barval(struct text_object *); int smapi_bat_installed(struct text_object *obj); +#ifdef __cplusplus +} +#endif + #endif /* _SMAPI_H */ diff --git a/src/sony.h b/src/sony.h index 7dea1b78..71cc6294 100644 --- a/src/sony.h +++ b/src/sony.h @@ -31,6 +31,14 @@ #ifndef _SONY_H #define _SONY_H +#ifdef __cplusplus +extern "C" { +#endif + void get_sony_fanspeed(struct text_object *, char *, int); +#ifdef __cplusplus +} +#endif + #endif /* _SONY_H */ diff --git a/src/specials.h b/src/specials.h index c23bec92..85bb3f74 100644 --- a/src/specials.h +++ b/src/specials.h @@ -29,6 +29,10 @@ #ifndef _SPECIALS_H #define _SPECIALS_H +#ifdef __cplusplus +extern "C" { +#endif + /* special stuff in text_buffer */ #define SPECIAL_CHAR '\x01' @@ -120,4 +124,8 @@ void new_alignc(struct text_object *, char *, int); void new_goto(struct text_object *, char *, int); void new_tab(struct text_object *, char *, int); +#ifdef __cplusplus +} +#endif + #endif /* _SPECIALS_H */ diff --git a/src/tailhead.h b/src/tailhead.h index 620e9e47..83f657ae 100644 --- a/src/tailhead.h +++ b/src/tailhead.h @@ -30,6 +30,10 @@ #ifndef _TAILHEAD_H #define _TAILHEAD_H +#ifdef __cplusplus +extern "C" { +#endif + void free_tailhead(struct text_object *); void init_tailhead(const char *, const char *, struct text_object *, void *); void print_head(struct text_object *, char *, int); @@ -38,4 +42,8 @@ void print_tail(struct text_object *, char *, int); void print_lines(struct text_object *, char *, int); void print_words(struct text_object *, char *, int); +#ifdef __cplusplus +} +#endif + #endif /* _TAILHEAD_H */ diff --git a/src/tcp-portmon.c b/src/tcp-portmon.cc similarity index 96% rename from src/tcp-portmon.c rename to src/tcp-portmon.cc index 9ed1c340..d0b2abb3 100644 --- a/src/tcp-portmon.c +++ b/src/tcp-portmon.cc @@ -77,7 +77,7 @@ int tcp_portmon_init(struct text_object *obj, const char *arg) CRIT_ERR(NULL, NULL, "tcp_portmon: connection index must be non-negative"); } /* ok, args looks good. save the text object data */ - pmd = malloc(sizeof(struct tcp_port_monitor_data)); + pmd = (tcp_port_monitor_data*)malloc(sizeof(struct tcp_port_monitor_data)); memset(pmd, 0, sizeof(struct tcp_port_monitor_data)); pmd->port_range_begin = (in_port_t) port_begin; pmd->port_range_end = (in_port_t) port_end; @@ -109,7 +109,7 @@ int tcp_portmon_init(struct text_object *obj, const char *arg) void tcp_portmon_action(struct text_object *obj, char *p, int p_max_size) { - struct tcp_port_monitor_data *pmd = obj->data.opaque; + struct tcp_port_monitor_data *pmd = (tcp_port_monitor_data*)obj->data.opaque; tcp_port_monitor_t *p_monitor; if (!pmd) diff --git a/src/tcp-portmon.h b/src/tcp-portmon.h index c9e15935..a97feaff 100644 --- a/src/tcp-portmon.h +++ b/src/tcp-portmon.h @@ -16,8 +16,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . * - * $Id$ - * */ #ifndef _TCP_PORTMON_H #define _TCP_PORTMON_H diff --git a/src/temphelper.h b/src/temphelper.h index 19f97af7..70ced553 100644 --- a/src/temphelper.h +++ b/src/temphelper.h @@ -24,6 +24,10 @@ #ifndef TEMPHELPER_H #define TEMPHELPER_H +#ifdef __cplusplus +extern "C" { +#endif + enum TEMP_UNIT { TEMP_CELSIUS, TEMP_FAHRENHEIT @@ -32,4 +36,8 @@ enum TEMP_UNIT { int set_temp_output_unit(const char *); int temp_print(char *, size_t, double, enum TEMP_UNIT); +#ifdef __cplusplus +} +#endif + #endif /* TEMPHELPER_H */ diff --git a/src/template.h b/src/template.h index a9ad267e..cae89b61 100644 --- a/src/template.h +++ b/src/template.h @@ -31,10 +31,18 @@ #ifndef _TEMPLATE_H #define _TEMPLATE_H +#ifdef __cplusplus +extern "C" { +#endif + void free_templates(void); int set_template(int, const char *); char *find_and_replace_templates(const char *); int text_contains_templates(const char *); +#ifdef __cplusplus +} +#endif + #endif /* _TEMPLATE_H */ diff --git a/src/text_object.h b/src/text_object.h index 11221e1d..73489e4c 100644 --- a/src/text_object.h +++ b/src/text_object.h @@ -33,6 +33,10 @@ #include "config.h" /* for the defines */ #include "specials.h" /* enum special_types */ +#ifdef __cplusplus +extern "C" { +#endif + enum text_object_type { OBJ_read_tcp, OBJ_addr, @@ -549,4 +553,8 @@ int ifblock_stack_empty(void **opaque); /* make the given object be a plain text object printing given string */ void obj_be_plain_text(struct text_object *, const char *); +#ifdef __cplusplus +} +#endif + #endif /* _TEXT_OBJECT_H */ diff --git a/src/timed_thread.h b/src/timed_thread.h index cc4adcd2..5b9d1591 100644 --- a/src/timed_thread.h +++ b/src/timed_thread.h @@ -27,6 +27,10 @@ /* 10000 microseconds = 10 ms = 0.01 sec */ #define MINIMUM_INTERVAL_USECS 10000 +#ifdef __cplusplus +extern "C" { +#endif + /* opaque structure for clients */ typedef struct _timed_thread timed_thread; @@ -66,4 +70,7 @@ void timed_thread_destroy_registered_threads(void); /* returns read file descriptor for thread pipe */ int timed_thread_readfd(timed_thread *p_timed_thread); +#ifdef __cplusplus +} +#endif #endif /* #ifdef _TIMED_THREAD_H_ */ diff --git a/src/timeinfo.h b/src/timeinfo.h index 88fa6ed2..46b58d05 100644 --- a/src/timeinfo.h +++ b/src/timeinfo.h @@ -30,6 +30,10 @@ #ifndef _TIMEINFO_H #define _TIMEINFO_H +#ifdef __cplusplus +extern "C" { +#endif + /* for the times_in_seconds configuration variable and it's users */ void set_times_in_seconds(char); char times_in_seconds(void); @@ -51,4 +55,8 @@ void print_format_time(struct text_object *obj, char *p, int p_max_size); void free_time(struct text_object *); void free_tztime(struct text_object *); +#ifdef __cplusplus +} +#endif + #endif /* _TIMEINFO_H */ diff --git a/src/top.h b/src/top.h index b3eb0a3c..deddf1de 100644 --- a/src/top.h +++ b/src/top.h @@ -64,6 +64,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + /****************************************** * Defines * ******************************************/ @@ -149,4 +153,8 @@ void free_top(struct text_object *); int set_top_name_width(const char *); +#ifdef __cplusplus +} +#endif + #endif /* _top_h_ */ diff --git a/src/user.h b/src/user.h index 58c7083b..312475e8 100644 --- a/src/user.h +++ b/src/user.h @@ -31,7 +31,15 @@ #ifndef _USER_H #define _USER_H +#ifdef __cplusplus +extern "C" { +#endif + void print_gid_name(struct text_object *obj, char *p, int p_max_size); void print_uid_name(struct text_object *obj, char *p, int p_max_size); +#ifdef __cplusplus +} +#endif + #endif /* _USER_H */ diff --git a/src/users.h b/src/users.h index 885fbc1c..920d223f 100644 --- a/src/users.h +++ b/src/users.h @@ -31,6 +31,10 @@ #ifndef _USERS_H #define _USERS_H +#ifdef __cplusplus +extern "C" { +#endif + void update_users(void); void print_user_names(struct text_object *, char *, int); @@ -44,4 +48,8 @@ void free_user_terms(struct text_object *); void free_user_times(struct text_object *); void free_user_time(struct text_object *); +#ifdef __cplusplus +} +#endif + #endif /* _USERS_H */ diff --git a/src/weather.h b/src/weather.h index 713a1ea8..db9603a8 100644 --- a/src/weather.h +++ b/src/weather.h @@ -30,6 +30,10 @@ #ifndef WEATHER_H_ #define WEATHER_H_ +#ifdef __cplusplus +extern "C" { +#endif + /* Prototypes */ void weather_free_info(void); @@ -43,4 +47,8 @@ void scan_weather_arg(struct text_object *, const char *, void *); void print_weather(struct text_object *, char *, int); void free_weather(struct text_object *); +#ifdef __cplusplus +} +#endif + #endif /*WEATHER_H_*/ diff --git a/src/x11.h b/src/x11.h index fbed45f8..cc298bc1 100644 --- a/src/x11.h +++ b/src/x11.h @@ -85,6 +85,10 @@ extern int workarea[4]; extern struct conky_window window; extern char window_created; +#ifdef __cplusplus +extern "C" { +#endif + void init_X11(const char*); void init_window(int use_own_window, int width, int height, int set_trans, int back_colour, char **argv, int argc); @@ -105,5 +109,9 @@ void free_desktop_info(void); void xdbe_swap_buffers(void); #endif /* HAVE_XDBE */ +#ifdef __cplusplus +} +#endif + #endif /*X11_H_*/ #endif /* X11 */