1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-16 01:08:31 -04:00
Commit Graph

255 Commits

Author SHA1 Message Date
Jonas Fonseca
1bd98053b0 Fix memory leak in the DOM configuration module
... by making the (only) user (which is the RSS renderer) responsible
allocation of the dom_config structure.
2008-06-21 00:19:15 +02:00
Jonas Fonseca
0240c469b7 Merge branch 'elinks-0.12'
Conflicts:

	src/document/dom/renderer.c
2007-09-09 18:25:49 +02:00
Jonas Fonseca
bbd7c8354a Move get_test_opt to util/test.h and use throughout test programs 2007-08-28 20:34:17 +02:00
Jonas Fonseca
c6a223c8dd dom/test: properly test test option matches in get_test_opt 2007-08-28 20:22:29 +02:00
Jonas Fonseca
5d88ea78f9 dom/test: rename get_opt to get_test_opt to avoid namespace problems 2007-08-28 20:16:27 +02:00
Jonas Fonseca
0f53941fef Introduce test library in util/test.h containing the die() function
Fix the die() function to exit with EXIT_FAILURE value as pointed
out by Kalle on elinks-dev in <87tzqkxhlp.fsf@Astalo.kon.iki.fi>.
2007-08-28 20:14:08 +02:00
Miciah Dashiel Butler Masters
3975d28bce Merge commit 'origin/elinks-0.12'
Conflicts:

	doc/Doxyfile.in
	src/protocol/bittorrent/common.h
2007-08-28 14:47:39 +00:00
Jonas Fonseca
b831ee64aa Fix dom_node_attribute comment mentioning non-existant struct
Noticed by kon.
2007-07-31 14:37:41 +02:00
Kalle Olavi Niemitalo
2437d35904 Merge commit 'pasky.or.cz/elinks-0.12' into elinks-0.13
There were conflicts in src/document/css/ because 0.12.GIT switched
to LIST_OF(struct css_selector) and 0.13.GIT switched to struct
css_selector_set.  Resolved by using LIST_OF(struct css_selector)
inside struct css_selector_set.
2007-07-28 03:22:29 +03:00
Kalle Olavi Niemitalo
d3d2bb26c5 New macro LIST_OF for better Doxygen support. 2007-07-26 22:45:51 +03:00
Kalle Olavi Niemitalo
585f8b426b Doxygen syntax fixes
Fix warnings:
dom/stack.h:70: Warning: explicit link request to 'pop_dom_node' could not be resolved
dom/stack.h:71: Warning: explicit link request to 'pop_dom_nodes' could not be resolved
dom/stack.h:71: Warning: explicit link request to 'pop_dom_state' could not be resolved
dom/stack.h:115: Warning: explicit link request to 'done_dom_node' could not be resolved

Use @returns instead of \return in src/document/css/parser.c,
and other such things.
2007-07-26 14:14:27 +03:00
Kalle Olavi Niemitalo
eccc8c23f0 Merge with http://elinks.cz/elinks.git#elinks-0.12 2007-07-09 16:03:06 +03:00
Jonas Fonseca
ba66ff37db Simplify TESTDEPS maintainance by adding common objects in Makefile.lib 2007-05-26 14:04:29 +02:00
Jonas Fonseca
56f692ef08 DOM test: add test/ to SUBDIRS so DOM test is run for 'make test' 2007-05-26 13:10:55 +02:00
Jonas Fonseca
67188584ea DOM test: make die() in sgml-parser static 2007-05-26 13:08:03 +02:00
Jonas Fonseca
ad6addbd92 DOM test: refactor options parsing in sgml-parser
Introduce get_opt() to do the tedious work of getting the right
argument for options expecting them and handles both '--opt=arg'
and '--opt arg'. As a side effect it also removes an unneeded
assignment of the source string for stdin.
2007-05-26 12:40:06 +02:00
Jonas Fonseca
17a76257f8 Use printf to handle test string containing escapes more portable
Works with both bash and dash. This reintroduces the fix to the
test-sgml-parser-basic test, and also fixes test-sgml-parser-incremental
and test-sgml-parser-lines, which Witek has reported as failing.
2007-05-26 10:42:51 +02:00
Jonas Fonseca
113077ce00 Revert "Refactor test-sgml-parser-basic to work with non-bash shells"
This reverts commit 3f93148c9b.
2007-05-26 10:26:38 +02:00
Jonas Fonseca
3f93148c9b Refactor test-sgml-parser-basic to work with non-bash shells
A problem with \n replacement caused test no. 19 to fail.
Fix it by also allowing expected output to be prepared in a
file by introducing a new backend: test_output_equals_file,
also used test_output_equals.

Tested on Ubuntu Feisty Fawn with both /bin/bash and /bin/sh
where /bin/sh failed before the fix. Reported by Witek.
2007-05-05 11:39:23 +02:00
Jonas Fonseca
1d62835148 Make non-standard pluginspage attribute to embed hyperlinkable
Appears on page reachable from links on
http://www.gilbertogil.com.br/sec_discografia_view.php?id=17
2007-04-27 16:25:36 +02:00
Kalle Olavi Niemitalo
976f06ddf8 ELinks 0.13.GIT.
There is a now separate elinks-0.12 branch for the upcoming 0.12.0 release.
2007-04-22 19:50:15 +03:00
Kalle Olavi Niemitalo
801d520ddd Fix compiler errors without HAVE_VARIADIC_MACROS. 2007-03-11 12:22:02 +02:00
Jonas Fonseca
47d27a4d39 DOM: rename init_dom_node_ to init_dom_node_at and cleanup the declaration
Only use the __FILE__ and __LINE__ parameters when DEBUG_MEMLEAK is defined
so that they do not end up in the generated documentation.
2006-12-11 21:21:30 +01:00
Jonas Fonseca
1435211cf6 DOM: add Doxyfile for generating DOM implementation documentation
Optimized for Doxygen version 1.5.1 ...
2006-12-11 21:04:38 +01:00
Jonas Fonseca
6df4df9cc4 DOM: start documenting the node module 2006-12-11 20:59:52 +01:00
Jonas Fonseca
a89ab52ebd Start writing a DOM stack 101 2006-12-10 18:24:34 +01:00
Jonas Fonseca
93e9cf089e DOM: Change code documentation to be Doxygen "compliant" 2006-12-10 01:17:35 +01:00
Jonas Fonseca
4d248638be Remove empty first lines; a remnant from when CVS Id tags was in play 2006-12-09 22:54:22 +01:00
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