Uptime meter for FreeBSD.

This will produce too much replicated code.
I think I'll use a lighter abstraction in things like this.
This commit is contained in:
Hisham Muhammad 2014-11-27 19:33:37 -02:00
parent 79662291fa
commit a9f05c2a8b
3 changed files with 39 additions and 4 deletions

View File

@ -45,10 +45,12 @@ endif
if HTOP_FREEBSD if HTOP_FREEBSD
myhtopplatsources = freebsd/Platform.c freebsd/FreeBSDProcessList.c \ myhtopplatsources = freebsd/Platform.c freebsd/FreeBSDProcessList.c \
freebsd/FreeBSDCRT.c freebsd/FreeBSDCRT.c \
freebsd/UptimeMeter.c
myhtopplatheaders = freebsd/Platform.h freebsd/FreeBSDProcessList.h \ myhtopplatheaders = freebsd/Platform.h freebsd/FreeBSDProcessList.h \
freebsd/FreeBSDCRT.h freebsd/FreeBSDCRT.h \
freebsd/UptimeMeter.h
endif endif
if HTOP_UNSUPPORTED if HTOP_UNSUPPORTED

View File

@ -1,11 +1,21 @@
/* /*
htop - unsupported/Platform.c htop - freebsd/Platform.c
(C) 2014 Hisham H. Muhammad (C) 2014 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file Released under the GNU GPL, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "Platform.h" #include "Platform.h"
#include "Meter.h"
#include "CPUMeter.h"
#include "MemoryMeter.h"
#include "SwapMeter.h"
#include "TasksMeter.h"
#include "LoadAverageMeter.h"
#include "UptimeMeter.h"
#include "BatteryMeter.h"
#include "ClockMeter.h"
#include "HostnameMeter.h"
/*{ /*{
#include "Action.h" #include "Action.h"
@ -15,3 +25,24 @@ void Platform_setBindings(Htop_Action* keys) {
(void) keys; (void) keys;
} }
MeterClass* Platform_meterTypes[] = {
&CPUMeter_class,
&ClockMeter_class,
&LoadAverageMeter_class,
&LoadMeter_class,
&MemoryMeter_class,
&SwapMeter_class,
&TasksMeter_class,
&UptimeMeter_class,
&BatteryMeter_class,
&HostnameMeter_class,
&AllCPUsMeter_class,
&AllCPUs2Meter_class,
&LeftCPUsMeter_class,
&RightCPUsMeter_class,
&LeftCPUs2Meter_class,
&RightCPUs2Meter_class,
&BlankMeter_class,
NULL
};

View File

@ -3,7 +3,7 @@
#ifndef HEADER_Platform #ifndef HEADER_Platform
#define HEADER_Platform #define HEADER_Platform
/* /*
htop - unsupported/Platform.h htop - freebsd/Platform.h
(C) 2014 Hisham H. Muhammad (C) 2014 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file Released under the GNU GPL, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
@ -13,5 +13,7 @@ in the source distribution for its full text.
void Platform_setBindings(Htop_Action* keys); void Platform_setBindings(Htop_Action* keys);
extern MeterClass* Platform_meterTypes[];
#endif #endif