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 <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 "Panel.h"
#include "CheckItem.h"
#include "CheckItem.h"
#include "debug.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) {
CheckItem* selected = (CheckItem*) Panel_getSelected(this);

View File

@ -2,13 +2,17 @@
#ifndef 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 "CheckItem.h"
#include "debug.h"
#include <assert.h>
#include "Affinity.h"
#include "ProcessList.h"
#include "ListItem.h"
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 "Settings.h"
#include "Header.h"
#include "ScreenManager.h"
#include "ColumnsPanel.h"
#include "Panel.h"
#include "debug.h"
#include <assert.h>
#include <stdlib.h>
#include <ctype.h>
/*{
#include "Panel.h"
#include "Settings.h"
#include "ScreenManager.h"
typedef struct AvailableColumnsPanel_ {
Panel super;

View File

@ -2,17 +2,16 @@
#ifndef HEADER_AvailableColumnsPanel
#define HEADER_AvailableColumnsPanel
#include "Settings.h"
#include "Header.h"
#include "ScreenManager.h"
#include "ColumnsPanel.h"
/*
htop - AvailableColumnsPanel.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 "debug.h"
#include <assert.h>
#include "Settings.h"
#include "ScreenManager.h"
typedef struct AvailableColumnsPanel_ {
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 "Settings.h"
#include "Header.h"
#include "ScreenManager.h"
#include "CPUMeter.h"
#include "Panel.h"
#include "Header.h"
#include "ListItem.h"
#include "debug.h"
#include <assert.h>
#include <stdlib.h>
/*{
#include "Settings.h"
#include "Panel.h"
#include "ScreenManager.h"
typedef struct AvailableMetersPanel_ {
Panel super;

View File

@ -2,17 +2,16 @@
#ifndef 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 "Header.h"
#include "ScreenManager.h"
#include "CPUMeter.h"
#include "Panel.h"
#include "debug.h"
#include <assert.h>
#include "ScreenManager.h"
typedef struct AvailableMetersPanel_ {
Panel super;

View File

@ -1,20 +1,26 @@
/*
htop
htop - BatteryMeter.c
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
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 "Meter.h"
#include "ProcessList.h"
#include "CRT.h"
#include "String.h"
#include "debug.h"
#include <string.h>
#include <stdlib.h>
#include <dirent.h>
#include <unistd.h>
/*{
#include "Meter.h"
typedef enum ACPresence_ {
AC_ABSENT,

View File

@ -3,20 +3,15 @@
#ifndef HEADER_BatteryMeter
#define HEADER_BatteryMeter
/*
htop
htop - BatteryMeter.h
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
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 "ProcessList.h"
#include "CRT.h"
#include "String.h"
#include "debug.h"
typedef enum ACPresence_ {
AC_ABSENT,

View File

@ -6,17 +6,20 @@ in the source distribution for its full text.
*/
#include "CPUMeter.h"
#include "Meter.h"
#include "CRT.h"
#include "ProcessList.h"
#include "debug.h"
#include <assert.h>
#include <stdlib.h>
#include <curses.h>
#include <string.h>
#include <math.h>
#include "debug.h"
#include <assert.h>
/*{
#include "Meter.h"
}*/
int CPUMeter_attributes[] = {
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 "ProcessList.h"
#include <stdlib.h>
#include <curses.h>
#include <string.h>
#include <math.h>
#include "debug.h"
#include <assert.h>
extern int CPUMeter_attributes[];
#ifndef MIN

15
CRT.c
View File

@ -7,19 +7,17 @@ in the source distribution for its full text.
#include "CRT.h"
#include "config.h"
#include "String.h"
#include "debug.h"
#include <curses.h>
#include <signal.h>
#include <stdlib.h>
#include <stdbool.h>
#ifdef HAVE_EXECINFO_H
#include <execinfo.h>
#endif
#include "String.h"
#include "config.h"
#include "debug.h"
#define ColorPair(i,j) COLOR_PAIR((7-i)*8+j)
#define COLORSCHEME_DEFAULT 0
@ -40,9 +38,8 @@ in the source distribution for its full text.
//#link curses
bool CRT_hasColors;
/*{
#include <stdbool.h>
typedef enum ColorElements_ {
RESET_COLOR,
@ -112,6 +109,8 @@ typedef enum ColorElements_ {
// TODO: centralize these in Settings.
static bool CRT_hasColors;
int CRT_delay = 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.
*/
#include <curses.h>
#include <signal.h>
#include <stdlib.h>
#include <stdbool.h>
#ifdef HAVE_EXECINFO_H
#include <execinfo.h>
#endif
#include "String.h"
#include "config.h"
#include "debug.h"
#define ColorPair(i,j) COLOR_PAIR((7-i)*8+j)
#define COLORSCHEME_DEFAULT 0
@ -43,8 +32,7 @@ in the source distribution for its full text.
//#link curses
bool CRT_hasColors;
#include <stdbool.h>
typedef enum ColorElements_ {
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 "AvailableMetersPanel.h"
#include "MetersPanel.h"
#include "DisplayOptionsPanel.h"
#include "ColumnsPanel.h"
#include "ColorsPanel.h"
#include "AvailableColumnsPanel.h"
#include "Panel.h"
#include "debug.h"
#include <assert.h>
#include <stdlib.h>
/*{
#include "Panel.h"
#include "Settings.h"
#include "ScreenManager.h"
typedef struct CategoriesPanel_ {
Panel super;

View File

@ -2,19 +2,16 @@
#ifndef HEADER_CategoriesPanel
#define HEADER_CategoriesPanel
#include "AvailableMetersPanel.h"
#include "MetersPanel.h"
#include "DisplayOptionsPanel.h"
#include "ColumnsPanel.h"
#include "ColorsPanel.h"
#include "AvailableColumnsPanel.h"
/*
htop - CategoriesPanel.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 "debug.h"
#include <assert.h>
#include "Settings.h"
#include "ScreenManager.h"
typedef struct CategoriesPanel_ {
Panel super;

View File

@ -1,17 +1,20 @@
/*
htop
htop - CheckItem.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 "CheckItem.h"
#include "Object.h"
#include "CRT.h"
#include "CRT.h"
#include "debug.h"
#include <assert.h>
#include <stdlib.h>
/*{
#include "Object.h"
typedef struct CheckItem_ {
Object super;

View File

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

View File

@ -1,16 +1,20 @@
/*
htop
htop - ClockMeter.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 "ClockMeter.h"
#include "Meter.h"
#include "CRT.h"
#include "debug.h"
#include <time.h>
#include "debug.h"
/*{
#include "Meter.h"
}*/
int ClockMeter_attributes[] = {
CLOCK

View File

@ -3,7 +3,7 @@
#ifndef HEADER_ClockMeter
#define HEADER_ClockMeter
/*
htop
htop - ClockMeter.h
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
@ -11,10 +11,6 @@ in the source distribution for its full text.
#include "Meter.h"
#include <time.h>
#include "debug.h"
extern int ClockMeter_attributes[];
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 "Panel.h"
#include "CRT.h"
#include "CheckItem.h"
#include "Settings.h"
#include "ScreenManager.h"
#include "debug.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
// TO ADD A NEW SCHEME:
// * Increment the size of bool check in ColorsPanel.h
@ -18,6 +22,9 @@
// * Add the colors in CRT_setColors
/*{
#include "Panel.h"
#include "Settings.h"
#include "ScreenManager.h"
typedef struct ColorsPanel_ {
Panel super;

View File

@ -2,17 +2,12 @@
#ifndef HEADER_ColorsPanel
#define HEADER_ColorsPanel
#include "config.h"
#include "CRT.h"
#include "Panel.h"
#include "CheckItem.h"
#include "Settings.h"
#include "ScreenManager.h"
#include "debug.h"
#include <assert.h>
/*
htop - ColorsPanel.h
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
// TO ADD A NEW SCHEME:
// * 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 the colors in CRT_setColors
#include "Panel.h"
#include "Settings.h"
#include "ScreenManager.h"
typedef struct ColorsPanel_ {
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 "String.h"
#include "debug.h"
#include <assert.h>
#include <stdlib.h>
#include <ctype.h>
/*{
#include "Panel.h"
#include "Settings.h"
#include "ScreenManager.h"
#include "debug.h"
#include <assert.h>
/*{
typedef struct ColumnsPanel_ {
Panel super;

View File

@ -2,16 +2,17 @@
#ifndef 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 "Settings.h"
#include "ScreenManager.h"
#include "debug.h"
#include <assert.h>
typedef struct ColumnsPanel_ {
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 <stdlib.h>

View File

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

View File

@ -2,17 +2,17 @@
#ifndef 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 "CheckItem.h"
#include "Settings.h"
#include "ScreenManager.h"
#include "debug.h"
#include <assert.h>
typedef struct DisplayOptionsPanel_ {
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.
*/
#include "Object.h"
#include "FunctionBar.h"
#include "CRT.h"
#include "debug.h"
#include <assert.h>
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <curses.h>
/*{
#include "Object.h"
typedef struct FunctionBar_ {
Object super;

View File

@ -10,16 +10,6 @@ in the source distribution for its full text.
*/
#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_ {
Object super;

View File

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

View File

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

View File

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

View File

@ -1,16 +1,20 @@
/*
htop
htop - HostnameMeter.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 "HostnameMeter.h"
#include "Meter.h"
#include "CRT.h"
#include "debug.h"
#include <unistd.h>
#include "debug.h"
/*{
#include "Meter.h"
}*/
int HostnameMeter_attributes[] = {
HOSTNAME

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
#ifndef HEADER_MemoryMeter
#define HEADER_MemoryMeter
/*
htop
htop - MemoryMeter.h
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
@ -11,17 +11,6 @@ in the source distribution for its full text.
#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 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.
*/
#include "RichString.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 "CRT.h"
#include "ListItem.h"
#include "String.h"
#include "ProcessList.h"
#include "ListItem.h"
#include "debug.h"
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include "debug.h"
#include <assert.h>
#include <time.h>
#ifndef USE_FUNKY_MODES
#include <time.h>
#define USE_FUNKY_MODES 1
#endif
#define METER_BUFFER_LEN 128
/*{
#include "ListItem.h"
#include "ProcessList.h"
typedef struct Meter_ Meter;
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
#define MIN(a,b) ((a)<(b)?(a):(b))
#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.
*/
#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
#include <time.h>
#define USE_FUNKY_MODES 1
#endif
#define METER_BUFFER_LEN 128
#include "ListItem.h"
#include "ProcessList.h"
typedef struct Meter_ Meter;
typedef struct MeterType_ MeterType;
@ -97,17 +83,6 @@ typedef enum {
} 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
#define MIN(a,b) ((a)<(b)?(a):(b))
#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 "Panel.h"
#include "Settings.h"
#include "ScreenManager.h"
#include "debug.h"
#include <stdlib.h>
#include <assert.h>
/*{
#include "Panel.h"
#include "Settings.h"
#include "ScreenManager.h"
typedef struct MetersPanel_ {
Panel super;

View File

@ -2,16 +2,17 @@
#ifndef 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 "Settings.h"
#include "ScreenManager.h"
#include "debug.h"
#include <assert.h>
typedef struct MetersPanel_ {
Panel super;

View File

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

View File

@ -3,20 +3,13 @@
#ifndef HEADER_Object
#define HEADER_Object
/*
htop
htop - Object.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 "RichString.h"
#include "CRT.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include "debug.h"
#ifndef DEBUG
#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.
*/
#include "OpenFilesScreen.h"
#include "CRT.h"
#include "ProcessList.h"
#include "ListItem.h"
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <stdbool.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "OpenFilesScreen.h"
#include "ProcessList.h"
/*{
#include "Process.h"
#include "ListItem.h"
#include "Panel.h"
#include "FunctionBar.h"
/*{
typedef struct OpenFiles_ProcessData_ {
char* data[256];
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.
*/
#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 "ListItem.h"
#include "Panel.h"
#include "FunctionBar.h"
typedef struct OpenFiles_ProcessData_ {
char* data[256];
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.
*/
#include "Object.h"
#include "Panel.h"
#include "Vector.h"
#include "CRT.h"
#include "RichString.h"
#include "ListItem.h"
#include "String.h"
#include "debug.h"
#include <math.h>
#include <stdbool.h>
#include "debug.h"
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <assert.h>
#include <curses.h>
//#link curses
/*{
#include "Object.h"
#include "Vector.h"
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.
*/
#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
#include "Object.h"
#include "Vector.h"
typedef struct Panel_ Panel;
@ -117,7 +106,6 @@ void Panel_draw(Panel* this, bool focus);
bool Panel_onKey(Panel* this, int key);
HandlerResult Panel_selectByTyping(Panel* this, int ch);
#endif

View File

@ -5,29 +5,28 @@ Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "Process.h"
#include "ProcessList.h"
#include "Object.h"
#include "CRT.h"
#include "String.h"
#include "Process.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 <stdlib.h>
#include <signal.h>
#include <string.h>
#include <stdbool.h>
#include <pwd.h>
#include <sched.h>
#include <time.h>
#include <assert.h>
#ifdef HAVE_LIBHWLOC
#include <hwloc/linux.h>
@ -41,6 +40,9 @@ in the source distribution for its full text.
#define PAGE_SIZE_KB ( PAGE_SIZE / ONE_K )
/*{
#include "Object.h"
#include "Affinity.h"
#include <sys/types.h>
#ifndef Process_isKernelThread
#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.
*/
#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
#include <hwloc/linux.h>
#endif
// This works only with glibc 2.1+. On earlier versions
@ -43,6 +19,9 @@ in the source distribution for its full text.
#endif
#define PAGE_SIZE_KB ( PAGE_SIZE / ONE_K )
#include "Object.h"
#include "Affinity.h"
#include <sys/types.h>
#ifndef Process_isKernelThread
#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.
*/
#ifndef CONFIG_H
#define CONFIG_H
#include "config.h"
#endif
#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 <unistd.h>
#include <dirent.h>
@ -26,14 +20,19 @@ in the source distribution for its full text.
#include <stdio.h>
#include <signal.h>
#include <stdbool.h>
#include <sys/utsname.h>
#include <stdarg.h>
#include <math.h>
#include "debug.h"
#include <string.h>
#include <time.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
#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.
*/
#ifndef CONFIG_H
#define CONFIG_H
#include "config.h"
#endif
#include "Process.h"
#include "Vector.h"
#include "UsersTable.h"
#include "Hashtable.h"
#include "String.h"
#include "UsersTable.h"
#include "Panel.h"
#include "Process.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
#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"
#ifndef CONFIG_H
#define CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
#define RICHSTRING_MAXLEN 300
/*{
#include "config.h"
#include <ctype.h>
#include "debug.h"
@ -22,10 +28,6 @@
#include <curses.h>
#endif
#define RICHSTRING_MAXLEN 300
/*{
#define RichString_size(this) ((this)->chlen)
#define RichString_sizeVal(this) ((this).chlen)

View File

@ -2,15 +2,16 @@
#ifndef 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"
#endif
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "debug.h"
@ -25,9 +26,6 @@
#include <curses.h>
#endif
#define RICHSTRING_MAXLEN 300
#define RichString_size(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
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "ScreenManager.h"
#include "Panel.h"
#include "Object.h"
#include "Vector.h"
#include "Header.h"
#include "FunctionBar.h"
#include "debug.h"
#include <assert.h>
#include <time.h>
#include <stdlib.h>
#include <stdbool.h>
/*{
#include "FunctionBar.h"
#include "Vector.h"
#include "Header.h"
typedef enum Orientation_ {
VERTICAL,

View File

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

View File

@ -5,17 +5,23 @@ Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "config.h"
#include "Settings.h"
#include "String.h"
#include "ProcessList.h"
#include "Header.h"
#include "String.h"
#include "Vector.h"
#include "debug.h"
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define DEFAULT_DELAY 15
/*{
#include "ProcessList.h"
#include "Header.h"
#include <stdbool.h>
typedef struct Settings_ {
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.
*/
#include "config.h"
#include "String.h"
#include "ProcessList.h"
#include "Header.h"
#include "debug.h"
#define DEFAULT_DELAY 15
#include "ProcessList.h"
#include "Header.h"
#include <stdbool.h>
typedef struct Settings_ {
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 "Panel.h"
#include "ListItem.h"
#include "RichString.h"
#include "debug.h"
#include <stdlib.h>
#include <assert.h>
#include <ctype.h>
/*{
#include "Panel.h"
typedef struct SignalItem_ {
const char* name;

View File

@ -2,16 +2,14 @@
#ifndef 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 "ListItem.h"
#include "RichString.h"
#include "debug.h"
#include <assert.h>
#include <ctype.h>
typedef struct SignalItem_ {
const char* name;

View File

@ -1,19 +1,20 @@
/*
htop
htop - String.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 "String.h"
#include "config.h"
#include "debug.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))
}*/

View File

@ -3,20 +3,12 @@
#ifndef HEADER_String
#define HEADER_String
/*
htop
htop - String.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 "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))
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
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "SwapMeter.h"
#include "Meter.h"
#include "CRT.h"
#include "ProcessList.h"
#include "debug.h"
#include <stdlib.h>
#include <curses.h>
#include <string.h>
#include <math.h>
#include <sys/param.h>
#include "debug.h"
#include <assert.h>
/*{
#include "Meter.h"
}*/
#define KILOBYTE 1
#define MEGABYTE 1024
#define GIGABYTE 1048576

View File

@ -3,7 +3,7 @@
#ifndef HEADER_SwapMeter
#define HEADER_SwapMeter
/*
htop
htop - SwapMeter.h
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
@ -11,17 +11,6 @@ in the source distribution for its full text.
#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 MEGABYTE 1024
#define GIGABYTE 1048576

View File

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

View File

@ -3,7 +3,7 @@
#ifndef HEADER_TasksMeter
#define HEADER_TasksMeter
/*
htop
htop - TasksMeter.h
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
@ -11,12 +11,6 @@ in the source distribution for its full text.
#include "Meter.h"
#include "ProcessList.h"
#include "CRT.h"
#include "debug.h"
extern int TasksMeter_attributes[];
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.
*/
#include "config.h"
#include "TraceScreen.h"
#include "CRT.h"
#include "ProcessList.h"
#include "ListItem.h"
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "TraceScreen.h"
#include "ProcessList.h"
/*{
#include "Process.h"
#include "ListItem.h"
#include "Panel.h"
#include "FunctionBar.h"
/*{
typedef struct TraceScreen_ {
Process* process;
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.
*/
#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 "ListItem.h"
#include "Panel.h"
#include "FunctionBar.h"
typedef struct TraceScreen_ {
Process* process;
Panel* display;

View File

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

View File

@ -3,7 +3,7 @@
#ifndef HEADER_UptimeMeter
#define HEADER_UptimeMeter
/*
htop
htop - UptimeMeter.h
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
@ -11,12 +11,6 @@ in the source distribution for its full text.
#include "Meter.h"
#include "ProcessList.h"
#include "CRT.h"
#include "debug.h"
extern int UptimeMeter_attributes[];
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.
*/
#include "config.h"
#include "UsersTable.h"
#include "Hashtable.h"
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <pwd.h>
#include <sys/types.h>
#include "debug.h"
#include <stdlib.h>
#include <assert.h>
/*{
#include "Hashtable.h"
typedef struct UsersTable_ {
Hashtable* users;
} UsersTable;

View File

@ -9,18 +9,8 @@ Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "config.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_ {
Hashtable* users;
} UsersTable;

View File

@ -1,20 +1,21 @@
/*
htop
htop - Vector.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 "Vector.h"
#include "Object.h"
#include "debug.h"
#include <assert.h>
#include <stdlib.h>
#include <string.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)

View File

@ -3,20 +3,13 @@
#ifndef HEADER_Vector
#define HEADER_Vector
/*
htop
htop - Vector.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 "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)

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.
*/
#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"
@ -24,14 +15,27 @@ in the source distribution for its full text.
#include "ScreenManager.h"
#include "FunctionBar.h"
#include "ListItem.h"
#include "String.h"
#include "ColumnsPanel.h"
#include "CategoriesPanel.h"
#include "SignalsPanel.h"
#include "TraceScreen.h"
#include "OpenFilesScreen.h"
#include "AffinityPanel.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
#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.
*/
#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
#define INCSEARCH_MAX 40

View File

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