home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!snorkelwacker!apple!sun-barr!newstop!sun!meepmeep.pcs.com
- From: jkh@meepmeep.pcs.com (Jordan K. Hubbard)
- Newsgroups: comp.sources.x
- Subject: v07i014: Emacs Info Browsing Widget, Patch1, Part01/01
- Message-ID: <135058@sun.Eng.Sun.COM>
- Date: 1 May 90 08:16:30 GMT
- Sender: news@sun.Eng.Sun.COM
- Lines: 352
- Approved: argv@sun.com
-
- Submitted-by: jkh@meepmeep.pcs.com (Jordan K. Hubbard)
- Posting-number: Volume 7, Issue 14
- Archive-name: infow/patch1
- Patch-To: infow: Volume 6, Issues 92,93
-
- Fixes contained in patch 1:
-
- 1. Those without strpbrk() will now find a PD version at the end of
- Info.c (automatically used if BSD is defined).
-
- 2. toupper() as macro now properly dealt with.
-
- 3. Menu names containing imbeded punctuation are now dealt with properly.
-
- 4. RCS log/header lines filled in (we only needed to do this once).
-
- -------------------------------------------------------------------------
- diff -c xinfo.release/Info.c xinfo/Info.c
- *** xinfo.release/Info.c Wed Apr 25 18:43:08 1990
- --- xinfo/Info.c Mon Apr 30 13:42:19 1990
- ***************
- *** 1,5 ****
- #ifndef lint
- ! static char *rcsid = "$Header$";
- #endif
-
- #include <X11/IntrinsicP.h>
- --- 1,5 ----
- #ifndef lint
- ! static char *rcsid = "$Header: /usr1/ben/jkh/src/xinfo/RCS/Info.c,v 1.1 90/04/30 13:29:21 jkh Exp Locker: jkh $";
- #endif
-
- #include <X11/IntrinsicP.h>
- ***************
- *** 49,55 ****
- */
-
- /*
- ! * $Log$
- */
-
- #define offset(name) XtOffset(InfoWidget, info.name)
- --- 49,58 ----
- */
-
- /*
- ! * $Log: Info.c,v $
- ! * Revision 1.1 90/04/30 13:29:21 jkh
- ! * Initial revision
- ! *
- */
-
- #define offset(name) XtOffset(InfoWidget, info.name)
- ***************
- *** 233,238 ****
- --- 236,244 ----
-
- #ifndef tolower
- Import char tolower();
- + #define TOLOWER(c) (tolower(c))
- + #else
- + #define TOLOWER(c) (isupper(c) ? tolower(c) : (c))
- #endif
-
- Local XtCallbackRec cb[2];
- ***************
- *** 798,808 ****
- strip_evil(LPOS(n->menu));
- /* Is the menu name not the node name? */
- if (*mstart != ':') {
- mstart = eat_whitespace(mstart);
- I_START(TPOS(n->menu.t)) = INTOFF(START(iw), mstart);
- I_LEN(TPOS(n->menu.t)) =
- ! INTOFF(START(iw), strpbrk(mstart, NAME_END_TOKEN)) -
- ! I_START(TPOS(n->menu.t));
- }
- INCP(n->menu.t);
- }
- --- 804,823 ----
- strip_evil(LPOS(n->menu));
- /* Is the menu name not the node name? */
- if (*mstart != ':') {
- + int plev = 0;
- +
- mstart = eat_whitespace(mstart);
- I_START(TPOS(n->menu.t)) = INTOFF(START(iw), mstart);
- + while (*mstart != '\0' && !(plev == 0
- + && index(NAME_END_TOKEN, *mstart) != NULL)) {
- + if (*mstart == '(')
- + ++plev;
- + else if (*mstart == ')')
- + --plev;
- + mstart++;
- + }
- I_LEN(TPOS(n->menu.t)) =
- ! INTOFF(START(iw), mstart) - I_START(TPOS(n->menu.t));
- }
- INCP(n->menu.t);
- }
- ***************
- *** 1746,1752 ****
- if (!igncase)
- comp = (*start == *ind);
- else
- ! comp = (tolower(*start) == tolower(*ind));
- if (!comp) {
- if (ind != str)
- ind = str;
- --- 1761,1767 ----
- if (!igncase)
- comp = (*start == *ind);
- else
- ! comp = (TOLOWER(*start) == TOLOWER(*ind));
- if (!comp) {
- if (ind != str)
- ind = str;
- ***************
- *** 1780,1786 ****
- if (!igncase)
- comp = (*start == *ind);
- else
- ! comp = (tolower(*start) == tolower(*ind));
- if (!comp) {
- if (ind != str)
- ind = str;
- --- 1795,1801 ----
- if (!igncase)
- comp = (*start == *ind);
- else
- ! comp = (TOLOWER(*start) == TOLOWER(*ind));
- if (!comp) {
- if (ind != str)
- ind = str;
- ***************
- *** 1807,1813 ****
- if (strlen(s1) != strlen(s2))
- return(-1);
-
- ! while (*s1 && *s2 && (tolower(*s1) == tolower(*s2)))
- s1++, s2++;
- if (!*s1 && !*s2)
- return(0);
- --- 1822,1828 ----
- if (strlen(s1) != strlen(s2))
- return(-1);
-
- ! while (*s1 && *s2 && (TOLOWER(*s1) == TOLOWER(*s2)))
- s1++, s2++;
- if (!*s1 && !*s2)
- return(0);
- ***************
- *** 1832,1838 ****
- register String s3 = s2 + n;
-
- if (s1 && s2) {
- ! while (*s1 && *s2 && (tolower(*s1) == tolower(*s2)) && (s2 < s3))
- s1++, s2++;
- if (!*s1 && !*s2 || s2 == s3)
- return(0);
- --- 1847,1853 ----
- register String s3 = s2 + n;
-
- if (s1 && s2) {
- ! while (*s1 && *s2 && (TOLOWER(*s1) == TOLOWER(*s2)) && (s2 < s3))
- s1++, s2++;
- if (!*s1 && !*s2 || s2 == s3)
- return(0);
- ***************
- *** 1964,1971 ****
-
- if (s)
- while (*s) {
- ! *s = tolower(*s);
- s++;
- }
- return(orig);
- }
- --- 1979,2033 ----
-
- if (s)
- while (*s) {
- ! *s = TOLOWER(*s);
- s++;
- }
- return(orig);
- }
- +
- + #ifdef BSD
- + /* BSD users don't have strpbrk() */
- + /* Routines taken from PD libc by Richard A. O'Keefe. */
- +
- + #if CharsAreSigned
- + #define MaxPosChar 127
- + #else ~CharsAreSigned
- + #define MaxPosChar 255
- + #endif CharsAreSigned
- + #ifndef _AlphabetSize
- + #define _AlphabetSize 128
- + #endif
- +
- + static int _set_ctr = MaxPosChar;
- + static char _set_vec[_AlphabetSize];
- +
- + void _str2set(set)
- + register String set;
- + {
- + if (set == NULL)
- + return;
- + if (++_set_ctr == MaxPosChar+1) {
- + #if VAX
- + asm("movc5 $0,4(ap),$0,$128,__set_vec");
- + #else /* !VAX */
- + register char *w = &_set_vec[_AlphabetSize];
- + do
- + *--w = '\0';
- + while (w != &_set_vec[0]);
- + #endif VAX
- + _set_ctr = 1;
- + }
- + while (*set)
- + _set_vec[*set++] = _set_ctr;
- + }
- +
- + String strpbrk(s1, s2)
- + register String s1, s2;
- + {
- + _str2set(set);
- + while (_set_vec[*str] != _set_ctr)
- + if (!*str++)
- + return NULL;
- + return str;
- + }
- + #endif /* BSD */
- diff -c xinfo.release/Info.h xinfo/Info.h
- *** xinfo.release/Info.h Mon Jan 29 11:55:20 1990
- --- xinfo/Info.h Mon Apr 30 13:29:44 1990
- ***************
- *** 1,7 ****
- #ifndef _Info_h
- #define _Info_h
-
- ! /* $Header: /usr1/ben/jkh/src/xinfo/RCS/Info.h,v 1.1 90/01/27 22:43:34 jkh Exp $ */
-
- /*
- *
- --- 1,7 ----
- #ifndef _Info_h
- #define _Info_h
-
- ! /* $Header: /usr1/ben/jkh/src/xinfo/RCS/Info.h,v 1.1 90/04/30 13:29:36 jkh Exp $ */
-
- /*
- *
- ***************
- *** 34,39 ****
- --- 34,42 ----
- /*
- *
- * $Log: Info.h,v $
- + * Revision 1.1 90/04/30 13:29:36 jkh
- + * Initial revision
- + *
- * Revision 1.1 90/01/27 22:43:34 jkh
- * Initial revision
- *
- diff -c xinfo.release/InfoP.h xinfo/InfoP.h
- *** xinfo.release/InfoP.h Mon Jan 29 11:55:22 1990
- --- xinfo/InfoP.h Mon Apr 30 13:29:46 1990
- ***************
- *** 1,7 ****
- #ifndef _InfoP_h
- #define _InfoP_h
-
- ! /* $Header: /usr1/ben/jkh/src/xinfo/RCS/InfoP.h,v 1.3 90/01/29 11:29:24 jkh Exp $ */
-
- /*
- *
- --- 1,7 ----
- #ifndef _InfoP_h
- #define _InfoP_h
-
- ! /* $Header: /usr1/ben/jkh/src/xinfo/RCS/InfoP.h,v 1.1 90/04/30 13:29:44 jkh Exp $ */
-
- /*
- *
- ***************
- *** 34,39 ****
- --- 34,42 ----
- /*
- *
- * $Log: InfoP.h,v $
- + * Revision 1.1 90/04/30 13:29:44 jkh
- + * Initial revision
- + *
- * Revision 1.3 90/01/29 11:29:24 jkh
- * *** empty log message ***
- *
- diff -c xinfo.release/xinfo.c xinfo/xinfo.c
- *** xinfo.release/xinfo.c Mon Jan 29 11:55:26 1990
- --- xinfo/xinfo.c Mon Apr 30 13:29:48 1990
- ***************
- *** 1,5 ****
- #ifndef lint
- ! static char *rcsid = "$Header: /usr1/ben/jkh/src/xinfo/RCS/xinfo.c,v 1.4 90/01/29 11:29:33 jkh Exp $";
- #endif
-
- /*
- --- 1,5 ----
- #ifndef lint
- ! static char *rcsid = "$Header: /usr1/ben/jkh/src/xinfo/RCS/xinfo.c,v 1.1 90/04/30 13:29:46 jkh Exp $";
- #endif
-
- /*
- ***************
- *** 33,38 ****
- --- 33,41 ----
- /*
- *
- * $Log: xinfo.c,v $
- + * Revision 1.1 90/04/30 13:29:46 jkh
- + * Initial revision
- + *
- * Revision 1.4 90/01/29 11:29:33 jkh
- * *** empty log message ***
- *
-
- *** Info.c~ Mon Apr 30 13:42:19 1990
- --- Info.c Mon Apr 30 13:52:48 1990
- ***************
- *** 779,784 ****
- --- 779,785 ----
- NodeInfo *n;
- {
- register String mstart;
- + String strpbrk();
-
- /* start clean */
- ZERO_LIST(n->menu);
- ***************
- *** 830,835 ****
- --- 831,837 ----
- NodeInfo *n;
- {
- register String nstart;
- + String strpbrk();
-
- /* start clean */
- ZERO_LIST(n->xref);
- dan
- ----------------------------------------------------
- O'Reilly && Associates argv@sun.com / argv@ora.com
- Opinions expressed reflect those of the author only.
-