aboutsummaryrefslogtreecommitdiff
path: root/README
diff options
context:
space:
mode:
authorJames Westby <jw+debian@jameswestby.net>2006-12-18 22:00:21 +0000
committerJosh Triplett <josh@freedesktop.org>2007-02-27 10:59:17 -0800
commit34ac7df96dd9609d684b0c949a52bc07ab1fd8b5 (patch)
treeae5d784e0009af65b88e07d34eb77d9549054f09 /README
parentdissect: simplify lookup_member() (diff)
downloadsparse-34ac7df96dd9609d684b0c949a52bc07ab1fd8b5.tar.gz
sparse-34ac7df96dd9609d684b0c949a52bc07ab1fd8b5.tar.bz2
sparse-34ac7df96dd9609d684b0c949a52bc07ab1fd8b5.zip
Update the information in README about using the library.
Changes in the library have left the README giving out of date information on how to intialise the library and get the symbols out of it. Update the documentation to match the latest functions. Signed-off-by: James Westby <jw+debian@jameswestby.net>
Diffstat (limited to 'README')
-rw-r--r--README29
1 files changed, 8 insertions, 21 deletions
diff --git a/README b/README
index 6b1034b..144d274 100644
--- a/README
+++ b/README
@@ -47,35 +47,22 @@ requires the information.
This means that a user of the library will literally just need to do
- struct token *token;
- int fd = open(filename, O_RDONLY);
- struct symbol_list *list = NULL;
+ struct string_list *filelist = NULL;
+ char *file;
- if (fd < 0)
- exit_with_complaint();
+ action(sparse_initialize(argc, argv, filelist));
- // Initialize parse symbols
- init_symbols();
-
- // Tokenize the input stream
- token = tokenize(filename, fd, NULL);
-
- // Pre-process the stream
- token = preprocess(token);
-
- // Parse the resulting C code
- translation_unit(token, &list);
-
- // Evaluate the types now if we want to
- // Or leave it until later.
- symbol_iterate(list, evaluate_symbol, NULL);
+ FOR_EACH_PTR_NOTAG(filelist, file) {
+ action(sparse(file));
+ } END_FOR_EACH_PTR_NOTAG(file);
and he is now done - having a full C parse of the file he opened. The
library doesn't need any more setup, and once done does not impose any
more requirements. The user is free to do whatever he wants with the
parse tree that got built up, and needs not worry about the library ever
again. There is no extra state, there are no parser callbacks, there is
-only the parse tree that is described by the header files.
+only the parse tree that is described by the header files. The action
+funtion takes a pointer to a symbol_list and does whatever it likes with it.
The library also contains (as an example user) a few clients that do the
preprocessing, parsing and type evaluation and just print out the