/*
* Determine if this task matches the 'u/U' selection
* criteria for a given window */
-static inline int wins_usrselect (const WIN_t *q, struct pids_stack *p) {
+static inline int wins_usrselect (const WIN_t *q, int idx) {
// a tailored 'results stack value' extractor macro
#define rSv(E) PID_VAL(E, u_int, p)
+ struct pids_stack *p = q->ppt[idx];
+
switch(q->usrseltyp) {
case 0: // uid selection inactive
return 1;
/*
* This guy adds the artwork to either 'cmd' or 'cmdline' values |
* if we are in forest view mode otherwise he just returns them. | */
-static inline const char *forest_display (const WIN_t *q, struct pids_stack *p) {
+static inline const char *forest_display (const WIN_t *q, int idx) {
// tailored 'results stack value' extractor macros
#define rSv(E) PID_VAL(E, str, p)
#define rSv_Lvl PID_VAL(eu_TREE_LVL, s_int, p)
#else
static char buf[ROWMINSIZ];
#endif
+ struct pids_stack *p = q->ppt[idx];
const char *which = (CHKw(q, Show_CMDLIN)) ? rSv(eu_CMDLINE) : rSv(EU_CMD);
if (!CHKw(q, Show_FOREST) || rSv_Lvl == 0) return which;
/* This is currently the only true prototype required by top.
It is placed here, instead of top.h, to avoid one compiler
warning when the top_nls.c source was compiled separately. */
-static const char *task_show (const WIN_t *q, struct pids_stack *p);
+static const char *task_show (const WIN_t *q, int idx);
static void find_string (int ch) {
#define reDUX (found) ? N_txt(WORD_another_txt) : ""
if (Curwin->findstr[0]) {
SETw(Curwin, NOPRINT_xxx);
for (i = Curwin->begtask; i < PIDSmaxt; i++) {
- const char *row = task_show(Curwin, Curwin->ppt[i]);
+ const char *row = task_show(Curwin, i);
if (*row && -1 < find_ofs(Curwin, row)) {
found = 1;
if (i == Curwin->begtask) continue;
/*
* Build the information for a single task row and
* display the results or return them to the caller. */
-static const char *task_show (const WIN_t *q, struct pids_stack *p) {
+static const char *task_show (const WIN_t *q, int idx) {
// a tailored 'results stack value' extractor macro
#define rSv(E,T) PID_VAL(E, T, p)
#ifndef SCROLLVAR_NO
#define makeVAR(S) cp = make_str(S, q->varcolsz, Js, AUTOX_NO)
#define varUTF8(S) cp = make_str_utf8(S, q->varcolsz, Js, AUTOX_NO)
#endif
+ struct pids_stack *p = q->ppt[idx];
static char rbuf[ROWMINSIZ];
char *rp;
int x;
break;
/* str, make_str with varialbe width + additional decoration */
case EU_CMD: // PIDS_CMD or PIDS_CMDLINE
- varUTF8(forest_display(q, p));
+ varUTF8(forest_display(q, idx));
break;
default: // keep gcc happy
continue;
if (w->begnext > beg) {
fwd_redux:
for (i = w->begtask; i < end; i++) {
- if (wins_usrselect(w, w->ppt[i])
- && (*task_show(w, w->ppt[i])))
+ if (wins_usrselect(w, i)
+ && (*task_show(w, i)))
break;
}
if (i < end) {
// potentially scroll backward ...
for (i = w->begtask; i > beg; i--) {
- if (wins_usrselect(w, w->ppt[i])
- && (*task_show(w, w->ppt[i])))
+ if (wins_usrselect(w, i)
+ && (*task_show(w, i)))
break;
}
w->begtask = i;
// reached the top, but maybe this guy ain't visible
if (w->begtask == beg && !reversed) {
- if (!(wins_usrselect(w, w->ppt[beg]))
- || (!(*task_show(w, w->ppt[beg])))) {
+ if (!(wins_usrselect(w, beg))
+ || (!(*task_show(w, beg)))) {
reversed = 1;
goto fwd_redux;
}
checking some stuff with each iteration and check it just once... */
if (CHKw(q, Show_IDLEPS) && !q->usrseltyp)
while (i < numtasks && lwin < wmax) {
- if (*task_show(q, q->ppt[i++]))
+ if (*task_show(q, i++))
++lwin;
}
else
while (i < numtasks && lwin < wmax) {
if ((CHKw(q, Show_IDLEPS) || isBUSY(q->ppt[i]))
- && wins_usrselect(q, q->ppt[i])
- && *task_show(q, q->ppt[i]))
+ && wins_usrselect(q, i)
+ && *task_show(q, i))
++lwin;
++i;
}
//atic void wins_reflag (int what, int flg);
//atic void wins_stage_1 (void);
//atic void wins_stage_2 (void);
-//atic inline int wins_usrselect (const WIN_t *q, struct pids_stack *p);
+//atic inline int wins_usrselect (const WIN_t *q, int idx);
/*------ Forest View support -------------------------------------------*/
//atic void forest_adds (const int self, unsigned level);
//atic void forest_begin (WIN_t *q);
//atic void forest_config (WIN_t *q);
-//atic inline const char *forest_display (const WIN_t *q, struct pids_stack *p);
+//atic inline const char *forest_display (const WIN_t *q, int idx);
/*------ Interactive Input Tertiary support ----------------------------*/
//atic inline int find_ofs (const WIN_t *q, const char *buf);
//atic void find_string (int ch);
/*------ Main Screen routines ------------------------------------------*/
//atic void do_key (int ch);
//atic void summary_show (void);
-//atic const char *task_show (const WIN_t *q, struct pids_stack *p);
+//atic const char *task_show (const WIN_t *q, int idx);
//atic void window_hlp (void);
//atic int window_show (WIN_t *q, int wmax);
/*------ Entry point plus two ------------------------------------------*/