major header cleanup

This commit is contained in:
Hisham Muhammad 2011-12-26 21:35:57 +00:00
parent 81e44312b4
commit 84281bdc44
80 changed files with 491 additions and 591 deletions

View File

@ -1,6 +1,12 @@
/*
htop - Affinity.c
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "config.h"
#include "Affinity.h" #include "Affinity.h"
#include <stdlib.h> #include <stdlib.h>
/*{ /*{

View File

@ -1,11 +1,24 @@
/*
htop - AffinityPanel.c
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "ProcessList.h"
#include "AffinityPanel.h" #include "AffinityPanel.h"
#include "Panel.h"
#include "CheckItem.h"
#include "CheckItem.h"
#include "debug.h" #include "debug.h"
#include <assert.h> #include <assert.h>
#include <string.h>
/*{
#include "Panel.h"
#include "Affinity.h"
#include "ProcessList.h"
#include "ListItem.h"
}*/
static HandlerResult AffinityPanel_eventHandler(Panel* this, int ch) { static HandlerResult AffinityPanel_eventHandler(Panel* this, int ch) {
CheckItem* selected = (CheckItem*) Panel_getSelected(this); CheckItem* selected = (CheckItem*) Panel_getSelected(this);

View File

@ -2,13 +2,17 @@
#ifndef HEADER_AffinityPanel #ifndef HEADER_AffinityPanel
#define HEADER_AffinityPanel #define HEADER_AffinityPanel
/*
htop - AffinityPanel.h
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "ProcessList.h"
#include "Panel.h" #include "Panel.h"
#include "CheckItem.h" #include "Affinity.h"
#include "ProcessList.h"
#include "debug.h" #include "ListItem.h"
#include <assert.h>
Panel* AffinityPanel_new(ProcessList* pl, Affinity* affinity); Panel* AffinityPanel_new(ProcessList* pl, Affinity* affinity);

View File

@ -1,16 +1,24 @@
/*
htop - AvailableColumnsPanel.c
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "AvailableColumnsPanel.h" #include "AvailableColumnsPanel.h"
#include "Settings.h"
#include "Header.h" #include "Header.h"
#include "ScreenManager.h"
#include "ColumnsPanel.h" #include "ColumnsPanel.h"
#include "Panel.h"
#include "debug.h" #include "debug.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h>
#include <ctype.h>
/*{ /*{
#include "Panel.h"
#include "Settings.h"
#include "ScreenManager.h"
typedef struct AvailableColumnsPanel_ { typedef struct AvailableColumnsPanel_ {
Panel super; Panel super;

View File

@ -2,17 +2,16 @@
#ifndef HEADER_AvailableColumnsPanel #ifndef HEADER_AvailableColumnsPanel
#define HEADER_AvailableColumnsPanel #define HEADER_AvailableColumnsPanel
/*
#include "Settings.h" htop - AvailableColumnsPanel.h
#include "Header.h" (C) 2004-2011 Hisham H. Muhammad
#include "ScreenManager.h" Released under the GNU GPL, see the COPYING file
#include "ColumnsPanel.h" in the source distribution for its full text.
*/
#include "Panel.h" #include "Panel.h"
#include "Settings.h"
#include "debug.h" #include "ScreenManager.h"
#include <assert.h>
typedef struct AvailableColumnsPanel_ { typedef struct AvailableColumnsPanel_ {
Panel super; Panel super;

View File

@ -1,16 +1,24 @@
/*
htop - AvailableMetersPanel.c
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "AvailableMetersPanel.h" #include "AvailableMetersPanel.h"
#include "Settings.h"
#include "Header.h"
#include "ScreenManager.h"
#include "CPUMeter.h" #include "CPUMeter.h"
#include "Header.h"
#include "Panel.h" #include "ListItem.h"
#include "debug.h" #include "debug.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h>
/*{ /*{
#include "Settings.h"
#include "Panel.h"
#include "ScreenManager.h"
typedef struct AvailableMetersPanel_ { typedef struct AvailableMetersPanel_ {
Panel super; Panel super;

View File

@ -2,17 +2,16 @@
#ifndef HEADER_AvailableMetersPanel #ifndef HEADER_AvailableMetersPanel
#define HEADER_AvailableMetersPanel #define HEADER_AvailableMetersPanel
/*
htop - AvailableMetersPanel.h
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "Settings.h" #include "Settings.h"
#include "Header.h"
#include "ScreenManager.h"
#include "CPUMeter.h"
#include "Panel.h" #include "Panel.h"
#include "ScreenManager.h"
#include "debug.h"
#include <assert.h>
typedef struct AvailableMetersPanel_ { typedef struct AvailableMetersPanel_ {
Panel super; Panel super;

View File

@ -1,20 +1,26 @@
/* /*
htop htop - BatteryMeter.c
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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.
This "Meter" written by Ian P. Hands (iphands@gmail.com, ihands@redhat.com). This meter written by Ian P. Hands (iphands@gmail.com, ihands@redhat.com).
*/ */
#include "BatteryMeter.h" #include "BatteryMeter.h"
#include "Meter.h"
#include "ProcessList.h" #include "ProcessList.h"
#include "CRT.h" #include "CRT.h"
#include "String.h" #include "String.h"
#include "debug.h" #include "debug.h"
#include <string.h>
#include <stdlib.h>
#include <dirent.h>
#include <unistd.h>
/*{ /*{
#include "Meter.h"
typedef enum ACPresence_ { typedef enum ACPresence_ {
AC_ABSENT, AC_ABSENT,

View File

@ -3,20 +3,15 @@
#ifndef HEADER_BatteryMeter #ifndef HEADER_BatteryMeter
#define HEADER_BatteryMeter #define HEADER_BatteryMeter
/* /*
htop htop - BatteryMeter.h
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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.
This "Meter" written by Ian P. Hands (iphands@gmail.com, ihands@redhat.com). This meter written by Ian P. Hands (iphands@gmail.com, ihands@redhat.com).
*/ */
#include "Meter.h" #include "Meter.h"
#include "ProcessList.h"
#include "CRT.h"
#include "String.h"
#include "debug.h"
typedef enum ACPresence_ { typedef enum ACPresence_ {
AC_ABSENT, AC_ABSENT,

View File

@ -6,17 +6,20 @@ in the source distribution for its full text.
*/ */
#include "CPUMeter.h" #include "CPUMeter.h"
#include "Meter.h"
#include "CRT.h"
#include "ProcessList.h" #include "ProcessList.h"
#include "debug.h"
#include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <curses.h> #include <curses.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include "debug.h" /*{
#include <assert.h> #include "Meter.h"
}*/
int CPUMeter_attributes[] = { int CPUMeter_attributes[] = {
CPU_NICE, CPU_NORMAL, CPU_KERNEL, CPU_IRQ, CPU_SOFTIRQ, CPU_IOWAIT, CPU_STEAL, CPU_GUEST CPU_NICE, CPU_NORMAL, CPU_KERNEL, CPU_IRQ, CPU_SOFTIRQ, CPU_IOWAIT, CPU_STEAL, CPU_GUEST

View File

@ -11,16 +11,6 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
#include "ProcessList.h"
#include <stdlib.h>
#include <curses.h>
#include <string.h>
#include <math.h>
#include "debug.h"
#include <assert.h>
extern int CPUMeter_attributes[]; extern int CPUMeter_attributes[];
#ifndef MIN #ifndef MIN

15
CRT.c
View File

@ -7,19 +7,17 @@ in the source distribution for its full text.
#include "CRT.h" #include "CRT.h"
#include "config.h"
#include "String.h"
#include "debug.h"
#include <curses.h> #include <curses.h>
#include <signal.h> #include <signal.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h>
#ifdef HAVE_EXECINFO_H #ifdef HAVE_EXECINFO_H
#include <execinfo.h> #include <execinfo.h>
#endif #endif
#include "String.h"
#include "config.h"
#include "debug.h"
#define ColorPair(i,j) COLOR_PAIR((7-i)*8+j) #define ColorPair(i,j) COLOR_PAIR((7-i)*8+j)
#define COLORSCHEME_DEFAULT 0 #define COLORSCHEME_DEFAULT 0
@ -40,9 +38,8 @@ in the source distribution for its full text.
//#link curses //#link curses
bool CRT_hasColors;
/*{ /*{
#include <stdbool.h>
typedef enum ColorElements_ { typedef enum ColorElements_ {
RESET_COLOR, RESET_COLOR,
@ -112,6 +109,8 @@ typedef enum ColorElements_ {
// TODO: centralize these in Settings. // TODO: centralize these in Settings.
static bool CRT_hasColors;
int CRT_delay = 0; int CRT_delay = 0;
int CRT_colorScheme = 0; int CRT_colorScheme = 0;

14
CRT.h
View File

@ -9,20 +9,9 @@ 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 <curses.h>
#include <signal.h>
#include <stdlib.h>
#include <stdbool.h>
#ifdef HAVE_EXECINFO_H #ifdef HAVE_EXECINFO_H
#include <execinfo.h>
#endif #endif
#include "String.h"
#include "config.h"
#include "debug.h"
#define ColorPair(i,j) COLOR_PAIR((7-i)*8+j) #define ColorPair(i,j) COLOR_PAIR((7-i)*8+j)
#define COLORSCHEME_DEFAULT 0 #define COLORSCHEME_DEFAULT 0
@ -43,8 +32,7 @@ in the source distribution for its full text.
//#link curses //#link curses
bool CRT_hasColors; #include <stdbool.h>
typedef enum ColorElements_ { typedef enum ColorElements_ {
RESET_COLOR, RESET_COLOR,

View File

@ -1,18 +1,27 @@
/*
htop - CategoriesPanel.c
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "CategoriesPanel.h" #include "CategoriesPanel.h"
#include "AvailableMetersPanel.h" #include "AvailableMetersPanel.h"
#include "MetersPanel.h" #include "MetersPanel.h"
#include "DisplayOptionsPanel.h" #include "DisplayOptionsPanel.h"
#include "ColumnsPanel.h" #include "ColumnsPanel.h"
#include "ColorsPanel.h" #include "ColorsPanel.h"
#include "AvailableColumnsPanel.h" #include "AvailableColumnsPanel.h"
#include "Panel.h"
#include "debug.h" #include "debug.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h>
/*{ /*{
#include "Panel.h"
#include "Settings.h"
#include "ScreenManager.h"
typedef struct CategoriesPanel_ { typedef struct CategoriesPanel_ {
Panel super; Panel super;

View File

@ -2,19 +2,16 @@
#ifndef HEADER_CategoriesPanel #ifndef HEADER_CategoriesPanel
#define HEADER_CategoriesPanel #define HEADER_CategoriesPanel
/*
#include "AvailableMetersPanel.h" htop - CategoriesPanel.h
#include "MetersPanel.h" (C) 2004-2011 Hisham H. Muhammad
#include "DisplayOptionsPanel.h" Released under the GNU GPL, see the COPYING file
#include "ColumnsPanel.h" in the source distribution for its full text.
#include "ColorsPanel.h" */
#include "AvailableColumnsPanel.h"
#include "Panel.h" #include "Panel.h"
#include "Settings.h"
#include "debug.h" #include "ScreenManager.h"
#include <assert.h>
typedef struct CategoriesPanel_ { typedef struct CategoriesPanel_ {
Panel super; Panel super;

View File

@ -1,17 +1,20 @@
/* /*
htop htop - CheckItem.c
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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 "CheckItem.h" #include "CheckItem.h"
#include "Object.h"
#include "CRT.h"
#include "CRT.h"
#include "debug.h" #include "debug.h"
#include <assert.h>
#include <stdlib.h>
/*{ /*{
#include "Object.h"
typedef struct CheckItem_ { typedef struct CheckItem_ {
Object super; Object super;

View File

@ -3,17 +3,13 @@
#ifndef HEADER_CheckItem #ifndef HEADER_CheckItem
#define HEADER_CheckItem #define HEADER_CheckItem
/* /*
htop htop - CheckItem.h
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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 "Object.h" #include "Object.h"
#include "CRT.h"
#include "debug.h"
typedef struct CheckItem_ { typedef struct CheckItem_ {
Object super; Object super;

View File

@ -1,16 +1,20 @@
/* /*
htop htop - ClockMeter.c
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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 "ClockMeter.h" #include "ClockMeter.h"
#include "Meter.h"
#include "CRT.h"
#include "debug.h"
#include <time.h> #include <time.h>
#include "debug.h" /*{
#include "Meter.h"
}*/
int ClockMeter_attributes[] = { int ClockMeter_attributes[] = {
CLOCK CLOCK

View File

@ -3,7 +3,7 @@
#ifndef HEADER_ClockMeter #ifndef HEADER_ClockMeter
#define HEADER_ClockMeter #define HEADER_ClockMeter
/* /*
htop htop - ClockMeter.h
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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.
@ -11,10 +11,6 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
#include <time.h>
#include "debug.h"
extern int ClockMeter_attributes[]; extern int ClockMeter_attributes[];
extern MeterType ClockMeter; extern MeterType ClockMeter;

View File

@ -1,15 +1,19 @@
/*
htop - ColorsPanel.c
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "config.h"
#include "CRT.h"
#include "ColorsPanel.h" #include "ColorsPanel.h"
#include "Panel.h" #include "CRT.h"
#include "CheckItem.h" #include "CheckItem.h"
#include "Settings.h"
#include "ScreenManager.h"
#include "debug.h" #include "debug.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h>
#include <string.h>
// TO ADD A NEW SCHEME: // TO ADD A NEW SCHEME:
// * Increment the size of bool check in ColorsPanel.h // * Increment the size of bool check in ColorsPanel.h
@ -18,6 +22,9 @@
// * Add the colors in CRT_setColors // * Add the colors in CRT_setColors
/*{ /*{
#include "Panel.h"
#include "Settings.h"
#include "ScreenManager.h"
typedef struct ColorsPanel_ { typedef struct ColorsPanel_ {
Panel super; Panel super;

View File

@ -2,17 +2,12 @@
#ifndef HEADER_ColorsPanel #ifndef HEADER_ColorsPanel
#define HEADER_ColorsPanel #define HEADER_ColorsPanel
/*
#include "config.h" htop - ColorsPanel.h
#include "CRT.h" (C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
#include "Panel.h" in the source distribution for its full text.
#include "CheckItem.h" */
#include "Settings.h"
#include "ScreenManager.h"
#include "debug.h"
#include <assert.h>
// TO ADD A NEW SCHEME: // TO ADD A NEW SCHEME:
// * Increment the size of bool check in ColorsPanel.h // * Increment the size of bool check in ColorsPanel.h
@ -20,6 +15,9 @@
// * Add a define in CRT.h that matches the order of the array // * Add a define in CRT.h that matches the order of the array
// * Add the colors in CRT_setColors // * Add the colors in CRT_setColors
#include "Panel.h"
#include "Settings.h"
#include "ScreenManager.h"
typedef struct ColorsPanel_ { typedef struct ColorsPanel_ {
Panel super; Panel super;

View File

@ -1,15 +1,24 @@
/*
htop - ColumnsPanel.c
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "ColumnsPanel.h" #include "ColumnsPanel.h"
#include "String.h"
#include "debug.h"
#include <assert.h>
#include <stdlib.h>
#include <ctype.h>
/*{
#include "Panel.h" #include "Panel.h"
#include "Settings.h" #include "Settings.h"
#include "ScreenManager.h" #include "ScreenManager.h"
#include "debug.h"
#include <assert.h>
/*{
typedef struct ColumnsPanel_ { typedef struct ColumnsPanel_ {
Panel super; Panel super;

View File

@ -2,16 +2,17 @@
#ifndef HEADER_ColumnsPanel #ifndef HEADER_ColumnsPanel
#define HEADER_ColumnsPanel #define HEADER_ColumnsPanel
/*
htop - ColumnsPanel.h
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "Panel.h" #include "Panel.h"
#include "Settings.h" #include "Settings.h"
#include "ScreenManager.h" #include "ScreenManager.h"
#include "debug.h"
#include <assert.h>
typedef struct ColumnsPanel_ { typedef struct ColumnsPanel_ {
Panel super; Panel super;

View File

@ -1,3 +1,9 @@
/*
htop - DebugMemory.c
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -2,12 +2,12 @@
#ifndef HEADER_DebugMemory #ifndef HEADER_DebugMemory
#define HEADER_DebugMemory #define HEADER_DebugMemory
/*
#include <string.h> htop - DebugMemory.h
#include <stdlib.h> (C) 2004-2011 Hisham H. Muhammad
#include <stdio.h> Released under the GNU GPL, see the COPYING file
#include <stdbool.h> in the source distribution for its full text.
#include <assert.h> */
#undef strdup #undef strdup
#undef malloc #undef malloc
@ -16,7 +16,6 @@
#undef free #undef free
typedef struct DebugMemoryItem_ DebugMemoryItem; typedef struct DebugMemoryItem_ DebugMemoryItem;
struct DebugMemoryItem_ { struct DebugMemoryItem_ {

View File

@ -1,15 +1,23 @@
/*
htop - DisplayOptionsPanel.c
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "DisplayOptionsPanel.h" #include "DisplayOptionsPanel.h"
#include "Panel.h"
#include "CheckItem.h" #include "CheckItem.h"
#include "Settings.h"
#include "ScreenManager.h"
#include "debug.h" #include "debug.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h>
#include <string.h>
/*{ /*{
#include "Panel.h"
#include "Settings.h"
#include "ScreenManager.h"
typedef struct DisplayOptionsPanel_ { typedef struct DisplayOptionsPanel_ {
Panel super; Panel super;

View File

@ -2,17 +2,17 @@
#ifndef HEADER_DisplayOptionsPanel #ifndef HEADER_DisplayOptionsPanel
#define HEADER_DisplayOptionsPanel #define HEADER_DisplayOptionsPanel
/*
htop - DisplayOptionsPanel.h
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "Panel.h" #include "Panel.h"
#include "CheckItem.h"
#include "Settings.h" #include "Settings.h"
#include "ScreenManager.h" #include "ScreenManager.h"
#include "debug.h"
#include <assert.h>
typedef struct DisplayOptionsPanel_ { typedef struct DisplayOptionsPanel_ {
Panel super; Panel super;

View File

@ -5,19 +5,19 @@ 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 "Object.h"
#include "FunctionBar.h" #include "FunctionBar.h"
#include "CRT.h" #include "CRT.h"
#include "debug.h" #include "debug.h"
#include <assert.h>
#include <assert.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
#include <curses.h> #include <curses.h>
/*{ /*{
#include "Object.h"
typedef struct FunctionBar_ { typedef struct FunctionBar_ {
Object super; Object super;

View File

@ -10,16 +10,6 @@ in the source distribution for its full text.
*/ */
#include "Object.h" #include "Object.h"
#include "CRT.h"
#include "debug.h"
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <curses.h>
typedef struct FunctionBar_ { typedef struct FunctionBar_ {
Object super; Object super;

View File

@ -1,5 +1,5 @@
/* /*
htop htop - Hashtable.c
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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.
@ -7,13 +7,14 @@ in the source distribution for its full text.
#include "Hashtable.h" #include "Hashtable.h"
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>
#include "debug.h" #include "debug.h"
#include <stdlib.h>
#include <assert.h>
/*{ /*{
#include <stdbool.h>
typedef struct Hashtable_ Hashtable; typedef struct Hashtable_ Hashtable;
typedef void(*Hashtable_PairFunction)(int, void*, void*); typedef void(*Hashtable_PairFunction)(int, void*, void*);

View File

@ -3,18 +3,13 @@
#ifndef HEADER_Hashtable #ifndef HEADER_Hashtable
#define HEADER_Hashtable #define HEADER_Hashtable
/* /*
htop htop - Hashtable.h
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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 <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
#include <assert.h>
#include "debug.h"
typedef struct Hashtable_ Hashtable; typedef struct Hashtable_ Hashtable;

View File

@ -6,13 +6,28 @@ in the source distribution for its full text.
*/ */
#include "Header.h" #include "Header.h"
#include "Meter.h"
#include "CRT.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 "String.h"
#include "debug.h" #include "debug.h"
#include <assert.h> #include <assert.h>
#include <time.h> #include <time.h>
#include <string.h>
#include <stdlib.h>
/*{ /*{
#include "ProcessList.h"
#include "Meter.h"
typedef enum HeaderSide_ { typedef enum HeaderSide_ {
LEFT_HEADER, LEFT_HEADER,

View File

@ -9,13 +9,9 @@ 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 "ProcessList.h"
#include "Meter.h" #include "Meter.h"
#include "debug.h"
#include <assert.h>
#include <time.h>
typedef enum HeaderSide_ { typedef enum HeaderSide_ {
LEFT_HEADER, LEFT_HEADER,
RIGHT_HEADER RIGHT_HEADER

View File

@ -1,16 +1,20 @@
/* /*
htop htop - HostnameMeter.c
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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 "HostnameMeter.h" #include "HostnameMeter.h"
#include "Meter.h"
#include "CRT.h"
#include "debug.h"
#include <unistd.h> #include <unistd.h>
#include "debug.h" /*{
#include "Meter.h"
}*/
int HostnameMeter_attributes[] = { int HostnameMeter_attributes[] = {
HOSTNAME HOSTNAME

View File

@ -3,7 +3,7 @@
#ifndef HEADER_HostnameMeter #ifndef HEADER_HostnameMeter
#define HEADER_HostnameMeter #define HEADER_HostnameMeter
/* /*
htop htop - HostnameMeter.h
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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.
@ -11,10 +11,6 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
#include <unistd.h>
#include "debug.h"
extern int HostnameMeter_attributes[]; extern int HostnameMeter_attributes[];
extern MeterType HostnameMeter; extern MeterType HostnameMeter;

View File

@ -6,14 +6,18 @@ in the source distribution for its full text.
*/ */
#include "ListItem.h" #include "ListItem.h"
#include "String.h"
#include "Object.h"
#include "RichString.h"
#include <string.h>
#include "CRT.h"
#include "String.h"
#include "RichString.h"
#include "debug.h" #include "debug.h"
#include <string.h>
#include <assert.h>
#include <stdlib.h>
/*{ /*{
#include "Object.h"
typedef struct ListItem_ { typedef struct ListItem_ {
Object super; Object super;

View File

@ -9,13 +9,7 @@ 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 "String.h"
#include "Object.h" #include "Object.h"
#include "RichString.h"
#include <string.h>
#include "debug.h"
typedef struct ListItem_ { typedef struct ListItem_ {
Object super; Object super;

View File

@ -1,16 +1,21 @@
/* /*
htop htop - LoadAverageMeter.c
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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 "LoadAverageMeter.h" #include "LoadAverageMeter.h"
#include "Meter.h"
#include "CRT.h"
#include "debug.h"
#include <curses.h> #include <curses.h>
#include <assert.h>
#include "debug.h" /*{
#include "Meter.h"
}*/
int LoadAverageMeter_attributes[] = { int LoadAverageMeter_attributes[] = {
LOAD_AVERAGE_FIFTEEN, LOAD_AVERAGE_FIVE, LOAD_AVERAGE_ONE LOAD_AVERAGE_FIFTEEN, LOAD_AVERAGE_FIVE, LOAD_AVERAGE_ONE

View File

@ -3,7 +3,7 @@
#ifndef HEADER_LoadAverageMeter #ifndef HEADER_LoadAverageMeter
#define HEADER_LoadAverageMeter #define HEADER_LoadAverageMeter
/* /*
htop htop - LoadAverageMeter.h
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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.
@ -11,10 +11,6 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
#include <curses.h>
#include "debug.h"
extern int LoadAverageMeter_attributes[]; extern int LoadAverageMeter_attributes[];
extern int LoadMeter_attributes[]; extern int LoadMeter_attributes[];

View File

@ -1,24 +1,27 @@
/* /*
htop htop - MemoryMeter.c
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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 "MemoryMeter.h" #include "MemoryMeter.h"
#include "Meter.h"
#include "CRT.h"
#include "ProcessList.h" #include "ProcessList.h"
#include "debug.h"
#include <stdlib.h> #include <stdlib.h>
#include <curses.h> #include <curses.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include <sys/param.h> #include <sys/param.h>
#include "debug.h"
#include <assert.h> #include <assert.h>
/*{
#include "Meter.h"
}*/
int MemoryMeter_attributes[] = { int MemoryMeter_attributes[] = {
MEMORY_USED, MEMORY_BUFFERS, MEMORY_CACHE MEMORY_USED, MEMORY_BUFFERS, MEMORY_CACHE
}; };

View File

@ -3,7 +3,7 @@
#ifndef HEADER_MemoryMeter #ifndef HEADER_MemoryMeter
#define HEADER_MemoryMeter #define HEADER_MemoryMeter
/* /*
htop htop - MemoryMeter.h
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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.
@ -11,17 +11,6 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
#include "ProcessList.h"
#include <stdlib.h>
#include <curses.h>
#include <string.h>
#include <math.h>
#include <sys/param.h>
#include "debug.h"
#include <assert.h>
extern int MemoryMeter_attributes[]; extern int MemoryMeter_attributes[];
extern MeterType MemoryMeter; extern MeterType MemoryMeter;

33
Meter.c
View File

@ -5,30 +5,40 @@ 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 "RichString.h"
#include "Meter.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 "RichString.h"
#include "Object.h" #include "Object.h"
#include "CRT.h" #include "CRT.h"
#include "ListItem.h"
#include "String.h" #include "String.h"
#include "ProcessList.h" #include "ListItem.h"
#include "debug.h"
#include <math.h> #include <math.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include "debug.h"
#include <assert.h> #include <assert.h>
#include <time.h>
#ifndef USE_FUNKY_MODES #ifndef USE_FUNKY_MODES
#include <time.h>
#define USE_FUNKY_MODES 1 #define USE_FUNKY_MODES 1
#endif #endif
#define METER_BUFFER_LEN 128 #define METER_BUFFER_LEN 128
/*{ /*{
#include "ListItem.h"
#include "ProcessList.h"
typedef struct Meter_ Meter; typedef struct Meter_ Meter;
typedef struct MeterType_ MeterType; typedef struct MeterType_ MeterType;
@ -96,17 +106,6 @@ typedef enum {
}*/ }*/
#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"
#ifndef MIN #ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b)) #define MIN(a,b) ((a)<(b)?(a):(b))
#endif #endif

29
Meter.h
View File

@ -9,28 +9,14 @@ 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 "RichString.h"
#include "Object.h"
#include "CRT.h"
#include "ListItem.h"
#include "String.h"
#include "ProcessList.h"
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include "debug.h"
#include <assert.h>
#ifndef USE_FUNKY_MODES #ifndef USE_FUNKY_MODES
#include <time.h>
#define USE_FUNKY_MODES 1 #define USE_FUNKY_MODES 1
#endif #endif
#define METER_BUFFER_LEN 128 #define METER_BUFFER_LEN 128
#include "ListItem.h"
#include "ProcessList.h"
typedef struct Meter_ Meter; typedef struct Meter_ Meter;
typedef struct MeterType_ MeterType; typedef struct MeterType_ MeterType;
@ -97,17 +83,6 @@ typedef enum {
} MeterModeId; } MeterModeId;
#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"
#ifndef MIN #ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b)) #define MIN(a,b) ((a)<(b)?(a):(b))
#endif #endif

View File

@ -1,14 +1,21 @@
/*
htop - MetersPanel.c
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "MetersPanel.h" #include "MetersPanel.h"
#include "Panel.h"
#include "Settings.h"
#include "ScreenManager.h"
#include "debug.h" #include "debug.h"
#include <stdlib.h>
#include <assert.h> #include <assert.h>
/*{ /*{
#include "Panel.h"
#include "Settings.h"
#include "ScreenManager.h"
typedef struct MetersPanel_ { typedef struct MetersPanel_ {
Panel super; Panel super;

View File

@ -2,16 +2,17 @@
#ifndef HEADER_MetersPanel #ifndef HEADER_MetersPanel
#define HEADER_MetersPanel #define HEADER_MetersPanel
/*
htop - MetersPanel.h
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "Panel.h" #include "Panel.h"
#include "Settings.h" #include "Settings.h"
#include "ScreenManager.h" #include "ScreenManager.h"
#include "debug.h"
#include <assert.h>
typedef struct MetersPanel_ { typedef struct MetersPanel_ {
Panel super; Panel super;

View File

@ -1,20 +1,21 @@
/* /*
htop htop - Object.c
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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 "Object.h" #include "Object.h"
#include "RichString.h"
#include "CRT.h" #include "CRT.h"
#include "debug.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdbool.h> #include <stdbool.h>
#include "debug.h"
/*{ /*{
#include "RichString.h"
#ifndef DEBUG #ifndef DEBUG
#define Object_setClass(obj, class) #define Object_setClass(obj, class)

View File

@ -3,20 +3,13 @@
#ifndef HEADER_Object #ifndef HEADER_Object
#define HEADER_Object #define HEADER_Object
/* /*
htop htop - Object.h
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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 "RichString.h" #include "RichString.h"
#include "CRT.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include "debug.h"
#ifndef DEBUG #ifndef DEBUG
#define Object_setClass(obj, class) #define Object_setClass(obj, class)

View File

@ -5,23 +5,27 @@ 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 "OpenFilesScreen.h"
#include "CRT.h"
#include "ProcessList.h"
#include "ListItem.h"
#include <string.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <stdbool.h> #include <stdbool.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include "OpenFilesScreen.h" /*{
#include "ProcessList.h"
#include "Process.h" #include "Process.h"
#include "ListItem.h"
#include "Panel.h" #include "Panel.h"
#include "FunctionBar.h" #include "FunctionBar.h"
/*{
typedef struct OpenFiles_ProcessData_ { typedef struct OpenFiles_ProcessData_ {
char* data[256]; char* data[256];
struct OpenFiles_FileData_* files; struct OpenFiles_FileData_* files;

View File

@ -9,22 +9,10 @@ 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 "config.h"
#include <stdio.h>
#include <unistd.h>
#include <stdbool.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "ProcessList.h"
#include "Process.h" #include "Process.h"
#include "ListItem.h"
#include "Panel.h" #include "Panel.h"
#include "FunctionBar.h" #include "FunctionBar.h"
typedef struct OpenFiles_ProcessData_ { typedef struct OpenFiles_ProcessData_ {
char* data[256]; char* data[256];
struct OpenFiles_FileData_* files; struct OpenFiles_FileData_* files;

14
Panel.c
View File

@ -5,23 +5,27 @@ 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 "Object.h"
#include "Panel.h" #include "Panel.h"
#include "Vector.h"
#include "CRT.h" #include "CRT.h"
#include "RichString.h" #include "RichString.h"
#include "ListItem.h" #include "ListItem.h"
#include "String.h"
#include "debug.h"
#include <math.h> #include <math.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdlib.h>
#include "debug.h" #include <ctype.h>
#include <string.h>
#include <assert.h> #include <assert.h>
#include <curses.h> #include <curses.h>
//#link curses //#link curses
/*{ /*{
#include "Object.h"
#include "Vector.h"
typedef struct Panel_ Panel; typedef struct Panel_ Panel;

16
Panel.h
View File

@ -9,21 +9,10 @@ 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 "Object.h"
#include "Vector.h"
#include "CRT.h"
#include "RichString.h"
#include "ListItem.h"
#include <math.h>
#include <stdbool.h>
#include "debug.h"
#include <assert.h>
#include <curses.h>
//#link curses //#link curses
#include "Object.h"
#include "Vector.h"
typedef struct Panel_ Panel; typedef struct Panel_ Panel;
@ -117,7 +106,6 @@ void Panel_draw(Panel* this, bool focus);
bool Panel_onKey(Panel* this, int key); bool Panel_onKey(Panel* this, int key);
HandlerResult Panel_selectByTyping(Panel* this, int ch); HandlerResult Panel_selectByTyping(Panel* this, int ch);
#endif #endif

View File

@ -5,29 +5,28 @@ 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 "Process.h"
#include "ProcessList.h" #include "ProcessList.h"
#include "Object.h"
#include "CRT.h" #include "CRT.h"
#include "String.h" #include "String.h"
#include "Process.h"
#include "RichString.h" #include "RichString.h"
#include "Affinity.h"
#include "debug.h" #include "debug.h"
#include <stdio.h> #include <stdio.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/resource.h> #include <sys/resource.h>
#include <sys/param.h> #include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h>
#include <signal.h> #include <signal.h>
#include <string.h> #include <string.h>
#include <stdbool.h> #include <stdbool.h>
#include <pwd.h> #include <pwd.h>
#include <sched.h> #include <sched.h>
#include <time.h> #include <time.h>
#include <assert.h>
#ifdef HAVE_LIBHWLOC #ifdef HAVE_LIBHWLOC
#include <hwloc/linux.h> #include <hwloc/linux.h>
@ -41,6 +40,9 @@ in the source distribution for its full text.
#define PAGE_SIZE_KB ( PAGE_SIZE / ONE_K ) #define PAGE_SIZE_KB ( PAGE_SIZE / ONE_K )
/*{ /*{
#include "Object.h"
#include "Affinity.h"
#include <sys/types.h>
#ifndef Process_isKernelThread #ifndef Process_isKernelThread
#define Process_isKernelThread(_process) (_process->pgrp == 0) #define Process_isKernelThread(_process) (_process->pgrp == 0)

View File

@ -9,31 +9,7 @@ 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 "ProcessList.h"
#include "Object.h"
#include "CRT.h"
#include "String.h"
#include "RichString.h"
#include "Affinity.h"
#include "debug.h"
#include <stdio.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
#include <stdbool.h>
#include <pwd.h>
#include <sched.h>
#include <time.h>
#ifdef HAVE_LIBHWLOC #ifdef HAVE_LIBHWLOC
#include <hwloc/linux.h>
#endif #endif
// This works only with glibc 2.1+. On earlier versions // This works only with glibc 2.1+. On earlier versions
@ -43,6 +19,9 @@ in the source distribution for its full text.
#endif #endif
#define PAGE_SIZE_KB ( PAGE_SIZE / ONE_K ) #define PAGE_SIZE_KB ( PAGE_SIZE / ONE_K )
#include "Object.h"
#include "Affinity.h"
#include <sys/types.h>
#ifndef Process_isKernelThread #ifndef Process_isKernelThread
#define Process_isKernelThread(_process) (_process->pgrp == 0) #define Process_isKernelThread(_process) (_process->pgrp == 0)

View File

@ -5,20 +5,14 @@ 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.
*/ */
#ifndef CONFIG_H
#define CONFIG_H
#include "config.h"
#endif
#include "ProcessList.h" #include "ProcessList.h"
#include "Process.h"
#include "Vector.h"
#include "UsersTable.h"
#include "Hashtable.h"
#include "String.h"
#include "Panel.h"
#include <sys/types.h> #include "CRT.h"
#include "String.h"
#include "debug.h"
#include <sys/time.h>
#include <sys/utsname.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <dirent.h> #include <dirent.h>
@ -26,14 +20,19 @@ in the source distribution for its full text.
#include <stdio.h> #include <stdio.h>
#include <signal.h> #include <signal.h>
#include <stdbool.h> #include <stdbool.h>
#include <sys/utsname.h>
#include <stdarg.h> #include <stdarg.h>
#include <math.h> #include <math.h>
#include <string.h>
#include "debug.h" #include <time.h>
#include <assert.h> #include <assert.h>
/*{ /*{
#include "Vector.h"
#include "Hashtable.h"
#include "UsersTable.h"
#include "Panel.h"
#include "Process.h"
#include <sys/types.h>
#ifndef PROCDIR #ifndef PROCDIR
#define PROCDIR "/proc" #define PROCDIR "/proc"

View File

@ -9,33 +9,12 @@ 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.
*/ */
#ifndef CONFIG_H
#define CONFIG_H
#include "config.h"
#endif
#include "Process.h"
#include "Vector.h" #include "Vector.h"
#include "UsersTable.h"
#include "Hashtable.h" #include "Hashtable.h"
#include "String.h" #include "UsersTable.h"
#include "Panel.h" #include "Panel.h"
#include "Process.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <stdbool.h>
#include <sys/utsname.h>
#include <stdarg.h>
#include <math.h>
#include "debug.h"
#include <assert.h>
#ifndef PROCDIR #ifndef PROCDIR
#define PROCDIR "/proc" #define PROCDIR "/proc"

View File

@ -1,13 +1,19 @@
/*
htop - RichString.c
(C) 2004,2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "RichString.h" #include "RichString.h"
#ifndef CONFIG_H
#define CONFIG_H
#include "config.h"
#endif
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#define RICHSTRING_MAXLEN 300
/*{
#include "config.h"
#include <ctype.h> #include <ctype.h>
#include "debug.h" #include "debug.h"
@ -22,10 +28,6 @@
#include <curses.h> #include <curses.h>
#endif #endif
#define RICHSTRING_MAXLEN 300
/*{
#define RichString_size(this) ((this)->chlen) #define RichString_size(this) ((this)->chlen)
#define RichString_sizeVal(this) ((this).chlen) #define RichString_sizeVal(this) ((this).chlen)

View File

@ -2,15 +2,16 @@
#ifndef HEADER_RichString #ifndef HEADER_RichString
#define HEADER_RichString #define HEADER_RichString
/*
htop - RichString.h
(C) 2004,2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#define RICHSTRING_MAXLEN 300
#ifndef CONFIG_H
#define CONFIG_H
#include "config.h" #include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
#include <ctype.h> #include <ctype.h>
#include "debug.h" #include "debug.h"
@ -25,9 +26,6 @@
#include <curses.h> #include <curses.h>
#endif #endif
#define RICHSTRING_MAXLEN 300
#define RichString_size(this) ((this)->chlen) #define RichString_size(this) ((this)->chlen)
#define RichString_sizeVal(this) ((this).chlen) #define RichString_sizeVal(this) ((this).chlen)

View File

@ -1,24 +1,25 @@
/* /*
htop htop - ScreenManager.c
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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 "ScreenManager.h" #include "ScreenManager.h"
#include "Panel.h" #include "Panel.h"
#include "Object.h" #include "Object.h"
#include "Vector.h"
#include "Header.h"
#include "FunctionBar.h"
#include "debug.h" #include "debug.h"
#include <assert.h> #include <assert.h>
#include <time.h> #include <time.h>
#include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
/*{ /*{
#include "FunctionBar.h"
#include "Vector.h"
#include "Header.h"
typedef enum Orientation_ { typedef enum Orientation_ {
VERTICAL, VERTICAL,

View File

@ -3,24 +3,15 @@
#ifndef HEADER_ScreenManager #ifndef HEADER_ScreenManager
#define HEADER_ScreenManager #define HEADER_ScreenManager
/* /*
htop htop - ScreenManager.h
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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 "Panel.h" #include "FunctionBar.h"
#include "Object.h"
#include "Vector.h" #include "Vector.h"
#include "Header.h" #include "Header.h"
#include "FunctionBar.h"
#include "debug.h"
#include <assert.h>
#include <time.h>
#include <stdbool.h>
typedef enum Orientation_ { typedef enum Orientation_ {
VERTICAL, VERTICAL,

View File

@ -5,17 +5,23 @@ 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 "config.h"
#include "Settings.h" #include "Settings.h"
#include "String.h"
#include "ProcessList.h"
#include "Header.h"
#include "String.h"
#include "Vector.h"
#include "debug.h" #include "debug.h"
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define DEFAULT_DELAY 15 #define DEFAULT_DELAY 15
/*{ /*{
#include "ProcessList.h"
#include "Header.h"
#include <stdbool.h>
typedef struct Settings_ { typedef struct Settings_ {
char* userSettings; char* userSettings;

View File

@ -9,15 +9,11 @@ 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 "config.h"
#include "String.h"
#include "ProcessList.h"
#include "Header.h"
#include "debug.h"
#define DEFAULT_DELAY 15 #define DEFAULT_DELAY 15
#include "ProcessList.h"
#include "Header.h"
#include <stdbool.h>
typedef struct Settings_ { typedef struct Settings_ {
char* userSettings; char* userSettings;

View File

@ -1,15 +1,23 @@
/*
htop - SignalsPanel.c
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "SignalsPanel.h" #include "SignalsPanel.h"
#include "Panel.h"
#include "ListItem.h" #include "ListItem.h"
#include "RichString.h" #include "RichString.h"
#include "debug.h" #include "debug.h"
#include <stdlib.h>
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>
/*{ /*{
#include "Panel.h"
typedef struct SignalItem_ { typedef struct SignalItem_ {
const char* name; const char* name;

View File

@ -2,16 +2,14 @@
#ifndef HEADER_SignalsPanel #ifndef HEADER_SignalsPanel
#define HEADER_SignalsPanel #define HEADER_SignalsPanel
/*
htop - SignalsPanel.h
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "Panel.h" #include "Panel.h"
#include "ListItem.h"
#include "RichString.h"
#include "debug.h"
#include <assert.h>
#include <ctype.h>
typedef struct SignalItem_ { typedef struct SignalItem_ {
const char* name; const char* name;

View File

@ -1,19 +1,20 @@
/* /*
htop htop - String.c
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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 "config.h"
#include "String.h" #include "String.h"
#include "config.h"
#include "debug.h"
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "debug.h"
/*{ /*{
#define String_startsWith(s, match) (strstr((s), (match)) == (s)) #define String_startsWith(s, match) (strstr((s), (match)) == (s))
}*/ }*/

View File

@ -3,20 +3,12 @@
#ifndef HEADER_String #ifndef HEADER_String
#define HEADER_String #define HEADER_String
/* /*
htop htop - String.h
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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 "config.h"
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <stdio.h>
#include "debug.h"
#define String_startsWith(s, match) (strstr((s), (match)) == (s)) #define String_startsWith(s, match) (strstr((s), (match)) == (s))
char* String_cat(const char* s1, const char* s2); char* String_cat(const char* s1, const char* s2);

View File

@ -1,24 +1,27 @@
/* /*
htop htop - SwapMeter.c
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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 "SwapMeter.h" #include "SwapMeter.h"
#include "Meter.h"
#include "CRT.h"
#include "ProcessList.h" #include "ProcessList.h"
#include "debug.h"
#include <stdlib.h> #include <stdlib.h>
#include <curses.h> #include <curses.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include <sys/param.h> #include <sys/param.h>
#include "debug.h"
#include <assert.h> #include <assert.h>
/*{
#include "Meter.h"
}*/
#define KILOBYTE 1 #define KILOBYTE 1
#define MEGABYTE 1024 #define MEGABYTE 1024
#define GIGABYTE 1048576 #define GIGABYTE 1048576

View File

@ -3,7 +3,7 @@
#ifndef HEADER_SwapMeter #ifndef HEADER_SwapMeter
#define HEADER_SwapMeter #define HEADER_SwapMeter
/* /*
htop htop - SwapMeter.h
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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.
@ -11,17 +11,6 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
#include "ProcessList.h"
#include <stdlib.h>
#include <curses.h>
#include <string.h>
#include <math.h>
#include <sys/param.h>
#include "debug.h"
#include <assert.h>
#define KILOBYTE 1 #define KILOBYTE 1
#define MEGABYTE 1024 #define MEGABYTE 1024
#define GIGABYTE 1048576 #define GIGABYTE 1048576

View File

@ -1,19 +1,20 @@
/* /*
htop htop - TasksMeter.c
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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 "TasksMeter.h" #include "TasksMeter.h"
#include "Meter.h"
#include "ProcessList.h" #include "ProcessList.h"
#include "CRT.h" #include "CRT.h"
#include "debug.h" #include "debug.h"
/*{
#include "Meter.h"
}*/
int TasksMeter_attributes[] = { int TasksMeter_attributes[] = {
TASKS_RUNNING TASKS_RUNNING
}; };

View File

@ -3,7 +3,7 @@
#ifndef HEADER_TasksMeter #ifndef HEADER_TasksMeter
#define HEADER_TasksMeter #define HEADER_TasksMeter
/* /*
htop htop - TasksMeter.h
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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.
@ -11,12 +11,6 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
#include "ProcessList.h"
#include "CRT.h"
#include "debug.h"
extern int TasksMeter_attributes[]; extern int TasksMeter_attributes[];
extern MeterType TasksMeter; extern MeterType TasksMeter;

View File

@ -5,24 +5,27 @@ 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 "config.h" #include "TraceScreen.h"
#include "CRT.h"
#include "ProcessList.h"
#include "ListItem.h"
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include "TraceScreen.h" /*{
#include "ProcessList.h"
#include "Process.h" #include "Process.h"
#include "ListItem.h"
#include "Panel.h" #include "Panel.h"
#include "FunctionBar.h" #include "FunctionBar.h"
/*{
typedef struct TraceScreen_ { typedef struct TraceScreen_ {
Process* process; Process* process;
Panel* display; Panel* display;

View File

@ -9,22 +9,10 @@ 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 "config.h"
#include <stdio.h>
#include <unistd.h>
#include <stdbool.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "ProcessList.h"
#include "Process.h" #include "Process.h"
#include "ListItem.h"
#include "Panel.h" #include "Panel.h"
#include "FunctionBar.h" #include "FunctionBar.h"
typedef struct TraceScreen_ { typedef struct TraceScreen_ {
Process* process; Process* process;
Panel* display; Panel* display;

View File

@ -1,19 +1,22 @@
/* /*
htop htop - UptimeMeter.c
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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 "UptimeMeter.h" #include "UptimeMeter.h"
#include "Meter.h"
#include "ProcessList.h" #include "ProcessList.h"
#include "CRT.h" #include "CRT.h"
#include "debug.h" #include "debug.h"
#include <math.h>
/*{
#include "Meter.h"
}*/
int UptimeMeter_attributes[] = { int UptimeMeter_attributes[] = {
UPTIME UPTIME
}; };

View File

@ -3,7 +3,7 @@
#ifndef HEADER_UptimeMeter #ifndef HEADER_UptimeMeter
#define HEADER_UptimeMeter #define HEADER_UptimeMeter
/* /*
htop htop - UptimeMeter.h
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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.
@ -11,12 +11,6 @@ in the source distribution for its full text.
#include "Meter.h" #include "Meter.h"
#include "ProcessList.h"
#include "CRT.h"
#include "debug.h"
extern int UptimeMeter_attributes[]; extern int UptimeMeter_attributes[];
extern MeterType UptimeMeter; extern MeterType UptimeMeter;

View File

@ -5,20 +5,21 @@ 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 "config.h"
#include "UsersTable.h" #include "UsersTable.h"
#include "Hashtable.h"
#include "config.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include <pwd.h> #include <pwd.h>
#include <sys/types.h> #include <sys/types.h>
#include <stdlib.h>
#include "debug.h"
#include <assert.h> #include <assert.h>
/*{ /*{
#include "Hashtable.h"
typedef struct UsersTable_ { typedef struct UsersTable_ {
Hashtable* users; Hashtable* users;
} UsersTable; } UsersTable;

View File

@ -9,18 +9,8 @@ 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 "config.h"
#include "Hashtable.h" #include "Hashtable.h"
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <pwd.h>
#include <sys/types.h>
#include "debug.h"
#include <assert.h>
typedef struct UsersTable_ { typedef struct UsersTable_ {
Hashtable* users; Hashtable* users;
} UsersTable; } UsersTable;

View File

@ -1,20 +1,21 @@
/* /*
htop htop - Vector.c
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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 "Vector.h" #include "Vector.h"
#include "Object.h"
#include "debug.h"
#include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdbool.h> #include <stdbool.h>
#include "debug.h"
#include <assert.h>
/*{ /*{
#include "Object.h"
#define swap(a_,x_,y_) do{ void* tmp_ = a_[x_]; a_[x_] = a_[y_]; a_[y_] = tmp_; }while(0) #define swap(a_,x_,y_) do{ void* tmp_ = a_[x_]; a_[x_] = a_[y_]; a_[y_] = tmp_; }while(0)

View File

@ -3,20 +3,13 @@
#ifndef HEADER_Vector #ifndef HEADER_Vector
#define HEADER_Vector #define HEADER_Vector
/* /*
htop htop - Vector.h
(C) 2004-2011 Hisham H. Muhammad (C) 2004-2011 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 "Object.h" #include "Object.h"
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include "debug.h"
#include <assert.h>
#define swap(a_,x_,y_) do{ void* tmp_ = a_[x_]; a_[x_] = a_[y_]; a_[y_] = tmp_; }while(0) #define swap(a_,x_,y_) do{ void* tmp_ = a_[x_]; a_[x_] = a_[y_]; a_[y_] = tmp_; }while(0)

26
htop.c
View File

@ -5,17 +5,8 @@ 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 "config.h"
#include <unistd.h>
#include <math.h>
#include <sys/param.h>
#include <ctype.h>
#include <stdbool.h>
#include <locale.h>
#include <getopt.h>
#include "ProcessList.h" #include "ProcessList.h"
#include "CRT.h" #include "CRT.h"
#include "Panel.h" #include "Panel.h"
#include "UsersTable.h" #include "UsersTable.h"
@ -24,14 +15,27 @@ in the source distribution for its full text.
#include "ScreenManager.h" #include "ScreenManager.h"
#include "FunctionBar.h" #include "FunctionBar.h"
#include "ListItem.h" #include "ListItem.h"
#include "String.h"
#include "ColumnsPanel.h"
#include "CategoriesPanel.h" #include "CategoriesPanel.h"
#include "SignalsPanel.h" #include "SignalsPanel.h"
#include "TraceScreen.h" #include "TraceScreen.h"
#include "OpenFilesScreen.h" #include "OpenFilesScreen.h"
#include "AffinityPanel.h" #include "AffinityPanel.h"
#include "debug.h" #include "debug.h"
#include <unistd.h>
#include <math.h>
#include <ctype.h>
#include <stdbool.h>
#include <stdlib.h>
#include <locale.h>
#include <getopt.h>
#include <pwd.h>
#include <string.h>
#include <sys/param.h>
#include <sys/time.h>
//#link m //#link m
#define INCSEARCH_MAX 40 #define INCSEARCH_MAX 40

27
htop.h
View File

@ -9,33 +9,6 @@ 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 "config.h"
#include <unistd.h>
#include <math.h>
#include <sys/param.h>
#include <ctype.h>
#include <stdbool.h>
#include <locale.h>
#include <getopt.h>
#include "ProcessList.h"
#include "CRT.h"
#include "Panel.h"
#include "UsersTable.h"
#include "RichString.h"
#include "Settings.h"
#include "ScreenManager.h"
#include "FunctionBar.h"
#include "ListItem.h"
#include "CategoriesPanel.h"
#include "SignalsPanel.h"
#include "TraceScreen.h"
#include "OpenFilesScreen.h"
#include "AffinityPanel.h"
#include "debug.h"
//#link m //#link m
#define INCSEARCH_MAX 40 #define INCSEARCH_MAX 40

View File

@ -30,6 +30,7 @@ out.write( "" )
out.write( "#ifndef HEADER_" + name ) out.write( "#ifndef HEADER_" + name )
out.write( "#define HEADER_" + name ) out.write( "#define HEADER_" + name )
is_blank = False
for line in file.readlines(): for line in file.readlines():
line = line[:-1] line = line[:-1]
if state == ANY: if state == ANY:
@ -37,6 +38,8 @@ for line in file.readlines():
state = COPY state = COPY
elif line == selfheader: elif line == selfheader:
pass pass
elif line.find("#include") == 0:
pass
elif line.find("htop - ") == 0 and line[-2:] == ".c": elif line.find("htop - ") == 0 and line[-2:] == ".c":
out.write(line[:-2] + ".h") out.write(line[:-2] + ".h")
elif line.find("static ") != -1: elif line.find("static ") != -1:
@ -58,14 +61,22 @@ for line in file.readlines():
state = SKIP state = SKIP
else: else:
out.write( line ) out.write( line )
is_blank = False
elif line == "":
if not is_blank:
out.write( line )
is_blank = True
else: else:
out.write( line ) out.write( line )
is_blank = False
elif state == COPY: elif state == COPY:
is_blank = False
if line == "}*/": if line == "}*/":
state = ANY state = ANY
else: else:
out.write( line ) out.write( line )
elif state == SKIP: elif state == SKIP:
is_blank = False
if len(line) >= 1 and line[0] == "}": if len(line) >= 1 and line[0] == "}":
if static == 1: if static == 1:
state = SKIPONE state = SKIPONE
@ -73,6 +84,7 @@ for line in file.readlines():
state = ANY state = ANY
static = 0 static = 0
elif state == SKIPONE: elif state == SKIPONE:
is_blank = False
state = ANY state = ANY
out.write( "" ) out.write( "" )