home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume7 / infow / patch1 next >
Encoding:
Internet Message Format  |  1990-04-30  |  8.4 KB

  1. Path: uunet!snorkelwacker!apple!sun-barr!newstop!sun!meepmeep.pcs.com
  2. From: jkh@meepmeep.pcs.com (Jordan K. Hubbard)
  3. Newsgroups: comp.sources.x
  4. Subject: v07i014: Emacs Info Browsing Widget, Patch1, Part01/01
  5. Message-ID: <135058@sun.Eng.Sun.COM>
  6. Date: 1 May 90 08:16:30 GMT
  7. Sender: news@sun.Eng.Sun.COM
  8. Lines: 352
  9. Approved: argv@sun.com
  10.  
  11. Submitted-by: jkh@meepmeep.pcs.com (Jordan K. Hubbard)
  12. Posting-number: Volume 7, Issue 14
  13. Archive-name: infow/patch1
  14. Patch-To: infow: Volume 6, Issues 92,93
  15.  
  16. Fixes contained in patch 1:
  17.  
  18. 1. Those without strpbrk() will now find a PD version at the end of
  19.    Info.c (automatically used if BSD is defined).
  20.  
  21. 2. toupper() as macro now properly dealt with.
  22.  
  23. 3. Menu names containing imbeded punctuation are now dealt with properly.
  24.  
  25. 4. RCS log/header lines filled in (we only needed to do this once).
  26.  
  27. -------------------------------------------------------------------------
  28. diff -c xinfo.release/Info.c xinfo/Info.c
  29. *** xinfo.release/Info.c    Wed Apr 25 18:43:08 1990
  30. --- xinfo/Info.c    Mon Apr 30 13:42:19 1990
  31. ***************
  32. *** 1,5 ****
  33.   #ifndef lint
  34. ! static char *rcsid = "$Header$";
  35.   #endif
  36.   
  37.   #include <X11/IntrinsicP.h>
  38. --- 1,5 ----
  39.   #ifndef lint
  40. ! 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 $";
  41.   #endif
  42.   
  43.   #include <X11/IntrinsicP.h>
  44. ***************
  45. *** 49,55 ****
  46.    */
  47.   
  48.   /*
  49. !  * $Log$
  50.    */
  51.   
  52.   #define offset(name)    XtOffset(InfoWidget, info.name)
  53. --- 49,58 ----
  54.    */
  55.   
  56.   /*
  57. !  * $Log:    Info.c,v $
  58. !  * Revision 1.1  90/04/30  13:29:21  jkh
  59. !  * Initial revision
  60. !  * 
  61.    */
  62.   
  63.   #define offset(name)    XtOffset(InfoWidget, info.name)
  64. ***************
  65. *** 233,238 ****
  66. --- 236,244 ----
  67.   
  68.   #ifndef tolower
  69.   Import char tolower();
  70. + #define TOLOWER(c) (tolower(c))
  71. + #else
  72. + #define TOLOWER(c) (isupper(c) ? tolower(c) : (c))
  73.   #endif
  74.   
  75.   Local XtCallbackRec cb[2];
  76. ***************
  77. *** 798,808 ****
  78.              strip_evil(LPOS(n->menu));
  79.              /* Is the menu name not the node name? */
  80.              if (*mstart != ':') {
  81.               mstart = eat_whitespace(mstart);
  82.               I_START(TPOS(n->menu.t)) = INTOFF(START(iw), mstart);
  83.               I_LEN(TPOS(n->menu.t)) =
  84. !              INTOFF(START(iw), strpbrk(mstart, NAME_END_TOKEN)) -
  85. !                   I_START(TPOS(n->menu.t));
  86.              }
  87.              INCP(n->menu.t);
  88.         }
  89. --- 804,823 ----
  90.              strip_evil(LPOS(n->menu));
  91.              /* Is the menu name not the node name? */
  92.              if (*mstart != ':') {
  93. +             int plev = 0;
  94.               mstart = eat_whitespace(mstart);
  95.               I_START(TPOS(n->menu.t)) = INTOFF(START(iw), mstart);
  96. +             while (*mstart != '\0' && !(plev == 0
  97. +                && index(NAME_END_TOKEN, *mstart) != NULL)) {
  98. +               if (*mstart == '(')
  99. +                    ++plev;
  100. +               else if (*mstart == ')')
  101. +                    --plev;
  102. +               mstart++;
  103. +              }
  104.               I_LEN(TPOS(n->menu.t)) =
  105. !              INTOFF(START(iw), mstart) - I_START(TPOS(n->menu.t));
  106.              }
  107.              INCP(n->menu.t);
  108.         }
  109. ***************
  110. *** 1746,1752 ****
  111.         if (!igncase)
  112.              comp = (*start == *ind);
  113.         else
  114. !            comp = (tolower(*start) == tolower(*ind));
  115.         if (!comp) {
  116.              if (ind != str)
  117.               ind = str;
  118. --- 1761,1767 ----
  119.         if (!igncase)
  120.              comp = (*start == *ind);
  121.         else
  122. !            comp = (TOLOWER(*start) == TOLOWER(*ind));
  123.         if (!comp) {
  124.              if (ind != str)
  125.               ind = str;
  126. ***************
  127. *** 1780,1786 ****
  128.         if (!igncase)
  129.              comp = (*start == *ind);
  130.         else
  131. !            comp = (tolower(*start) == tolower(*ind));
  132.         if (!comp) {
  133.              if (ind != str)
  134.               ind = str;
  135. --- 1795,1801 ----
  136.         if (!igncase)
  137.              comp = (*start == *ind);
  138.         else
  139. !            comp = (TOLOWER(*start) == TOLOWER(*ind));
  140.         if (!comp) {
  141.              if (ind != str)
  142.               ind = str;
  143. ***************
  144. *** 1807,1813 ****
  145.         if (strlen(s1) != strlen(s2))
  146.             return(-1);
  147.   
  148. !       while (*s1 && *s2 && (tolower(*s1) == tolower(*s2)))
  149.              s1++, s2++;
  150.         if (!*s1 && !*s2)
  151.              return(0);
  152. --- 1822,1828 ----
  153.         if (strlen(s1) != strlen(s2))
  154.             return(-1);
  155.   
  156. !       while (*s1 && *s2 && (TOLOWER(*s1) == TOLOWER(*s2)))
  157.              s1++, s2++;
  158.         if (!*s1 && !*s2)
  159.              return(0);
  160. ***************
  161. *** 1832,1838 ****
  162.        register String s3 = s2 + n;
  163.   
  164.        if (s1 && s2) {
  165. !       while (*s1 && *s2 && (tolower(*s1) == tolower(*s2)) && (s2 < s3))
  166.              s1++, s2++;
  167.         if (!*s1 && !*s2 || s2 == s3)
  168.              return(0);
  169. --- 1847,1853 ----
  170.        register String s3 = s2 + n;
  171.   
  172.        if (s1 && s2) {
  173. !       while (*s1 && *s2 && (TOLOWER(*s1) == TOLOWER(*s2)) && (s2 < s3))
  174.              s1++, s2++;
  175.         if (!*s1 && !*s2 || s2 == s3)
  176.              return(0);
  177. ***************
  178. *** 1964,1971 ****
  179.   
  180.        if (s)
  181.         while (*s) {
  182. !            *s = tolower(*s);
  183.              s++;
  184.         }
  185.        return(orig);
  186.   }
  187. --- 1979,2033 ----
  188.   
  189.        if (s)
  190.         while (*s) {
  191. !            *s = TOLOWER(*s);
  192.              s++;
  193.         }
  194.        return(orig);
  195.   }
  196. + #ifdef BSD
  197. + /* BSD users don't have strpbrk() */
  198. + /* Routines taken from PD libc by Richard A. O'Keefe. */
  199. + #if     CharsAreSigned
  200. + #define MaxPosChar      127
  201. + #else  ~CharsAreSigned
  202. + #define MaxPosChar      255
  203. + #endif  CharsAreSigned
  204. + #ifndef _AlphabetSize
  205. + #define _AlphabetSize   128
  206. + #endif
  207. + static int  _set_ctr = MaxPosChar;
  208. + static char _set_vec[_AlphabetSize];
  209. + void _str2set(set)
  210. + register String set;
  211. + {
  212. +      if (set == NULL)
  213. +       return;
  214. +      if (++_set_ctr == MaxPosChar+1) {
  215. + #if     VAX
  216. +       asm("movc5 $0,4(ap),$0,$128,__set_vec");
  217. + #else  /* !VAX */
  218. +       register char *w = &_set_vec[_AlphabetSize];
  219. +       do
  220. +            *--w = '\0';
  221. +       while (w != &_set_vec[0]);
  222. + #endif  VAX
  223. +           _set_ctr = 1;
  224. +      }
  225. +      while (*set)
  226. +       _set_vec[*set++] = _set_ctr;
  227. + }
  228. + String strpbrk(s1, s2)
  229. + register String s1, s2;
  230. + {
  231. +      _str2set(set);
  232. +      while (_set_vec[*str] != _set_ctr)
  233. +           if (!*str++)
  234. +            return NULL;
  235. +      return str;
  236. + }
  237. + #endif /* BSD */
  238. diff -c xinfo.release/Info.h xinfo/Info.h
  239. *** xinfo.release/Info.h    Mon Jan 29 11:55:20 1990
  240. --- xinfo/Info.h    Mon Apr 30 13:29:44 1990
  241. ***************
  242. *** 1,7 ****
  243.   #ifndef _Info_h
  244.   #define _Info_h
  245.   
  246. ! /* $Header: /usr1/ben/jkh/src/xinfo/RCS/Info.h,v 1.1 90/01/27 22:43:34 jkh Exp $ */
  247.   
  248.   /*
  249.    *
  250. --- 1,7 ----
  251.   #ifndef _Info_h
  252.   #define _Info_h
  253.   
  254. ! /* $Header: /usr1/ben/jkh/src/xinfo/RCS/Info.h,v 1.1 90/04/30 13:29:36 jkh Exp $ */
  255.   
  256.   /*
  257.    *
  258. ***************
  259. *** 34,39 ****
  260. --- 34,42 ----
  261.   /*
  262.    *
  263.    * $Log:    Info.h,v $
  264. +  * Revision 1.1  90/04/30  13:29:36  jkh
  265. +  * Initial revision
  266. +  * 
  267.    * Revision 1.1  90/01/27  22:43:34  jkh
  268.    * Initial revision
  269.    * 
  270. diff -c xinfo.release/InfoP.h xinfo/InfoP.h
  271. *** xinfo.release/InfoP.h    Mon Jan 29 11:55:22 1990
  272. --- xinfo/InfoP.h    Mon Apr 30 13:29:46 1990
  273. ***************
  274. *** 1,7 ****
  275.   #ifndef _InfoP_h
  276.   #define _InfoP_h
  277.   
  278. ! /* $Header: /usr1/ben/jkh/src/xinfo/RCS/InfoP.h,v 1.3 90/01/29 11:29:24 jkh Exp $ */
  279.   
  280.   /*
  281.    *
  282. --- 1,7 ----
  283.   #ifndef _InfoP_h
  284.   #define _InfoP_h
  285.   
  286. ! /* $Header: /usr1/ben/jkh/src/xinfo/RCS/InfoP.h,v 1.1 90/04/30 13:29:44 jkh Exp $ */
  287.   
  288.   /*
  289.    *
  290. ***************
  291. *** 34,39 ****
  292. --- 34,42 ----
  293.   /*
  294.    *
  295.    * $Log:    InfoP.h,v $
  296. +  * Revision 1.1  90/04/30  13:29:44  jkh
  297. +  * Initial revision
  298. +  * 
  299.    * Revision 1.3  90/01/29  11:29:24  jkh
  300.    * *** empty log message ***
  301.    * 
  302. diff -c xinfo.release/xinfo.c xinfo/xinfo.c
  303. *** xinfo.release/xinfo.c    Mon Jan 29 11:55:26 1990
  304. --- xinfo/xinfo.c    Mon Apr 30 13:29:48 1990
  305. ***************
  306. *** 1,5 ****
  307.   #ifndef lint
  308. ! static char *rcsid = "$Header: /usr1/ben/jkh/src/xinfo/RCS/xinfo.c,v 1.4 90/01/29 11:29:33 jkh Exp $";
  309.   #endif
  310.   
  311.   /*
  312. --- 1,5 ----
  313.   #ifndef lint
  314. ! static char *rcsid = "$Header: /usr1/ben/jkh/src/xinfo/RCS/xinfo.c,v 1.1 90/04/30 13:29:46 jkh Exp $";
  315.   #endif
  316.   
  317.   /*
  318. ***************
  319. *** 33,38 ****
  320. --- 33,41 ----
  321.   /*
  322.    *
  323.    * $Log:    xinfo.c,v $
  324. +  * Revision 1.1  90/04/30  13:29:46  jkh
  325. +  * Initial revision
  326. +  * 
  327.    * Revision 1.4  90/01/29  11:29:33  jkh
  328.    * *** empty log message ***
  329.    * 
  330.  
  331. *** Info.c~    Mon Apr 30 13:42:19 1990
  332. --- Info.c    Mon Apr 30 13:52:48 1990
  333. ***************
  334. *** 779,784 ****
  335. --- 779,785 ----
  336.   NodeInfo *n;
  337.   {
  338.        register String mstart;
  339. +      String strpbrk();
  340.   
  341.        /* start clean */
  342.        ZERO_LIST(n->menu);
  343. ***************
  344. *** 830,835 ****
  345. --- 831,837 ----
  346.   NodeInfo *n;
  347.   {
  348.        register String nstart;
  349. +      String strpbrk();
  350.   
  351.        /* start clean */
  352.        ZERO_LIST(n->xref);
  353. dan
  354. ----------------------------------------------------
  355. O'Reilly && Associates   argv@sun.com / argv@ora.com
  356. Opinions expressed reflect those of the author only.
  357.