File: tokenize.h

package info (click to toggle)
vis5d 4.3-5
  • links: PTS
  • area: main
  • in suites: slink
  • size: 16,856 kB
  • ctags: 6,127
  • sloc: ansic: 66,158; fortran: 4,470; makefile: 1,683; tcl: 414; sh: 69
file content (41 lines) | stat: -rw-r--r-- 839 bytes parent folder | download | duplicates (5)
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
36
37
38
39
40
41
/* tokenize.h */


/*
 * Divide an input string into a sequence of tokens similar to how argc and
 * argv pass arguments to main().
 */


#ifndef TOKENIZE_H
#define TOKENIZE_H



/*
 * Divide a line of input into tokens separated by whitespace.
 * Input:  str - the input string
 * Output:  ntokens - number of tokens found
 * Return:  address of array of pointers to token strings
 *
 * Example:
 *    char **tokenv;
 *    int tokenc;
 *    tokenv = tokenize( "this is a test.", &tokenc );
 * Then:
 *    tokenv[0] = "this"
 *    tokenv[1] = "is"
 *    tokenv[2] = "a"
 *    tokenv[3] = "test."
 */
extern char **tokenize( char *str, int *ntokens );


/*
 * Free a vector of tokens as returned by tokenize().
 * Input:  tokens - the address of the array of pointers to token strings
 */
extern void free_tokens( char **tokens );


#endif