home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / wp_dtp / xdme1820.lha / XDME / smallspc.c < prev    next >
C/C++ Source or Header  |  1993-03-09  |  17KB  |  767 lines

  1. /******************************************************************************
  2.  
  3.     MODUL
  4.     smallspc.c
  5.  
  6.     DESCRIPTION
  7.     minimal interface for special variables
  8.     setting and reading
  9.  
  10.     NOTES
  11.     look into future/...
  12.  
  13.     BUGS
  14.     none known
  15.  
  16.     TODO
  17.     entries for all new spcvars
  18.     join the 3 functions into 1
  19.     create a list that is scanned in a loop
  20.  
  21.     EXAMPLES
  22.  
  23.     SEE ALSO
  24.     vars.c
  25.  
  26.     INDEX
  27.  
  28.     HISTORY
  29.     21 Nov 92 null created
  30.  
  31. ******************************************************************************/
  32.  
  33. /**************************************
  34.         Includes
  35. **************************************/
  36. #include "defs.h"
  37.  
  38. /**************************************
  39.         Globale Variable
  40. **************************************/
  41. Prototype CHAR* GetSpecialVar (CHAR* Name);
  42. Prototype CHAR* GetSpecialInt (CHAR* Name);
  43. Prototype CHAR* GetSpecialFlag(CHAR* Name);
  44.  
  45. Prototype char SetSpecialFlag(CHAR* Name, CHAR* Value);
  46. Prototype char SetSpecialInt (CHAR* Name, CHAR* Value);
  47. Prototype char SetSpecialVar (CHAR* Name, CHAR* Value);
  48.  
  49. Prototype void do_togglespecialflag(void);
  50. Prototype void do_setspecialvar(void);
  51.  
  52. extern ubyte Fstr[];
  53. extern ubyte Rstr[];
  54.  
  55. /**************************************
  56.       Interne Defines & Strukturen
  57. **************************************/
  58.     const CHAR* N_ascii     = "ascii";
  59.     const CHAR* N_autoindent    = "autoindent";
  60.     const CHAR* N_autosplit    = "autosplit";
  61.     const CHAR* N_autounblock    = "autounblock";
  62.     const CHAR* N_activetofront = "activetofront";
  63.     const CHAR* N_bgpen     = "bgpen";
  64.     const CHAR* N_bbpen     = "bbpen";
  65.     const CHAR* N_colno     = "colno";
  66.     const CHAR* N_currentline    = "currentline";
  67.     const CHAR* N_currentword    = "currentword";
  68.     const CHAR* N_cursorpen    = "cursorpen";
  69.     const CHAR* N_debug     = "debug";
  70.     const CHAR* N_fgpen     = "fgpen";
  71.     const CHAR* N_filename    = "filename";
  72.     const CHAR* N_findstr    = "findstr";
  73.     const CHAR* N_fname     = "fname";
  74.     const CHAR* N_fpath     = "fpath";
  75.     const CHAR* N_globalsearch    = "globalsearch";
  76.     const CHAR* N_hgpen     = "hgpen";
  77.     const CHAR* N_ignorecase    = "ignorecase";
  78.     const CHAR* N_infixmode    = "infixmode";
  79.     const CHAR* N_insertmode    = "insertmode";
  80.     const CHAR* N_keytable    = "keytable";
  81.     const CHAR* N_lineno    = "lineno";
  82.     const CHAR* N_margin    = "margin";
  83.     const CHAR* N_menustrip    = "menustrip";
  84.     const CHAR* N_modified    = "modified";
  85.     const CHAR* N_parcol    = "parcol";
  86.     const CHAR* N_qualifiers    = "qualifiers";
  87.     const CHAR* N_refpaths    = "refpaths";
  88.     const CHAR* N_repstr    = "repstr";
  89.     const CHAR* N_restofline    = "restofline";
  90.     const CHAR* N_rexxport    = "rexxport";
  91.     const CHAR* N_savetabs    = "savetabs";
  92.     const CHAR* N_scanf     = "scanf";
  93.     const CHAR* N_tabstop    = "tabstop";
  94.     const CHAR* N_textnames    = "textnames";
  95.     const CHAR* N_tpen        = "tpen";
  96.     const CHAR* N_viewmode    = "viewmode";
  97.     const CHAR* N_wordwrap    = "wordwrap";
  98.     const CHAR* N_windowcycling = "windowcycling";
  99.  
  100.  
  101. /**************************************
  102.         Interne Variable
  103. **************************************/
  104.  
  105.  
  106. /**************************************
  107.        Interne Prototypes
  108. **************************************/
  109. Prototype CHAR* current_word (void);
  110.  
  111.  
  112. /*
  113. **  GetSpecialVar - Get one of the internal special String Vars:
  114. **
  115. **  >name == the name of the variable to search for
  116. **  <ptr to malloced string
  117. **  <NULL == not found or error
  118. */
  119.  
  120. CHAR*
  121. GetSpecialVar(CHAR* Name)
  122. {
  123.     int i,j;
  124.     CHAR* str;        /* return */
  125.     CHAR* ptr;        /* help: if not NULL, anything was found */
  126.  
  127.     str = NULL;
  128.     ptr = NULL;
  129.     i = 0;
  130.     j = 0;
  131. /* printf("Vn=%s\n",Name); */
  132.  
  133.     if ((Name == NULL) || (Name[0] == 0))
  134.     {
  135.     return(NULL);
  136.     } /* if */
  137.                     /* String Variables */
  138.  
  139.     switch (Name[0])
  140.     {
  141.     case 'c':
  142.     if (strcmp (Name, N_currentline) == 0)
  143.     { /* old */
  144.         ptr = Current;
  145.     } else
  146.     if (strcmp (Name, N_currentword) == 0)
  147.     { /* new */
  148.         ptr = current_word();
  149.     } /* if */
  150.     break;
  151.     case 'f':
  152.     if (strcmp (Name, N_filename) == 0)
  153.     {    /* old */
  154.         ptr = Ep->name;
  155.     } else
  156.     if (strcmp (Name, N_fname) == 0)
  157.     {    /* old */
  158.         ptr = fname(Ep->name);
  159.     } else
  160.     if (strcmp (Name, N_findstr) == 0)
  161.     {     /* old */
  162.         ptr = Fstr;
  163.     } /* if */
  164.     break;
  165.  
  166.     case 'k':                                   /* PATCH_NULL [01 Feb 1993] : added */
  167.     if (strcmp (Name, N_keytable) == 0)
  168.     {
  169.         if (ptr = currenthash()) {
  170.         ptr = ((struct Node *)ptr)->ln_Name;
  171.         } /* if */
  172.     } /* if */
  173.     break;
  174.     case 'm':                                   /* PATCH_NULL [01 Feb 1993] : added */
  175.     if (strcmp (Name, N_menustrip) == 0)
  176.     {
  177.         if (ptr = currentmenu()) {
  178.         ptr = ((struct Node *)ptr)->ln_Name;
  179.         } /* if */
  180.     } /* if */
  181.     break;
  182.     case 'r':
  183.     if (strcmp (Name, N_repstr) == 0)
  184.     {      /* old */
  185.         ptr = Rstr;
  186.     } else
  187.     if (strcmp (Name, N_restofline) == 0)
  188.     {
  189.         if (Clen>=Ep->column) {
  190.         ptr = Current + Ep->column;        /* DANGER */
  191.         } else {
  192.         ptr = Current + Clen;
  193.         } /* if */
  194.     } /* if */
  195.     break;
  196.     case 's':
  197.     if (strcmp (Name, N_scanf) == 0)
  198.     {    /* old */
  199.         ptr = String;
  200.     } /* if */
  201.     break;
  202.     default:
  203.     break;
  204.     } /* switch */
  205.  
  206.     if (ptr != NULL)
  207.     {
  208.     str = malloc (strlen(ptr)+1);
  209.     if (str)
  210.     {
  211.         strcpy(str, ptr);
  212.         return(str);
  213.     } else if (*ptr != 0)
  214.     {
  215.         nomemory();
  216.         abort(NULL);
  217.     } else
  218.     {
  219.         return(str);
  220.     } /* if */
  221.     } /* if */
  222.  
  223.     return(NULL);
  224. } /* GetSpcVar */
  225.  
  226.  
  227. /*
  228. **  SetSpecialVar - set one of DME's internal special String vars
  229. **
  230. **  >Name  - name of the variable to modify
  231. **  >Value - new value of the variable
  232. **  <0 == name not found
  233. **  <1 == ok ( also if variable is readonly )
  234. */
  235.  
  236. char
  237. SetSpecialVar(CHAR* Name, CHAR* Value)
  238. {
  239.     CHAR* ptr;
  240.     int len;
  241.  
  242.     if ((Name == NULL) || (Name[0] == 0))
  243.     {
  244.     return(0);
  245.     } /* if */
  246.     ptr = NULL;
  247.     len = LINE_LENGTH;
  248.  
  249. /* printf("Vs=%s\n",Name); */
  250.  
  251.     if (strcmp (Name, N_filename) == 0)
  252.     {
  253.         ptr = Ep->name;
  254.         len = 63;
  255.     } else
  256.  
  257.     if (strcmp (Name, N_findstr) == 0)
  258.     {
  259.         ptr = Fstr;
  260.     } else
  261.     if (strcmp (Name, N_repstr) == 0)
  262.     {
  263.         ptr = Rstr;
  264.     } else
  265.     if (strcmp (Name, N_scanf) == 0)
  266.     {
  267.         ptr = String;
  268.     } else
  269.     if (strcmp (Name, N_currentline) == 0)
  270.     {
  271.         abort(1);
  272.     } else
  273.     if (strcmp (Name, N_currentword) == 0)
  274.     {
  275.         abort(1);
  276.     } else
  277.     if (strcmp (Name, N_restofline) == 0)
  278.     {
  279.         abort(1);
  280.     } /* if */
  281.  
  282.     if (ptr)
  283.     {
  284.     strncpy(ptr, Value, len);
  285.     return(1);  /* found */
  286.     } else
  287.     return(0);  /* not found */
  288. } /* SetSpecialVar */
  289.  
  290.  
  291.  
  292. /*
  293. **  GetSpecialInt - Get one of the internal special Integer Vars:
  294. **
  295. **  >name == the name of the variable to search for
  296. **  <ptr to malloced string
  297. **  <NULL == not found or error
  298. */
  299.  
  300. CHAR*
  301. GetSpecialInt(CHAR* Name)
  302. {
  303.     int found;
  304.     long i;
  305.     CHAR* str;        /* return */
  306.     char buffer[16];    /* help: convert numbers here */
  307.  
  308.     found = 0;
  309. /* printf("In=%s\n",Name); */
  310.  
  311.     if (strcmp (Name, N_ascii) == 0)
  312.     { /* current char */
  313.         i = Current[Ep->column];
  314.         found = 1;
  315.     } else
  316.     if (strcmp (Name, N_bbpen) == 0)
  317.     { /* highlight pen */
  318.         i = BLOCK_BPEN;
  319.         found = 1;
  320.     } else
  321.     if (strcmp (Name, N_bgpen) == 0)
  322.     { /* background pen */
  323.         i = TEXT_BPEN;
  324.         found = 1;
  325.     } else
  326.     if (strcmp (Name, N_colno) == 0)
  327.     { /* current xpos */
  328.         i = Ep->column + 1;
  329.         found = 1;
  330.     } else
  331.     if (strcmp (Name, N_fgpen) == 0)
  332.     { /* foreground pen */
  333.         i = TEXT_FPEN;
  334.         found = 1;
  335.     } else
  336.     if (strcmp (Name, N_hgpen) == 0)
  337.     { /* highlight pen */
  338.         i = BLOCK_FPEN;
  339.         found = 1;
  340.     } else
  341.     if (strcmp (Name, N_lineno) == 0)
  342.     { /* current ypos */
  343.         i =  Ep->line + 1;
  344.         found = 1;
  345.     } else
  346.     if (strcmp (Name, N_margin) == 0)
  347.     { /* right margin for wordwrap */
  348.         i = Ep->config.margin;
  349.         found = 1;
  350.     } else
  351.     if (strcmp (Name, N_parcol) == 0)
  352.     { /* left margin of paragraph? */
  353.         i = Ep->config.wwcol;
  354.         found = 1;
  355.     } else
  356.     if (strcmp (Name, N_tpen) == 0)
  357.     { /* title bar rendering */
  358.         i = TITLE_BPEN;
  359.         found = 1;
  360.     } else
  361.     if (strcmp (Name, N_tabstop) == 0)
  362.     {
  363.         i = Ep->config.tabstop;
  364.         found = 1;
  365.     } /* if */
  366.  
  367.  
  368.     if (found)
  369.     {
  370.     sprintf(buffer,"%ld",i);
  371.     str = malloc(strlen(buffer)+1);
  372.     if (str)
  373.     {
  374.         strcpy(str, buffer);
  375.         return(str);
  376.     } else
  377.     {
  378.         nomemory();
  379.         abort(NULL);
  380.     } /* if */
  381.     } /* if */
  382.     return(NULL);
  383. } /* GetSpecialInt */
  384.  
  385.  
  386.  
  387. /*
  388.  *  GetSpecialFlag - Get one of the internal special Flags:
  389.  *
  390.  *  >name == the name of the variable to search for
  391.  *  <ptr to malloced string
  392.  *  <NULL == not found or error
  393.  */
  394.  
  395. CHAR*
  396. GetSpecialFlag(CHAR* Name)
  397. {
  398.     char i,found;
  399.     CHAR* str;        /* return */
  400.     char buffer[4];    /* help: convert numbers here */
  401.  
  402. /* printf("Fn=%s\n",Name); */
  403.     found = 0;
  404.                             /* locals */
  405.     if (strcmp (Name, N_autounblock) == 0)
  406.     {
  407.         i = Ep->config.autounblock ? 1 : 0;
  408.         found = 1;
  409.     } else
  410.     if (strcmp (Name, N_autoindent) == 0)
  411.     {
  412.         i = Ep->config.autoindent ? 1 : 0;
  413.         found = 1;
  414.     } else
  415.     if (strcmp (Name, N_autosplit) == 0)
  416.     {
  417.         i = Ep->config.autosplit ? 1 : 0;
  418.         found = 1;
  419.     } else
  420.     if (strcmp (Name, N_debug) == 0)
  421.     {
  422.         i = globalflags.debug ? 1 : 0;
  423.         found = 1;
  424.     } else
  425.     if (strcmp (Name, N_infixmode) == 0)
  426.     {  /* while searching */
  427.         i = Ep->config.ignorecase ? 1 : 0;
  428.         found = 1;
  429.     } else
  430.     if (strcmp (Name, N_insertmode) == 0)
  431.     {  /* <-> overwrite */
  432.         i = Ep->config.insertmode ? 1 : 0;
  433.         found = 1;
  434.     } else
  435.     if (strcmp (Name, N_modified) == 0)
  436.     {    /*  */
  437.         i = Ep->modified ? 1 : 0;
  438.         found = 1;
  439.     } else
  440.     if (strcmp (Name, N_viewmode) == 0)
  441.     {
  442.         i = Ep->viewmode ? 1 : 0;
  443.         found = 1;
  444.     } else
  445.     if (strcmp (Name, N_wordwrap) == 0)
  446.     {
  447.         i = Ep->config.wordwrap ? 1 : 0;
  448.         found = 1;
  449.     } else
  450.  
  451.                             /* globals */
  452.     if (strcmp (Name, N_activetofront) == 0)
  453.     {
  454.         i = globalflags.ActivateToFront ? 1 : 0;
  455.         found = 1;
  456.     } else
  457.     if (strcmp (Name, N_globalsearch) == 0)
  458.     {
  459.         i = globalflags.global_search ? 1 : 0;
  460.         found = 1;
  461.     } else
  462.     if (strcmp (Name, N_infixmode) == 0)
  463.     {   /* <-> prefixmode / math2 */
  464.         i = MathInfix ? 1 : 0;
  465.         found = 1;
  466.     } else
  467.     if (strcmp (Name, N_savetabs) == 0)
  468.     {
  469.         i = globalflags.Savetabs ? 1 : 0;
  470.         found = 1;
  471.     } else
  472.     if (strcmp (Name, N_windowcycling) == 0)
  473.     {
  474.         i = globalflags.Windowcycling ? 1 : 0;
  475.         found = 1;
  476.     /* aborted */
  477.     } /* if */
  478.  
  479.     if (found)
  480.     {
  481.     sprintf(buffer,"%ld",i);
  482.     if (str = strdup(buffer))
  483.     {
  484.         return(str);
  485.     } else
  486.     {
  487.         nomemory();
  488.         abort(NULL);
  489.     } /* if */
  490.     } /* if */
  491.     return(NULL);
  492. } /* GetSpecialFlag */
  493.  
  494.  
  495.  
  496. /*
  497.  *  SetSpecialInt - Set a special Integer variable
  498.  *
  499.  *  >Name  - name of the variable to modify
  500.  *  >value - new value of the variable
  501.  *  <0 == name not found or value was no integer
  502.  *  <1 == name found (also if variable is write only)
  503.  */
  504.  
  505. char
  506. SetSpecialInt(CHAR* name, CHAR* value)
  507. {
  508.     int   val;
  509.     char found = 0;
  510.  
  511. /* printf("Is=%s\n",name); */
  512.     if (!is_number(value))
  513.     {  /* --- that is not correct but easy */
  514.     return(0);
  515.     } /* if */
  516.     val = atoi(value);
  517.  
  518.  
  519.     if ((strcmp (name, N_bgpen) == 0) ||
  520.       (strcmp (name, N_colno) == 0) ||
  521.       (strcmp (name, N_lineno) == 0) ||
  522.       (strcmp (name, N_fgpen) == 0) ||
  523.       (strcmp (name, N_hgpen) == 0) ||
  524.       (strcmp (name, N_tpen) == 0))
  525.       {
  526.         abort(1);
  527.     } else
  528.     if (strcmp (name, N_ascii) == 0)
  529.     {
  530.         if (!Ep->viewmode)
  531.         {
  532.         Current[Ep->column] = val / LINE_LENGTH;
  533.         } /* if */
  534.     } else
  535.     if (strcmp (name, N_margin) == 0)
  536.     {
  537.         Ep->config.margin = val % (LINE_LENGTH);
  538.     } else
  539.     if (strcmp (name, N_parcol) == 0)
  540.     {
  541.         Ep->config.wwcol = val % (LINE_LENGTH);
  542.     } else
  543.     if (strcmp (name, N_tabstop) == 0)
  544.     {
  545.         Ep->config.tabstop = val % (LINE_LENGTH);
  546.     } else
  547.     {
  548.         return(0);  /* not found */
  549.     } /* if */
  550.     return(1);      /* found */
  551. } /* SetSpecialInt */
  552.  
  553.  
  554.  
  555. /*
  556.  *  SetSpecialFlag - Set a specialFlag
  557.  *
  558.  *  >Name  - name of the variable to modify
  559.  *  >value - new value of the variable
  560.  *  <0 == name not found
  561.  *  <1 == ok ( also if other error)
  562.  */
  563.  
  564. char
  565. SetSpecialFlag(CHAR* name, CHAR* value)
  566. {
  567.     CHAR* charptr;
  568.     CHAR* comment;
  569.     char  buffer[32];
  570.     CHAR* com[2];
  571.  
  572.     charptr = NULL;
  573.     comment = NULL;
  574.     com[0]  = "Off";
  575.     com[1]  = "On";
  576.  
  577. /* printf("Fs=%s\n",name); */
  578. /* --- local flags */
  579.     if (strcmp (name, N_autounblock) == 0)
  580.     {
  581.         charptr = &Ep->config.autounblock;
  582.         comment = "Autounblock";
  583.     } else
  584.     if (strcmp (name, N_autoindent) == 0)
  585.     {
  586.         charptr = &Ep->config.autoindent;
  587.         comment = "Autoindent";
  588.     } else
  589.     if (strcmp (name, N_autosplit) == 0)
  590.     {
  591.         charptr = &Ep->config.autosplit;
  592.         comment = "Autosplit";
  593.     } else
  594.     if (strcmp (name, N_ignorecase) == 0)
  595.     {   /* search case <-> ignorecase */
  596.         charptr = &Ep->config.ignorecase;
  597.         comment = "Case";
  598.         com[0]  = "Sensitive";
  599.         com[1]  = "InSensitive";
  600.     } else
  601.     if (strcmp (name, N_insertmode) == 0)
  602.     {   /* <-> overwrite text */
  603.         charptr = &Ep->config.insertmode;
  604.         comment = "Insert mode";
  605.     } else
  606.     if (strcmp (name, N_wordwrap) == 0)
  607.     {
  608.         charptr = &Ep->config.wordwrap;
  609.         comment = "WordWrap";
  610. #ifdef NOTDEF
  611.     } else
  612.     if (strcmp (name, N_viewmode) == 0)
  613.     {
  614.         charptr = &Ep->viewmode;
  615.         comment = "Viewmode";
  616.     } else
  617.     if (strcmp (name, N_modified) == 0)
  618.     {     /* text-modified */
  619.         charptr = &Ep->modified;
  620.         comment = "Modified";
  621. #endif
  622.     }
  623.  
  624. #ifdef NOTDEF
  625. /* --- global flags */
  626.     else if (strcmp (name, N_activetofront) == 0)
  627.     {
  628.         charptr = &globalflags.ActivateToFront;
  629.         comment = "Moving Activated Windows To Front";
  630.     } else
  631.     if (strcmp (name, N_debug) == 0)
  632.     {
  633.         charptr = &globalflags.debug;
  634.         comment = "Debugging mode";
  635.     } else
  636.     if (strcmp (name, N_globalsearch) == 0)
  637.     {
  638.         charptr = &globalflags.global_search;
  639.         comment = "Global Searching";
  640.     } else
  641.     if (strcmp (name, N_infixmode) == 0)
  642.     {    /* math infixmode <-> prefixmode */
  643.         charptr = &globalflags.MathInfix;
  644.         comment = "Infixmode";
  645.     } else
  646.     if (strcmp (name, N_savetabs) == 0)
  647.     {     /* save tabs or whitespaces */
  648.         charptr = &globalflags.Savetabs;
  649.         comment = "SaveTabs";
  650.     } else
  651.     if (strcmp (name, N_windowcycling) == 0)
  652.     {
  653.         charptr = &globalflags.Windowcycling;
  654.         comment = "Windowcycling";
  655.     } /* if */
  656. #endif
  657.  
  658.     if (charptr)
  659.     {
  660.     *charptr = test_arg (value, *charptr);
  661.     if (comment)
  662.     {
  663.         sprintf(buffer,"%s %s ",comment, com[*charptr]);
  664.         title(buffer);
  665.     } /* if */
  666.     return(1); /* found */
  667.     } /* if */
  668.     return(0);     /* not found */
  669. } /* SetSpecialFlag */
  670.  
  671.  
  672.  
  673. /*
  674.  *    This function is to be called for all toggling any special flag
  675.  *    via a command:        flagname mode
  676.  *  The only thing is - the variable must be treated here
  677.  */
  678.  
  679. void
  680. do_togglespecialflag()
  681. {
  682.     if (!SetSpecialFlag(av[0],av[1]))
  683.     abort();
  684. } /* do_togglespecialflag */
  685.  
  686.  
  687.  
  688. /*
  689.  *    This function might be called for all setting any special var
  690.  *    via a command:        varname mode
  691.  *  The only thing is - the variable must be treated here
  692.  */
  693.  
  694. void
  695. do_setspecialvar()
  696. {
  697.     if ( !SetSpecialInt(av[0],av[1])
  698.       && !SetSpecialVar(av[0],av[1]) )
  699.     abort();
  700. } /* do_setspecialvar */
  701.  
  702.  
  703. /*
  704. **  Redefine these names to adjust the used buffers to Your settings
  705. **  the commands are 'atomic' so there should be no interference to
  706. **  other 'atomic' commands using them.
  707. **
  708. **  for XDME changed buffers[0]/buffers[1] to tmp_buffer/tmp_buf2
  709. */
  710. #define firstbuffer  tmp_buffer
  711.  
  712.  
  713.  
  714.  
  715. /*
  716. *!  $[SPC.]currentword
  717. *!    that read-only special-variable
  718. *!    represents "the word under the cursor"
  719. *!    that means it finds the beginning of the current word on
  720. *!    on its own (but we do not move the cursor) if cursor is
  721. *!    not within a word, it returns the next word of the line
  722. *!    if there is no next word, an empty string is returned
  723. *!  NOTE this variable is not accessible, if PATCH_VARS is not active
  724. *!
  725. **  current_word           (uses firstbuffer)
  726. **
  727. **  Returns the word under the cursor,
  728. **  is used by fastscan and should be used by ref and tag instead of
  729. **  their own functions
  730. */
  731.  
  732. #define isC(ch)     (isalnum((ch)) || (ch) == '_')
  733.  
  734. CHAR * current_word (void)
  735. {
  736.     register CHAR* str;
  737.     register int i,j;
  738.  
  739.     str = firstbuffer;
  740.  
  741.     i = Ep->column;
  742.     while ((i>0) && isC(Current[i]))
  743.     {           /*  goto beginning of word */
  744.     i--;
  745.     } /* while */
  746.     while ((Current[i]) && !isC(Current[i]))
  747.     {  /* skip spaces and other garbage */
  748.     i++;
  749.     } /* while */
  750.  
  751.     j = 0;
  752.     while (isC(Current[i]) && (j <= LINE_LENGTH))
  753.     {
  754.     str[j] = Current[i];                /* copy "word" into buffer */
  755.     j++;
  756.     i++;
  757.     } /* while */
  758.     str[j] = 0;
  759.  
  760.     return (str);
  761. } /* current_word */
  762.  
  763.  
  764. /******************************************************************************
  765. *****  ENDE smallspc.c
  766. ******************************************************************************/
  767.