File: procmeterp.h

package info (click to toggle)
procmeter3 3.6-3.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,444 kB
  • sloc: ansic: 16,600; makefile: 428; sh: 13
file content (144 lines) | stat: -rw-r--r-- 3,890 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/***************************************
  ProcMeter - A system monitoring program for Linux - Version 3.6.

  Global private header file.
  ******************/ /******************
  Written by Andrew M. Bishop

  This file Copyright 1998-2012 Andrew M. Bishop
  It may be distributed under the GNU Public License, version 2, or
  any higher version.  See section COPYING of the GNU Public license
  for conditions under which this file may be redistributed.
  ***************************************/


#ifndef PROCMETERP_H
#define PROCMETERP_H    /*+ To stop multiple inclusions. +*/

/* The public header file. */

#include "procmeter.h"


/* The file locations. */

#ifndef INSTDIR
#define INSTDIR "/usr/local"
#endif

#ifndef LIB_PATH
#define LIB_PATH  INSTDIR  "/lib/ProcMeter3"
#endif
#ifndef MOD_PATH
#define MOD_PATH  LIB_PATH "/modules"
#endif
#ifndef RC_PATH
#define RC_PATH   LIB_PATH
#endif

/* The run mode options */

#define RUN_NONE       0
#define RUN_SHELL      1
#define RUN_XTERM      2
#define RUN_XTERM_WAIT 3
#define RUN_XBELL      4

/*+ The information needed to run a command. +*/
typedef struct _RunOption
{
 char flag;                     /*+ The type of command to run. +*/
 char *command;                 /*+ The pre-parsed command string. +*/
}
RunOption;

/* A forward definition for the Output type. */

typedef struct _Output *Output;

/*+ The information about a module that is used internally. +*/
typedef struct _Module
{
 char *filename;                /*+ The filename of the module. +*/

 void *dlhandle;                /*+ The handle returned by dlopen(). +*/

 int (*Update)(time_t,ProcMeterOutput*); /*+ The update function for the outputs in the module. +*/

 ProcMeterModule *module;       /*+ The module information returned by the Load() function. +*/
 Output *outputs;               /*+ The outputs based on those returned by the Initialise function. +*/

 void *menu_item_widget;        /*+ The menu item widget for the module on the main menu. +*/
 void *submenu_widget;          /*+ The submenu widget for the module. +*/
}
*Module;

/*+ The information about an output that is used internally. +*/
struct _Output
{
 ProcMeterOutput *output;       /*+ The output that this represents. +*/

 char label[PROCMETER_NAME_LEN+1];/*+ The label for the output. +*/

 RunOption menu_run;            /*+ The function that can be run for this output. +*/

 int type;                      /*+ The type of output. +*/

 int first;                     /*+ Set this to true if the widget is new and needs an update. +*/

 void *menu_item_widget;        /*+ The menu item widget for the output on the module menu. +*/
 void *output_widget;           /*+ The widget for the output in the main window. +*/
};


/*+ The complete list of modules. +*/
extern Module* Modules;

/* In procmeter.c */

void UpdateOutputs(time_t now);
void AddDefaultOutputs(int argc,char **argv);

/* In module.c */

void LoadAllModules(void);
void UnloadAllModules(void);

Module LoadModule(char* filename);
void UnloadModule(Module module);

/* In procmeterrc.c */

void LoadProcMeterRC(int *argc,char **argv);

char *GetProcMeterRC(char *section,char *parameter);
char *GetProcMeterRC2(char *module,char *output,char *parameter);

void FreeProcMeterRC(void);

/* In xaw/window.c or gtk/window.c or log/window.c or lcd/window.c */

void Start(int *argc,char **argv);
void Stop(void);

void Sleep(time_t until);

void AddRemoveOutput(Output output);

void UpdateGraph(Output output,short value);
void UpdateText(Output output,char *value);
void UpdateBar(Output output,short value);

/* In xaw/menus.c or gtk/menus.c or no-x/menus.c */

void AddModuleToMenu(Module module);
void RemoveModuleFromMenu(Module module);

/* In xaw/run.c or gtk/run.c or no-x/run.c */

void ParseRunCommand(char *string,RunOption *run);

void RunProgram(RunOption *run);


#endif /* PROCMETERP_H */