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 ...@@ -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;
......
/*
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;
......
...@@ -2,16 +2,14 @@ ...@@ -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;
......
/* /*
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))
}*/ }*/
......
...@@ -3,20 +3,12 @@ ...@@ -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);
......
/* /*
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
......
...@@ -3,7 +3,7 @@ ...@@ -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. ...@@ -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
......
/* /*
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
}; };
......
...@@ -3,7 +3,7 @@ ...@@ -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. ...@@ -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;
......
...@@ -5,24 +5,27 @@ Released under the GNU GPL, see the COPYING 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;
......
...@@ -9,22 +9,10 @@ Released under the GNU GPL, see the COPYING 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;
......
/* /*
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
}; };
......
...@@ -3,7 +3,7 @@ ...@@ -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. ...@@ -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;
......
...@@ -5,20 +5,21 @@ Released under the GNU GPL, see the COPYING 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;
......
...@@ -9,18 +9,8 @@ Released under the GNU GPL, see the COPYING 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;
......
/* /*
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 <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include "debug.h" #include "debug.h"
#include <assert.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) #define swap(a_,x_,y_) do{ void* tmp_ = a_[x_]; a_[x_] = a_[y_]; a_[y_] = tmp_; }while(0)
......
...@@ -3,20 +3,13 @@ ...@@ -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)
......
...@@ -5,17 +5,8 @@ Released under the GNU GPL, see the COPYING 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. ...@@ -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
......
...@@ -9,33 +9,6 @@ Released under the GNU GPL, see the COPYING 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
......
...@@ -30,6 +30,7 @@ out.write( "" ) ...@@ -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(): ...@@ -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(): ...@@ -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(): ...@@ -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( "" )
......
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