Commit 84281bdc authored by Hisham Muhammad's avatar Hisham Muhammad
Browse files

major header cleanup

parent 81e44312
......@@ -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;
......
/*
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;
......
......@@ -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;
......
/*
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))
}*/
......
......@@ -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);
......
/*
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
......
......@@ -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
......
/*
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
};
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
/*
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
};
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
/*
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 <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include "debug.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
/*{
#include "Object.h"
#define swap(a_,x_,y_) do{ void* tmp_ = a_[x_]; a_[x_] = a_[y_]; a_[y_] = tmp_; }while(0)
......
......@@ -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)
......
......@@ -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
......
......@@ -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
......
......@@ -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( "" )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment