1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00
Commit Graph

227 Commits

Author SHA1 Message Date
Jonas Fonseca
640d73b7db Cast indentation counter to int to fix compilation on Mac OS X
The error was:

sgml-parser.c: In function 'print_indent':
sgml-parser.c:99: warning: field precision should have type 'int', but argument 2 has type 'long unsigned int'
2006-12-03 20:45:01 +01:00
Laurent MONIN
5acb5e6663 Trim trailing whitespaces. 2006-05-31 19:34:49 +02:00
Miciah Dashiel Butler Masters
190259ca22 mem_alloc_align: drop the obj type parameter
Instead use the object itself, i.e., replace typeof(obj) with
typeof(**ptr).
2006-02-17 17:32:59 +00:00
Jonas Fonseca
1b4bee7a82 DOM: Change struct dom_string length member from size_t to unsigned int
Requested-by: Miciah
2006-02-10 01:25:48 +01:00
Jonas Fonseca
4a27637529 DOM: Cleanup the unused parts of the node interface
Take a quick stroll through the unchartered corners of the DOM node data
structures:

 - Remove ununsed struct dom_node_id_item.
 - Make the document node reference a future struct dom_document.
 - Describe ideas for node data, e.g. the entity reference node should use
 it for storing the unicode_val_T.
2006-02-03 10:44:27 +01:00
Jonas Fonseca
6cd5e387e5 DOM: Change sgml-parser program to have sane exit code for incomplete input 2006-02-01 10:51:24 +01:00
Jonas Fonseca
c7843058fc DOM: Convert to use enum dom_code
Doh, ended pushing out half finished commits. :(
2006-02-01 10:38:21 +01:00
Jonas Fonseca
a983603863 DOM: Rename src/dom/dom.h src/dom/code.h
Additionally, add API doc mark.
2006-01-31 23:30:55 +01:00
Jonas Fonseca
4de26051b9 Ignore test files 2006-01-31 22:23:22 +01:00
Jonas Fonseca
92a9cafb6e DOM: Replace various DOM status/error/exception codes with dom_code enum
Replaces sgml_parser_code, dom_stack_code, and dom_exception_code and
generally tries to simplify things and remove redundant codes.
2006-01-31 22:01:35 +01:00
Jonas Fonseca
73c06aaa10 DOM: Add test for parsing randomized HTML
It uses mangleme by Michal Zalewski <lcamtuf@coredump.cx> to generate HTML
which is then fed into the sgml-parser program. By default 100 random HTML
documents are tested. But the test script takes the number of documents
to test against as an argument. Useful for torture testing the SGML parser.
2006-01-31 19:29:48 +01:00
Jonas Fonseca
f42dd94fb5 DOM: Fix test descriptions 2006-01-30 06:45:53 +01:00
Jonas Fonseca
7be0093e36 DOM: Add test for dumping DOM trees to SGML 2006-01-30 06:25:22 +01:00
Jonas Fonseca
f8a86a26c4 DOM: Add simple stack context based utility for dumping DOM trees to SGML 2006-01-30 06:07:16 +01:00
Jonas Fonseca
a3dcc7d5e5 DOM: Change the attribute node's quoted member to be unsigned char
It can hold NUL, ', or " depending on not quoted, single quoted or double
quoted.
2006-01-30 06:05:32 +01:00
Jonas Fonseca
bc50084475 DOM: Add get_dom_node_next() 2006-01-30 06:03:36 +01:00
Jonas Fonseca
ea675cbb6e DOM: Fix get_dom_node_map_index() so it returns the correct ordered index
This was cause by the recent change to allocate string during incremental
parsing where the node string was set after insertion. Test for this in the
works.

Fixes: b6b6d3c67e
2006-01-30 06:02:02 +01:00
Jonas Fonseca
f268d0c495 DOM: Add missing config.h #include 2006-01-30 05:55:35 +01:00
Jonas Fonseca
9fe0608bd2 DOM: Fix checking of out-of-bound access to scanned strings 2006-01-29 12:12:41 +01:00
Jonas Fonseca
2918e3f595 DOM: Add STATIC_DOM_STRING macro and make INIT_DOM_STRING cleaner 2006-01-28 22:55:15 +01:00
Jonas Fonseca
58b8635caf DOM: Add test to check that '\f' (form feed) counts as a newline 2006-01-28 22:51:52 +01:00
Jonas Fonseca
c223f6ce94 Sed the expected output instead of the output from sgml-parser 2006-01-28 15:12:49 +01:00
Jonas Fonseca
03c467bcbf Move URI normalization to the test library 2006-01-28 15:03:19 +01:00
Jonas Fonseca
b6b6d3c67e DOM: Allocate all node strings when doing incremental rendering
This changes init_dom_node_() to take an allocated argument saying whether
to allocate or not. If the value is -1, node->allocated will be set to the
value of node->parent->allocated. This way the value is inherited like we
do it in the menu code. It should be a sane default since we eventually
want not to rely on the 'underlying' source of the document and there will
be less variables to pass around.
2006-01-28 04:51:25 +01:00
Jonas Fonseca
24a9d103b4 DOM: Add allocated flag to struct dom_node; replaces subtype flags
Prepare for handling of allocated strings in the various nodes.
2006-01-28 04:50:04 +01:00
Jonas Fonseca
3b183c1685 Merge with git+ssh://pasky/srv/git/elinks.git 2006-01-28 03:36:47 +01:00
Jonas Fonseca
95c1de2315 Fix handling of incomplete processing instructions
When doing incremental rendering we now require the whole thing to be there
and that there is room for two tokens in the scanner token table.  This is
necessary because we have to generate both a processing target token and a
processing data token to make life simpler for the parser.

Remove processing instruction data case label from the main parser loop. It
is safer this way since it already assumes that the processing target token
has been stored.
2006-01-28 03:35:36 +01:00
Jonas Fonseca
823c594524 Use ssize_t instead of size_t for length since it must carry a signed value 2006-01-28 03:24:16 +01:00
Jonas Fonseca
00c4e0bfa2 Do not attempt to read *string when string == scanner->end
There might be other places that needs to be reviewd for this.
2006-01-28 03:23:06 +01:00
Jonas Fonseca
d92a074e40 Fix parsing of '<a< b>' where the scanner didn't rewind to the proper place
Add test for this tag soup combo.
2006-01-28 03:21:27 +01:00
Laurent MONIN
5114c9d110 Trim trailing whitespaces. 2006-01-28 01:59:22 +01:00
Jonas Fonseca
e5e06764c4 Improve checks for incompleteness when parsing attributes
Check whether there are '=' and value tokens before handling them. If there
is any doubt the whole attribute structure is 'pushed back' into the
stream. That way incremental parsing will not add the value as a new
attribute because the name token was handled in the previous parsing run.
2006-01-28 01:40:56 +01:00
Jonas Fonseca
4ab1dde874 Preserve the scanner state when it is not the 'default' state
This is necessary to make it possible to resume parsing of element
attributes. Allows the incomplete string in the parsing state struct to
be unset.
2006-01-28 01:24:30 +01:00
Jonas Fonseca
c6e83d1d9c Assert parsing depth >= parser stack depth
Like the comment says popping parsing nodes during incremental parsing
might trigger this.
2006-01-28 01:12:03 +01:00
Jonas Fonseca
9e7b0d4fa3 Remove assertion logic from parse_sgml_attributes()
They are getting out of hand and making it hard to use the function in
'unusual' situations (like when resuming parsing inside elements).
2006-01-28 01:09:05 +01:00
Jonas Fonseca
1e104afbba Improve error checking when adding nodes
Fail with SGML_PARSER_CODE_MEM_ALLOC.
2006-01-28 01:05:42 +01:00
Jonas Fonseca
74728cab05 Also set the node subtype for <?xml-stylesheet?> 2006-01-28 01:00:28 +01:00
Jonas Fonseca
bccf5512d6 Force an incomplete token for quoted attribute values when there's no end 2006-01-28 00:56:48 +01:00
Jonas Fonseca
a2376609e3 Expand the testing of incremental parsing
There are still some bugs to resolve.
2006-01-28 00:50:06 +01:00
Jonas Fonseca
0f8aa77ebb Add test for incremental SGML parsing
It is a loop that parses the same small document with various read sizes.
The sgml-parser program is updated to take --stdin option taking a the read
size as a required parameter.
2006-01-27 07:49:15 +01:00
Jonas Fonseca
b25cd27232 Add support incremental parsing
That is, add the last parts that saves and resumes previous incomplete
parsing states. Now the parsing stack push handler checks if the parent has
a resume flag set. When set, the incomplete fragment to resume is restored
and the new source fragment appended and parsing is continued.
2006-01-27 07:47:17 +01:00
Jonas Fonseca
9d91994f3c Propone updating the scanner->state until incompleteness has been checked
That way the scanner state is meaningful when resuming during incremental
parsing.
2006-01-27 07:41:42 +01:00
Jonas Fonseca
afb45aace5 Add support for scanning comment endings such as '--!>' correctly 2006-01-25 18:18:01 +01:00
Jonas Fonseca
2eba71d95b Add support for testing normalization using the DOM configuration module 2006-01-20 02:08:46 +01:00
Jonas Fonseca
cc61578fcb Fix node pushing in walk_dom_nodes() 2006-01-20 02:07:24 +01:00
Jonas Fonseca
22e647813e Fix DOM_CONFIG_NORMALIZE_WHITESPACE comment 2006-01-20 02:06:41 +01:00
Jonas Fonseca
7fe214fbb2 Fix text node appending; fix DOM configuration parser 2006-01-19 04:54:30 +01:00
Jonas Fonseca
fe43bf8a4f Fix leaks in the DOM stack tracer 2006-01-19 04:51:33 +01:00
Jonas Fonseca
126ae8c764 #include dom/node.h instead of dom/stack.h 2006-01-19 04:50:10 +01:00
Jonas Fonseca
34b12d21bd Upgrade to use dom_stack_codes in the callbacks 2006-01-17 16:58:19 +01:00
Jonas Fonseca
2cd151c5c5 Add parse_dom_config() which converts a textual config list to flags 2006-01-17 16:55:10 +01:00
Jonas Fonseca
1d52d67e50 Add get_dom_node_child() which searches for a node with given type 2006-01-16 07:11:02 +01:00
Jonas Fonseca
6c85c0f009 Add DOM configuration inspired module
It add support for normalizing a DOM document in various ways, such as
removing comments, converting CDATA section nodes to text nodes, cleanup
whitespace, etc.

Use it in the RSS renderer to sanitize the text to be rendered.
2006-01-16 05:12:34 +01:00
Jonas Fonseca
768f97c38e Add get_dom_node_prev() which gets the previous sibling of a DOM node 2006-01-16 05:10:22 +01:00
Jonas Fonseca
4e6b05394d ADD DOM_STACK_CODE_FREE_NODE so callbacks can remove nodes when popping 2006-01-16 05:09:45 +01:00
Jonas Fonseca
eecc22751d Use dom_stack_code enum for dom_stack_callback_T 2006-01-16 00:55:58 +01:00
Jonas Fonseca
4a2cde1c00 Introduce dom_stack_code enum and use it for push_dom_node() 2006-01-16 00:40:51 +01:00
Jonas Fonseca
2748d043f9 Autogenerate .vimrc files and put the master in config/vimrc
This changes the init target to be idempotent: most importantly it will now
never overwrite a Makefile if it exists. Additionally 'make init' will
generate the .vimrc files. Yay, no more stupid 'added fairies' commits! ;)
2006-01-15 18:38:58 +01:00
Jonas Fonseca
082031c10c Fix SGML parser test program 2006-01-14 12:44:06 +01:00
Jonas Fonseca
c8aa6c2360 Move struct sgml_parsing_state near the parsing state managing 2006-01-14 12:11:35 +01:00
Jonas Fonseca
e70b779366 Add code member to struct sgml_parser and simplify parsing state setup
parse_sgml() now just pushes a text node on the parsing state and the push
handler will now call parse_sgml_plain() and save the return code in
parser->code so parse_sgml() can return it. Much simpler.
2006-01-14 12:09:17 +01:00
Jonas Fonseca
0950996dd8 Change parse_sgml() to take buf+bufsize instead of DOM string 2006-01-14 11:32:11 +01:00
Jonas Fonseca
aecfb28711 Cleanup SGML info backends #includes and description 2006-01-14 08:07:00 +01:00
Laurent MONIN
5685221512 Trim trailing whitespaces. 2006-01-13 00:11:39 +01:00
Laurent MONIN
bdc59d5ac4 Store lib.o name in a variable named LIB_O_NAME. 2006-01-12 19:06:50 +01:00
Jonas Fonseca
2d80258f72 Mark doc'd headers with: /* API Doc :: <api-name> */ 2006-01-11 11:03:59 +01:00
Jonas Fonseca
dd2516f597 Oops, someone added stuff he wuz not s'posed to 2006-01-09 14:11:29 +01:00
Jonas Fonseca
620730e642 Document the DOM scanner 2006-01-09 14:01:48 +01:00
Jonas Fonseca
3b166b0633 Document the DOM stack 2006-01-09 12:44:57 +01:00
Jonas Fonseca
938c8a80b4 Support more implicit markup of source files 2006-01-09 11:01:36 +01:00
Jonas Fonseca
db11b6452f Fix a typo and a ref:[] 2006-01-09 01:20:03 +01:00
Jonas Fonseca
5b818b20ba Use the new asciidoc code markup to document the DOM sgml parser 2006-01-08 23:36:07 +01:00
Jonas Fonseca
2f9c406ef1 Introduce add_to_dom_string() and turn init_dom_string() into its user 2006-01-08 03:40:54 +01:00
Jonas Fonseca
acb1f7e74d Refactor computation of scanner error string length to get_sgml_error_end() 2006-01-07 23:51:19 +01:00
Jonas Fonseca
534a16fff1 Improve error detection 2006-01-07 23:40:21 +01:00
Jonas Fonseca
3835bf8449 A handful of fixes related to error detection
- Fix assertion failure by breaking the switch if an error token is next
   when previous was a processing instruction.
 - Fix <!notation parsing by skipping ident chars instead of spaces.
 - Improve checking of processing instruction 'target'-end and what error
   string is generated.
 - For now put all of the processing instruction data in the error token.
 - Remove a DBG()-print.
