Commit Graph

221 Commits

Author SHA1 Message Date
Jim Warner
0c6aa6af41 top: improve USE_X_COLHDR effect when colors toggled off
Normally, when the chosen sort column is displayed via the
'x' command toggle the entire column is highlighted.  And
while this version of top substantially reduced the cost
of such highlighting, a small pathlength increase remained.

The USE_X_COLHDR define was an experimental alternative which
eliminated all recurring runtime costs for such emphasis by
highlighting the column header, not the entire column.

The previous implementation required colors to be turned on
(the 'z' toggle) for such highlighting to be visible.  This
commit extends column header emphasis to include monochrome
displays as well.

Reference:
http://www.freelists.org/post/procps/post-nls-merge,6
2012-02-08 20:57:38 +11:00
Jim Warner
9573a6fe5b top: properly handle an improper $HOME environment variable
Since its inception, this top has improperly handled an
empty HOME environment variable.  Under those conditions
a path to the root directory would have been constructed.

That caused no real harm upon startup since the display
defaults would have been employed.  However, except for
root, it would have been impossible to save the rc file.

This commit keeps the promise made in the documentation.
2012-02-08 20:57:30 +11:00
Jim Warner
b73a423cc2 top: avoid %cpu distortions when toggling task/thread modes
This commit addresses a long standing buglet (debian #441166) which
surfaces when the display mode is switched between task and threads.

An extra procps refresh is now forced upon such a transition which
parallels the approach used at startup for the exact same reason.

Reference: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=441166
2012-01-14 00:04:46 +11:00
Jim Warner
7a64b0cd6c top: add PACKAGE and LOCALEDIR to ATEOJ_RPTSTD output 2012-01-05 09:56:05 +11:00
Jim Warner
e64b6f70d7 top: update some programmer documentation (no logic, just comments)
This commit corrects some outdated programmer comments.

Additionally, certain nls justifications might become
increasingly obscure with the passage of time so some
previous nls commit text has been added as comments.
2012-01-04 08:58:54 +11:00
Jim Warner
f38c42ff21 top: final cleanup following nls conflict resolutions
This patch represents the final resting place for miscellaneous
changes not otherwise encountered or for which the resolution
was incomplete or incorrect.
2011-12-22 23:48:06 +11:00
Jim Warner
c465dca573 top: adapt 'locate/find next' search capability for nls 2011-12-22 23:48:06 +11:00
Jim Warner
2246663f66 top: changed 'err' to 'errmsg', avoid conflict with <err.h> 2011-12-22 23:48:06 +11:00
Jim Warner
cb3b040718 top: repositioned nls.h to avoid redefine of procps.h restrict 2011-12-22 23:48:05 +11:00
Jim Warner
04e3ec75dd top: idiot! sometimes nls was misspelled nsl (but not anymore) 2011-12-22 23:48:05 +11:00
Jim Warner
bc441a67ea top: added additional xgettext strings plus translator hints 2011-12-22 23:48:05 +11:00
Jim Warner
67034a9a4a top: finalized nls translation implementation 2011-12-22 23:48:05 +11:00
Jim Warner
3d1f469995 top: restored static to scat(), not needed in top_nls.c 2011-12-22 23:48:05 +11:00
Jim Warner
26b4e0e1c6 top: optimization for show_special function 2011-12-22 23:48:04 +11:00
Jim Warner
617d46633e top: redesign Uniq_nlstab/show_special (nls quirks)
Until this patch, top had used some strings with
special escape sequences to produce colors, normal
text, bold text, etc.  They took the following form,
explained by an excerpt from program comments:
  ...
  Our special formatting consists of:
     "some text <_delimiter_> some more text <_delimiter_>...\n"
  Where <_delimiter_> is a single byte in the range of:
     \001 through \010  (in decimalizee, 1 - 8)
  and is used to select an 'attribute' from a capabilities table
  which is then applied to the *preceding* substring.
  ...

Unfortunately, these nonprinting values revealed
insurmountable inconsistencies in both the front-end
and back-end translation tools.

The xgettext (extraction) program would take those
special escapes, convert them and then output raw
binary values.  Thus the .pot file would contain
lots of unprintable stuff making it unreadable.

If the following was added to po/Makevars, most of
those special escapes would be preserved in their
escape notation:
  XGETTEXT_OPTIONS = ... --escape
But two escapes were converted from octal notation
and there was no way to prevent it:
  \007  -->  \a
  \010  -->  \b

After a pass through the msginit program, most of
the escapes were reconverted to raw binary values
making translation impossible.  There was no
"--escape" option for the back-end programs like
there was for xgettext.

But the real killer was the escape \004, also used
in some of top's special strings.  This value would
be silently accepted by xgettext, only to produce
the following fatal error in back-end programs like
msginit, msgfmt and msgen:
  .pot:2647: context separator <EOT> within string

To quote from one of the references below:
  "Would you create a suite of tools that silently
   allow what is destined to become a fatal error
   to pass unnoticed?"

So the bottom line was: top's special strings, in
use for the past nine years, had to be redesigned.

References:
http://www.freelists.org/post/procps/procpsng-nls-support,11
http://www.freelists.org/post/procps/procpsng-nls-support,14
2011-12-22 23:48:04 +11:00
Jim Warner
090923e546 top: shortened some of the longer lines, mostly nls 2011-12-22 23:48:04 +11:00
Jim Warner
18fc0b963d top: use existing unsigned vs. separate int 2011-12-22 23:48:04 +11:00
Jim Warner
eac96c37b5 top: corrected several programmer comments 2011-12-22 23:48:04 +11:00
Jim Warner
82c0dfd877 top: fix misapplied 'rh analysis #2: top' patch 2011-12-22 23:48:04 +11:00
Jim Warner
3f7468082a top: finalized top nls support (or so he thought)
summary of changes:
. adopted relative paths to 'include' and 'proc'
  dirs so that stand alone compiles are made
  easier and no one need guess their locations

. corrected several names for enums and macro
  usage reflecting fmt vs. txt

. expanded all octal escape sequences to a full
  3 digits since one already required 3 digits

. finalized translator hints (for now)

programming note:
  as an aside, by not including an argument for
  the gettext --add-comments, any preceeding c
  style comment will be propagated to the .pot
  file, if the gettext macro isn't empty.

  /* Need Not Say 'TRANSLATORS' ...
  snprintf(buf, sizeof(buf), "%s", _(   // unseen
  /* Translator Hint: ...
  snprintf(buf, sizeof(buf), "%s", _("" // seen
2011-12-22 23:48:04 +11:00
Jim Warner
32a9adbc13 top: provide extensive, generalized nls support
Reviewed-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Jim Warner <james.warner@comcast.net>
2011-12-22 23:48:04 +11:00