Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
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
40317df3
Commit
40317df3
authored
7 years ago
by
Hisham Muhammad
Browse files
Options
Download
Email Patches
Plain Diff
Rename API to PluginAPI
parent
872ee776
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
Makefile.am
+2
-2
Makefile.am
PluginAPI.c
+6
-6
PluginAPI.c
PluginAPI.h
+4
-4
PluginAPI.h
ProcessList.c
+3
-7
ProcessList.c
ProcessList.h
+1
-5
ProcessList.h
htop.c
+1
-1
htop.c
with
17 additions
and
25 deletions
+17
-25
Makefile.am
View file @
40317df3
...
...
@@ -37,7 +37,7 @@ BatteryMeter.c Process.c ProcessList.c RichString.c ScreenManager.c Settings.c \
SignalsPanel.c StringUtils.c SwapMeter.c TasksMeter.c UptimeMeter.c ScreensPanel.c
\
TraceScreen.c UsersTable.c Vector.c AvailableColumnsPanel.c AffinityPanel.c
\
HostnameMeter.c OpenFilesScreen.c Affinity.c IncSet.c Action.c EnvScreen.c
\
InfoScreen.c XAlloc.c API.c
InfoScreen.c XAlloc.c
Plugin
API.c
myhtopheaders
=
AvailableColumnsPanel.h AvailableMetersPanel.h
\
CategoriesPanel.h CheckItem.h ClockMeter.h ColorsPanel.h ColumnsPanel.h
\
...
...
@@ -47,7 +47,7 @@ BatteryMeter.h Meter.h MetersPanel.h Object.h Panel.h ProcessList.h RichString.h
ScreenManager.h Settings.h SignalsPanel.h StringUtils.h SwapMeter.h ScreensPanel.h
\
TasksMeter.h UptimeMeter.h TraceScreen.h UsersTable.h Vector.h Process.h
\
AffinityPanel.h HostnameMeter.h OpenFilesScreen.h Affinity.h IncSet.h Action.h
\
EnvScreen.h InfoScreen.h XAlloc.h API.h
EnvScreen.h InfoScreen.h XAlloc.h
Plugin
API.h
if
HTOP_LINUX
htop_CFLAGS
+=
-rdynamic
...
...
This diff is collapsed.
Click to expand it.
API.c
→
Plugin
API.c
View file @
40317df3
#include "config.h"
#include "API.h"
#include "
Plugin
API.h"
#include "Process.h"
#ifdef HAVE_LUA
...
...
@@ -32,7 +32,7 @@
}*/
int
API_newColumn
(
lua_State
*
L
)
{
int
Plugin
API_newColumn
(
lua_State
*
L
)
{
luaL_checktype
(
L
,
1
,
LUA_TTABLE
);
check_field
(
"name"
,
LUA_TSTRING
,
"expected 'name' field of type string"
);
...
...
@@ -58,19 +58,19 @@ int API_newColumn(lua_State* L) {
return
1
;
}
static
luaL_Reg
API_functions
[]
=
{
{
.
name
=
"new_column"
,
.
func
=
API_newColumn
},
static
luaL_Reg
Plugin
API_functions
[]
=
{
{
.
name
=
"new_column"
,
.
func
=
Plugin
API_newColumn
},
{
.
name
=
NULL
,
.
func
=
NULL
},
};
int
API_new
(
lua_State
*
L
)
{
int
Plugin
API_new
(
lua_State
*
L
)
{
lua_settop
(
L
,
0
);
lua_newtable
(
L
);
lua_setfield
(
L
,
LUA_REGISTRYINDEX
,
"htop_columns"
);
lua_newtable
(
L
);
luaL_setfuncs
(
L
,
API_functions
,
0
);
luaL_setfuncs
(
L
,
Plugin
API_functions
,
0
);
return
1
;
}
...
...
This diff is collapsed.
Click to expand it.
API.h
→
Plugin
API.h
View file @
40317df3
/* Do not edit this file. It was automatically generated. */
#ifndef HEADER_API
#define HEADER_API
#ifndef HEADER_
Plugin
API
#define HEADER_
Plugin
API
#ifdef HAVE_LUA
...
...
@@ -30,9 +30,9 @@
} while(0)
int
API_newColumn
(
lua_State
*
L
);
int
Plugin
API_newColumn
(
lua_State
*
L
);
int
API_new
(
lua_State
*
L
);
int
Plugin
API_new
(
lua_State
*
L
);
#endif
...
...
This diff is collapsed.
Click to expand it.
ProcessList.c
View file @
40317df3
...
...
@@ -10,7 +10,7 @@ in the source distribution for its full text.
#include "CRT.h"
#include "StringUtils.h"
#include "API.h"
#include "
Plugin
API.h"
#include <stdlib.h>
#include <string.h>
...
...
@@ -87,10 +87,6 @@ ProcessList* ProcessList_new(UsersTable* ut, Hashtable* pidWhiteList, uid_t user
void ProcessList_delete(ProcessList* pl);
void ProcessList_goThroughEntries(ProcessList* pl);
#ifdef HAVE_LUA
void ProcessList_enableScripting(ProcessList* pl, lua_State* L);
#endif
}*/
ProcessList
*
ProcessList_init
(
ProcessList
*
this
,
ObjectClass
*
klass
,
UsersTable
*
usersTable
,
Hashtable
*
pidWhiteList
,
uid_t
userId
)
{
...
...
@@ -138,12 +134,12 @@ void ProcessList_done(ProcessList* this) {
#ifdef HAVE_LUA
void
ProcessList_init
Script
in
g
(
ProcessList
*
this
)
{
void
ProcessList_init
Plug
in
s
(
ProcessList
*
this
)
{
lua_State
*
L
=
luaL_newstate
();
luaL_openlibs
(
L
);
this
->
L
=
L
;
luaL_requiref
(
L
,
"htop"
,
API_new
,
0
);
luaL_requiref
(
L
,
"htop"
,
Plugin
API_new
,
0
);
lua_pop
(
L
,
1
);
for
(
int
i
=
0
;
i
<
this
->
settings
->
nPlugins
;
i
++
)
{
char
*
plugin
=
this
->
settings
->
plugins
[
i
];
...
...
This diff is collapsed.
Click to expand it.
ProcessList.h
View file @
40317df3
...
...
@@ -80,10 +80,6 @@ ProcessList* ProcessList_new(UsersTable* ut, Hashtable* pidWhiteList, uid_t user
void
ProcessList_delete
(
ProcessList
*
pl
);
void
ProcessList_goThroughEntries
(
ProcessList
*
pl
);
#ifdef HAVE_LUA
void
ProcessList_enableScripting
(
ProcessList
*
pl
,
lua_State
*
L
);
#endif
ProcessList
*
ProcessList_init
(
ProcessList
*
this
,
ObjectClass
*
klass
,
UsersTable
*
usersTable
,
Hashtable
*
pidWhiteList
,
uid_t
userId
);
...
...
@@ -91,7 +87,7 @@ void ProcessList_done(ProcessList* this);
#ifdef HAVE_LUA
void
ProcessList_init
Script
in
g
(
ProcessList
*
this
);
void
ProcessList_init
Plug
in
s
(
ProcessList
*
this
);
#endif
void
ProcessList_setPanel
(
ProcessList
*
this
,
Panel
*
panel
);
...
...
This diff is collapsed.
Click to expand it.
htop.c
View file @
40317df3
...
...
@@ -196,7 +196,7 @@ int main(int argc, char** argv) {
pl
->
settings
=
settings
;
#ifdef HAVE_LUA
ProcessList_init
Script
in
g
(
pl
);
ProcessList_init
Plug
in
s
(
pl
);
settings
->
L
=
pl
->
L
;
#endif
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help