2006-01-07 05:18:43 +01:00
Jonas Fonseca
97f403a9d9 Add a test file for checking detection of errors by the SGML parser 2006-01-07 05:15:16 +01:00
Jonas Fonseca
03ee543e21 Make sgml-parser request error detection when passed --error option 2006-01-07 04:27:08 +01:00
Jonas Fonseca
c993a0012e Add basic support for detection errors while scanning
It mostly uses the checking for incompleteness already in place. Tested
lightly so it will definately need some more work.
2006-01-07 04:26:08 +01:00
Jonas Fonseca
5defc48eb3 Add basic support for requesting error detection; SGML scanner part missing 2006-01-07 04:21:39 +01:00
Jonas Fonseca
a1e5122183 Drop unnneeded URL argument and simplify test helpers 2006-01-07 02:14:45 +01:00
Jonas Fonseca
f1c3c90a4f Move line counting tests to own file; simplifies a few things 2006-01-07 02:02:21 +01:00
Jonas Fonseca
dee8ac5b45 Move test for incompleteness to own file 2006-01-07 01:48:51 +01:00
Jonas Fonseca
7ff2cb2607 Improve a comment a bit 2006-01-07 01:41:07 +01:00
Jonas Fonseca
7c65c06b41 Move up enum sgml_parser_code declaration 2006-01-07 01:29:44 +01:00
Jonas Fonseca
c9c41e38a2 test_expect_incomplete(): Put sgml-parser output to /dev/null 2006-01-07 01:27:48 +01:00
Jonas Fonseca
f8d44ffe32 scan_sgml_tokens(): Drop local variable and use scanner->current
... so lower level scanners can change the next token to use.
2006-01-07 01:25:42 +01:00
Jonas Fonseca
bca330fcbd Simplify incomplete test helper and fix quoting problem 2006-01-07 01:22:14 +01:00
Jonas Fonseca
215d7ec158 Append memdebug to test dependencies in Makefile.lib 2006-01-06 22:11:45 +01:00
Jonas Fonseca
5f5c78a87f Realign the test docs with reality 2006-01-06 18:32:22 +01:00
Jonas Fonseca
ab8a4b2847 Add more tests based on test/comments.html 2006-01-05 15:36:18 +01:00
Laurent MONIN
31c30864e0 Trim trailing whitespaces. 2006-01-04 18:08:48 +01:00
Jonas Fonseca
0bfb1d7742 Free nodes created on the SGML parsing stack 2006-01-04 00:29:10 +01:00
Jonas Fonseca
66cf866ab6 Cleanup the DOM stack flags; s/KEEP_NODES/FREE_NODES/ 2006-01-03 20:35:32 +01:00
Jonas Fonseca
7a5f699a88 Drop unneeded -b arg to cmp, which isn't available in FreeBSD's version 2006-01-03 20:00:06 +01:00
Jonas Fonseca
146ca09c43 Improve support for running 'make test' when srcdir != builddir
Additionally, also make TESTDEPS conditionally contain memdebug object
binary only if CONFIG_DEBUG is yes.
2006-01-03 19:04:17 +01:00
Jonas Fonseca
50183bf5d8 Add support for recursively running all tests 2006-01-03 02:07:51 +01:00
Jonas Fonseca
ba5bdfec00 Move the 'make test' handling to Makefile.lib
The test rule is defined when TEST_PROGS is defined. Users should also set
TESTDEPS to get the correct object files linked in.
2006-01-03 00:45:22 +01:00
Jonas Fonseca
23f0085842 Move src/dom/test/libtest test/libtest.sh, put path to it in TEST_LIB 2006-01-03 00:34:10 +01:00
Jonas Fonseca
f88cbe6761 Add check of incomplete text 2006-01-02 22:35:03 +01:00