File: GETWORD.c

package info (click to toggle)
qepcad 1.74%2Bds-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,848 kB
  • sloc: ansic: 27,242; cpp: 2,995; makefile: 1,287; perl: 91
file content (35 lines) | stat: -rw-r--r-- 879 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*======================================================================
                      W <- GETWORD()

Get a word.

\Output
  \parm{W} is a list of alphanumeric characters  read from the input stream.
           The leading blanks are skipped. (- and _ are considered to be
           alphbetics)
======================================================================*/
#include "qepcad.h"

Word GETWORD()
{
       Word C,W;
       /* hide C; */

Step1: /* Get a word. */
       C = CREADB();
       W = LIST1(C);
       C = CREAD();
       while (('A' <= C && C <= 'Z') || 
              ('a' <= C && C <= 'z') || 
              ('0' <= C && C <= '9') || 
              C == '-' ||
              C == '_' )
         {
         W = COMP(C,W);
         C = CREAD();
         }
       BKSP(); W = INV(W); goto Return;

Return: /* Prepare for return. */
       return(W);
}