Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
htop
Commits
2f1f82ee
Commit
2f1f82ee
authored
Jun 06, 2006
by
Hisham Muhammad
Browse files
Updates for new version of the MakeHeader.py script.
parent
b95993fa
Changes
25
Hide whitespace changes
Inline
Side-by-side
AvailableMetersPanel.c
View file @
2f1f82ee
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include "Settings.h"
#include "Settings.h"
#include "Header.h"
#include "Header.h"
#include "ScreenManager.h"
#include "ScreenManager.h"
#include "CPUMeter.h"
#include "Panel.h"
#include "Panel.h"
...
@@ -63,8 +64,7 @@ void AvailableMetersPanel_delete(Object* object) {
...
@@ -63,8 +64,7 @@ void AvailableMetersPanel_delete(Object* object) {
free
(
this
);
free
(
this
);
}
}
/* private */
static
inline
void
AvailableMetersPanel_addHeader
(
Header
*
header
,
Panel
*
panel
,
MeterType
*
type
,
int
param
,
HeaderSide
side
)
{
inline
void
AvailableMetersPanel_addHeader
(
Header
*
header
,
Panel
*
panel
,
MeterType
*
type
,
int
param
,
HeaderSide
side
)
{
Meter
*
meter
=
(
Meter
*
)
Header_addMeter
(
header
,
type
,
param
,
side
);
Meter
*
meter
=
(
Meter
*
)
Header_addMeter
(
header
,
type
,
param
,
side
);
Panel_add
(
panel
,
(
Object
*
)
Meter_toListItem
(
meter
));
Panel_add
(
panel
,
(
Object
*
)
Meter_toListItem
(
meter
));
}
}
...
...
CPUMeter.c
View file @
2f1f82ee
...
@@ -18,10 +18,10 @@ in the source distribution for its full text.
...
@@ -18,10 +18,10 @@ in the source distribution for its full text.
#include "debug.h"
#include "debug.h"
#include <assert.h>
#include <assert.h>
/* private property */
int
CPUMeter_attributes
[]
=
{
static
int
CPUMeter_attributes
[]
=
{
CPU_NICE
,
CPU_NORMAL
,
CPU_KERNEL
};
CPU_NICE
,
CPU_NORMAL
,
CPU_KERNEL
};
/* private */
MeterType
CPUMeter
=
{
MeterType
CPUMeter
=
{
.
setValues
=
CPUMeter_setValues
,
.
setValues
=
CPUMeter_setValues
,
.
display
=
CPUMeter_display
,
.
display
=
CPUMeter_display
,
...
@@ -35,7 +35,6 @@ MeterType CPUMeter = {
...
@@ -35,7 +35,6 @@ MeterType CPUMeter = {
.
init
=
CPUMeter_init
.
init
=
CPUMeter_init
};
};
/* private */
MeterType
AllCPUsMeter
=
{
MeterType
AllCPUsMeter
=
{
.
mode
=
0
,
.
mode
=
0
,
.
items
=
1
,
.
items
=
1
,
...
...
CRT.c
View file @
2f1f82ee
...
@@ -96,24 +96,15 @@ typedef enum ColorElements_ {
...
@@ -96,24 +96,15 @@ typedef enum ColorElements_ {
LAST_COLORELEMENT
LAST_COLORELEMENT
} ColorElements;
} ColorElements;
extern int CRT_delay;
extern int CRT_colors[LAST_COLORELEMENT];
extern int CRT_colorScheme;
}*/
}*/
// TODO: centralize these in Settings.
// TODO: centralize these in Settings.
/* private property */
int
CRT_delay
=
0
;
int
CRT_delay
;
/* private property */
int
CRT_colorScheme
=
0
;
int
CRT_colorScheme
;
/* private property */
int
CRT_colors
[
LAST_COLORELEMENT
]
=
{
0
};
int
CRT_colors
[
LAST_COLORELEMENT
];
// TODO: pass an instance of Settings instead.
// TODO: pass an instance of Settings instead.
...
...
CategoriesPanel.c
View file @
2f1f82ee
...
@@ -23,23 +23,17 @@ typedef struct CategoriesPanel_ {
...
@@ -23,23 +23,17 @@ typedef struct CategoriesPanel_ {
}*/
}*/
/* private property */
static
char
*
MetersFunctions
[
10
]
=
{
" "
,
" "
,
" "
,
"Type "
,
" "
,
" "
,
"MoveUp"
,
"MoveDn"
,
"Remove"
,
"Done "
};
char
*
MetersFunctions
[
10
]
=
{
" "
,
" "
,
" "
,
"Type "
,
" "
,
" "
,
"MoveUp"
,
"MoveDn"
,
"Remove"
,
"Done "
};
/* private property */
static
char
*
AvailableMetersFunctions
[
10
]
=
{
" "
,
" "
,
" "
,
" "
,
"Add L "
,
"Add R "
,
" "
,
" "
,
" "
,
"Done "
};
char
*
AvailableMetersFunctions
[
10
]
=
{
" "
,
" "
,
" "
,
" "
,
"Add L "
,
"Add R "
,
" "
,
" "
,
" "
,
"Done "
};
/* private property */
static
char
*
DisplayOptionsFunctions
[
10
]
=
{
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
"Done "
};
char
*
DisplayOptionsFunctions
[
10
]
=
{
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
"Done "
};
/* private property */
static
char
*
ColumnsFunctions
[
10
]
=
{
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
"MoveUp"
,
"MoveDn"
,
"Remove"
,
"Done "
};
char
*
ColumnsFunctions
[
10
]
=
{
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
"MoveUp"
,
"MoveDn"
,
"Remove"
,
"Done "
};
/* private property */
static
char
*
ColorsFunctions
[
10
]
=
{
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
"Done "
};
char
*
ColorsFunctions
[
10
]
=
{
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
"Done "
};
/* private property */
static
char
*
AvailableColumnsFunctions
[
10
]
=
{
" "
,
" "
,
" "
,
" "
,
"Add "
,
" "
,
" "
,
" "
,
" "
,
"Done "
};
char
*
AvailableColumnsFunctions
[
10
]
=
{
" "
,
" "
,
" "
,
" "
,
"Add "
,
" "
,
" "
,
" "
,
" "
,
"Done "
};
CategoriesPanel
*
CategoriesPanel_new
(
Settings
*
settings
,
ScreenManager
*
scr
)
{
CategoriesPanel
*
CategoriesPanel_new
(
Settings
*
settings
,
ScreenManager
*
scr
)
{
CategoriesPanel
*
this
=
(
CategoriesPanel
*
)
malloc
(
sizeof
(
CategoriesPanel
));
CategoriesPanel
*
this
=
(
CategoriesPanel
*
)
malloc
(
sizeof
(
CategoriesPanel
));
...
...
CheckItem.c
View file @
2f1f82ee
...
@@ -19,10 +19,8 @@ typedef struct CheckItem_ {
...
@@ -19,10 +19,8 @@ typedef struct CheckItem_ {
bool* value;
bool* value;
} CheckItem;
} CheckItem;
extern char* CHECKITEM_CLASS;
}*/
}*/
/* private property */
char
*
CHECKITEM_CLASS
=
"CheckItem"
;
char
*
CHECKITEM_CLASS
=
"CheckItem"
;
CheckItem
*
CheckItem_new
(
char
*
text
,
bool
*
value
)
{
CheckItem
*
CheckItem_new
(
char
*
text
,
bool
*
value
)
{
...
...
ClockMeter.c
View file @
2f1f82ee
...
@@ -12,10 +12,10 @@ in the source distribution for its full text.
...
@@ -12,10 +12,10 @@ in the source distribution for its full text.
#include "debug.h"
#include "debug.h"
/* private */
int
ClockMeter_attributes
[]
=
{
static
int
ClockMeter_attributes
[]
=
{
CLOCK
};
CLOCK
};
/* private */
MeterType
ClockMeter
=
{
MeterType
ClockMeter
=
{
.
setValues
=
ClockMeter_setValues
,
.
setValues
=
ClockMeter_setValues
,
.
display
=
NULL
,
.
display
=
NULL
,
...
...
ColorsPanel.c
View file @
2f1f82ee
...
@@ -28,7 +28,6 @@ typedef struct ColorsPanel_ {
...
@@ -28,7 +28,6 @@ typedef struct ColorsPanel_ {
}*/
}*/
/* private */
static
char
*
ColorSchemes
[]
=
{
static
char
*
ColorSchemes
[]
=
{
"Default"
,
"Default"
,
"Monochromatic"
,
"Monochromatic"
,
...
...
FunctionBar.c
View file @
2f1f82ee
...
@@ -28,20 +28,14 @@ typedef struct FunctionBar_ {
...
@@ -28,20 +28,14 @@ typedef struct FunctionBar_ {
bool staticData;
bool staticData;
} FunctionBar;
} FunctionBar;
extern char* FUNCTIONBAR_CLASS;
}*/
}*/
/* private property */
char
*
FUNCTIONBAR_CLASS
=
"FunctionBar"
;
char
*
FUNCTIONBAR_CLASS
=
"FunctionBar"
;
/* private property */
static
char
*
FunctionBar_FKeys
[
10
]
=
{
"F1"
,
"F2"
,
"F3"
,
"F4"
,
"F5"
,
"F6"
,
"F7"
,
"F8"
,
"F9"
,
"F10"
};
static
char
*
FunctionBar_FKeys
[
10
]
=
{
"F1"
,
"F2"
,
"F3"
,
"F4"
,
"F5"
,
"F6"
,
"F7"
,
"F8"
,
"F9"
,
"F10"
};
/* private property */
static
char
*
FunctionBar_FLabels
[
10
]
=
{
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
" "
};
static
char
*
FunctionBar_FLabels
[
10
]
=
{
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
" "
,
" "
};
/* private property */
static
int
FunctionBar_FEvents
[
10
]
=
{
KEY_F
(
1
),
KEY_F
(
2
),
KEY_F
(
3
),
KEY_F
(
4
),
KEY_F
(
5
),
KEY_F
(
6
),
KEY_F
(
7
),
KEY_F
(
8
),
KEY_F
(
9
),
KEY_F
(
10
)};
static
int
FunctionBar_FEvents
[
10
]
=
{
KEY_F
(
1
),
KEY_F
(
2
),
KEY_F
(
3
),
KEY_F
(
4
),
KEY_F
(
5
),
KEY_F
(
6
),
KEY_F
(
7
),
KEY_F
(
8
),
KEY_F
(
9
),
KEY_F
(
10
)};
FunctionBar
*
FunctionBar_new
(
int
size
,
char
**
functions
,
char
**
keys
,
int
*
events
)
{
FunctionBar
*
FunctionBar_new
(
int
size
,
char
**
functions
,
char
**
keys
,
int
*
events
)
{
...
...
ListItem.c
View file @
2f1f82ee
...
@@ -21,10 +21,8 @@ typedef struct ListItem_ {
...
@@ -21,10 +21,8 @@ typedef struct ListItem_ {
int key;
int key;
} ListItem;
} ListItem;
extern char* LISTITEM_CLASS;
}*/
}*/
/* private property */
char
*
LISTITEM_CLASS
=
"ListItem"
;
char
*
LISTITEM_CLASS
=
"ListItem"
;
ListItem
*
ListItem_new
(
char
*
value
,
int
key
)
{
ListItem
*
ListItem_new
(
char
*
value
,
int
key
)
{
...
...
LoadAverageMeter.c
View file @
2f1f82ee
...
@@ -12,10 +12,10 @@ in the source distribution for its full text.
...
@@ -12,10 +12,10 @@ in the source distribution for its full text.
#include "debug.h"
#include "debug.h"
/* private property */
int
LoadAverageMeter_attributes
[]
=
{
int
LoadAverageMeter_attributes
[]
=
{
LOAD_AVERAGE_FIFTEEN
,
LOAD_AVERAGE_FIVE
,
LOAD_AVERAGE_ONE
};
LOAD_AVERAGE_FIFTEEN
,
LOAD_AVERAGE_FIVE
,
LOAD_AVERAGE_ONE
};
/* private */
MeterType
LoadAverageMeter
=
{
MeterType
LoadAverageMeter
=
{
.
setValues
=
LoadAverageMeter_setValues
,
.
setValues
=
LoadAverageMeter_setValues
,
.
display
=
LoadAverageMeter_display
,
.
display
=
LoadAverageMeter_display
,
...
@@ -28,10 +28,8 @@ MeterType LoadAverageMeter = {
...
@@ -28,10 +28,8 @@ MeterType LoadAverageMeter = {
.
caption
=
"Load average: "
.
caption
=
"Load average: "
};
};
/* private property */
int
LoadMeter_attributes
[]
=
{
LOAD
};
int
LoadMeter_attributes
[]
=
{
LOAD
};
/* private */
MeterType
LoadMeter
=
{
MeterType
LoadMeter
=
{
.
setValues
=
LoadMeter_setValues
,
.
setValues
=
LoadMeter_setValues
,
.
display
=
LoadMeter_display
,
.
display
=
LoadMeter_display
,
...
@@ -44,8 +42,7 @@ MeterType LoadMeter = {
...
@@ -44,8 +42,7 @@ MeterType LoadMeter = {
.
caption
=
"Load: "
.
caption
=
"Load: "
};
};
/* private */
static
inline
void
LoadAverageMeter_scan
(
double
*
one
,
double
*
five
,
double
*
fifteen
)
{
inline
static
void
LoadAverageMeter_scan
(
double
*
one
,
double
*
five
,
double
*
fifteen
)
{
int
activeProcs
,
totalProcs
,
lastProc
;
int
activeProcs
,
totalProcs
,
lastProc
;
FILE
*
fd
=
fopen
(
PROCDIR
"/loadavg"
,
"r"
);
FILE
*
fd
=
fopen
(
PROCDIR
"/loadavg"
,
"r"
);
int
read
=
fscanf
(
fd
,
"%lf %lf %lf %d/%d %d"
,
one
,
five
,
fifteen
,
int
read
=
fscanf
(
fd
,
"%lf %lf %lf %d/%d %d"
,
one
,
five
,
fifteen
,
...
...
MemoryMeter.c
View file @
2f1f82ee
...
@@ -19,10 +19,10 @@ in the source distribution for its full text.
...
@@ -19,10 +19,10 @@ in the source distribution for its full text.
#include "debug.h"
#include "debug.h"
#include <assert.h>
#include <assert.h>
/* private property */
int
MemoryMeter_attributes
[]
=
{
static
int
MemoryMeter_attributes
[]
=
{
MEMORY_USED
,
MEMORY_BUFFERS
,
MEMORY_CACHE
};
MEMORY_USED
,
MEMORY_BUFFERS
,
MEMORY_CACHE
};
/* private */
MeterType
MemoryMeter
=
{
MeterType
MemoryMeter
=
{
.
setValues
=
MemoryMeter_setValues
,
.
setValues
=
MemoryMeter_setValues
,
.
display
=
MemoryMeter_display
,
.
display
=
MemoryMeter_display
,
...
...
Meter.c
View file @
2f1f82ee
...
@@ -76,18 +76,6 @@ struct Meter_ {
...
@@ -76,18 +76,6 @@ struct Meter_ {
double total;
double total;
};
};
extern char* METER_CLASS;
extern MeterType CPUMeter;
extern MeterType ClockMeter;
extern MeterType LoadAverageMeter;
extern MeterType LoadMeter;
extern MeterType MemoryMeter;
extern MeterType SwapMeter;
extern MeterType TasksMeter;
extern MeterType UptimeMeter;
extern MeterType AllCPUsMeter;
typedef enum {
typedef enum {
CUSTOM_METERMODE = 0,
CUSTOM_METERMODE = 0,
BAR_METERMODE,
BAR_METERMODE,
...
@@ -99,11 +87,16 @@ typedef enum {
...
@@ -99,11 +87,16 @@ typedef enum {
LAST_METERMODE
LAST_METERMODE
} MeterModeId;
} MeterModeId;
extern MeterType* Meter_types[];
extern MeterMode* Meter_modes[];
}*/
}*/
#include "CPUMeter.h"
#include "MemoryMeter.h"
#include "SwapMeter.h"
#include "TasksMeter.h"
#include "LoadAverageMeter.h"
#include "UptimeMeter.h"
#include "ClockMeter.h"
#ifndef MIN
#ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#endif
#endif
...
@@ -111,10 +104,8 @@ extern MeterMode* Meter_modes[];
...
@@ -111,10 +104,8 @@ extern MeterMode* Meter_modes[];
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))
#endif
#endif
/* private property */
char
*
METER_CLASS
=
"Meter"
;
char
*
METER_CLASS
=
"Meter"
;
/* private */
MeterType
*
Meter_types
[]
=
{
MeterType
*
Meter_types
[]
=
{
&
CPUMeter
,
&
CPUMeter
,
&
ClockMeter
,
&
ClockMeter
,
...
@@ -128,14 +119,12 @@ MeterType* Meter_types[] = {
...
@@ -128,14 +119,12 @@ MeterType* Meter_types[] = {
NULL
NULL
};
};
/* private */
static
MeterMode
BarMeterMode
=
{
static
MeterMode
BarMeterMode
=
{
.
uiName
=
"Bar"
,
.
uiName
=
"Bar"
,
.
h
=
1
,
.
h
=
1
,
.
draw
=
BarMeterMode_draw
,
.
draw
=
BarMeterMode_draw
,
};
};
/* private */
static
MeterMode
TextMeterMode
=
{
static
MeterMode
TextMeterMode
=
{
.
uiName
=
"Text"
,
.
uiName
=
"Text"
,
.
h
=
1
,
.
h
=
1
,
...
@@ -143,22 +132,21 @@ static MeterMode TextMeterMode = {
...
@@ -143,22 +132,21 @@ static MeterMode TextMeterMode = {
};
};
#ifdef USE_FUNKY_MODES
#ifdef USE_FUNKY_MODES
/* private */
static
MeterMode
GraphMeterMode
=
{
static
MeterMode
GraphMeterMode
=
{
.
uiName
=
"Graph"
,
.
uiName
=
"Graph"
,
.
h
=
3
,
.
h
=
3
,
.
draw
=
GraphMeterMode_draw
,
.
draw
=
GraphMeterMode_draw
,
};
};
/* private */
static
MeterMode
LEDMeterMode
=
{
static
MeterMode
LEDMeterMode
=
{
.
uiName
=
"LED"
,
.
uiName
=
"LED"
,
.
h
=
3
,
.
h
=
3
,
.
draw
=
LEDMeterMode_draw
,
.
draw
=
LEDMeterMode_draw
,
};
};
#endif
#endif
/* private */
MeterMode
*
Meter_modes
[]
=
{
MeterMode
*
Meter_modes
[]
=
{
NULL
,
NULL
,
&
BarMeterMode
,
&
BarMeterMode
,
...
@@ -170,7 +158,6 @@ MeterMode* Meter_modes[] = {
...
@@ -170,7 +158,6 @@ MeterMode* Meter_modes[] = {
NULL
NULL
};
};
/* private property */
static
RichString
Meter_stringBuffer
;
static
RichString
Meter_stringBuffer
;
Meter
*
Meter_new
(
ProcessList
*
pl
,
int
param
,
MeterType
*
type
)
{
Meter
*
Meter_new
(
ProcessList
*
pl
,
int
param
,
MeterType
*
type
)
{
...
@@ -209,8 +196,7 @@ void Meter_setCaption(Meter* this, char* caption) {
...
@@ -209,8 +196,7 @@ void Meter_setCaption(Meter* this, char* caption) {
this
->
caption
=
strdup
(
caption
);
this
->
caption
=
strdup
(
caption
);
}
}
/* private */
static
inline
void
Meter_displayToStringBuffer
(
Meter
*
this
,
char
*
buffer
)
{
inline
static
void
Meter_displayToStringBuffer
(
Meter
*
this
,
char
*
buffer
)
{
MeterType
*
type
=
this
->
type
;
MeterType
*
type
=
this
->
type
;
Object_Display
display
=
((
Object
*
)
this
)
->
display
;
Object_Display
display
=
((
Object
*
)
this
)
->
display
;
if
(
display
)
{
if
(
display
)
{
...
@@ -281,8 +267,7 @@ void TextMeterMode_draw(Meter* this, int x, int y, int w) {
...
@@ -281,8 +267,7 @@ void TextMeterMode_draw(Meter* this, int x, int y, int w) {
/* ---------- BarMeterMode ---------- */
/* ---------- BarMeterMode ---------- */
/* private property */
static
char
BarMeterMode_characters
[]
=
"|#*@$%&"
;
char
BarMeterMode_characters
[]
=
"|#*@$%&"
;
void
BarMeterMode_draw
(
Meter
*
this
,
int
x
,
int
y
,
int
w
)
{
void
BarMeterMode_draw
(
Meter
*
this
,
int
x
,
int
y
,
int
w
)
{
MeterType
*
type
=
this
->
type
;
MeterType
*
type
=
this
->
type
;
...
@@ -360,14 +345,16 @@ void BarMeterMode_draw(Meter* this, int x, int y, int w) {
...
@@ -360,14 +345,16 @@ void BarMeterMode_draw(Meter* this, int x, int y, int w) {
#define DrawDot(a,y,c) do { attrset(a); mvaddch(y, x+k, c); } while(0)
#define DrawDot(a,y,c) do { attrset(a); mvaddch(y, x+k, c); } while(0)
/* private */
static
int
GraphMeterMode_colors
[
21
]
=
{
static
int
GraphMeterMode_colors
[
21
]
=
{
GRAPH_1
,
GRAPH_1
,
GRAPH_1
,
GRAPH_1
,
GRAPH_1
,
GRAPH_1
,
GRAPH_2
,
GRAPH_2
,
GRAPH_2
,
GRAPH_3
,
GRAPH_3
,
GRAPH_3
,
GRAPH_2
,
GRAPH_2
,
GRAPH_2
,
GRAPH_4
,
GRAPH_4
,
GRAPH_4
,
GRAPH_5
,
GRAPH_5
,
GRAPH_6
,
GRAPH_3
,
GRAPH_3
,
GRAPH_3
,
GRAPH_7
,
GRAPH_7
,
GRAPH_7
,
GRAPH_8
,
GRAPH_8
,
GRAPH_9
GRAPH_4
,
GRAPH_4
,
GRAPH_4
,
GRAPH_5
,
GRAPH_5
,
GRAPH_6
,
GRAPH_7
,
GRAPH_7
,
GRAPH_7
,
GRAPH_8
,
GRAPH_8
,
GRAPH_9
};
};
/* private property */
static
char
*
GraphMeterMode_characters
=
"^`'-.,_~'`-.,_~'`-.,_"
;
static
char
*
GraphMeterMode_characters
=
"^`'-.,_~'`-.,_~'`-.,_"
;
void
GraphMeterMode_draw
(
Meter
*
this
,
int
x
,
int
y
,
int
w
)
{
void
GraphMeterMode_draw
(
Meter
*
this
,
int
x
,
int
y
,
int
w
)
{
...
@@ -405,14 +392,12 @@ void GraphMeterMode_draw(Meter* this, int x, int y, int w) {
...
@@ -405,14 +392,12 @@ void GraphMeterMode_draw(Meter* this, int x, int y, int w) {
/* ---------- LEDMeterMode ---------- */
/* ---------- LEDMeterMode ---------- */
/* private */
static
char
*
LEDMeterMode_digits
[
3
][
10
]
=
{
static
char
*
LEDMeterMode_digits
[
3
][
10
]
=
{
{
" __ "
,
" "
,
" __ "
,
" __ "
,
" "
,
" __ "
,
" __ "
,
" __ "
,
" __ "
,
" __ "
},
{
" __ "
,
" "
,
" __ "
,
" __ "
,
" "
,
" __ "
,
" __ "
,
" __ "
,
" __ "
,
" __ "
},
{
"| |"
,
" |"
,
" __|"
,
" __|"
,
"|__|"
,
"|__ "
,
"|__ "
,
" |"
,
"|__|"
,
"|__|"
},
{
"| |"
,
" |"
,
" __|"
,
" __|"
,
"|__|"
,
"|__ "
,
"|__ "
,
" |"
,
"|__|"
,
"|__|"
},
{
"|__|"
,
" |"
,
"|__ "
,
" __|"
,
" |"
,
" __|"
,
"|__|"
,
" |"
,
"|__|"
,
" __|"
},
{
"|__|"
,
" |"
,
"|__ "
,
" __|"
,
" |"
,
" __|"
,
"|__|"
,
" |"
,
"|__|"
,
" __|"
},
};
};
/* private */
static
void
LEDMeterMode_drawDigit
(
int
x
,
int
y
,
int
n
)
{
static
void
LEDMeterMode_drawDigit
(
int
x
,
int
y
,
int
n
)
{
for
(
int
i
=
0
;
i
<
3
;
i
++
)
for
(
int
i
=
0
;
i
<
3
;
i
++
)
mvaddstr
(
y
+
i
,
x
,
LEDMeterMode_digits
[
i
][
n
]);
mvaddstr
(
y
+
i
,
x
,
LEDMeterMode_digits
[
i
][
n
]);
...
...
Object.c
View file @
2f1f82ee
...
@@ -29,8 +29,7 @@ struct Object_ {
...
@@ -29,8 +29,7 @@ struct Object_ {
};
};
}*/
}*/
/* private property */
static
char
*
OBJECT_CLASS
=
"Object"
;
char
*
OBJECT_CLASS
=
"Object"
;
void
Object_new
()
{
void
Object_new
()
{
Object
*
this
;
Object
*
this
;
...
...
Panel.c
View file @
2f1f82ee
...
@@ -45,8 +45,6 @@ struct Panel_ {
...
@@ -45,8 +45,6 @@ struct Panel_ {
Panel_EventHandler eventHandler;
Panel_EventHandler eventHandler;
};
};
extern char* PANEL_CLASS;
}*/
}*/
#ifndef MIN
#ifndef MIN
...
@@ -56,7 +54,6 @@ extern char* PANEL_CLASS;
...
@@ -56,7 +54,6 @@ extern char* PANEL_CLASS;
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))
#endif
#endif
/* private property */
char
*
PANEL_CLASS
=
"Panel"
;
char
*
PANEL_CLASS
=
"Panel"
;
Panel
*
Panel_new
(
int
x
,
int
y
,
int
w
,
int
h
,
char
*
type
,
bool
owner
)
{
Panel
*
Panel_new
(
int
x
,
int
y
,
int
w
,
int
h
,
char
*
type
,
bool
owner
)
{
...
...
Process.c
View file @
2f1f82ee
...
@@ -104,17 +104,13 @@ typedef struct Process_ {
...
@@ -104,17 +104,13 @@ typedef struct Process_ {
char user[PROCESS_USER_LEN + 1];
char user[PROCESS_USER_LEN + 1];
} Process;
} Process;
extern char* PROCESS_CLASS;
extern char* Process_fieldNames[];
}*/
}*/
/* private property */
char
*
PROCESS_CLASS
=
"Process"
;
char
*
PROCESS_CLASS
=
"Process"
;
/* private property */
char
*
Process_fieldNames
[]
=
{
char
*
Process_fieldNames
[]
=
{
""
,
"PID"
,
"Command"
,
"STATE"
,
"PPID"
,
"PGRP"
,
"SESSION"
,
"TTY_NR"
,
"TPGID"
,
"FLAGS"
,
"MINFLT"
,
"CMINFLT"
,
"MAJFLT"
,
"CMAJFLT"
,
"UTIME"
,
"STIME"
,
"CUTIME"
,
"CSTIME"
,
"PRIORITY"
,
"NICE"
,
"ITREALVALUE"
,
"STARTTIME"
,
"VSIZE"
,
"RSS"
,
"RLIM"
,
"STARTCODE"
,
"ENDCODE"
,
"STARTSTACK"
,
"KSTKESP"
,
"KSTKEIP"
,
"SIGNAL"
,
"BLOCKED"
,
"SIGIGNORE"
,
"SIGCATCH"
,
"WCHAN"
,
"NSWAP"
,
"CNSWAP"
,
"EXIT_SIGNAL"
,
"PROCESSOR"
,
"M_SIZE"
,
"M_RESIDENT"
,
"M_SHARE"
,
"M_TRS"
,
"M_DRS"
,
"M_LRS"
,
"M_DT"
,
"ST_UID"
,
"PERCENT_CPU"
,
"PERCENT_MEM"
,
"USER"
,
"TIME"
,
"*** report bug! ***"
};
""
,
"PID"
,
"Command"
,
"STATE"
,
"PPID"
,
"PGRP"
,
"SESSION"
,
"TTY_NR"
,
"TPGID"
,
"FLAGS"
,
"MINFLT"
,
"CMINFLT"
,
"MAJFLT"
,
"CMAJFLT"
,
"UTIME"
,
"STIME"
,
"CUTIME"
,
"CSTIME"
,
"PRIORITY"
,
"NICE"
,
"ITREALVALUE"
,
"STARTTIME"
,
"VSIZE"
,
"RSS"
,
"RLIM"
,
"STARTCODE"
,
"ENDCODE"
,
"STARTSTACK"
,
"KSTKESP"
,
"KSTKEIP"
,
"SIGNAL"
,
"BLOCKED"
,
"SIGIGNORE"
,
"SIGCATCH"
,
"WCHAN"
,
"NSWAP"
,
"CNSWAP"
,
"EXIT_SIGNAL"
,
"PROCESSOR"
,
"M_SIZE"
,
"M_RESIDENT"
,
"M_SHARE"
,
"M_TRS"
,
"M_DRS"
,
"M_LRS"
,
"M_DT"
,
"ST_UID"
,
"PERCENT_CPU"
,
"PERCENT_MEM"
,
"USER"
,
"TIME"
,
"*** report bug! ***"
};
Process
*
Process_new
(
struct
ProcessList_
*
pl
)
{
Process
*
Process_new
(
struct
ProcessList_
*
pl
)
{
Process
*
this
=
malloc
(
sizeof
(
Process
));
Process
*
this
=
malloc
(
sizeof
(
Process
));
...
@@ -177,8 +173,7 @@ void Process_sendSignal(Process* this, int signal) {
...
@@ -177,8 +173,7 @@ void Process_sendSignal(Process* this, int signal) {
#define ONE_M (ONE_K * ONE_K)
#define ONE_M (ONE_K * ONE_K)
#define ONE_G (ONE_M * ONE_K)
#define ONE_G (ONE_M * ONE_K)
/* private */
static
void
Process_printLargeNumber
(
Process
*
this
,
RichString
*
str
,
unsigned
int
number
)
{
void
Process_printLargeNumber
(
Process
*
this
,
RichString
*
str
,
unsigned
int
number
)
{
char
buffer
[
11
];
char
buffer
[
11
];
int
len
;
int
len
;
if
(
number
>=
(
1000
*
ONE_M
))
{
if
(
number
>=
(
1000
*
ONE_M
))
{
...
@@ -202,10 +197,8 @@ void Process_printLargeNumber(Process* this, RichString *str, unsigned int numbe
...
@@ -202,10 +197,8 @@ void Process_printLargeNumber(Process* this, RichString *str, unsigned int numbe
}
}
}
}
/* private property */
static
double
jiffy
=
0
.
0
;
double
jiffy
=
0
.
0
;
/* private */
static
void
Process_printTime
(
RichString
*
str
,
unsigned
long
t
)
{
static
void
Process_printTime
(
RichString
*
str
,
unsigned
long
t
)
{
if
(
jiffy
==
0
.
0
)
jiffy
=
sysconf
(
_SC_CLK_TCK
);
if
(
jiffy
==
0
.
0
)
jiffy
=
sysconf
(
_SC_CLK_TCK
);
double
jiffytime
=
1
.
0
/
jiffy
;
double
jiffytime
=
1
.
0
/
jiffy
;
...
@@ -228,8 +221,7 @@ static void Process_printTime(RichString* str, unsigned long t) {
...
@@ -228,8 +221,7 @@ static void Process_printTime(RichString* str, unsigned long t) {
RichString_append
(
str
,
CRT_colors
[
DEFAULT_COLOR
],
buffer
);
RichString_append
(
str
,
CRT_colors
[
DEFAULT_COLOR
],
buffer
);
}
}
/* private */
static
inline
void
Process_writeCommand
(
Process
*
this
,
int
attr
,
RichString
*
str
)
{
inline
static
void
Process_writeCommand
(
Process
*
this
,
int
attr
,
RichString
*
str
)
{
if
(
this
->
pl
->
highlightBaseName
)
{
if
(
this
->
pl
->
highlightBaseName
)
{
char
*
firstSpace
=
strchr
(
this
->
comm
,
' '
);
char
*
firstSpace
=
strchr
(
this
->
comm
,
' '
);
if
(
firstSpace
)
{
if
(
firstSpace
)
{
...
...
ProcessList.c
View file @
2f1f82ee
...
@@ -104,24 +104,20 @@ typedef struct ProcessList_ {
...
@@ -104,24 +104,20 @@ typedef struct ProcessList_ {
} ProcessList;
} ProcessList;
}*/
}*/
/* private property */
static
ProcessField
defaultHeaders
[]
=
{
PID
,
USER
,
PRIORITY
,
NICE
,
M_SIZE
,
M_RESIDENT
,
M_SHARE
,
STATE
,
PERCENT_CPU
,
PERCENT_MEM
,
TIME
,
COMM
,
0
};
ProcessField
defaultHeaders
[]
=
{
PID
,
USER
,
PRIORITY
,
NICE
,
M_SIZE
,
M_RESIDENT
,
M_SHARE
,
STATE
,
PERCENT_CPU
,
PERCENT_MEM
,
TIME
,
COMM
,
0
};
#ifdef DEBUG
#ifdef DEBUG
/* private property */
typedef
int
(
*
vxscanf
)(
void
*
,
const
char
*
,
va_list
);
typedef
int
(
*
vxscanf
)(
void
*
,
const
char
*
,
va_list
);
#define ProcessList_read(this, buffer, format, ...) ProcessList_xread(this, (vxscanf) vsscanf, buffer, format, ## __VA_ARGS__ )
#define ProcessList_read(this, buffer, format, ...) ProcessList_xread(this, (vxscanf) vsscanf, buffer, format, ## __VA_ARGS__ )
#define ProcessList_fread(this, file, format, ...) ProcessList_xread(this, (vxscanf) vfscanf, file, format, ## __VA_ARGS__ )
#define ProcessList_fread(this, file, format, ...) ProcessList_xread(this, (vxscanf) vfscanf, file, format, ## __VA_ARGS__ )
/* private */
static
FILE
*
ProcessList_fopen
(
ProcessList
*
this
,
const
char
*
path
,
const
char
*
mode
)
{
FILE
*
ProcessList_fopen
(
ProcessList
*
this
,
const
char
*
path
,
const
char
*
mode
)
{
fprintf
(
this
->
traceFile
,
"[%s]
\n
"
,
path
);
fprintf
(
this
->
traceFile
,
"[%s]
\n
"
,
path
);
return
fopen
(
path
,
mode
);
return
fopen
(
path
,
mode
);
}
}
/* private */
static
inline
int
ProcessList_xread
(
ProcessList
*
this
,
vxscanf
fn
,
void
*
buffer
,
char
*
format
,
...)
{
static
inline
int
ProcessList_xread
(
ProcessList
*
this
,
vxscanf
fn
,
void
*
buffer
,
char
*
format
,
...)
{
va_list
ap
;
va_list
ap
;
va_start
(
ap
,
format
);
va_start
(
ap
,
format
);
...
@@ -305,8 +301,7 @@ int ProcessList_size(ProcessList* this) {
...
@@ -305,8 +301,7 @@ int ProcessList_size(ProcessList* this) {
return
(
Vector_size
(
this
->
processes
));
return
(
Vector_size
(
this
->
processes
));
}
}
/* private */
static
void
ProcessList_buildTree
(
ProcessList
*
this
,
int
pid
,
int
level
,
int
indent
,
int
direction
)
{
void
ProcessList_buildTree
(
ProcessList
*
this
,
int
pid
,
int
level
,
int
indent
,
int
direction
)
{
Vector
*
children
=
Vector_new
(
PROCESS_CLASS
,
false
,
DEFAULT_SIZE
);
Vector
*
children
=
Vector_new
(
PROCESS_CLASS
,
false
,
DEFAULT_SIZE
);
for
(
int
i
=
0
;
i
<
Vector_size
(
this
->
processes
);
i
++
)
{
for
(
int
i
=
0
;
i
<
Vector_size
(
this
->
processes
);
i
++
)
{
...
@@ -355,8 +350,7 @@ void ProcessList_sort(ProcessList* this) {
...
@@ -355,8 +350,7 @@ void ProcessList_sort(ProcessList* this) {
}
}
}
}
/* private */
static
int
ProcessList_readStatFile
(
ProcessList
*
this
,
Process
*
proc
,
FILE
*
f
,
char
*
command
)
{
int
ProcessList_readStatFile
(
ProcessList
*
this
,
Process
*
proc
,
FILE
*
f
,
char
*
command
)
{
static
char
buf
[
MAX_READ
];
static
char
buf
[
MAX_READ
];
long
int
zero
;
long
int
zero
;
...
...
RichString.c
View file @
2f1f82ee
...
@@ -23,8 +23,7 @@ typedef struct RichString_ {
...
@@ -23,8 +23,7 @@ typedef struct RichString_ {
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#endif
#endif
/* private property */
static
WINDOW
*
workArea
=
NULL
;
WINDOW
*
workArea
=
NULL
;
RichString
RichString_new
()
{
RichString
RichString_new
()
{
RichString
this
;
RichString
this
;
...
...
Settings.c
View file @
2f1f82ee
...
@@ -65,8 +65,7 @@ void Settings_delete(Settings* this) {
...
@@ -65,8 +65,7 @@ void Settings_delete(Settings* this) {
free
(
this
);
free
(
this
);
}
}
/* private */
static
void
Settings_readMeters
(
Settings
*
this
,
char
*
line
,
HeaderSide
side
)
{
void
Settings_readMeters
(
Settings
*
this
,
char
*
line
,
HeaderSide
side
)
{
char
*
trim
=
String_trim
(
line
);
char
*
trim
=
String_trim
(
line
);
char
**
ids
=
String_split
(
trim
,
' '
);
char
**
ids
=
String_split
(
trim
,
' '
);
free
(
trim
);
free
(
trim
);
...
@@ -77,8 +76,7 @@ void Settings_readMeters(Settings* this, char* line, HeaderSide side) {
...
@@ -77,8 +76,7 @@ void Settings_readMeters(Settings* this, char* line, HeaderSide side) {
String_freeArray
(
ids
);
String_freeArray
(
ids
);
}
}
/* private */
static
void
Settings_readMeterModes
(
Settings
*
this
,
char
*
line
,
HeaderSide
side
)
{
void
Settings_readMeterModes
(
Settings
*
this
,
char
*
line
,
HeaderSide
side
)
{
char
*
trim
=
String_trim
(
line
);
char
*
trim
=
String_trim
(
line
);
char
**
ids
=
String_split
(
trim
,
' '
);
char
**
ids
=
String_split
(
trim
,
' '
);
free
(
trim
);
free
(
trim
);
...
...
SignalItem.c
View file @
2f1f82ee
...
@@ -23,10 +23,8 @@ typedef struct Signal_ {
...
@@ -23,10 +23,8 @@ typedef struct Signal_ {
int number;
int number;
} Signal;
} Signal;
extern char* SIGNAL_CLASS;
}*/
}*/
/* private property */
char
*
SIGNAL_CLASS
=
"Signal"
;
char
*
SIGNAL_CLASS
=
"Signal"
;
Signal
*
Signal_new
(
char
*
name
,
int
number
)
{
Signal
*
Signal_new
(
char
*
name
,
int
number
)
{
...
...
SwapMeter.c
View file @
2f1f82ee
...
@@ -19,10 +19,10 @@ in the source distribution for its full text.
...
@@ -19,10 +19,10 @@ in the source distribution for its full text.
#include "debug.h"
#include "debug.h"
#include <assert.h>
#include <assert.h>
/* private property */
int
SwapMeter_attributes
[]
=
{
static
int
SwapMeter_attributes
[]
=
{
SWAP
};
SWAP
};
/* private */
MeterType
SwapMeter
=
{
MeterType
SwapMeter
=
{
.
setValues
=
SwapMeter_setValues
,
.
setValues
=
SwapMeter_setValues
,
.
display
=
SwapMeter_display
,
.
display
=
SwapMeter_display
,
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment