drop adt746x objects
[monky] / src / common.h
index be18280..53bee4f 100644 (file)
@@ -1,3 +1,7 @@
+/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*- 
+ * vim: ts=4 sw=4 noet ai cindent syntax=c
+ */
+
 #ifndef _COMMON_H
 #define _COMMON_H
 
@@ -5,7 +9,14 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/socket.h>
+#include "text_object.h"
+
+void add_update_callback(void (*func)(void));
+void free_update_callbacks(void);
+void start_update_threading(void);
+
 
+void strfold(char *start, int count);
 int check_mount(char *s);
 void prepare_update(void);
 void update_uptime(void);
@@ -14,6 +25,7 @@ void update_net_stats(void);
 void update_cpu_usage(void);
 void update_total_processes(void);
 void update_uname(void);
+void update_threads(void);
 void update_running_processes(void);
 void update_i8k(void);
 void update_stuff(void);
@@ -27,7 +39,12 @@ struct process *get_first_process(void);
 void get_cpu_count(void);
 double get_time(void);
 
-FILE *open_file(const char *, int *);
+/* Converts '~/...' paths to '/home/blah/...' assumes that 'dest' is at least
+ * DEFAULT_TEXT_BUFFER_SIZE.  It's similar to variable_substitute, except only
+ * cheques for $HOME and ~/ in path */
+void to_real_path(char *dest, const char *source);
+FILE *open_file(const char *file, int *reported);
+int open_fifo(const char *file, int *reported);
 void variable_substitute(const char *s, char *dest, unsigned int n);
 
 void format_seconds(char *buf, unsigned int n, long t);
@@ -37,41 +54,11 @@ void format_seconds_short(char *buf, unsigned int n, long t);
 void update_x11info(void);
 #endif
 
-int round_to_int(float);
-
-extern unsigned long long need_mask;
-extern int no_buffers;
+int round_to_int_temp(float);
 
-struct dns_data {
-        int nscount;
-        char **ns_list;
-};
-void free_dns_data(void);
+unsigned int round_to_int(float);
 
-struct net_stat {
-        const char *dev;
-        int up;
-        long long last_read_recv, last_read_trans;
-        long long recv, trans;
-        double recv_speed, trans_speed;
-        struct sockaddr addr;
-#if defined(__linux__)
-        char addrs[273];
-#endif /* __linux__ */
-        double net_rec[15], net_trans[15];
-        // wireless extensions
-        char essid[32];
-        char bitrate[16];
-        char mode[16];
-        int link_qual;
-        int link_qual_max;
-        char ap[18];
-};
-void clear_net_stats(void);
-struct net_stat *get_net_stat(const char *);
-
-void get_adt746x_cpu(char *, size_t);
-void get_adt746x_fan(char *, size_t);
+extern int no_buffers;
 
 int open_acpi_temperature(const char *name);
 double get_acpi_temperature(int fd);
@@ -82,4 +69,11 @@ int get_battery_perct(const char *bat);
 int get_battery_perct_bar(const char *bat);
 void get_battery_short_status(char *buf, unsigned int n, const char *bat);
 
+void scan_loadavg_arg(struct text_object *, const char *);
+void print_loadavg(struct text_object *, char *, int);
+#ifdef X11
+void scan_loadgraph_arg(struct text_object *, const char *);
+void print_loadgraph(struct text_object *, char *);
+#endif /* X11 */
+
 #endif /* _COMMON_H */