Go to the source code of this file.
Data Structures | |
| struct | node |
Functions | |
| err (char *s) | |
| int | getword (char *buf) |
| int | isletter (c) |
| node * | lookup (char *word, struct node **p) |
| node * | lookup () |
| main () | |
| int | strcmp (char *s1, char *s2) |
| tprint (struct node *tree) | |
Variables | |
| int | next |
| node | words [2000] |
|
Here is the call graph for this function:

|
|
Definition at line 32 of file wf1.c. References c, getchar, isletter(), and s. Referenced by main(). 00032 {
00033 char *s;
00034 int c;
00035
00036 while ((c = getchar()) != -1 && isletter(c) == 0)
00037 ;
00038 for (s = buf; c = isletter(c); c = getchar())
00039 *s++ = c;
00040 *s = 0;
00041 if (s > buf)
00042 return (1);
00043 return (0);
00044 }
|
Here is the call graph for this function:

|
|
Definition at line 47 of file wf1.c. References c. Referenced by getword(). 00047 {
00048 if (c >= 'A' && c <= 'Z')
00049 c += 'a' - 'A';
00050 if (c >= 'a' && c <= 'z')
00051 return (c);
00052 return (0);
00053 }
|
|
||||||||||||
|
Definition at line 56 of file wf1.c. References cond(), err(), lookup(), malloc(), next, p, strcmp(), strcpy(), strlen(), and words. 00056 {
00057 int cond;
00058 char *malloc();
00059
00060 if (*p) {
00061 cond = strcmp(word, (*p)->word);
00062 if (cond < 0)
00063 return lookup(word, &(*p)->left);
00064 else if (cond > 0)
00065 return lookup(word, &(*p)->right);
00066 else
00067 return *p;
00068 }
00069 if (next >= 2000)
00070 err("out of node storage");
00071 words[next].count = 0;
00072 words[next].left = words[next].right = 0;
00073 words[next].word = malloc(strlen(word) + 1);
00074 if (words[next].word == 0)
00075 err("out of word storage");
00076 strcpy(words[next].word, word);
00077 return *p = &words[next++];
00078 }
|
Here is the call graph for this function:

|
|
Referenced by control(), dclglobal(), dcllocal(), dclparam(), decl(), doadefine(), dodefine(), enumdcl(), eval(), expandrow(), fieldref(), funcdefn(), gettok(), lookup(), main(), newstruct(), nonterm(), setup_kwtab(), statement(), stmtlabel(), structdcl(), term(), tokval(), and tree(). |
|
|
Definition at line 13 of file wf1.c. References node::count, getword(), lookup(), next, root(), and tprint(). 00013 {
00014 struct node *root;
00015 char word[20];
00016
00017 root = 0;
00018 next = 0;
00019 while (getword(word))
00020 lookup(word, &root)->count++;
00021 tprint(root);
00022 return 0;
00023 }
|
Here is the call graph for this function:

|
||||||||||||
|
|
Definition at line 81 of file wf1.c. References tree::left, printf(), tree::right, and tree(). Referenced by main(). 00081 {
00082 if (tree) {
00083 tprint(tree->left);
00084 printf("%d\t%s\n", tree->count, tree->word);
00085 tprint(tree->right);
00086 }
00087 }
|
Here is the call graph for this function:

|
|
|
|
1.3.9.1