home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / jove-4.16-src.tgz / tar.out / bsd / jove / vars.c < prev    next >
C/C++ Source or Header  |  1996-09-28  |  1KB  |  60 lines

  1. /************************************************************************
  2.  * This program is Copyright (C) 1986-1996 by Jonathan Payne.  JOVE is  *
  3.  * provided to you without charge, and with no warranty.  You may give  *
  4.  * away copies of JOVE, including sources, provided that this notice is *
  5.  * included in all the files.                                           *
  6.  ************************************************************************/
  7.  
  8. #include "jove.h"
  9. #include "extend.h"
  10. #include "vars.h"
  11.  
  12. /* included for variable declarations */
  13. #include "abbrev.h"
  14. #include "ask.h"
  15. #include "c.h"
  16. #include "jctype.h"
  17. #include "disp.h"
  18. #include "insert.h"
  19. /* #include "io.h" */
  20. #include "sysprocs.h"    /* needed for iproc.h */
  21. #include "iproc.h"
  22. /* #include "jove.h" */
  23. #include "mac.h"
  24. #include "mouse.h"
  25. #include "paragraph.h"
  26. #include "proc.h"
  27. #include "re.h"
  28. #include "reapp.h"
  29. #include "rec.h"
  30. #include "screen.h"
  31. #include "term.h"
  32. #include "ttystate.h"
  33. /* #include "util.h" */
  34. #include "wind.h"
  35.  
  36.  
  37. #define VAR(v)    (UnivPtr)(v), sizeof(v)
  38. #include "vars.tab"
  39.  
  40. data_obj *
  41. findvar(prompt)
  42. const char    *prompt;
  43. {
  44.     static char    *strings[elemsof(variables)];
  45.     static int    last = -1;
  46.  
  47.     if (strings[0] == NULL) {
  48.         register char    **strs = strings;
  49.         register const struct variable    *v = variables;
  50.  
  51.         for (; v->Name; v++)
  52.             *strs++ = v->Name;
  53.         *strs = NULL;
  54.     }
  55.  
  56.     last = complete(strings, last >= 0? strings[last] : (char *)NULL,
  57.         prompt, ALLOW_OLD);
  58.     return (data_obj *) &variables[last];
  59. }
  60.