// xr.cpp - generate a cross-reference of words
#include <ctype.h>
#include <stdio.h>
#include "table.h"
int get_token(char *s, size_t n);
#define MAX_TOKEN 256
int main()
{
cross_reference_table table;
char token[MAX_TOKEN];
unsigned ln = 1;
while (get_token(token, MAX_TOKEN))
if (isalpha(token[0]) || token[0] == '_')
table.add(token, ln);
else // if (token[0] == '\n')
++ln;
table.put();
return 0;
}
int get_token(char *s, size_t n)
{
... same as in Listing 1 ...
}
//End of File