aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFranz Schrober <franzschrober@yahoo.de>2013-11-28 11:16:18 +0100
committerChristopher Li <sparse@chrisli.org>2013-11-29 15:03:40 -0800
commit01b00f59f2a6aba6b623c0a68827938c1f570877 (patch)
tree5809c429ff61aace2c70186d0ca3043c1b2212d5
parent0df97504df242fc3c6cc8f5e4616976346763c7e (diff)
downloadsparse-01b00f59f2a6aba6b623c0a68827938c1f570877.tar.gz
Revert "Update the information in README about using the library."
James Westby is the only person not reacting when asking him about the MIT license change over email or social media. So he has to count as not accepting and reverting his contributions is the only way to to avoid possible legal problems. The contributions can be re-added later when they are rewritten from scratch. This reverts commit 34ac7df96dd9609d684b0c949a52bc07ab1fd8b5. Cc: James Westby <jw+debian@jameswestby.net> Signed-off-by: Franz Schrober <franzschrober@yahoo.de> Signed-off-by: Christopher Li <sparse@chrisli.org>
-rw-r--r--README29
1 files changed, 21 insertions, 8 deletions
diff --git a/README b/README
index 63f752b5..a731a826 100644
--- a/README
+++ b/README
@@ -47,22 +47,35 @@ requires the information.
This means that a user of the library will literally just need to do
- struct string_list *filelist = NULL;
- char *file;
+ struct token *token;
+ int fd = open(filename, O_RDONLY);
+ struct symbol_list *list = NULL;
- action(sparse_initialize(argc, argv, filelist));
+ if (fd < 0)
+ exit_with_complaint();
- FOR_EACH_PTR_NOTAG(filelist, file) {
- action(sparse(file));
- } END_FOR_EACH_PTR_NOTAG(file);
+ // 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);
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. The action
-function takes a pointer to a symbol_list and does whatever it likes with it.
+only the parse tree that is described by the header files.
The library also contains (as an example user) a few clients that do the
preprocessing, parsing and type evaluation and just print out the