libcss: branch lcneves/units updated. release/0.7.0-23-gae14e8b
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libcss.git/shortlog/ae14e8b9dd656a59d1013b...
...commit http://git.netsurf-browser.org/libcss.git/commit/ae14e8b9dd656a59d1013b97...
...tree http://git.netsurf-browser.org/libcss.git/tree/ae14e8b9dd656a59d1013b977b...
The branch, lcneves/units has been updated
via ae14e8b9dd656a59d1013b977b8e2057825624b7 (commit)
from 723fba2c05a80274ab50e529d8fcba0310dad1ae (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=ae14e8b9dd656a59d101...
commit ae14e8b9dd656a59d1013b977b8e2057825624b7
Author: Lucas Neves <lcneves(a)gmail.com>
Commit: Lucas Neves <lcneves(a)gmail.com>
WIP: Select: Autogen for selection properties.
diff --git a/src/select/__pycache__/assets.cpython-36.pyc b/src/select/__pycache__/assets.cpython-36.pyc
new file mode 100644
index 0000000..f7b7da8
Binary files /dev/null and b/src/select/__pycache__/assets.cpython-36.pyc differ
diff --git a/src/select/__pycache__/select_config.cpython-36.pyc b/src/select/__pycache__/select_config.cpython-36.pyc
index 52b37eb..bcda842 100644
Binary files a/src/select/__pycache__/select_config.cpython-36.pyc and b/src/select/__pycache__/select_config.cpython-36.pyc differ
diff --git a/src/select/assets.py b/src/select/assets.py
index 8151182..1d726a3 100644
--- a/src/select/assets.py
+++ b/src/select/assets.py
@@ -5,8 +5,8 @@
assets = {}
-assets['computed_h'] = {}
-assets['computed_h']['header'] = '''\
+assets['computed.h'] = {}
+assets['computed.h']['header'] = '''\
/*
* This file is part of LibCSS
* Licensed under the MIT License,
@@ -21,7 +21,7 @@ assets['computed_h']['header'] = '''\
#include <libcss/hint.h>
'''
-assets['computed_h']['footer'] = '''\
+assets['computed.h']['footer'] = '''\
/**
* Take a new reference to a computed style
*
diff --git a/src/select/autogenerated_computed.h b/src/select/autogenerated_computed.h
new file mode 100644
index 0000000..76a6b32
--- /dev/null
+++ b/src/select/autogenerated_computed.h
@@ -0,0 +1,162 @@
+/*
+ * This file is part of LibCSS
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2017 The NetSurf Project
+ */
+
+#ifndef css_select_computed_h_
+#define css_select_computed_h_
+
+#include <libcss/computed.h>
+#include <libcss/hint.h>
+
+
+
+/*
+ * border_spacing 1 + 10 8
+ * break_after 4
+ * break_before 4
+ * break_inside 4
+ * clip 6
+ * column_count 2 4
+ * column_fill 2
+ * column_gap 2 + 5 4
+ * column_rule_color 2 4
+ * column_rule_style 4
+ * column_rule_width 3 + 5 4
+ * column_span 2
+ * column_width 2 + 5 4
+ * content 2 sizeof(ptr)
+ * counter_increment 1 sizeof(ptr)
+ * counter_reset 1 sizeof(ptr)
+ * cursor 5 sizeof(ptr)
+ * letter_spacing 2 + 5 4
+ * outline_color 2 4
+ * outline_width 3 + 5 4
+ * word_spacing 2 + 5 4
+ */
+
+/*
+ * orphans 1 4
+ * page_break_after 3
+ * page_break_before 3
+ * page_break_inside 2
+ * widows 1 4
+ */
+
+/*
+ * align_content 3
+ * align_items 3
+ * align_self 3
+ * background_attachment 2
+ * background_color 2 4
+ * background_image 1 sizeof(ptr)
+ * background_position 1 + 10 8
+ * background_repeat 3
+ * border_bottom_color 2 4
+ * border_bottom_style 4
+ * border_bottom_width 3 + 5 4
+ * border_collapse 2
+ * border_left_color 2 4
+ * border_left_style 4
+ * border_left_width 3 + 5 4
+ * border_right_color 2 4
+ * border_right_style 4
+ * border_right_width 3 + 5 4
+ * border_top_color 2 4
+ * border_top_style 4
+ * border_top_width 3 + 5 4
+ * bottom 2 + 5 4
+ * box_sizing 2
+ * caption_side 2
+ * clear 3
+ * color 1 4
+ * direction 2
+ * display 5
+ * empty_cells 2
+ * flex_basis 2 + 5 4
+ * flex_direction 3
+ * flex_grow 1 4
+ * flex_shrink 1 4
+ * flex_wrap 2
+ * float 2
+ * font_family 3 sizeof(ptr)
+ * font_size 4 + 5 4
+ * font_style 2
+ * font_variant 2
+ * font_weight 4
+ * height 2 + 5 4
+ * justify_content 3
+ * left 2 + 5 4
+ * line_height 2 + 5 4
+ * list_style_image 1 sizeof(ptr)
+ * list_style_position 2
+ * list_style_type 4
+ * margin_bottom 2 + 5 4
+ * margin_left 2 + 5 4
+ * margin_right 2 + 5 4
+ * margin_top 2 + 5 4
+ * max_height 2 + 5 4
+ * max_width 2 + 5 4
+ * min_height 2 + 5 4
+ * min_width 2 + 5 4
+ * opacity 1 4
+ * order 1 4
+ * outline_style 4
+ * overflow 3
+ * padding_bottom 1 + 5 4
+ * padding_left 1 + 5 4
+ * padding_right 1 + 5 4
+ * padding_top 1 + 5 4
+ * position 3
+ * quotes 1 sizeof(ptr)
+ * right 2 + 5 4
+ * table_layout 2
+ * text_align 4
+ * text_decoration 5
+ * text_indent 1 + 5 4
+ * text_transform 3
+ * top 2 + 5 4
+ * unicode_bidi 2
+ * vertical_align 4 + 5 4
+ * visibility 2
+ * white_space 3
+ * width 2 + 5 4
+ * z_index 2 4
+ */
+/**
+ * Take a new reference to a computed style
+ *
+ * \param style The style to take a new reference to.
+ *
eturn The new computed style reference
+ */
+static inline css_computed_style * css__computed_style_ref(
+ css_computed_style *style)
+{
+ if (style == NULL)
+ return NULL;
+
+ if (style->i.uncommon != NULL) {
+ style->i.uncommon->count++;
+ }
+
+ style->count++;
+ return style;
+}
+
+css_error css__computed_style_create(css_computed_style **result);
+
+css_error css__computed_style_initialise(css_computed_style *style,
+ struct css_select_handler *handler, void *pw);
+
+
+css_error css__computed_uncommon_destroy(css_computed_uncommon *uncommon);
+
+css_error css__compute_absolute_values(const css_computed_style *parent,
+ css_computed_style *style,
+ css_error (*compute_font_size)(void *pw,
+ const css_hint *parent, css_hint *size),
+ void *pw);
+
+#endif
diff --git a/src/select/select_config.py b/src/select/select_config.py
index d5cd525..27b2dc9 100644
--- a/src/select/select_config.py
+++ b/src/select/select_config.py
@@ -98,8 +98,8 @@ style = {
('z_index', 2, 'integer'),
# Style group, arrays
('font_family', 3, 'string_arr', None, None,
- 'Encode font family as an array of string objects, terminated with a'
- '\n' 'blank entry.'),
+ 'Encode font family as an array of string objects, terminated with a '
+ 'blank entry.'),
('quotes', 1, 'string_arr', None, None,
'Encode quotes as an array of string objects, terminated with a '
'blank entry.')
@@ -145,13 +145,13 @@ uncommon = {
'CSS_WORD_SPACING_SET', 'CSS_WORD_SPACING_NORMAL'),
# Uncommon group, arrays
('counter_increment', 1, 'counter', None, 'CSS_COUNTER_INCREMENT_NONE',
- 'Encode counter_increment as an array of name, value pairs,\n'
+ 'Encode counter_increment as an array of name, value pairs, '
'terminated with a blank entry.'),
('counter_reset', 1, 'counter', None, 'CSS_COUNTER_RESET_NONE',
- 'Encode counter_reset as an array of name, value pairs,\n'
+ 'Encode counter_reset as an array of name, value pairs, '
'terminated with a blank entry.'),
('cursor', 5, 'string_arr', 'CSS_CURSOR_AUTO', None,
- 'Encode cursor uri(s) as an array of string objects, terminated\n'
+ 'Encode cursor uri(s) as an array of string objects, terminated '
'with a blank entry'),
('content', 2, 'content_item', 'CSS_CONTENT_NORMAL', None,
'Encode content as an array of content items, terminated with '
diff --git a/src/select/select_generator.py b/src/select/select_generator.py
index c37aa74..3e6744c 100644
--- a/src/select/select_generator.py
+++ b/src/select/select_generator.py
@@ -6,15 +6,6 @@
from select_config import values, groups
from assets import assets
-def get_tuple(from_var):
- 'Accepts tuples and strings, returns a tuple.'
- if type(from_var) is tuple:
- return from_var
- elif type(from_var) is str:
- return (from_var,)
- else:
- return ()
-
class Bin:
def __init__(self, first_object):
self.contents = [ first_object ]
@@ -26,24 +17,7 @@ class Bin:
def push(self, obj):
self.contents.append(obj)
-def make_bit_map(group):
- '''Implements a `best fit first` heuristics for the bin packing of
- property bits in the bits array'''
-
- bin_size = 32
- bit_map = []
- group_props = sorted([ { 'name': p.name, 'size': p.bits_size }
- for p in group['props'] ], key=(lambda x: x['size']), reverse=True)
- for p in group_props:
- for b in bit_map:
- if b.size + p['size'] <= bin_size:
- b.push(p)
- break
- else:
- bit_map.append(Bin(p))
- bit_map.sort(key=(lambda x: x.size), reverse=True)
-
-class FileText:
+class Text:
def __init__(self):
self._lines = []
self._comment = False
@@ -56,10 +30,21 @@ class FileText:
self._indent += value
def comment(self):
- self.append(' */' if self._comment else '/*')
- self._comment = !self._comment
+ comm = self._comment
+ self._comment = False
+ self.append(' */' if comm else '/*')
+ self._comment = not comm
+
+ def append(self, text=None, pre_formatted=False):
+ if text is None:
+ self._lines.append('\t' * self._indent + ' * '
+ if self._comment else '')
+ return
+
+ if pre_formatted:
+ self._lines.append(text)
+ return
- def append(self, text):
column_max = 80
multiline = False
@@ -75,7 +60,7 @@ class FileText:
break_index = text[:text[:column_max - prefix_size].rfind(' ')]
line += text[:break_index].rstrip()
text = text[break_index:].lstrip()
- self.lines.append(line)
+ self._lines.append(line)
if text and not self._comment and not multiline:
self.indent(2)
multiline = True
@@ -83,12 +68,8 @@ class FileText:
if multiline:
self._indent(-2)
- def write_file(self, filename):
- with open(filename, 'w') as f:
- f.write('\n'.join(self._lines))
-
-def make_computed_h(group, is_main=false):
-
+ def to_string(self):
+ return '\n'.join(self._lines)
class CSSValue:
'Values to be associated with properties.'
@@ -111,22 +92,102 @@ class CSSProperty:
defaults=None, comments=None, override=None):
self.name = name
self.type_size = type_size
- self.values = [ v for v in self.__vals if v.name in get_tuple(values) ]
- self.defaults = get_tuple(defaults)
+ self.values = [ x for v in self.get_tuple(values) for x in self.__vals
+ if x.name is v ]
+ self.defaults = self.get_tuple(defaults)
self.condition = condition
- self.override = get_tuple(override)
+ self.override = self.get_tuple(override)
self.comments = comments
__vals = [ CSSValue(*x) for x in values ]
+ def get_tuple(self, from_var):
+ 'Accepts tuples, strings and None; returns a tuple.'
+ if type(from_var) is tuple:
+ return from_var
+ elif type(from_var) is str:
+ return (from_var,)
+ elif from_var is None:
+ return ()
+ else:
+ raise TypeError('Value should be either tuple, string or None, ' +
+ 'received: ' + type(from_var).__name__)
+
@property
def bits_size(self):
return self.type_size + sum([ v.bits['size'] for v in self.values
if v.bits is not None ])
-groups['main']['props'] = [ CSSProperty(*x) for x in groups['main']['props'] ]
-groups['main']['map'] = make_bit_map(groups['main'])
-for g in groups['others']:
- g['props'] = [ CSSProperty(*x) for x in g['props'] ]
- g['map'] = make_bit_map(g)
+ @property
+ def size_line(self):
+ name = '{:31}'.format(self.name)
+ type_size = str(self.type_size)
+ extra_size = sum([ v.bits['size'] for v in self.values
+ if v.bits is not None ])
+ bits_size = '{:16}'.format(type_size +
+ (' + ' + str(extra_size) if extra_size else ''))
+ vars_size = sum([ v.size for v in self.values if v.size is not None ])
+ vars_size = str(vars_size) if vars_size else ''
+ ptr = ''
+ for v in self.values:
+ if v.size is None:
+ ptr = 'sizeof(ptr)'
+ break
+
+ return (name + bits_size + vars_size +
+ (' + ' if vars_size and ptr else '') + ptr)
+
+class CSSGroup:
+ def __init__(self, config, is_main=False):
+ self.name = config['name']
+ self.props = [ CSSProperty(*x) for x in config['props'] ]
+ self.is_main = is_main
+
+ @property
+ def bit_map(self):
+ '''Implements a `best fit first` heuristics for the bin packing of
+ property bits in the bits array'''
+
+ bin_size = 32
+ bit_map = []
+ props = sorted([ { 'name': p.name, 'size': p.bits_size }
+ for p in self.props ], key=(lambda x: x['size']), reverse=True)
+
+ for p in props:
+ for b in bit_map:
+ if b.size + p['size'] <= bin_size:
+ b.push(p)
+ break
+ else:
+ bit_map.append(Bin(p))
+ bit_map.sort(key=(lambda x: x.size), reverse=True)
+
+ return bit_map
+
+ def make_computed_h(self):
+ t = Text()
+ t.append()
+ t.comment()
+ for prop in sorted(self.props, key=(lambda x: x.name)):
+ t.append(prop.size_line)
+ t.comment()
+ return t.to_string()
+
+ def make_text(self, filename):
+ if filename == 'computed.h':
+ return self.make_computed_h()
+ else:
+ raise ValueError()
+
+def write_file(self, filename, data):
+ self._lines.append('')
+
+css_groups = [ CSSGroup(g) for g in groups['others'] ]
+css_groups.append(CSSGroup(groups['main'], is_main=True))
+files = ['computed.h']
+for f in files:
+ body = '\n'.join([ x.make_text(f) for x in css_groups ])
+ text = '\n'.join([ assets[f]['header'], body, assets[f]['footer'] ])
+ with open('autogenerated_' + f, 'w') as file_f:
+ file_f.write(text)
-----------------------------------------------------------------------
Summary of changes:
.../assets.cpython-36.pyc} | Bin 1448 -> 1375 bytes
.../__pycache__/select_config.cpython-36.pyc | Bin 6502 -> 6502 bytes
src/select/assets.py | 6 +-
src/select/autogenerated_computed.h | 162 ++++++++++++++++++++
src/select/select_config.py | 10 +-
src/select/select_generator.py | 151 ++++++++++++------
6 files changed, 276 insertions(+), 53 deletions(-)
copy src/select/{assets.py => __pycache__/assets.cpython-36.pyc} (76%)
create mode 100644 src/select/autogenerated_computed.h
diff --git a/src/select/assets.py b/src/select/__pycache__/assets.cpython-36.pyc
similarity index 76%
copy from src/select/assets.py
copy to src/select/__pycache__/assets.cpython-36.pyc
index 8151182..f7b7da8 100644
Binary files a/src/select/assets.py and b/src/select/__pycache__/assets.cpython-36.pyc differ
diff --git a/src/select/__pycache__/select_config.cpython-36.pyc b/src/select/__pycache__/select_config.cpython-36.pyc
index 52b37eb..bcda842 100644
Binary files a/src/select/__pycache__/select_config.cpython-36.pyc and b/src/select/__pycache__/select_config.cpython-36.pyc differ
diff --git a/src/select/assets.py b/src/select/assets.py
index 8151182..1d726a3 100644
--- a/src/select/assets.py
+++ b/src/select/assets.py
@@ -5,8 +5,8 @@
assets = {}
-assets['computed_h'] = {}
-assets['computed_h']['header'] = '''\
+assets['computed.h'] = {}
+assets['computed.h']['header'] = '''\
/*
* This file is part of LibCSS
* Licensed under the MIT License,
@@ -21,7 +21,7 @@ assets['computed_h']['header'] = '''\
#include <libcss/hint.h>
'''
-assets['computed_h']['footer'] = '''\
+assets['computed.h']['footer'] = '''\
/**
* Take a new reference to a computed style
*
diff --git a/src/select/autogenerated_computed.h b/src/select/autogenerated_computed.h
new file mode 100644
index 0000000..76a6b32
--- /dev/null
+++ b/src/select/autogenerated_computed.h
@@ -0,0 +1,162 @@
+/*
+ * This file is part of LibCSS
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2017 The NetSurf Project
+ */
+
+#ifndef css_select_computed_h_
+#define css_select_computed_h_
+
+#include <libcss/computed.h>
+#include <libcss/hint.h>
+
+
+
+/*
+ * border_spacing 1 + 10 8
+ * break_after 4
+ * break_before 4
+ * break_inside 4
+ * clip 6
+ * column_count 2 4
+ * column_fill 2
+ * column_gap 2 + 5 4
+ * column_rule_color 2 4
+ * column_rule_style 4
+ * column_rule_width 3 + 5 4
+ * column_span 2
+ * column_width 2 + 5 4
+ * content 2 sizeof(ptr)
+ * counter_increment 1 sizeof(ptr)
+ * counter_reset 1 sizeof(ptr)
+ * cursor 5 sizeof(ptr)
+ * letter_spacing 2 + 5 4
+ * outline_color 2 4
+ * outline_width 3 + 5 4
+ * word_spacing 2 + 5 4
+ */
+
+/*
+ * orphans 1 4
+ * page_break_after 3
+ * page_break_before 3
+ * page_break_inside 2
+ * widows 1 4
+ */
+
+/*
+ * align_content 3
+ * align_items 3
+ * align_self 3
+ * background_attachment 2
+ * background_color 2 4
+ * background_image 1 sizeof(ptr)
+ * background_position 1 + 10 8
+ * background_repeat 3
+ * border_bottom_color 2 4
+ * border_bottom_style 4
+ * border_bottom_width 3 + 5 4
+ * border_collapse 2
+ * border_left_color 2 4
+ * border_left_style 4
+ * border_left_width 3 + 5 4
+ * border_right_color 2 4
+ * border_right_style 4
+ * border_right_width 3 + 5 4
+ * border_top_color 2 4
+ * border_top_style 4
+ * border_top_width 3 + 5 4
+ * bottom 2 + 5 4
+ * box_sizing 2
+ * caption_side 2
+ * clear 3
+ * color 1 4
+ * direction 2
+ * display 5
+ * empty_cells 2
+ * flex_basis 2 + 5 4
+ * flex_direction 3
+ * flex_grow 1 4
+ * flex_shrink 1 4
+ * flex_wrap 2
+ * float 2
+ * font_family 3 sizeof(ptr)
+ * font_size 4 + 5 4
+ * font_style 2
+ * font_variant 2
+ * font_weight 4
+ * height 2 + 5 4
+ * justify_content 3
+ * left 2 + 5 4
+ * line_height 2 + 5 4
+ * list_style_image 1 sizeof(ptr)
+ * list_style_position 2
+ * list_style_type 4
+ * margin_bottom 2 + 5 4
+ * margin_left 2 + 5 4
+ * margin_right 2 + 5 4
+ * margin_top 2 + 5 4
+ * max_height 2 + 5 4
+ * max_width 2 + 5 4
+ * min_height 2 + 5 4
+ * min_width 2 + 5 4
+ * opacity 1 4
+ * order 1 4
+ * outline_style 4
+ * overflow 3
+ * padding_bottom 1 + 5 4
+ * padding_left 1 + 5 4
+ * padding_right 1 + 5 4
+ * padding_top 1 + 5 4
+ * position 3
+ * quotes 1 sizeof(ptr)
+ * right 2 + 5 4
+ * table_layout 2
+ * text_align 4
+ * text_decoration 5
+ * text_indent 1 + 5 4
+ * text_transform 3
+ * top 2 + 5 4
+ * unicode_bidi 2
+ * vertical_align 4 + 5 4
+ * visibility 2
+ * white_space 3
+ * width 2 + 5 4
+ * z_index 2 4
+ */
+/**
+ * Take a new reference to a computed style
+ *
+ * \param style The style to take a new reference to.
+ *
eturn The new computed style reference
+ */
+static inline css_computed_style * css__computed_style_ref(
+ css_computed_style *style)
+{
+ if (style == NULL)
+ return NULL;
+
+ if (style->i.uncommon != NULL) {
+ style->i.uncommon->count++;
+ }
+
+ style->count++;
+ return style;
+}
+
+css_error css__computed_style_create(css_computed_style **result);
+
+css_error css__computed_style_initialise(css_computed_style *style,
+ struct css_select_handler *handler, void *pw);
+
+
+css_error css__computed_uncommon_destroy(css_computed_uncommon *uncommon);
+
+css_error css__compute_absolute_values(const css_computed_style *parent,
+ css_computed_style *style,
+ css_error (*compute_font_size)(void *pw,
+ const css_hint *parent, css_hint *size),
+ void *pw);
+
+#endif
diff --git a/src/select/select_config.py b/src/select/select_config.py
index d5cd525..27b2dc9 100644
--- a/src/select/select_config.py
+++ b/src/select/select_config.py
@@ -98,8 +98,8 @@ style = {
('z_index', 2, 'integer'),
# Style group, arrays
('font_family', 3, 'string_arr', None, None,
- 'Encode font family as an array of string objects, terminated with a'
- '\n' 'blank entry.'),
+ 'Encode font family as an array of string objects, terminated with a '
+ 'blank entry.'),
('quotes', 1, 'string_arr', None, None,
'Encode quotes as an array of string objects, terminated with a '
'blank entry.')
@@ -145,13 +145,13 @@ uncommon = {
'CSS_WORD_SPACING_SET', 'CSS_WORD_SPACING_NORMAL'),
# Uncommon group, arrays
('counter_increment', 1, 'counter', None, 'CSS_COUNTER_INCREMENT_NONE',
- 'Encode counter_increment as an array of name, value pairs,\n'
+ 'Encode counter_increment as an array of name, value pairs, '
'terminated with a blank entry.'),
('counter_reset', 1, 'counter', None, 'CSS_COUNTER_RESET_NONE',
- 'Encode counter_reset as an array of name, value pairs,\n'
+ 'Encode counter_reset as an array of name, value pairs, '
'terminated with a blank entry.'),
('cursor', 5, 'string_arr', 'CSS_CURSOR_AUTO', None,
- 'Encode cursor uri(s) as an array of string objects, terminated\n'
+ 'Encode cursor uri(s) as an array of string objects, terminated '
'with a blank entry'),
('content', 2, 'content_item', 'CSS_CONTENT_NORMAL', None,
'Encode content as an array of content items, terminated with '
diff --git a/src/select/select_generator.py b/src/select/select_generator.py
index c37aa74..3e6744c 100644
--- a/src/select/select_generator.py
+++ b/src/select/select_generator.py
@@ -6,15 +6,6 @@
from select_config import values, groups
from assets import assets
-def get_tuple(from_var):
- 'Accepts tuples and strings, returns a tuple.'
- if type(from_var) is tuple:
- return from_var
- elif type(from_var) is str:
- return (from_var,)
- else:
- return ()
-
class Bin:
def __init__(self, first_object):
self.contents = [ first_object ]
@@ -26,24 +17,7 @@ class Bin:
def push(self, obj):
self.contents.append(obj)
-def make_bit_map(group):
- '''Implements a `best fit first` heuristics for the bin packing of
- property bits in the bits array'''
-
- bin_size = 32
- bit_map = []
- group_props = sorted([ { 'name': p.name, 'size': p.bits_size }
- for p in group['props'] ], key=(lambda x: x['size']), reverse=True)
- for p in group_props:
- for b in bit_map:
- if b.size + p['size'] <= bin_size:
- b.push(p)
- break
- else:
- bit_map.append(Bin(p))
- bit_map.sort(key=(lambda x: x.size), reverse=True)
-
-class FileText:
+class Text:
def __init__(self):
self._lines = []
self._comment = False
@@ -56,10 +30,21 @@ class FileText:
self._indent += value
def comment(self):
- self.append(' */' if self._comment else '/*')
- self._comment = !self._comment
+ comm = self._comment
+ self._comment = False
+ self.append(' */' if comm else '/*')
+ self._comment = not comm
+
+ def append(self, text=None, pre_formatted=False):
+ if text is None:
+ self._lines.append('\t' * self._indent + ' * '
+ if self._comment else '')
+ return
+
+ if pre_formatted:
+ self._lines.append(text)
+ return
- def append(self, text):
column_max = 80
multiline = False
@@ -75,7 +60,7 @@ class FileText:
break_index = text[:text[:column_max - prefix_size].rfind(' ')]
line += text[:break_index].rstrip()
text = text[break_index:].lstrip()
- self.lines.append(line)
+ self._lines.append(line)
if text and not self._comment and not multiline:
self.indent(2)
multiline = True
@@ -83,12 +68,8 @@ class FileText:
if multiline:
self._indent(-2)
- def write_file(self, filename):
- with open(filename, 'w') as f:
- f.write('\n'.join(self._lines))
-
-def make_computed_h(group, is_main=false):
-
+ def to_string(self):
+ return '\n'.join(self._lines)
class CSSValue:
'Values to be associated with properties.'
@@ -111,22 +92,102 @@ class CSSProperty:
defaults=None, comments=None, override=None):
self.name = name
self.type_size = type_size
- self.values = [ v for v in self.__vals if v.name in get_tuple(values) ]
- self.defaults = get_tuple(defaults)
+ self.values = [ x for v in self.get_tuple(values) for x in self.__vals
+ if x.name is v ]
+ self.defaults = self.get_tuple(defaults)
self.condition = condition
- self.override = get_tuple(override)
+ self.override = self.get_tuple(override)
self.comments = comments
__vals = [ CSSValue(*x) for x in values ]
+ def get_tuple(self, from_var):
+ 'Accepts tuples, strings and None; returns a tuple.'
+ if type(from_var) is tuple:
+ return from_var
+ elif type(from_var) is str:
+ return (from_var,)
+ elif from_var is None:
+ return ()
+ else:
+ raise TypeError('Value should be either tuple, string or None, ' +
+ 'received: ' + type(from_var).__name__)
+
@property
def bits_size(self):
return self.type_size + sum([ v.bits['size'] for v in self.values
if v.bits is not None ])
-groups['main']['props'] = [ CSSProperty(*x) for x in groups['main']['props'] ]
-groups['main']['map'] = make_bit_map(groups['main'])
-for g in groups['others']:
- g['props'] = [ CSSProperty(*x) for x in g['props'] ]
- g['map'] = make_bit_map(g)
+ @property
+ def size_line(self):
+ name = '{:31}'.format(self.name)
+ type_size = str(self.type_size)
+ extra_size = sum([ v.bits['size'] for v in self.values
+ if v.bits is not None ])
+ bits_size = '{:16}'.format(type_size +
+ (' + ' + str(extra_size) if extra_size else ''))
+ vars_size = sum([ v.size for v in self.values if v.size is not None ])
+ vars_size = str(vars_size) if vars_size else ''
+ ptr = ''
+ for v in self.values:
+ if v.size is None:
+ ptr = 'sizeof(ptr)'
+ break
+
+ return (name + bits_size + vars_size +
+ (' + ' if vars_size and ptr else '') + ptr)
+
+class CSSGroup:
+ def __init__(self, config, is_main=False):
+ self.name = config['name']
+ self.props = [ CSSProperty(*x) for x in config['props'] ]
+ self.is_main = is_main
+
+ @property
+ def bit_map(self):
+ '''Implements a `best fit first` heuristics for the bin packing of
+ property bits in the bits array'''
+
+ bin_size = 32
+ bit_map = []
+ props = sorted([ { 'name': p.name, 'size': p.bits_size }
+ for p in self.props ], key=(lambda x: x['size']), reverse=True)
+
+ for p in props:
+ for b in bit_map:
+ if b.size + p['size'] <= bin_size:
+ b.push(p)
+ break
+ else:
+ bit_map.append(Bin(p))
+ bit_map.sort(key=(lambda x: x.size), reverse=True)
+
+ return bit_map
+
+ def make_computed_h(self):
+ t = Text()
+ t.append()
+ t.comment()
+ for prop in sorted(self.props, key=(lambda x: x.name)):
+ t.append(prop.size_line)
+ t.comment()
+ return t.to_string()
+
+ def make_text(self, filename):
+ if filename == 'computed.h':
+ return self.make_computed_h()
+ else:
+ raise ValueError()
+
+def write_file(self, filename, data):
+ self._lines.append('')
+
+css_groups = [ CSSGroup(g) for g in groups['others'] ]
+css_groups.append(CSSGroup(groups['main'], is_main=True))
+files = ['computed.h']
+for f in files:
+ body = '\n'.join([ x.make_text(f) for x in css_groups ])
+ text = '\n'.join([ assets[f]['header'], body, assets[f]['footer'] ])
+ with open('autogenerated_' + f, 'w') as file_f:
+ file_f.write(text)
--
Cascading Style Sheets library
5 years, 11 months
libcss: branch lcneves/units updated. release/0.7.0-22-g723fba2
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libcss.git/shortlog/723fba2c05a80274ab50e5...
...commit http://git.netsurf-browser.org/libcss.git/commit/723fba2c05a80274ab50e529...
...tree http://git.netsurf-browser.org/libcss.git/tree/723fba2c05a80274ab50e529d8...
The branch, lcneves/units has been updated
via 723fba2c05a80274ab50e529d8fcba0310dad1ae (commit)
from 21a344cfb578bc53ef41b2d2459f3f8892aec30b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=723fba2c05a80274ab50...
commit 723fba2c05a80274ab50e529d8fcba0310dad1ae
Author: Lucas Neves <lcneves(a)gmail.com>
Commit: Lucas Neves <lcneves(a)gmail.com>
WIP: Select: autogen for selection properties.
diff --git a/src/select/select_generator.py b/src/select/select_generator.py
index 701d7d5..c37aa74 100644
--- a/src/select/select_generator.py
+++ b/src/select/select_generator.py
@@ -68,18 +68,27 @@ class FileText:
if self._comment:
line += ' * '
prefix_size = (3 if self._comment else 0) + 8 * self._indent
- line += text[:column_max - prefix_size]
+ if prefix_size + len(text) <= column_max:
+ line += text
+ text = ''
+ else:
+ break_index = text[:text[:column_max - prefix_size].rfind(' ')]
+ line += text[:break_index].rstrip()
+ text = text[break_index:].lstrip()
self.lines.append(line)
- text = text[column_max - prefix_size:]
if text and not self._comment and not multiline:
- self._indent(2)
+ self.indent(2)
multiline = True
if multiline:
self._indent(-2)
+ def write_file(self, filename):
+ with open(filename, 'w') as f:
+ f.write('\n'.join(self._lines))
+
def make_computed_h(group, is_main=false):
- pass
+
class CSSValue:
'Values to be associated with properties.'
-----------------------------------------------------------------------
Summary of changes:
src/select/select_generator.py | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/select/select_generator.py b/src/select/select_generator.py
index 701d7d5..c37aa74 100644
--- a/src/select/select_generator.py
+++ b/src/select/select_generator.py
@@ -68,18 +68,27 @@ class FileText:
if self._comment:
line += ' * '
prefix_size = (3 if self._comment else 0) + 8 * self._indent
- line += text[:column_max - prefix_size]
+ if prefix_size + len(text) <= column_max:
+ line += text
+ text = ''
+ else:
+ break_index = text[:text[:column_max - prefix_size].rfind(' ')]
+ line += text[:break_index].rstrip()
+ text = text[break_index:].lstrip()
self.lines.append(line)
- text = text[column_max - prefix_size:]
if text and not self._comment and not multiline:
- self._indent(2)
+ self.indent(2)
multiline = True
if multiline:
self._indent(-2)
+ def write_file(self, filename):
+ with open(filename, 'w') as f:
+ f.write('\n'.join(self._lines))
+
def make_computed_h(group, is_main=false):
- pass
+
class CSSValue:
'Values to be associated with properties.'
--
Cascading Style Sheets library
5 years, 11 months
netsurf: branch master updated. release/3.7-20-g8cc3ade
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/8cc3adee5aabd3b6ad1c6...
...commit http://git.netsurf-browser.org/netsurf.git/commit/8cc3adee5aabd3b6ad1c6c8...
...tree http://git.netsurf-browser.org/netsurf.git/tree/8cc3adee5aabd3b6ad1c6c897...
The branch, master has been updated
via 8cc3adee5aabd3b6ad1c6c897c9c31a8136e61cc (commit)
from 448228a30cc76ccb47d5cbb7053a042453244f47 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=8cc3adee5aabd3b6ad1...
commit 8cc3adee5aabd3b6ad1c6c897c9c31a8136e61cc
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Duktape: Attempt to squash aarch64 cast increases required alignment warnings.
content/handlers/javascript/duktape/duktape.c: In function 'duk_resolve_nonbound_function':
content/handlers/javascript/duktape/duktape.c:14585:25: error: cast increases required alignment of target type [-Werror=cast-align]
duk_push_tval(thr, &((duk_hboundfunc *) h)->target);
^
content/handlers/javascript/duktape/duktape.c: In function 'duk_bi_function_prototype_bind':
content/handlers/javascript/duktape/duktape.c:32399:20: error: cast increases required alignment of target type [-Werror=cast-align]
h_boundtarget = (duk_hboundfunc *) h_target;
^
content/handlers/javascript/duktape/duktape.c: In function 'duk_free_hobject':
content/handlers/javascript/duktape/duktape.c:46048:23: error: cast increases required alignment of target type [-Werror=cast-align]
duk_hboundfunc *f = (duk_hboundfunc *) h;
^
content/handlers/javascript/duktape/duktape.c: In function 'duk__mark_hobject':
content/handlers/javascript/duktape/duktape.c:47865:23: error: cast increases required alignment of target type [-Werror=cast-align]
duk_hboundfunc *f = (duk_hboundfunc *) h;
^
content/handlers/javascript/duktape/duktape.c: In function 'duk_hobject_refcount_finalize_norz':
content/handlers/javascript/duktape/duktape.c:49842:23: error: cast increases required alignment of target type [-Werror=cast-align]
duk_hboundfunc *f = (duk_hboundfunc *) h;
^
content/handlers/javascript/duktape/duktape.c: In function 'duk__handle_bound_chain_for_call':
content/handlers/javascript/duktape/duktape.c:61509:14: error: cast increases required alignment of target type [-Werror=cast-align]
h_bound = (duk_hboundfunc *) func;
^
content/handlers/javascript/duktape/duktape.c: In function 'duk_js_instanceof':
content/handlers/javascript/duktape/duktape.c:78117:24: error: cast increases required alignment of target type [-Werror=cast-align]
duk_push_tval(thr, &((duk_hboundfunc *) func)->target);
^
diff --git a/content/handlers/javascript/duktape/duktape.c b/content/handlers/javascript/duktape/duktape.c
index 3139b69..5e3b467 100644
--- a/content/handlers/javascript/duktape/duktape.c
+++ b/content/handlers/javascript/duktape/duktape.c
@@ -6663,7 +6663,11 @@ struct duk_hobject {
duk_uint32_t h_size; /* hash part size or 0 if unused */
#endif
#endif
-};
+}
+#if (DUK_USE_ALIGN_BY == 8)
+__attribute__ ((aligned (8)))
+#endif
+;
/*
* Exposed data
-----------------------------------------------------------------------
Summary of changes:
content/handlers/javascript/duktape/duktape.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/content/handlers/javascript/duktape/duktape.c b/content/handlers/javascript/duktape/duktape.c
index 3139b69..5e3b467 100644
--- a/content/handlers/javascript/duktape/duktape.c
+++ b/content/handlers/javascript/duktape/duktape.c
@@ -6663,7 +6663,11 @@ struct duk_hobject {
duk_uint32_t h_size; /* hash part size or 0 if unused */
#endif
#endif
-};
+}
+#if (DUK_USE_ALIGN_BY == 8)
+__attribute__ ((aligned (8)))
+#endif
+;
/*
* Exposed data
--
NetSurf Browser
5 years, 11 months
netsurf: branch ashmew2/nskolibrios updated. release/3.7-86-gdef0cfc
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/def0cfce51794a243814c...
...commit http://git.netsurf-browser.org/netsurf.git/commit/def0cfce51794a243814c8e...
...tree http://git.netsurf-browser.org/netsurf.git/tree/def0cfce51794a243814c8e5c...
The branch, ashmew2/nskolibrios has been updated
via def0cfce51794a243814c8e5ca68033177e64382 (commit)
via 93c012c0e3aeb1d5f2272634d0cd21edcd20676d (commit)
from 42573b3d134996973b3cbcfa4688b58e87fc478d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=def0cfce51794a24381...
commit def0cfce51794a243814c8e5ca68033177e64382
Author: Ashish Gupta <ashmew2(a)gmail.com>
Commit: Ashish Gupta <ashmew2(a)gmail.com>
Remove from poll on abort. Fix loglevels
diff --git a/content/fetchers/httplib_kolibri.c b/content/fetchers/httplib_kolibri.c
index 9036ee2..efeb5a9 100644
--- a/content/fetchers/httplib_kolibri.c
+++ b/content/fetchers/httplib_kolibri.c
@@ -25,47 +25,42 @@ struct httpfetcher {
struct httpfetcher *next;
};
-struct httpfetcher *head = NULL;
+static struct httpfetcher *head = NULL;
-void add_to_poll(struct httpfetcher *newfetcher) {
+static void add_to_poll(struct httpfetcher *newfetcher) {
- NSLOG(fetch, ERROR, "(head:0x%x) newfetcher 0x%x, newfetcher->handle 0x%x", head, newfetcher, newfetcher->handle);
+ NSLOG(fetch, DEBUG, "(head:0x%x) newfetcher 0x%x, newfetcher->handle 0x%x", head, newfetcher, newfetcher->handle);
struct httpfetcher *t = head;
while(t) {
- NSLOG(fetch, ERROR, "ll node = 0x%x", t);
+ NSLOG(fetch, DEBUG, "ll node = 0x%x, ->next 0x%x", t, t->next);
t=t->next;
}
if(head == NULL) {
head = newfetcher;
assert(head->next == NULL);
- NSLOG(fetch, ERROR, "(head:0x%x) ADDED newfetcher 0x%x, newfetcher->handle 0x%x", head, head, head->handle);
+ NSLOG(fetch, DEBUG, "(head:0x%x) ADDED newfetcher 0x%x, newfetcher->handle 0x%x", head, head, head->handle);
}
else {
t = head;
while(t->next != NULL) {
- NSLOG(fetch, ERROR, "-- Looping t 0x%x, t->handle 0x%x", t->next, t->next->handle);
+ NSLOG(fetch, DEBUG, "-- Looping t 0x%x, t->handle 0x%x", t->next, t->next->handle);
t = t->next;
}
t->next = newfetcher;
- NSLOG(fetch, ERROR, "(head:0x%x) ADDED newfetcher 0x%x, newfetcher->handle 0x%x, nn 0x%x", head, t->next, t->next->handle, t->next->next);
+ NSLOG(fetch, DEBUG, "(head:0x%x) ADDED newfetcher 0x%x, newfetcher->handle 0x%x, nn 0x%x", head, t->next, t->next->handle, t->next->next);
}
- struct httpfetcher *xx = head;
- while(xx) {
- NSLOG(fetch, ERROR, "ll node = 0x%x", xx);
- xx=xx->next;
- }
}
-struct httpfetcher* remove_from_poll(struct httpfetcher *removee) {
+static struct httpfetcher* remove_from_poll(struct httpfetcher *removee) {
struct httpfetcher *t = head, *p = head;
- NSLOG(fetch, ERROR, "(head=0x%x), remove: 0x%x , removee->handle: 0x%x", head, removee, removee->handle);
+ NSLOG(fetch, DEBUG, "(head=0x%x), remove: 0x%x , removee->handle: 0x%x", head, removee, removee->handle);
while(t) {
- NSLOG(fetch, ERROR, "BEFORE REMOVE ll node = 0x%x", t);
+ NSLOG(fetch, DEBUG, "BEFORE REMOVE ll node = 0x%x, next 0x%x", t, t->next);
t=t->next;
}
@@ -76,21 +71,11 @@ struct httpfetcher* remove_from_poll(struct httpfetcher *removee) {
p = t->next;
head = p;
- struct httpfetcher *xx = head;
- while(xx) {
- NSLOG(fetch, ERROR, "ll node = 0x%x", xx);
- xx=xx->next;
- }
return head;
break;
}
else {
p->next = t->next;
- struct httpfetcher *xx = head;
- while(xx) {
- NSLOG(fetch, ERROR, "ll node = 0x%x", xx);
- xx=xx->next;
- }
return t->next;
break;
}
@@ -103,27 +88,27 @@ struct httpfetcher* remove_from_poll(struct httpfetcher *removee) {
return head;
}
-bool init_fetcher(lwc_string *scheme) {
+static bool init_fetcher(lwc_string *scheme) {
bool supported_scheme;
assert(lwc_string_isequal(scheme, corestring_lwc_http, &supported_scheme) == lwc_error_ok);
- NSLOG(fetch, DEBUG, "Initializing http library!");
+ NSLOG(fetch, INFO, "Initializing http library!");
debug_board_printf("---- [NETSURF] Trying to initialize http library.\n");
+
if(kolibri_http_init() == 0) {
- NSLOG(fetch, DEBUG, "[INFO] Loaded http.obj library successfully.\n");
+ NSLOG(fetch, INFO, "[INFO] Loaded http.obj library successfully.\n");
debug_board_printf("---- [NETSURF] Successfully initialized http library.\n");
}
else {
- NSLOG(fetch, ERROR, "[ERROR] Could not load http.obj library.\n");
+ NSLOG(fetch, ERROR, "Could not load http.obj library.\n");
debug_board_printf("---- [NETSURF] Could not initialize http library. Exiting.\n");
- assert(0 && 1);
return false;
}
return supported_scheme;
}
-bool supported_url_check(const struct nsurl *url) {
+static bool supported_url_check(const struct nsurl *url) {
bool supported;
lwc_string *url_scheme = nsurl_get_component(url, NSURL_SCHEME);
assert(lwc_string_isequal(url_scheme, corestring_lwc_http, &supported) == lwc_error_ok);
@@ -131,7 +116,7 @@ bool supported_url_check(const struct nsurl *url) {
return supported;
}
-void *setup_fetch(struct fetch *parent_fetch, struct nsurl *url,
+static void *setup_fetch(struct fetch *parent_fetch, struct nsurl *url,
bool only_2xx, bool downgrade_tls, const char *post_urlenc,
const struct fetch_multipart_data *post_multipart,
const char **headers) {
@@ -293,41 +278,42 @@ void *setup_fetch(struct fetch *parent_fetch, struct nsurl *url,
return newfetcher;
}
-bool start_fetch(void *httpf) {
+static bool start_fetch(void *httpf) {
assert(((struct httpfetcher *)httpf)->owner != NULL);
- NSLOG(fetch, ERROR, "httpf: 0x%x", httpf);
- add_to_poll((struct httpfetcher *) httpf);
+ NSLOG(fetch, DEBUG, "httpf: 0x%x", httpf);
+ add_to_poll((struct httpfetcher *) httpf);
struct httpfetcher *wrapper = httpf;
assert(((struct httpfetcher *)httpf)->owner != NULL);
- NSLOG(fetch, ERROR, "END OF add_to_poll: httpf: 0x%x, httpf->handle 0x%x, httpf->next 0x%x", wrapper, wrapper->handle, *wrapper );
+ NSLOG(fetch, DEBUG, "END OF add_to_poll: httpf: 0x%x, httpf->handle 0x%x, httpf->next 0x%x", wrapper, wrapper->handle, wrapper->next);
return true;
}
-bool abort_fetch(void *httpf) {
- NSLOG(fetch, ERROR, "aborting fetch 0x%x,", ((struct httpfetcher *)httpf)->owner);
+static bool abort_fetch(void *httpf) {
+ NSLOG(fetch, DEBUG, "aborting httpf 0x%x, httpf->handle 0x%x, httpf->next 0x%x", ((struct httpfetcher *)httpf), ((struct httpfetcher *)httpf)->handle, ((struct httpfetcher *)httpf)->next);
+
+ remove_from_poll(httpf);
- // remove_from_poll((struct httpfetcher *) httpf);
fetch_remove_from_queues(((struct httpfetcher *)httpf)->owner);
+
fetch_free(((struct httpfetcher *)httpf)->owner);
return true;
}
-bool free_fetch(void *httpf) {
- NSLOG(fetch, ERROR, "free_fetch fetch 0x%x", ((struct httpfetcher *)httpf)->owner);
+static void free_fetch(void *httpf) {
+ NSLOG(fetch, DEBUG, "free_fetch httpf 0x%x", ((struct httpfetcher *)httpf));
+
http_disconnect_asm((((struct httpfetcher *)httpf)->handle));
http_free_asm((((struct httpfetcher *)httpf)->handle));
free((struct httpfetcher *)httpf);
-
- return true;
}
-void poll_fetch(lwc_string *scheme) {
+static void poll_fetch(lwc_string *scheme) {
bool supported_scheme;
assert(lwc_string_isequal(scheme, corestring_lwc_http, &supported_scheme) == lwc_error_ok);
assert(supported_scheme);
@@ -344,19 +330,12 @@ void poll_fetch(lwc_string *scheme) {
NSLOG(fetch, DEBUG, "--- Content Length (received / total): %d / %d", t->handle->content_received, t->handle->content_length);
NSLOG(fetch, DEBUG, "--- ^ was for url : %s", nsurl_access(t->url));
- struct httpfetcher *xx = head;
- while(xx) {
- NSLOG(fetch, ERROR, "ll node poller = 0x%x", xx);
- xx=xx->next;
- }
- NSLOG(fetch, ERROR, "ll node poller breakage --");
-
int ret = http_receive_asm(t->handle);
if(t->handle->flags & HTTP_ERRORS) {
fetch_msg msg;
msg.type = FETCH_ERROR;
- NSLOG(fetch, ERROR, "---- http_msg -> flags = 0x%x", t->handle->flags);
+ NSLOG(fetch, DEBUG, "---- http_msg -> flags = 0x%x", t->handle->flags);
msg.data.header_or_data.buf = (const uint8_t *) "HTTPLIB ERROR";
msg.data.header_or_data.len = strlen("HTTPLIB ERROR");
struct httpfetcher *t2 = remove_from_poll(t);
@@ -423,12 +402,12 @@ void poll_fetch(lwc_string *scheme) {
newlocation[lenloc]='\0';
msg.data.redirect = newlocation;
- NSLOG(fetch, INFO, "---- [3xx] : Redirect to %s", msg.data.redirect);
+ NSLOG(fetch, DEBUG, "---- [3xx] : Redirect to %s", msg.data.redirect);
struct httpfetcher *t2 = remove_from_poll(t);
fetch_send_callback(&msg, t->owner);
t->headercbdone = true;
t = t2;
- NSLOG(fetch, INFO, "---- DID [3xx] : Redirect to %s", msg.data.redirect);
+ NSLOG(fetch, DEBUG, "---- DID [3xx] : Redirect to %s", msg.data.redirect);
/* t = t->next; */
/* t = head; */
continue;
@@ -437,7 +416,7 @@ void poll_fetch(lwc_string *scheme) {
else {
fetch_msg msg;
msg.type = FETCH_ERROR;
- NSLOG(fetch, DEBUG, " ---- [ERROR] Unhandled HTTP Code : %d", t->handle->status);
+ NSLOG(fetch, ERROR, " ---- Unhandled HTTP Code : %d", t->handle->status);
fetch_send_callback(&msg, t->owner);
t->headercbdone = true;
fetch_remove_from_queues(t->owner);
@@ -500,7 +479,7 @@ void poll_fetch(lwc_string *scheme) {
}
}
-void finalize_fetcher(lwc_string *scheme) {
+static void finalize_fetcher(lwc_string *scheme) {
bool supported_scheme;
assert(lwc_string_isequal(scheme, corestring_lwc_http, &supported_scheme) == lwc_error_ok);
lwc_string_unref(scheme);
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=93c012c0e3aeb1d5f22...
commit 93c012c0e3aeb1d5f2272634d0cd21edcd20676d
Author: Ashish Gupta <ashmew2(a)gmail.com>
Commit: Ashish Gupta <ashmew2(a)gmail.com>
Add Leency's icons to Netsurf
diff --git a/frontends/kolibrios/res/icons/scrolld.png b/frontends/kolibrios/res/icons/scrolld.png
index 1977207..f2d955a 100644
Binary files a/frontends/kolibrios/res/icons/scrolld.png and b/frontends/kolibrios/res/icons/scrolld.png differ
diff --git a/frontends/kolibrios/res/icons/scrolll.png b/frontends/kolibrios/res/icons/scrolll.png
index 83f8609..0b86fcb 100644
Binary files a/frontends/kolibrios/res/icons/scrolll.png and b/frontends/kolibrios/res/icons/scrolll.png differ
diff --git a/frontends/kolibrios/res/icons/scrollr.png b/frontends/kolibrios/res/icons/scrollr.png
index 669e758..fd5f478 100644
Binary files a/frontends/kolibrios/res/icons/scrollr.png and b/frontends/kolibrios/res/icons/scrollr.png differ
diff --git a/frontends/kolibrios/res/icons/scrollu.png b/frontends/kolibrios/res/icons/scrollu.png
index f635c2b..753ec46 100644
Binary files a/frontends/kolibrios/res/icons/scrollu.png and b/frontends/kolibrios/res/icons/scrollu.png differ
diff --git a/frontends/kolibrios/res/netsurf.png b/frontends/kolibrios/res/netsurf.png
index 8ba116c..9eb65a5 100644
Binary files a/frontends/kolibrios/res/netsurf.png and b/frontends/kolibrios/res/netsurf.png differ
-----------------------------------------------------------------------
Summary of changes:
content/fetchers/httplib_kolibri.c | 91 +++++++++++------------------
frontends/kolibrios/res/icons/scrolld.png | Bin 294 -> 204 bytes
frontends/kolibrios/res/icons/scrolll.png | Bin 307 -> 201 bytes
frontends/kolibrios/res/icons/scrollr.png | Bin 286 -> 200 bytes
frontends/kolibrios/res/icons/scrollu.png | Bin 280 -> 196 bytes
frontends/kolibrios/res/netsurf.png | Bin 16486 -> 5184 bytes
6 files changed, 35 insertions(+), 56 deletions(-)
diff --git a/content/fetchers/httplib_kolibri.c b/content/fetchers/httplib_kolibri.c
index 9036ee2..efeb5a9 100644
--- a/content/fetchers/httplib_kolibri.c
+++ b/content/fetchers/httplib_kolibri.c
@@ -25,47 +25,42 @@ struct httpfetcher {
struct httpfetcher *next;
};
-struct httpfetcher *head = NULL;
+static struct httpfetcher *head = NULL;
-void add_to_poll(struct httpfetcher *newfetcher) {
+static void add_to_poll(struct httpfetcher *newfetcher) {
- NSLOG(fetch, ERROR, "(head:0x%x) newfetcher 0x%x, newfetcher->handle 0x%x", head, newfetcher, newfetcher->handle);
+ NSLOG(fetch, DEBUG, "(head:0x%x) newfetcher 0x%x, newfetcher->handle 0x%x", head, newfetcher, newfetcher->handle);
struct httpfetcher *t = head;
while(t) {
- NSLOG(fetch, ERROR, "ll node = 0x%x", t);
+ NSLOG(fetch, DEBUG, "ll node = 0x%x, ->next 0x%x", t, t->next);
t=t->next;
}
if(head == NULL) {
head = newfetcher;
assert(head->next == NULL);
- NSLOG(fetch, ERROR, "(head:0x%x) ADDED newfetcher 0x%x, newfetcher->handle 0x%x", head, head, head->handle);
+ NSLOG(fetch, DEBUG, "(head:0x%x) ADDED newfetcher 0x%x, newfetcher->handle 0x%x", head, head, head->handle);
}
else {
t = head;
while(t->next != NULL) {
- NSLOG(fetch, ERROR, "-- Looping t 0x%x, t->handle 0x%x", t->next, t->next->handle);
+ NSLOG(fetch, DEBUG, "-- Looping t 0x%x, t->handle 0x%x", t->next, t->next->handle);
t = t->next;
}
t->next = newfetcher;
- NSLOG(fetch, ERROR, "(head:0x%x) ADDED newfetcher 0x%x, newfetcher->handle 0x%x, nn 0x%x", head, t->next, t->next->handle, t->next->next);
+ NSLOG(fetch, DEBUG, "(head:0x%x) ADDED newfetcher 0x%x, newfetcher->handle 0x%x, nn 0x%x", head, t->next, t->next->handle, t->next->next);
}
- struct httpfetcher *xx = head;
- while(xx) {
- NSLOG(fetch, ERROR, "ll node = 0x%x", xx);
- xx=xx->next;
- }
}
-struct httpfetcher* remove_from_poll(struct httpfetcher *removee) {
+static struct httpfetcher* remove_from_poll(struct httpfetcher *removee) {
struct httpfetcher *t = head, *p = head;
- NSLOG(fetch, ERROR, "(head=0x%x), remove: 0x%x , removee->handle: 0x%x", head, removee, removee->handle);
+ NSLOG(fetch, DEBUG, "(head=0x%x), remove: 0x%x , removee->handle: 0x%x", head, removee, removee->handle);
while(t) {
- NSLOG(fetch, ERROR, "BEFORE REMOVE ll node = 0x%x", t);
+ NSLOG(fetch, DEBUG, "BEFORE REMOVE ll node = 0x%x, next 0x%x", t, t->next);
t=t->next;
}
@@ -76,21 +71,11 @@ struct httpfetcher* remove_from_poll(struct httpfetcher *removee) {
p = t->next;
head = p;
- struct httpfetcher *xx = head;
- while(xx) {
- NSLOG(fetch, ERROR, "ll node = 0x%x", xx);
- xx=xx->next;
- }
return head;
break;
}
else {
p->next = t->next;
- struct httpfetcher *xx = head;
- while(xx) {
- NSLOG(fetch, ERROR, "ll node = 0x%x", xx);
- xx=xx->next;
- }
return t->next;
break;
}
@@ -103,27 +88,27 @@ struct httpfetcher* remove_from_poll(struct httpfetcher *removee) {
return head;
}
-bool init_fetcher(lwc_string *scheme) {
+static bool init_fetcher(lwc_string *scheme) {
bool supported_scheme;
assert(lwc_string_isequal(scheme, corestring_lwc_http, &supported_scheme) == lwc_error_ok);
- NSLOG(fetch, DEBUG, "Initializing http library!");
+ NSLOG(fetch, INFO, "Initializing http library!");
debug_board_printf("---- [NETSURF] Trying to initialize http library.\n");
+
if(kolibri_http_init() == 0) {
- NSLOG(fetch, DEBUG, "[INFO] Loaded http.obj library successfully.\n");
+ NSLOG(fetch, INFO, "[INFO] Loaded http.obj library successfully.\n");
debug_board_printf("---- [NETSURF] Successfully initialized http library.\n");
}
else {
- NSLOG(fetch, ERROR, "[ERROR] Could not load http.obj library.\n");
+ NSLOG(fetch, ERROR, "Could not load http.obj library.\n");
debug_board_printf("---- [NETSURF] Could not initialize http library. Exiting.\n");
- assert(0 && 1);
return false;
}
return supported_scheme;
}
-bool supported_url_check(const struct nsurl *url) {
+static bool supported_url_check(const struct nsurl *url) {
bool supported;
lwc_string *url_scheme = nsurl_get_component(url, NSURL_SCHEME);
assert(lwc_string_isequal(url_scheme, corestring_lwc_http, &supported) == lwc_error_ok);
@@ -131,7 +116,7 @@ bool supported_url_check(const struct nsurl *url) {
return supported;
}
-void *setup_fetch(struct fetch *parent_fetch, struct nsurl *url,
+static void *setup_fetch(struct fetch *parent_fetch, struct nsurl *url,
bool only_2xx, bool downgrade_tls, const char *post_urlenc,
const struct fetch_multipart_data *post_multipart,
const char **headers) {
@@ -293,41 +278,42 @@ void *setup_fetch(struct fetch *parent_fetch, struct nsurl *url,
return newfetcher;
}
-bool start_fetch(void *httpf) {
+static bool start_fetch(void *httpf) {
assert(((struct httpfetcher *)httpf)->owner != NULL);
- NSLOG(fetch, ERROR, "httpf: 0x%x", httpf);
- add_to_poll((struct httpfetcher *) httpf);
+ NSLOG(fetch, DEBUG, "httpf: 0x%x", httpf);
+ add_to_poll((struct httpfetcher *) httpf);
struct httpfetcher *wrapper = httpf;
assert(((struct httpfetcher *)httpf)->owner != NULL);
- NSLOG(fetch, ERROR, "END OF add_to_poll: httpf: 0x%x, httpf->handle 0x%x, httpf->next 0x%x", wrapper, wrapper->handle, *wrapper );
+ NSLOG(fetch, DEBUG, "END OF add_to_poll: httpf: 0x%x, httpf->handle 0x%x, httpf->next 0x%x", wrapper, wrapper->handle, wrapper->next);
return true;
}
-bool abort_fetch(void *httpf) {
- NSLOG(fetch, ERROR, "aborting fetch 0x%x,", ((struct httpfetcher *)httpf)->owner);
+static bool abort_fetch(void *httpf) {
+ NSLOG(fetch, DEBUG, "aborting httpf 0x%x, httpf->handle 0x%x, httpf->next 0x%x", ((struct httpfetcher *)httpf), ((struct httpfetcher *)httpf)->handle, ((struct httpfetcher *)httpf)->next);
+
+ remove_from_poll(httpf);
- // remove_from_poll((struct httpfetcher *) httpf);
fetch_remove_from_queues(((struct httpfetcher *)httpf)->owner);
+
fetch_free(((struct httpfetcher *)httpf)->owner);
return true;
}
-bool free_fetch(void *httpf) {
- NSLOG(fetch, ERROR, "free_fetch fetch 0x%x", ((struct httpfetcher *)httpf)->owner);
+static void free_fetch(void *httpf) {
+ NSLOG(fetch, DEBUG, "free_fetch httpf 0x%x", ((struct httpfetcher *)httpf));
+
http_disconnect_asm((((struct httpfetcher *)httpf)->handle));
http_free_asm((((struct httpfetcher *)httpf)->handle));
free((struct httpfetcher *)httpf);
-
- return true;
}
-void poll_fetch(lwc_string *scheme) {
+static void poll_fetch(lwc_string *scheme) {
bool supported_scheme;
assert(lwc_string_isequal(scheme, corestring_lwc_http, &supported_scheme) == lwc_error_ok);
assert(supported_scheme);
@@ -344,19 +330,12 @@ void poll_fetch(lwc_string *scheme) {
NSLOG(fetch, DEBUG, "--- Content Length (received / total): %d / %d", t->handle->content_received, t->handle->content_length);
NSLOG(fetch, DEBUG, "--- ^ was for url : %s", nsurl_access(t->url));
- struct httpfetcher *xx = head;
- while(xx) {
- NSLOG(fetch, ERROR, "ll node poller = 0x%x", xx);
- xx=xx->next;
- }
- NSLOG(fetch, ERROR, "ll node poller breakage --");
-
int ret = http_receive_asm(t->handle);
if(t->handle->flags & HTTP_ERRORS) {
fetch_msg msg;
msg.type = FETCH_ERROR;
- NSLOG(fetch, ERROR, "---- http_msg -> flags = 0x%x", t->handle->flags);
+ NSLOG(fetch, DEBUG, "---- http_msg -> flags = 0x%x", t->handle->flags);
msg.data.header_or_data.buf = (const uint8_t *) "HTTPLIB ERROR";
msg.data.header_or_data.len = strlen("HTTPLIB ERROR");
struct httpfetcher *t2 = remove_from_poll(t);
@@ -423,12 +402,12 @@ void poll_fetch(lwc_string *scheme) {
newlocation[lenloc]='\0';
msg.data.redirect = newlocation;
- NSLOG(fetch, INFO, "---- [3xx] : Redirect to %s", msg.data.redirect);
+ NSLOG(fetch, DEBUG, "---- [3xx] : Redirect to %s", msg.data.redirect);
struct httpfetcher *t2 = remove_from_poll(t);
fetch_send_callback(&msg, t->owner);
t->headercbdone = true;
t = t2;
- NSLOG(fetch, INFO, "---- DID [3xx] : Redirect to %s", msg.data.redirect);
+ NSLOG(fetch, DEBUG, "---- DID [3xx] : Redirect to %s", msg.data.redirect);
/* t = t->next; */
/* t = head; */
continue;
@@ -437,7 +416,7 @@ void poll_fetch(lwc_string *scheme) {
else {
fetch_msg msg;
msg.type = FETCH_ERROR;
- NSLOG(fetch, DEBUG, " ---- [ERROR] Unhandled HTTP Code : %d", t->handle->status);
+ NSLOG(fetch, ERROR, " ---- Unhandled HTTP Code : %d", t->handle->status);
fetch_send_callback(&msg, t->owner);
t->headercbdone = true;
fetch_remove_from_queues(t->owner);
@@ -500,7 +479,7 @@ void poll_fetch(lwc_string *scheme) {
}
}
-void finalize_fetcher(lwc_string *scheme) {
+static void finalize_fetcher(lwc_string *scheme) {
bool supported_scheme;
assert(lwc_string_isequal(scheme, corestring_lwc_http, &supported_scheme) == lwc_error_ok);
lwc_string_unref(scheme);
diff --git a/frontends/kolibrios/res/icons/scrolld.png b/frontends/kolibrios/res/icons/scrolld.png
index 1977207..f2d955a 100644
Binary files a/frontends/kolibrios/res/icons/scrolld.png and b/frontends/kolibrios/res/icons/scrolld.png differ
diff --git a/frontends/kolibrios/res/icons/scrolll.png b/frontends/kolibrios/res/icons/scrolll.png
index 83f8609..0b86fcb 100644
Binary files a/frontends/kolibrios/res/icons/scrolll.png and b/frontends/kolibrios/res/icons/scrolll.png differ
diff --git a/frontends/kolibrios/res/icons/scrollr.png b/frontends/kolibrios/res/icons/scrollr.png
index 669e758..fd5f478 100644
Binary files a/frontends/kolibrios/res/icons/scrollr.png and b/frontends/kolibrios/res/icons/scrollr.png differ
diff --git a/frontends/kolibrios/res/icons/scrollu.png b/frontends/kolibrios/res/icons/scrollu.png
index f635c2b..753ec46 100644
Binary files a/frontends/kolibrios/res/icons/scrollu.png and b/frontends/kolibrios/res/icons/scrollu.png differ
diff --git a/frontends/kolibrios/res/netsurf.png b/frontends/kolibrios/res/netsurf.png
index 8ba116c..9eb65a5 100644
Binary files a/frontends/kolibrios/res/netsurf.png and b/frontends/kolibrios/res/netsurf.png differ
--
NetSurf Browser
5 years, 11 months
netsurf: branch master updated. release/3.7-19-g448228a
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/448228a30cc76ccb47d5c...
...commit http://git.netsurf-browser.org/netsurf.git/commit/448228a30cc76ccb47d5cbb...
...tree http://git.netsurf-browser.org/netsurf.git/tree/448228a30cc76ccb47d5cbb70...
The branch, master has been updated
via 448228a30cc76ccb47d5cbb7053a042453244f47 (commit)
via 0687687c379f43f6decf0d53595671f020ac92cc (commit)
from ea7da966de05e5f372997f8969f64685f732a6a0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=448228a30cc76ccb47d...
commit 448228a30cc76ccb47d5cbb7053a042453244f47
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Duktape: Use align-by-8 on all platforms by default
This reproduces upstream commit de7ae8a2ecc597e1c2024c15dbeae4d28c9f2a2c.
* https://github.com/svaarala/duktape/commit/de7ae8a2ecc597e1c2024c15dbeae4...
It was applied to master after the release of Duktape 2.2.0. See also:
* https://github.com/svaarala/duktape/issues/1783
* https://github.com/svaarala/duktape/issues/812#issuecomment-337058737
diff --git a/content/handlers/javascript/duktape/duk_config.h b/content/handlers/javascript/duktape/duk_config.h
index 1f2b1da..379e9f6 100644
--- a/content/handlers/javascript/duktape/duk_config.h
+++ b/content/handlers/javascript/duktape/duk_config.h
@@ -850,12 +850,6 @@
#if !defined(DUK_USE_BYTEORDER)
#define DUK_USE_BYTEORDER 1
#endif
-/* XXX: This is technically not guaranteed because it's possible to configure
- * an x86 to require aligned accesses with Alignment Check (AC) flag.
- */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 1
-#endif
#define DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_X64)
@@ -864,12 +858,6 @@
#if !defined(DUK_USE_BYTEORDER)
#define DUK_USE_BYTEORDER 1
#endif
-/* XXX: This is technically not guaranteed because it's possible to configure
- * an x86 to require aligned accesses with Alignment Check (AC) flag.
- */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 1
-#endif
#undef DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_X32)
@@ -878,48 +866,30 @@
#if !defined(DUK_USE_BYTEORDER)
#define DUK_USE_BYTEORDER 1
#endif
-/* XXX: This is technically not guaranteed because it's possible to configure
- * an x86 to require aligned accesses with Alignment Check (AC) flag.
- */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 1
-#endif
#define DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_ARM32)
/* --- ARM 32-bit --- */
#define DUK_USE_ARCH_STRING "arm32"
/* Byte order varies, so rely on autodetect. */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 4
-#endif
#define DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_ARM64)
/* --- ARM 64-bit --- */
#define DUK_USE_ARCH_STRING "arm64"
/* Byte order varies, so rely on autodetect. */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
#undef DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_MIPS32)
/* --- MIPS 32-bit --- */
#define DUK_USE_ARCH_STRING "mips32"
/* MIPS byte order varies so rely on autodetection. */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
#define DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_MIPS64)
/* --- MIPS 64-bit --- */
#define DUK_USE_ARCH_STRING "mips64"
/* MIPS byte order varies so rely on autodetection. */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
#undef DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_PPC32)
@@ -928,9 +898,6 @@
#if !defined(DUK_USE_BYTEORDER)
#define DUK_USE_BYTEORDER 3
#endif
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
#define DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_PPC64)
@@ -939,27 +906,18 @@
#if !defined(DUK_USE_BYTEORDER)
#define DUK_USE_BYTEORDER 3
#endif
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
#undef DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_SPARC32)
/* --- SPARC 32-bit --- */
#define DUK_USE_ARCH_STRING "sparc32"
/* SPARC byte order varies so rely on autodetection. */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
#define DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_SPARC64)
/* --- SPARC 64-bit --- */
#define DUK_USE_ARCH_STRING "sparc64"
/* SPARC byte order varies so rely on autodetection. */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
#undef DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_SUPERH)
@@ -969,9 +927,6 @@
/* Based on 'make checkalign' there are no alignment requirements on
* Linux SH4, but align by 4 is probably a good basic default.
*/
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 4
-#endif
#define DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_M68K)
@@ -980,9 +935,6 @@
#if !defined(DUK_USE_BYTEORDER)
#define DUK_USE_BYTEORDER 3
#endif
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
#define DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_EMSCRIPTEN)
@@ -991,9 +943,6 @@
#if !defined(DUK_USE_BYTEORDER)
#define DUK_USE_BYTEORDER 1
#endif
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
#undef DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#else
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=0687687c379f43f6dec...
commit 0687687c379f43f6decf0d53595671f020ac92cc
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Duktape: Revert alignment of `struct duk_hobject`.
diff --git a/content/handlers/javascript/duktape/duktape.c b/content/handlers/javascript/duktape/duktape.c
index 5e3b467..3139b69 100644
--- a/content/handlers/javascript/duktape/duktape.c
+++ b/content/handlers/javascript/duktape/duktape.c
@@ -6663,11 +6663,7 @@ struct duk_hobject {
duk_uint32_t h_size; /* hash part size or 0 if unused */
#endif
#endif
-}
-#if (DUK_USE_ALIGN_BY == 8)
-__attribute__ ((aligned (8)))
-#endif
-;
+};
/*
* Exposed data
-----------------------------------------------------------------------
Summary of changes:
content/handlers/javascript/duktape/duk_config.h | 51 ----------------------
content/handlers/javascript/duktape/duktape.c | 6 +--
2 files changed, 1 insertion(+), 56 deletions(-)
diff --git a/content/handlers/javascript/duktape/duk_config.h b/content/handlers/javascript/duktape/duk_config.h
index 1f2b1da..379e9f6 100644
--- a/content/handlers/javascript/duktape/duk_config.h
+++ b/content/handlers/javascript/duktape/duk_config.h
@@ -850,12 +850,6 @@
#if !defined(DUK_USE_BYTEORDER)
#define DUK_USE_BYTEORDER 1
#endif
-/* XXX: This is technically not guaranteed because it's possible to configure
- * an x86 to require aligned accesses with Alignment Check (AC) flag.
- */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 1
-#endif
#define DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_X64)
@@ -864,12 +858,6 @@
#if !defined(DUK_USE_BYTEORDER)
#define DUK_USE_BYTEORDER 1
#endif
-/* XXX: This is technically not guaranteed because it's possible to configure
- * an x86 to require aligned accesses with Alignment Check (AC) flag.
- */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 1
-#endif
#undef DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_X32)
@@ -878,48 +866,30 @@
#if !defined(DUK_USE_BYTEORDER)
#define DUK_USE_BYTEORDER 1
#endif
-/* XXX: This is technically not guaranteed because it's possible to configure
- * an x86 to require aligned accesses with Alignment Check (AC) flag.
- */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 1
-#endif
#define DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_ARM32)
/* --- ARM 32-bit --- */
#define DUK_USE_ARCH_STRING "arm32"
/* Byte order varies, so rely on autodetect. */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 4
-#endif
#define DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_ARM64)
/* --- ARM 64-bit --- */
#define DUK_USE_ARCH_STRING "arm64"
/* Byte order varies, so rely on autodetect. */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
#undef DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_MIPS32)
/* --- MIPS 32-bit --- */
#define DUK_USE_ARCH_STRING "mips32"
/* MIPS byte order varies so rely on autodetection. */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
#define DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_MIPS64)
/* --- MIPS 64-bit --- */
#define DUK_USE_ARCH_STRING "mips64"
/* MIPS byte order varies so rely on autodetection. */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
#undef DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_PPC32)
@@ -928,9 +898,6 @@
#if !defined(DUK_USE_BYTEORDER)
#define DUK_USE_BYTEORDER 3
#endif
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
#define DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_PPC64)
@@ -939,27 +906,18 @@
#if !defined(DUK_USE_BYTEORDER)
#define DUK_USE_BYTEORDER 3
#endif
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
#undef DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_SPARC32)
/* --- SPARC 32-bit --- */
#define DUK_USE_ARCH_STRING "sparc32"
/* SPARC byte order varies so rely on autodetection. */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
#define DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_SPARC64)
/* --- SPARC 64-bit --- */
#define DUK_USE_ARCH_STRING "sparc64"
/* SPARC byte order varies so rely on autodetection. */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
#undef DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_SUPERH)
@@ -969,9 +927,6 @@
/* Based on 'make checkalign' there are no alignment requirements on
* Linux SH4, but align by 4 is probably a good basic default.
*/
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 4
-#endif
#define DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_M68K)
@@ -980,9 +935,6 @@
#if !defined(DUK_USE_BYTEORDER)
#define DUK_USE_BYTEORDER 3
#endif
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
#define DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#elif defined(DUK_F_EMSCRIPTEN)
@@ -991,9 +943,6 @@
#if !defined(DUK_USE_BYTEORDER)
#define DUK_USE_BYTEORDER 1
#endif
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
#undef DUK_USE_PACKED_TVAL
#define DUK_F_PACKED_TVAL_PROVIDED
#else
diff --git a/content/handlers/javascript/duktape/duktape.c b/content/handlers/javascript/duktape/duktape.c
index 5e3b467..3139b69 100644
--- a/content/handlers/javascript/duktape/duktape.c
+++ b/content/handlers/javascript/duktape/duktape.c
@@ -6663,11 +6663,7 @@ struct duk_hobject {
duk_uint32_t h_size; /* hash part size or 0 if unused */
#endif
#endif
-}
-#if (DUK_USE_ALIGN_BY == 8)
-__attribute__ ((aligned (8)))
-#endif
-;
+};
/*
* Exposed data
--
NetSurf Browser
5 years, 11 months
netsurf: branch master updated. release/3.7-17-gea7da96
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/ea7da966de05e5f372997...
...commit http://git.netsurf-browser.org/netsurf.git/commit/ea7da966de05e5f372997f8...
...tree http://git.netsurf-browser.org/netsurf.git/tree/ea7da966de05e5f372997f896...
The branch, master has been updated
via ea7da966de05e5f372997f8969f64685f732a6a0 (commit)
from 6619be2b72820b40c8afe95fcf9cabb45d85130d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=ea7da966de05e5f3729...
commit ea7da966de05e5f372997f8969f64685f732a6a0
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Duktape: Another attempt to squash aarch64 increases required alignment warnings.
diff --git a/content/handlers/javascript/duktape/duktape.c b/content/handlers/javascript/duktape/duktape.c
index 0bde7d4..5e3b467 100644
--- a/content/handlers/javascript/duktape/duktape.c
+++ b/content/handlers/javascript/duktape/duktape.c
@@ -6664,9 +6664,7 @@ struct duk_hobject {
#endif
#endif
}
-#if (DUK_USE_ALIGN_BY == 8) && defined(DUK_USE_PACK_GCC_ATTR)
-__attribute__ ((aligned (8)))
-#elif (DUK_USE_ALIGN_BY == 8) && defined(DUK_USE_PACK_CLANG_ATTR)
+#if (DUK_USE_ALIGN_BY == 8)
__attribute__ ((aligned (8)))
#endif
;
-----------------------------------------------------------------------
Summary of changes:
content/handlers/javascript/duktape/duktape.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/content/handlers/javascript/duktape/duktape.c b/content/handlers/javascript/duktape/duktape.c
index 0bde7d4..5e3b467 100644
--- a/content/handlers/javascript/duktape/duktape.c
+++ b/content/handlers/javascript/duktape/duktape.c
@@ -6664,9 +6664,7 @@ struct duk_hobject {
#endif
#endif
}
-#if (DUK_USE_ALIGN_BY == 8) && defined(DUK_USE_PACK_GCC_ATTR)
-__attribute__ ((aligned (8)))
-#elif (DUK_USE_ALIGN_BY == 8) && defined(DUK_USE_PACK_CLANG_ATTR)
+#if (DUK_USE_ALIGN_BY == 8)
__attribute__ ((aligned (8)))
#endif
;
--
NetSurf Browser
5 years, 11 months
netsurf: branch master updated. release/3.7-16-g6619be2
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/6619be2b72820b40c8afe...
...commit http://git.netsurf-browser.org/netsurf.git/commit/6619be2b72820b40c8afe95...
...tree http://git.netsurf-browser.org/netsurf.git/tree/6619be2b72820b40c8afe95fc...
The branch, master has been updated
via 6619be2b72820b40c8afe95fcf9cabb45d85130d (commit)
from 341c22d2a593040c558de5f9b82d3f740207d82f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=6619be2b72820b40c8a...
commit 6619be2b72820b40c8afe95fcf9cabb45d85130d
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
Duktape: Attempt to squash aarch64 cast increases required alignment warnings.
content/handlers/javascript/duktape/duktape.c: In function 'duk_resolve_nonbound_function':
content/handlers/javascript/duktape/duktape.c:14585:25: error: cast increases required alignment of target type [-Werror=cast-align]
duk_push_tval(thr, &((duk_hboundfunc *) h)->target);
^
content/handlers/javascript/duktape/duktape.c: In function 'duk_bi_function_prototype_bind':
content/handlers/javascript/duktape/duktape.c:32399:20: error: cast increases required alignment of target type [-Werror=cast-align]
h_boundtarget = (duk_hboundfunc *) h_target;
^
content/handlers/javascript/duktape/duktape.c: In function 'duk_free_hobject':
content/handlers/javascript/duktape/duktape.c:46048:23: error: cast increases required alignment of target type [-Werror=cast-align]
duk_hboundfunc *f = (duk_hboundfunc *) h;
^
content/handlers/javascript/duktape/duktape.c: In function 'duk__mark_hobject':
content/handlers/javascript/duktape/duktape.c:47865:23: error: cast increases required alignment of target type [-Werror=cast-align]
duk_hboundfunc *f = (duk_hboundfunc *) h;
^
content/handlers/javascript/duktape/duktape.c: In function 'duk_hobject_refcount_finalize_norz':
content/handlers/javascript/duktape/duktape.c:49842:23: error: cast increases required alignment of target type [-Werror=cast-align]
duk_hboundfunc *f = (duk_hboundfunc *) h;
^
content/handlers/javascript/duktape/duktape.c: In function 'duk__handle_bound_chain_for_call':
content/handlers/javascript/duktape/duktape.c:61509:14: error: cast increases required alignment of target type [-Werror=cast-align]
h_bound = (duk_hboundfunc *) func;
^
content/handlers/javascript/duktape/duktape.c: In function 'duk_js_instanceof':
content/handlers/javascript/duktape/duktape.c:78117:24: error: cast increases required alignment of target type [-Werror=cast-align]
duk_push_tval(thr, &((duk_hboundfunc *) func)->target);
^
diff --git a/content/handlers/javascript/duktape/duktape.c b/content/handlers/javascript/duktape/duktape.c
index 3139b69..0bde7d4 100644
--- a/content/handlers/javascript/duktape/duktape.c
+++ b/content/handlers/javascript/duktape/duktape.c
@@ -6663,7 +6663,13 @@ struct duk_hobject {
duk_uint32_t h_size; /* hash part size or 0 if unused */
#endif
#endif
-};
+}
+#if (DUK_USE_ALIGN_BY == 8) && defined(DUK_USE_PACK_GCC_ATTR)
+__attribute__ ((aligned (8)))
+#elif (DUK_USE_ALIGN_BY == 8) && defined(DUK_USE_PACK_CLANG_ATTR)
+__attribute__ ((aligned (8)))
+#endif
+;
/*
* Exposed data
-----------------------------------------------------------------------
Summary of changes:
content/handlers/javascript/duktape/duktape.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/content/handlers/javascript/duktape/duktape.c b/content/handlers/javascript/duktape/duktape.c
index 3139b69..0bde7d4 100644
--- a/content/handlers/javascript/duktape/duktape.c
+++ b/content/handlers/javascript/duktape/duktape.c
@@ -6663,7 +6663,13 @@ struct duk_hobject {
duk_uint32_t h_size; /* hash part size or 0 if unused */
#endif
#endif
-};
+}
+#if (DUK_USE_ALIGN_BY == 8) && defined(DUK_USE_PACK_GCC_ATTR)
+__attribute__ ((aligned (8)))
+#elif (DUK_USE_ALIGN_BY == 8) && defined(DUK_USE_PACK_CLANG_ATTR)
+__attribute__ ((aligned (8)))
+#endif
+;
/*
* Exposed data
--
NetSurf Browser
5 years, 11 months
netsurf: branch ashmew2/nskolibrios updated. release/3.7-84-g42573b3
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/42573b3d134996973b3cb...
...commit http://git.netsurf-browser.org/netsurf.git/commit/42573b3d134996973b3cbcf...
...tree http://git.netsurf-browser.org/netsurf.git/tree/42573b3d134996973b3cbcfa4...
The branch, ashmew2/nskolibrios has been updated
via 42573b3d134996973b3cbcfa4688b58e87fc478d (commit)
from 7bd0bd49538b0ab0810588ed7525199797e8daaa (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=42573b3d134996973b3...
commit 42573b3d134996973b3cbcfa4688b58e87fc478d
Author: Ashish Gupta <ashmew2(a)gmail.com>
Commit: Ashish Gupta <ashmew2(a)gmail.com>
Debugging : Squash / undo this commit later.
diff --git a/content/fetchers/httplib_kolibri.c b/content/fetchers/httplib_kolibri.c
index 28c3ec8..9036ee2 100644
--- a/content/fetchers/httplib_kolibri.c
+++ b/content/fetchers/httplib_kolibri.c
@@ -13,6 +13,8 @@
#include "content/fetchers/httplib_kolibri.h"
#include "frontends/kolibrios/kolibri_http.h"
+#include <assert.h>
+
struct httpfetcher {
struct http_msg *handle;
struct fetch *owner;
@@ -27,37 +29,68 @@ struct httpfetcher *head = NULL;
void add_to_poll(struct httpfetcher *newfetcher) {
- NSLOG(fetch, DEBUG, "(head:0x%x) newfetcher 0x%x, newfetcher->handle 0x%x", head, newfetcher, newfetcher->handle);
+ NSLOG(fetch, ERROR, "(head:0x%x) newfetcher 0x%x, newfetcher->handle 0x%x", head, newfetcher, newfetcher->handle);
struct httpfetcher *t = head;
- assert(newfetcher->next == NULL);
+ while(t) {
+ NSLOG(fetch, ERROR, "ll node = 0x%x", t);
+ t=t->next;
+ }
if(head == NULL) {
head = newfetcher;
assert(head->next == NULL);
+ NSLOG(fetch, ERROR, "(head:0x%x) ADDED newfetcher 0x%x, newfetcher->handle 0x%x", head, head, head->handle);
}
else {
+ t = head;
+
while(t->next != NULL) {
+ NSLOG(fetch, ERROR, "-- Looping t 0x%x, t->handle 0x%x", t->next, t->next->handle);
t = t->next;
}
t->next = newfetcher;
+ NSLOG(fetch, ERROR, "(head:0x%x) ADDED newfetcher 0x%x, newfetcher->handle 0x%x, nn 0x%x", head, t->next, t->next->handle, t->next->next);
+ }
+
+ struct httpfetcher *xx = head;
+ while(xx) {
+ NSLOG(fetch, ERROR, "ll node = 0x%x", xx);
+ xx=xx->next;
}
}
struct httpfetcher* remove_from_poll(struct httpfetcher *removee) {
struct httpfetcher *t = head, *p = head;
- NSLOG(fetch, DEBUG, "(head=0x%x), remove: 0x%x , removee->handle: 0x%x", head, removee, removee->handle);
+ NSLOG(fetch, ERROR, "(head=0x%x), remove: 0x%x , removee->handle: 0x%x", head, removee, removee->handle);
while(t) {
+ NSLOG(fetch, ERROR, "BEFORE REMOVE ll node = 0x%x", t);
+ t=t->next;
+ }
+
+ t = head;
+ while(t) {
if (t == removee) {
if(t == head) {
p = t->next;
head = p;
+
+ struct httpfetcher *xx = head;
+ while(xx) {
+ NSLOG(fetch, ERROR, "ll node = 0x%x", xx);
+ xx=xx->next;
+ }
return head;
break;
}
else {
p->next = t->next;
+ struct httpfetcher *xx = head;
+ while(xx) {
+ NSLOG(fetch, ERROR, "ll node = 0x%x", xx);
+ xx=xx->next;
+ }
return t->next;
break;
}
@@ -261,22 +294,31 @@ void *setup_fetch(struct fetch *parent_fetch, struct nsurl *url,
}
bool start_fetch(void *httpf) {
- NSLOG(fetch, DEBUG, "start_fetch : httpf: 0x%x", httpf);
+ assert(((struct httpfetcher *)httpf)->owner != NULL);
+
+ NSLOG(fetch, ERROR, "httpf: 0x%x", httpf);
add_to_poll((struct httpfetcher *) httpf);
+
+ struct httpfetcher *wrapper = httpf;
+
+ assert(((struct httpfetcher *)httpf)->owner != NULL);
+
+ NSLOG(fetch, ERROR, "END OF add_to_poll: httpf: 0x%x, httpf->handle 0x%x, httpf->next 0x%x", wrapper, wrapper->handle, *wrapper );
return true;
}
bool abort_fetch(void *httpf) {
- NSLOG(fetch, DEBUG, "aborting fetch 0x%x,", ((struct httpfetcher *)httpf)->owner);
- remove_from_poll((struct httpfetcher *) httpf);
+ NSLOG(fetch, ERROR, "aborting fetch 0x%x,", ((struct httpfetcher *)httpf)->owner);
+
+ // remove_from_poll((struct httpfetcher *) httpf);
fetch_remove_from_queues(((struct httpfetcher *)httpf)->owner);
fetch_free(((struct httpfetcher *)httpf)->owner);
return true;
}
bool free_fetch(void *httpf) {
- NSLOG(fetch, DEBUG, "free_fetch fetch 0x%x", ((struct httpfetcher *)httpf)->owner);
+ NSLOG(fetch, ERROR, "free_fetch fetch 0x%x", ((struct httpfetcher *)httpf)->owner);
http_disconnect_asm((((struct httpfetcher *)httpf)->handle));
http_free_asm((((struct httpfetcher *)httpf)->handle));
@@ -302,6 +344,13 @@ void poll_fetch(lwc_string *scheme) {
NSLOG(fetch, DEBUG, "--- Content Length (received / total): %d / %d", t->handle->content_received, t->handle->content_length);
NSLOG(fetch, DEBUG, "--- ^ was for url : %s", nsurl_access(t->url));
+ struct httpfetcher *xx = head;
+ while(xx) {
+ NSLOG(fetch, ERROR, "ll node poller = 0x%x", xx);
+ xx=xx->next;
+ }
+ NSLOG(fetch, ERROR, "ll node poller breakage --");
+
int ret = http_receive_asm(t->handle);
if(t->handle->flags & HTTP_ERRORS) {
@@ -357,8 +406,9 @@ void poll_fetch(lwc_string *scheme) {
if(t->handle->status == 304) {
fetch_msg msg;
msg.type = FETCH_NOTMODIFIED;
+ struct httpfetcher *t2 = remove_from_poll(t);
fetch_send_callback(&msg, t->owner);
- t = remove_from_poll(t);
+ t = t2;
continue;
}
else {
@@ -378,6 +428,7 @@ void poll_fetch(lwc_string *scheme) {
fetch_send_callback(&msg, t->owner);
t->headercbdone = true;
t = t2;
+ NSLOG(fetch, INFO, "---- DID [3xx] : Redirect to %s", msg.data.redirect);
/* t = t->next; */
/* t = head; */
continue;
diff --git a/desktop/options.h b/desktop/options.h
index 9b7064e..6e98af6 100644
--- a/desktop/options.h
+++ b/desktop/options.h
@@ -293,4 +293,4 @@ NSOPTION_COLOUR(sys_colour_WindowText, 0x00000000)
/** Filter for non-verbose logging */
NSOPTION_STRING(log_filter, "level:WARNING")
/** Filter for verbose logging */
-NSOPTION_STRING(verbose_filter, "level:VERBOSE")
+NSOPTION_STRING(verbose_filter, "level:ERROR")
diff --git a/frontends/kolibrios/Makefile b/frontends/kolibrios/Makefile
index 3f08a12..bb5695f 100644
--- a/frontends/kolibrios/Makefile
+++ b/frontends/kolibrios/Makefile
@@ -38,6 +38,8 @@ CFLAGS += '-DNETSURF_FB_FONT_FANTASY="$(NETSURF_KOLIBRI_FONT_SANS_SERIF)"'
CFLAGS += '-DWITH_NSLOG'
+CFLAGS += '-w'
+
#########################################################################
KOLIBRI_IMAGE_left_arrow := $(FRONTEND_SOURCE_DIR)/res/icons/back.png
-----------------------------------------------------------------------
Summary of changes:
content/fetchers/httplib_kolibri.c | 67 +++++++++++++++++++++++++++++++-----
desktop/options.h | 2 +-
frontends/kolibrios/Makefile | 2 ++
3 files changed, 62 insertions(+), 9 deletions(-)
diff --git a/content/fetchers/httplib_kolibri.c b/content/fetchers/httplib_kolibri.c
index 28c3ec8..9036ee2 100644
--- a/content/fetchers/httplib_kolibri.c
+++ b/content/fetchers/httplib_kolibri.c
@@ -13,6 +13,8 @@
#include "content/fetchers/httplib_kolibri.h"
#include "frontends/kolibrios/kolibri_http.h"
+#include <assert.h>
+
struct httpfetcher {
struct http_msg *handle;
struct fetch *owner;
@@ -27,37 +29,68 @@ struct httpfetcher *head = NULL;
void add_to_poll(struct httpfetcher *newfetcher) {
- NSLOG(fetch, DEBUG, "(head:0x%x) newfetcher 0x%x, newfetcher->handle 0x%x", head, newfetcher, newfetcher->handle);
+ NSLOG(fetch, ERROR, "(head:0x%x) newfetcher 0x%x, newfetcher->handle 0x%x", head, newfetcher, newfetcher->handle);
struct httpfetcher *t = head;
- assert(newfetcher->next == NULL);
+ while(t) {
+ NSLOG(fetch, ERROR, "ll node = 0x%x", t);
+ t=t->next;
+ }
if(head == NULL) {
head = newfetcher;
assert(head->next == NULL);
+ NSLOG(fetch, ERROR, "(head:0x%x) ADDED newfetcher 0x%x, newfetcher->handle 0x%x", head, head, head->handle);
}
else {
+ t = head;
+
while(t->next != NULL) {
+ NSLOG(fetch, ERROR, "-- Looping t 0x%x, t->handle 0x%x", t->next, t->next->handle);
t = t->next;
}
t->next = newfetcher;
+ NSLOG(fetch, ERROR, "(head:0x%x) ADDED newfetcher 0x%x, newfetcher->handle 0x%x, nn 0x%x", head, t->next, t->next->handle, t->next->next);
+ }
+
+ struct httpfetcher *xx = head;
+ while(xx) {
+ NSLOG(fetch, ERROR, "ll node = 0x%x", xx);
+ xx=xx->next;
}
}
struct httpfetcher* remove_from_poll(struct httpfetcher *removee) {
struct httpfetcher *t = head, *p = head;
- NSLOG(fetch, DEBUG, "(head=0x%x), remove: 0x%x , removee->handle: 0x%x", head, removee, removee->handle);
+ NSLOG(fetch, ERROR, "(head=0x%x), remove: 0x%x , removee->handle: 0x%x", head, removee, removee->handle);
while(t) {
+ NSLOG(fetch, ERROR, "BEFORE REMOVE ll node = 0x%x", t);
+ t=t->next;
+ }
+
+ t = head;
+ while(t) {
if (t == removee) {
if(t == head) {
p = t->next;
head = p;
+
+ struct httpfetcher *xx = head;
+ while(xx) {
+ NSLOG(fetch, ERROR, "ll node = 0x%x", xx);
+ xx=xx->next;
+ }
return head;
break;
}
else {
p->next = t->next;
+ struct httpfetcher *xx = head;
+ while(xx) {
+ NSLOG(fetch, ERROR, "ll node = 0x%x", xx);
+ xx=xx->next;
+ }
return t->next;
break;
}
@@ -261,22 +294,31 @@ void *setup_fetch(struct fetch *parent_fetch, struct nsurl *url,
}
bool start_fetch(void *httpf) {
- NSLOG(fetch, DEBUG, "start_fetch : httpf: 0x%x", httpf);
+ assert(((struct httpfetcher *)httpf)->owner != NULL);
+
+ NSLOG(fetch, ERROR, "httpf: 0x%x", httpf);
add_to_poll((struct httpfetcher *) httpf);
+
+ struct httpfetcher *wrapper = httpf;
+
+ assert(((struct httpfetcher *)httpf)->owner != NULL);
+
+ NSLOG(fetch, ERROR, "END OF add_to_poll: httpf: 0x%x, httpf->handle 0x%x, httpf->next 0x%x", wrapper, wrapper->handle, *wrapper );
return true;
}
bool abort_fetch(void *httpf) {
- NSLOG(fetch, DEBUG, "aborting fetch 0x%x,", ((struct httpfetcher *)httpf)->owner);
- remove_from_poll((struct httpfetcher *) httpf);
+ NSLOG(fetch, ERROR, "aborting fetch 0x%x,", ((struct httpfetcher *)httpf)->owner);
+
+ // remove_from_poll((struct httpfetcher *) httpf);
fetch_remove_from_queues(((struct httpfetcher *)httpf)->owner);
fetch_free(((struct httpfetcher *)httpf)->owner);
return true;
}
bool free_fetch(void *httpf) {
- NSLOG(fetch, DEBUG, "free_fetch fetch 0x%x", ((struct httpfetcher *)httpf)->owner);
+ NSLOG(fetch, ERROR, "free_fetch fetch 0x%x", ((struct httpfetcher *)httpf)->owner);
http_disconnect_asm((((struct httpfetcher *)httpf)->handle));
http_free_asm((((struct httpfetcher *)httpf)->handle));
@@ -302,6 +344,13 @@ void poll_fetch(lwc_string *scheme) {
NSLOG(fetch, DEBUG, "--- Content Length (received / total): %d / %d", t->handle->content_received, t->handle->content_length);
NSLOG(fetch, DEBUG, "--- ^ was for url : %s", nsurl_access(t->url));
+ struct httpfetcher *xx = head;
+ while(xx) {
+ NSLOG(fetch, ERROR, "ll node poller = 0x%x", xx);
+ xx=xx->next;
+ }
+ NSLOG(fetch, ERROR, "ll node poller breakage --");
+
int ret = http_receive_asm(t->handle);
if(t->handle->flags & HTTP_ERRORS) {
@@ -357,8 +406,9 @@ void poll_fetch(lwc_string *scheme) {
if(t->handle->status == 304) {
fetch_msg msg;
msg.type = FETCH_NOTMODIFIED;
+ struct httpfetcher *t2 = remove_from_poll(t);
fetch_send_callback(&msg, t->owner);
- t = remove_from_poll(t);
+ t = t2;
continue;
}
else {
@@ -378,6 +428,7 @@ void poll_fetch(lwc_string *scheme) {
fetch_send_callback(&msg, t->owner);
t->headercbdone = true;
t = t2;
+ NSLOG(fetch, INFO, "---- DID [3xx] : Redirect to %s", msg.data.redirect);
/* t = t->next; */
/* t = head; */
continue;
diff --git a/desktop/options.h b/desktop/options.h
index 9b7064e..6e98af6 100644
--- a/desktop/options.h
+++ b/desktop/options.h
@@ -293,4 +293,4 @@ NSOPTION_COLOUR(sys_colour_WindowText, 0x00000000)
/** Filter for non-verbose logging */
NSOPTION_STRING(log_filter, "level:WARNING")
/** Filter for verbose logging */
-NSOPTION_STRING(verbose_filter, "level:VERBOSE")
+NSOPTION_STRING(verbose_filter, "level:ERROR")
diff --git a/frontends/kolibrios/Makefile b/frontends/kolibrios/Makefile
index 3f08a12..bb5695f 100644
--- a/frontends/kolibrios/Makefile
+++ b/frontends/kolibrios/Makefile
@@ -38,6 +38,8 @@ CFLAGS += '-DNETSURF_FB_FONT_FANTASY="$(NETSURF_KOLIBRI_FONT_SANS_SERIF)"'
CFLAGS += '-DWITH_NSLOG'
+CFLAGS += '-w'
+
#########################################################################
KOLIBRI_IMAGE_left_arrow := $(FRONTEND_SOURCE_DIR)/res/icons/back.png
--
NetSurf Browser
5 years, 11 months
libcss: branch lcneves/units updated. release/0.7.0-21-g21a344c
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libcss.git/shortlog/21a344cfb578bc53ef41b2...
...commit http://git.netsurf-browser.org/libcss.git/commit/21a344cfb578bc53ef41b2d2...
...tree http://git.netsurf-browser.org/libcss.git/tree/21a344cfb578bc53ef41b2d245...
The branch, lcneves/units has been updated
via 21a344cfb578bc53ef41b2d2459f3f8892aec30b (commit)
from 10f5daa91de724edafd79094100787ad3a73a7c4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=21a344cfb578bc53ef41...
commit 21a344cfb578bc53ef41b2d2459f3f8892aec30b
Author: Lucas Neves <lcneves(a)gmail.com>
Commit: Lucas Neves <lcneves(a)gmail.com>
WIP: Select: Autogen for selection properties.
diff --git a/src/select/__pycache__/select_config.cpython-36.pyc b/src/select/__pycache__/select_config.cpython-36.pyc
new file mode 100644
index 0000000..52b37eb
Binary files /dev/null and b/src/select/__pycache__/select_config.cpython-36.pyc differ
diff --git a/src/select/assets.py b/src/select/assets.py
new file mode 100644
index 0000000..8151182
--- /dev/null
+++ b/src/select/assets.py
@@ -0,0 +1,61 @@
+# This file is part of LibCSS.
+# Licensed under the MIT License,
+# http://www.opensource.org/licenses/mit-license.php
+# Copyright 2017 Lucas Neves <lcneves(a)gmail.com>
+
+assets = {}
+
+assets['computed_h'] = {}
+assets['computed_h']['header'] = '''\
+/*
+ * This file is part of LibCSS
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2017 The NetSurf Project
+ */
+
+#ifndef css_select_computed_h_
+#define css_select_computed_h_
+
+#include <libcss/computed.h>
+#include <libcss/hint.h>
+
+'''
+assets['computed_h']['footer'] = '''\
+/**
+ * Take a new reference to a computed style
+ *
+ * \param style The style to take a new reference to.
+ * \return The new computed style reference
+ */
+static inline css_computed_style * css__computed_style_ref(
+ css_computed_style *style)
+{
+ if (style == NULL)
+ return NULL;
+
+ if (style->i.uncommon != NULL) {
+ style->i.uncommon->count++;
+ }
+
+ style->count++;
+ return style;
+}
+
+css_error css__computed_style_create(css_computed_style **result);
+
+css_error css__computed_style_initialise(css_computed_style *style,
+ struct css_select_handler *handler, void *pw);
+
+
+css_error css__computed_uncommon_destroy(css_computed_uncommon *uncommon);
+
+css_error css__compute_absolute_values(const css_computed_style *parent,
+ css_computed_style *style,
+ css_error (*compute_font_size)(void *pw,
+ const css_hint *parent, css_hint *size),
+ void *pw);
+
+#endif
+'''
+
diff --git a/src/select/computed_properties.py b/src/select/computed_properties.py
deleted file mode 100644
index 3f87bed..0000000
--- a/src/select/computed_properties.py
+++ /dev/null
@@ -1,197 +0,0 @@
-# This file is part of LibCSS.
-# Licensed under the MIT License,
-# http://www.opensource.org/licenses/mit-license.php
-# Copyright 2017 Lucas Neves <lcneves(a)gmail.com>
-
-def get_tuple(from_var):
- if type(from_var) is tuple:
- return from_var
- elif type(from_var) is str:
- return (from_var,)
- else:
- return ()
-
-def make_type(name, css_type, size = None, default = 'NULL',
- bits_name = None, bits_type = None,
- bits_size = None, bits_default = 0):
- return {
- 'name': name,
- 'type': css_type,
- 'size': size, # `None` means sizeof(ptr)
- 'default': default,
- 'bits': None if bits_name is None else {
- 'name': bits_name,
- 'type': bits_type,
- 'size': bits_size,
- 'default': bits_default
- }
- }
-
-# Configuration of types
-type_config = {
- ('length', 'css_fixed', 4, 0, 'unit', 'css_unit', 5, 'CSS_UNIT_PX'),
- ('integer', 'int32_t', 4, 0),
- ('fixed', 'css_fixed', 4, 0),
- ('color', 'css_color', 4, 0),
- ('string', 'lwc_string*'),
- ('string_arr', 'lwc_string**'),
- ('counter', 'css_computed_counter*'),
- ('content_item', 'css_computed_content_item*')
-}
-
-types = [ make_type(*x) for x in type_config ]
-
-def make_property(name, opcode_size, values = None,
- defaults = None, comments = None):
- 'Returns a CSS property.'
- default_tuple = get_tuple(defaults)
- value_tuple = get_tuple(values)
-
- return {
- 'name': name,
- 'size': opcode_size,
- 'values': [ types[x] for x in value_tuple ] or None,
- 'defaults': default_tuple or None, # May be `None` only for main group
- 'comments': comments
- }
-
-# Configuration of properties
-style_config = {
- # Style group, only opcode
- ('align_content', 3),
- ('align_items', 3),
- ('align_self', 3),
- ('background_attachment', 2),
- ('background_repeat', 3),
- ('border_collapse', 2),
- ('border_top_style', 4),
- ('border_right_style', 4),
- ('border_bottom_style', 4),
- ('border_left_style', 4),
- ('box_sizing', 2),
- ('caption_side', 2),
- ('clear', 3),
- ('direction', 2),
- ('display', 5),
- ('empty_cells', 2),
- ('flex_direction', 3),
- ('flex_wrap', 2),
- ('float', 2),
- ('font_style', 2),
- ('font_variant', 2),
- ('font_weight', 4),
- ('justify_content', 3),
- ('list_style_position', 2),
- ('list_style_type', 4),
- ('overflow', 3),
- ('outline_style', 4),
- ('position', 3),
- ('table_layout', 2),
- ('text_align', 4),
- ('text_decoration', 5),
- ('text_transform', 3),
- ('unicode_bidi', 2),
- ('visibility', 2),
- ('white_space', 3),
- # Style group, with additional value
- ('background_color', 2, 'color'),
- ('background_image', 1, 'string'),
- ('background_position', 1, ('length', 'length')),
- ('border_top_color', 2, 'color'),
- ('border_right_color', 2, 'color'),
- ('border_bottom_color', 2, 'color'),
- ('border_left_color', 2, 'color'),
- ('border_top_width', 3, 'length'),
- ('border_right_width', 3, 'length'),
- ('border_bottom_width', 3, 'length'),
- ('border_left_width', 3, 'length'),
- ('top', 2, 'length'),
- ('right', 2, 'length'),
- ('bottom', 2, 'length'),
- ('left', 2, 'length'),
- ('color', 1, 'color'),
- ('flex_basis', 2, 'length'),
- ('flex_grow', 1, 'fixed'),
- ('flex_shrink', 1, 'fixed'),
- ('font_size', 4, 'length'),
- ('height', 2, 'length'),
- ('line_height', 2, 'length'),
- ('list_style_image', 1, 'string'),
- ('margin_top', 2, 'length'),
- ('margin_right', 2, 'length'),
- ('margin_bottom', 2, 'length'),
- ('margin_left', 2, 'length'),
- ('max_height', 2, 'length'),
- ('max_width', 2, 'length'),
- ('min_height', 2, 'length'),
- ('min_width', 2, 'length'),
- ('order', 1, 'integer'),
- ('padding_top', 1, 'length'),
- ('padding_right', 1, 'length'),
- ('padding_left', 1, 'length'),
- ('padding_bottom', 1, 'length'),
- ('text_indent', 1, 'length'),
- ('vertical_align', 4, 'length'),
- ('width', 2, 'length'),
- ('z_index', 2, 'integer'),
- # Style group, arrays
- ('font_family', 3, 'string_arr', None,
- 'Encode font family as an array of string objects, terminated with a'
- '\n' 'blank entry.'),
- ('quotes', 1, 'string_arr', None,
- 'Encode quotes as an array of string objects, terminated with a '
- 'blank entry.')
-}
-
-page_config = {
- # Page group
- ('page_break_after', 3, None, 'CSS_PAGE_BREAK_AFTER_AUTO'),
- ('page_break_before', 3, None, 'CSS_PAGE_BREAK_BEFORE_AUTO'),
- ('page_break_inside', 2, None, 'CSS_PAGE_BREAK_INSIDE_AUTO'),
- ('widows', 1, 'integer', ('CSS_WIDOWS_SET', 2)),
- ('orphans', 1, 'integer', ('CSS_ORPHANS_SET', 2))
-}
-
-uncommon_config = {
- # Uncommon group
- ('border_spacing', 1, ('length', 'length'),
- ('CSS_BORDER_SPACING_SET', 0, 'CSS_UNIT_PX', 0, 'CSS_UNIT_PX')),
- ('break_after', 4, None, 'CSS_BREAK_AFTER_AUTO'),
- ('break_before', 4, None, 'CSS_BREAK_BEFORE_AUTO'),
- ('break_inside', 4, None, 'CSS_BREAK_INSIDE_AUTO'),
- ('clip', 6, ('length, length, length, length'), ('get', 'set')),
- ('column_count', 2, 'integer', 'CSS_COLUMN_COUNT_AUTO'),
- ('column_fill', 2, None, 'CSS_COLUMN_FILL_BALANCE'),
- ('column_gap', 2, 'length', 'CSS_COLUMN_GAP_NORMAL'),
- ('column_rule_color', 2, 'color', ('CSS_COLUMN_RULE_CURRENT_COLOR', 0)),
- ('column_rule_style', 4, None, 'CSS_COLUMN_RULE_STYLE_NONE'),
- ('column_rule_width', 3, 'length', 'CSS_COLUMN_RULE_WIDTH_MEDIUM'),
- ('column_span', 2, None, 'CSS_COLUMN_SPAN_NONE'),
- ('column_width', 2, 'length', 'CSS_COLUMN_WIDTH_AUTO'),
- ('letter_spacing', 2, 'length', 'CSS_LETTER_SPACING_NORMAL'),
- ('outline_color', 2, 'color', 'CSS_OUTLINE_COLOR_INVERT'),
- ('outline_width', 3, 'length', 'CSS_OUTLINE_WIDTH_MEDIUM'),
- ('word_spacing', 2, 'length', 'CSS_WORD_SPACING_NORMAL'),
- # Uncommon group, arrays
- ('counter_increment', 1, 'counter', 'CSS_COUNTER_INCREMENT_NONE',
- 'Encode counter_increment as an array of name, value pairs,\n'
- 'terminated with a blank entry.'),
- ('counter_reset', 1, 'counter', 'CSS_COUNTER_RESET_NONE',
- 'Encode counter_reset as an array of name, value pairs,\n'
- 'terminated with a blank entry.'),
- ('cursor', 5, 'string_arr', 'CSS_CURSOR_AUTO',
- 'Encode cursor uri(s) as an array of string objects, terminated\n'
- 'with a blank entry'),
- ('content', 2, 'content_item', 'CSS_CONTENT_NORMAL',
- 'Encode content as an array of content items, terminated with '
- 'a blank entry.')
-}
-
-uncommon = [ make_property(*x) for x in uncommon_config ]
-page = [ make_property(*x) for x in page_config ]
-style = [ make_property(*x) for x in style_config ]
-
-properties = {
- groups: [ uncommon, page, style ],
- default_group: style
-}
diff --git a/src/select/overrides.py b/src/select/overrides.py
index 930bd4a..3834c3f 100644
--- a/src/select/overrides.py
+++ b/src/select/overrides.py
@@ -5,7 +5,7 @@
clip = {}
clip['get'] = '''\
-static inline uint32_t get_clip(
+static inline uint8_t get_clip(
const css_computed_style *style,
css_computed_clip_rect *rect)
{
@@ -86,3 +86,27 @@ static inline css_error set_clip(
return CSS_OK;
}
'''
+
+line_height = {}
+line_height['get'] = '''\
+static inline uint8_t get_line_height(
+ const css_computed_style *style,
+ css_fixed *length, css_unit *unit)
+{
+ uint32_t bits = style->i.bits[LINE_HEIGHT_INDEX];
+ bits &= LINE_HEIGHT_MASK;
+ bits >>= LINE_HEIGHT_SHIFT;
+
+ /* 6bits: uuuutt : units | type */
+ if ((bits & 0x3) == CSS_LINE_HEIGHT_NUMBER ||
+ (bits & 0x3) == CSS_LINE_HEIGHT_DIMENSION) {
+ *length = style->i.line_height;
+ }
+
+ if ((bits & 0x3) == CSS_LINE_HEIGHT_DIMENSION) {
+ *unit = bits >> 2;
+ }
+
+ return (bits & 0x3);
+}
+'''
diff --git a/src/select/select_config.py b/src/select/select_config.py
new file mode 100644
index 0000000..d5cd525
--- /dev/null
+++ b/src/select/select_config.py
@@ -0,0 +1,167 @@
+# This file is part of LibCSS.
+# Licensed under the MIT License,
+# http://www.opensource.org/licenses/mit-license.php
+# Copyright 2017 Lucas Neves <lcneves(a)gmail.com>
+
+# Configuration of CSS values
+values = {
+ ('length', 'css_fixed', 4, 0, 'unit', 'css_unit', 5, 'CSS_UNIT_PX'),
+ ('integer', 'int32_t', 4, 0),
+ ('fixed', 'css_fixed', 4, 0),
+ ('color', 'css_color', 4, 0),
+ ('string', 'lwc_string*'),
+ ('string_arr', 'lwc_string**'),
+ ('counter', 'css_computed_counter*'),
+ ('content_item', 'css_computed_content_item*')
+}
+
+# Configuration of properties
+style = {
+ # Style group, only opcode
+ ('align_content', 3),
+ ('align_items', 3),
+ ('align_self', 3),
+ ('background_attachment', 2),
+ ('background_repeat', 3),
+ ('border_collapse', 2),
+ ('border_top_style', 4),
+ ('border_right_style', 4),
+ ('border_bottom_style', 4),
+ ('border_left_style', 4),
+ ('box_sizing', 2),
+ ('caption_side', 2),
+ ('clear', 3),
+ ('direction', 2),
+ ('display', 5),
+ ('empty_cells', 2),
+ ('flex_direction', 3),
+ ('flex_wrap', 2),
+ ('float', 2),
+ ('font_style', 2),
+ ('font_variant', 2),
+ ('font_weight', 4),
+ ('justify_content', 3),
+ ('list_style_position', 2),
+ ('list_style_type', 4),
+ ('overflow', 3),
+ ('outline_style', 4),
+ ('position', 3),
+ ('table_layout', 2),
+ ('text_align', 4),
+ ('text_decoration', 5),
+ ('text_transform', 3),
+ ('unicode_bidi', 2),
+ ('visibility', 2),
+ ('white_space', 3),
+ # Style group, with additional value
+ ('background_color', 2, 'color'),
+ ('background_image', 1, 'string'),
+ ('background_position', 1, ('length', 'length'),
+ 'CSS_BACKGROUND_POSITION_SET'),
+ ('border_top_color', 2, 'color'),
+ ('border_right_color', 2, 'color'),
+ ('border_bottom_color', 2, 'color'),
+ ('border_left_color', 2, 'color'),
+ ('border_top_width', 3, 'length', 'CSS_BORDER_WIDTH_WIDTH'),
+ ('border_right_width', 3, 'length', 'CSS_BORDER_WIDTH_WIDTH'),
+ ('border_bottom_width', 3, 'length', 'CSS_BORDER_WIDTH_WIDTH'),
+ ('border_left_width', 3, 'length', 'CSS_BORDER_WIDTH_WIDTH'),
+ ('top', 2, 'length', 'CSS_TOP_SET'),
+ ('right', 2, 'length', 'CSS_RIGHT_SET'),
+ ('bottom', 2, 'length', 'CSS_BOTTOM_SET'),
+ ('left', 2, 'length', 'CSS_LEFT_SET'),
+ ('color', 1, 'color'),
+ ('flex_basis', 2, 'length', 'CSS_FLEX_BASIS_SET'),
+ ('flex_grow', 1, 'fixed', 'CSS_FLEX_GROW_SET'),
+ ('flex_shrink', 1, 'fixed', 'CSS_FLEX_SHRINK_SET'),
+ ('font_size', 4, 'length', 'CSS_FONT_SIZE_DIMENSION'),
+ ('height', 2, 'length', 'CSS_HEIGHT_SET'),
+ ('line_height', 2, 'length', None, None, None, ('get')),
+ ('list_style_image', 1, 'string'),
+ ('margin_top', 2, 'length', 'CSS_MARGIN_SET'),
+ ('margin_right', 2, 'length', 'CSS_MARGIN_SET'),
+ ('margin_bottom', 2, 'length', 'CSS_MARGIN_SET'),
+ ('margin_left', 2, 'length', 'CSS_MARGIN_SET'),
+ ('max_height', 2, 'length', 'CSS_MAX_HEIGHT_SET'),
+ ('max_width', 2, 'length', 'CSS_MAX_WIDTH_SET'),
+ ('min_height', 2, 'length', 'CSS_MIN_HEIGHT_SET'),
+ ('min_width', 2, 'length', 'CSS_MIN_WIDTH_SET'),
+ ('opacity', 1, 'fixed', 'CSS_OPACITY_SET'),
+ ('order', 1, 'integer', 'CSS_ORDER_SET'),
+ ('padding_top', 1, 'length', 'CSS_PADDING_SET'),
+ ('padding_right', 1, 'length', 'CSS_PADDING_SET'),
+ ('padding_left', 1, 'length', 'CSS_PADDING_SET'),
+ ('padding_bottom', 1, 'length', 'CSS_PADDING_SET'),
+ ('text_indent', 1, 'length', 'CSS_TEXT_INDENT_SET'),
+ ('vertical_align', 4, 'length', 'CSS_VERTICAL_ALIGN_SET'),
+ ('width', 2, 'length', 'CSS_WIDTH_SET'),
+ ('z_index', 2, 'integer'),
+ # Style group, arrays
+ ('font_family', 3, 'string_arr', None, None,
+ 'Encode font family as an array of string objects, terminated with a'
+ '\n' 'blank entry.'),
+ ('quotes', 1, 'string_arr', None, None,
+ 'Encode quotes as an array of string objects, terminated with a '
+ 'blank entry.')
+}
+
+page = {
+ # Page group
+ ('page_break_after', 3, None, None, 'CSS_PAGE_BREAK_AFTER_AUTO'),
+ ('page_break_before', 3, None, None, 'CSS_PAGE_BREAK_BEFORE_AUTO'),
+ ('page_break_inside', 2, None, None, 'CSS_PAGE_BREAK_INSIDE_AUTO'),
+ ('widows', 1, 'integer', None, ('CSS_WIDOWS_SET', 2)),
+ ('orphans', 1, 'integer', None, ('CSS_ORPHANS_SET', 2))
+}
+
+uncommon = {
+ # Uncommon group
+ ('border_spacing', 1, ('length', 'length'), 'CSS_BORDER_SPACING_SET',
+ ('CSS_BORDER_SPACING_SET', 0, 'CSS_UNIT_PX', 0, 'CSS_UNIT_PX')),
+ ('break_after', 4, None, None, 'CSS_BREAK_AFTER_AUTO'),
+ ('break_before', 4, None, None, 'CSS_BREAK_BEFORE_AUTO'),
+ ('break_inside', 4, None, None, 'CSS_BREAK_INSIDE_AUTO'),
+ ('clip', 6, ('length, length, length, length'),
+ 'CSS_CLIP_RECT', None, None, ('get', 'set')),
+ ('column_count', 2, 'integer', None, 'CSS_COLUMN_COUNT_AUTO'),
+ ('column_fill', 2, None, None, 'CSS_COLUMN_FILL_BALANCE'),
+ ('column_gap', 2, 'length',
+ 'CSS_COLUMN_GAP_SET', 'CSS_COLUMN_GAP_NORMAL'),
+ ('column_rule_color', 2, 'color', None,
+ ('CSS_COLUMN_RULE_CURRENT_COLOR', 0)),
+ ('column_rule_style', 4, None, None, 'CSS_COLUMN_RULE_STYLE_NONE'),
+ ('column_rule_width', 3, 'length',
+ 'CSS_COLUMN_RULE_WIDTH_WIDTH', 'CSS_COLUMN_RULE_WIDTH_MEDIUM'),
+ ('column_span', 2, None, None, 'CSS_COLUMN_SPAN_NONE'),
+ ('column_width', 2, 'length',
+ 'CSS_COLUMN_WIDTH_SET', 'CSS_COLUMN_WIDTH_AUTO'),
+ ('letter_spacing', 2, 'length',
+ 'CSS_LETTER_SPACING_SET', 'CSS_LETTER_SPACING_NORMAL'),
+ ('outline_color', 2, 'color',
+ 'CSS_OUTLINE_COLOR_COLOR', 'CSS_OUTLINE_COLOR_INVERT'),
+ ('outline_width', 3, 'length',
+ 'CSS_OUTLINE_WIDTH_WIDTH', 'CSS_OUTLINE_WIDTH_MEDIUM'),
+ ('word_spacing', 2, 'length',
+ 'CSS_WORD_SPACING_SET', 'CSS_WORD_SPACING_NORMAL'),
+ # Uncommon group, arrays
+ ('counter_increment', 1, 'counter', None, 'CSS_COUNTER_INCREMENT_NONE',
+ 'Encode counter_increment as an array of name, value pairs,\n'
+ 'terminated with a blank entry.'),
+ ('counter_reset', 1, 'counter', None, 'CSS_COUNTER_RESET_NONE',
+ 'Encode counter_reset as an array of name, value pairs,\n'
+ 'terminated with a blank entry.'),
+ ('cursor', 5, 'string_arr', 'CSS_CURSOR_AUTO', None,
+ 'Encode cursor uri(s) as an array of string objects, terminated\n'
+ 'with a blank entry'),
+ ('content', 2, 'content_item', 'CSS_CONTENT_NORMAL', None,
+ 'Encode content as an array of content items, terminated with '
+ 'a blank entry.')
+}
+
+groups = {
+ 'main': { 'name': 'style', 'props': style },
+ 'others': [
+ { 'name': 'uncommon', 'props': uncommon },
+ { 'name': 'page', 'props': page }
+ ]
+}
diff --git a/src/select/select_generator.py b/src/select/select_generator.py
new file mode 100644
index 0000000..701d7d5
--- /dev/null
+++ b/src/select/select_generator.py
@@ -0,0 +1,123 @@
+# This file is part of LibCSS.
+# Licensed under the MIT License,
+# http://www.opensource.org/licenses/mit-license.php
+# Copyright 2017 Lucas Neves <lcneves(a)gmail.com>
+
+from select_config import values, groups
+from assets import assets
+
+def get_tuple(from_var):
+ 'Accepts tuples and strings, returns a tuple.'
+ if type(from_var) is tuple:
+ return from_var
+ elif type(from_var) is str:
+ return (from_var,)
+ else:
+ return ()
+
+class Bin:
+ def __init__(self, first_object):
+ self.contents = [ first_object ]
+
+ @property
+ def size(self):
+ return sum([ x['size'] for x in self.contents ])
+
+ def push(self, obj):
+ self.contents.append(obj)
+
+def make_bit_map(group):
+ '''Implements a `best fit first` heuristics for the bin packing of
+ property bits in the bits array'''
+
+ bin_size = 32
+ bit_map = []
+ group_props = sorted([ { 'name': p.name, 'size': p.bits_size }
+ for p in group['props'] ], key=(lambda x: x['size']), reverse=True)
+ for p in group_props:
+ for b in bit_map:
+ if b.size + p['size'] <= bin_size:
+ b.push(p)
+ break
+ else:
+ bit_map.append(Bin(p))
+ bit_map.sort(key=(lambda x: x.size), reverse=True)
+
+class FileText:
+ def __init__(self):
+ self._lines = []
+ self._comment = False
+ self._indent = 0
+
+ def indent(self, value, absolute=False):
+ if absolute:
+ self._indent = value
+ else:
+ self._indent += value
+
+ def comment(self):
+ self.append(' */' if self._comment else '/*')
+ self._comment = !self._comment
+
+ def append(self, text):
+ column_max = 80
+ multiline = False
+
+ while text:
+ line = '\t' * self._indent
+ if self._comment:
+ line += ' * '
+ prefix_size = (3 if self._comment else 0) + 8 * self._indent
+ line += text[:column_max - prefix_size]
+ self.lines.append(line)
+ text = text[column_max - prefix_size:]
+ if text and not self._comment and not multiline:
+ self._indent(2)
+ multiline = True
+
+ if multiline:
+ self._indent(-2)
+
+def make_computed_h(group, is_main=false):
+ pass
+
+class CSSValue:
+ 'Values to be associated with properties.'
+ def __init__(self, name, css_type, size=None, default='NULL',
+ bits_name=None, bits_type=None,
+ bits_size=None, bits_default=0):
+ self.name = name
+ self.type = css_type
+ self.size = size # `None` means sizeof(ptr)
+ self.default = default
+ self.bits = None if bits_size is None else {
+ 'name': bits_name,
+ 'type': bits_type,
+ 'size': bits_size,
+ 'default': bits_default
+ }
+
+class CSSProperty:
+ def __init__(self, name, type_size, values=None, condition=None,
+ defaults=None, comments=None, override=None):
+ self.name = name
+ self.type_size = type_size
+ self.values = [ v for v in self.__vals if v.name in get_tuple(values) ]
+ self.defaults = get_tuple(defaults)
+ self.condition = condition
+ self.override = get_tuple(override)
+ self.comments = comments
+
+ __vals = [ CSSValue(*x) for x in values ]
+
+ @property
+ def bits_size(self):
+ return self.type_size + sum([ v.bits['size'] for v in self.values
+ if v.bits is not None ])
+
+groups['main']['props'] = [ CSSProperty(*x) for x in groups['main']['props'] ]
+groups['main']['map'] = make_bit_map(groups['main'])
+for g in groups['others']:
+ g['props'] = [ CSSProperty(*x) for x in g['props'] ]
+ g['map'] = make_bit_map(g)
+
-----------------------------------------------------------------------
Summary of changes:
.../__pycache__/select_config.cpython-36.pyc | Bin 0 -> 6502 bytes
src/select/assets.py | 61 ++++++
src/select/computed_properties.py | 197 --------------------
src/select/overrides.py | 26 ++-
src/select/select_config.py | 167 +++++++++++++++++
src/select/select_generator.py | 123 ++++++++++++
6 files changed, 376 insertions(+), 198 deletions(-)
create mode 100644 src/select/__pycache__/select_config.cpython-36.pyc
create mode 100644 src/select/assets.py
delete mode 100644 src/select/computed_properties.py
create mode 100644 src/select/select_config.py
create mode 100644 src/select/select_generator.py
diff --git a/src/select/__pycache__/select_config.cpython-36.pyc b/src/select/__pycache__/select_config.cpython-36.pyc
new file mode 100644
index 0000000..52b37eb
Binary files /dev/null and b/src/select/__pycache__/select_config.cpython-36.pyc differ
diff --git a/src/select/assets.py b/src/select/assets.py
new file mode 100644
index 0000000..8151182
--- /dev/null
+++ b/src/select/assets.py
@@ -0,0 +1,61 @@
+# This file is part of LibCSS.
+# Licensed under the MIT License,
+# http://www.opensource.org/licenses/mit-license.php
+# Copyright 2017 Lucas Neves <lcneves(a)gmail.com>
+
+assets = {}
+
+assets['computed_h'] = {}
+assets['computed_h']['header'] = '''\
+/*
+ * This file is part of LibCSS
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2017 The NetSurf Project
+ */
+
+#ifndef css_select_computed_h_
+#define css_select_computed_h_
+
+#include <libcss/computed.h>
+#include <libcss/hint.h>
+
+'''
+assets['computed_h']['footer'] = '''\
+/**
+ * Take a new reference to a computed style
+ *
+ * \param style The style to take a new reference to.
+ * \return The new computed style reference
+ */
+static inline css_computed_style * css__computed_style_ref(
+ css_computed_style *style)
+{
+ if (style == NULL)
+ return NULL;
+
+ if (style->i.uncommon != NULL) {
+ style->i.uncommon->count++;
+ }
+
+ style->count++;
+ return style;
+}
+
+css_error css__computed_style_create(css_computed_style **result);
+
+css_error css__computed_style_initialise(css_computed_style *style,
+ struct css_select_handler *handler, void *pw);
+
+
+css_error css__computed_uncommon_destroy(css_computed_uncommon *uncommon);
+
+css_error css__compute_absolute_values(const css_computed_style *parent,
+ css_computed_style *style,
+ css_error (*compute_font_size)(void *pw,
+ const css_hint *parent, css_hint *size),
+ void *pw);
+
+#endif
+'''
+
diff --git a/src/select/computed_properties.py b/src/select/computed_properties.py
deleted file mode 100644
index 3f87bed..0000000
--- a/src/select/computed_properties.py
+++ /dev/null
@@ -1,197 +0,0 @@
-# This file is part of LibCSS.
-# Licensed under the MIT License,
-# http://www.opensource.org/licenses/mit-license.php
-# Copyright 2017 Lucas Neves <lcneves(a)gmail.com>
-
-def get_tuple(from_var):
- if type(from_var) is tuple:
- return from_var
- elif type(from_var) is str:
- return (from_var,)
- else:
- return ()
-
-def make_type(name, css_type, size = None, default = 'NULL',
- bits_name = None, bits_type = None,
- bits_size = None, bits_default = 0):
- return {
- 'name': name,
- 'type': css_type,
- 'size': size, # `None` means sizeof(ptr)
- 'default': default,
- 'bits': None if bits_name is None else {
- 'name': bits_name,
- 'type': bits_type,
- 'size': bits_size,
- 'default': bits_default
- }
- }
-
-# Configuration of types
-type_config = {
- ('length', 'css_fixed', 4, 0, 'unit', 'css_unit', 5, 'CSS_UNIT_PX'),
- ('integer', 'int32_t', 4, 0),
- ('fixed', 'css_fixed', 4, 0),
- ('color', 'css_color', 4, 0),
- ('string', 'lwc_string*'),
- ('string_arr', 'lwc_string**'),
- ('counter', 'css_computed_counter*'),
- ('content_item', 'css_computed_content_item*')
-}
-
-types = [ make_type(*x) for x in type_config ]
-
-def make_property(name, opcode_size, values = None,
- defaults = None, comments = None):
- 'Returns a CSS property.'
- default_tuple = get_tuple(defaults)
- value_tuple = get_tuple(values)
-
- return {
- 'name': name,
- 'size': opcode_size,
- 'values': [ types[x] for x in value_tuple ] or None,
- 'defaults': default_tuple or None, # May be `None` only for main group
- 'comments': comments
- }
-
-# Configuration of properties
-style_config = {
- # Style group, only opcode
- ('align_content', 3),
- ('align_items', 3),
- ('align_self', 3),
- ('background_attachment', 2),
- ('background_repeat', 3),
- ('border_collapse', 2),
- ('border_top_style', 4),
- ('border_right_style', 4),
- ('border_bottom_style', 4),
- ('border_left_style', 4),
- ('box_sizing', 2),
- ('caption_side', 2),
- ('clear', 3),
- ('direction', 2),
- ('display', 5),
- ('empty_cells', 2),
- ('flex_direction', 3),
- ('flex_wrap', 2),
- ('float', 2),
- ('font_style', 2),
- ('font_variant', 2),
- ('font_weight', 4),
- ('justify_content', 3),
- ('list_style_position', 2),
- ('list_style_type', 4),
- ('overflow', 3),
- ('outline_style', 4),
- ('position', 3),
- ('table_layout', 2),
- ('text_align', 4),
- ('text_decoration', 5),
- ('text_transform', 3),
- ('unicode_bidi', 2),
- ('visibility', 2),
- ('white_space', 3),
- # Style group, with additional value
- ('background_color', 2, 'color'),
- ('background_image', 1, 'string'),
- ('background_position', 1, ('length', 'length')),
- ('border_top_color', 2, 'color'),
- ('border_right_color', 2, 'color'),
- ('border_bottom_color', 2, 'color'),
- ('border_left_color', 2, 'color'),
- ('border_top_width', 3, 'length'),
- ('border_right_width', 3, 'length'),
- ('border_bottom_width', 3, 'length'),
- ('border_left_width', 3, 'length'),
- ('top', 2, 'length'),
- ('right', 2, 'length'),
- ('bottom', 2, 'length'),
- ('left', 2, 'length'),
- ('color', 1, 'color'),
- ('flex_basis', 2, 'length'),
- ('flex_grow', 1, 'fixed'),
- ('flex_shrink', 1, 'fixed'),
- ('font_size', 4, 'length'),
- ('height', 2, 'length'),
- ('line_height', 2, 'length'),
- ('list_style_image', 1, 'string'),
- ('margin_top', 2, 'length'),
- ('margin_right', 2, 'length'),
- ('margin_bottom', 2, 'length'),
- ('margin_left', 2, 'length'),
- ('max_height', 2, 'length'),
- ('max_width', 2, 'length'),
- ('min_height', 2, 'length'),
- ('min_width', 2, 'length'),
- ('order', 1, 'integer'),
- ('padding_top', 1, 'length'),
- ('padding_right', 1, 'length'),
- ('padding_left', 1, 'length'),
- ('padding_bottom', 1, 'length'),
- ('text_indent', 1, 'length'),
- ('vertical_align', 4, 'length'),
- ('width', 2, 'length'),
- ('z_index', 2, 'integer'),
- # Style group, arrays
- ('font_family', 3, 'string_arr', None,
- 'Encode font family as an array of string objects, terminated with a'
- '\n' 'blank entry.'),
- ('quotes', 1, 'string_arr', None,
- 'Encode quotes as an array of string objects, terminated with a '
- 'blank entry.')
-}
-
-page_config = {
- # Page group
- ('page_break_after', 3, None, 'CSS_PAGE_BREAK_AFTER_AUTO'),
- ('page_break_before', 3, None, 'CSS_PAGE_BREAK_BEFORE_AUTO'),
- ('page_break_inside', 2, None, 'CSS_PAGE_BREAK_INSIDE_AUTO'),
- ('widows', 1, 'integer', ('CSS_WIDOWS_SET', 2)),
- ('orphans', 1, 'integer', ('CSS_ORPHANS_SET', 2))
-}
-
-uncommon_config = {
- # Uncommon group
- ('border_spacing', 1, ('length', 'length'),
- ('CSS_BORDER_SPACING_SET', 0, 'CSS_UNIT_PX', 0, 'CSS_UNIT_PX')),
- ('break_after', 4, None, 'CSS_BREAK_AFTER_AUTO'),
- ('break_before', 4, None, 'CSS_BREAK_BEFORE_AUTO'),
- ('break_inside', 4, None, 'CSS_BREAK_INSIDE_AUTO'),
- ('clip', 6, ('length, length, length, length'), ('get', 'set')),
- ('column_count', 2, 'integer', 'CSS_COLUMN_COUNT_AUTO'),
- ('column_fill', 2, None, 'CSS_COLUMN_FILL_BALANCE'),
- ('column_gap', 2, 'length', 'CSS_COLUMN_GAP_NORMAL'),
- ('column_rule_color', 2, 'color', ('CSS_COLUMN_RULE_CURRENT_COLOR', 0)),
- ('column_rule_style', 4, None, 'CSS_COLUMN_RULE_STYLE_NONE'),
- ('column_rule_width', 3, 'length', 'CSS_COLUMN_RULE_WIDTH_MEDIUM'),
- ('column_span', 2, None, 'CSS_COLUMN_SPAN_NONE'),
- ('column_width', 2, 'length', 'CSS_COLUMN_WIDTH_AUTO'),
- ('letter_spacing', 2, 'length', 'CSS_LETTER_SPACING_NORMAL'),
- ('outline_color', 2, 'color', 'CSS_OUTLINE_COLOR_INVERT'),
- ('outline_width', 3, 'length', 'CSS_OUTLINE_WIDTH_MEDIUM'),
- ('word_spacing', 2, 'length', 'CSS_WORD_SPACING_NORMAL'),
- # Uncommon group, arrays
- ('counter_increment', 1, 'counter', 'CSS_COUNTER_INCREMENT_NONE',
- 'Encode counter_increment as an array of name, value pairs,\n'
- 'terminated with a blank entry.'),
- ('counter_reset', 1, 'counter', 'CSS_COUNTER_RESET_NONE',
- 'Encode counter_reset as an array of name, value pairs,\n'
- 'terminated with a blank entry.'),
- ('cursor', 5, 'string_arr', 'CSS_CURSOR_AUTO',
- 'Encode cursor uri(s) as an array of string objects, terminated\n'
- 'with a blank entry'),
- ('content', 2, 'content_item', 'CSS_CONTENT_NORMAL',
- 'Encode content as an array of content items, terminated with '
- 'a blank entry.')
-}
-
-uncommon = [ make_property(*x) for x in uncommon_config ]
-page = [ make_property(*x) for x in page_config ]
-style = [ make_property(*x) for x in style_config ]
-
-properties = {
- groups: [ uncommon, page, style ],
- default_group: style
-}
diff --git a/src/select/overrides.py b/src/select/overrides.py
index 930bd4a..3834c3f 100644
--- a/src/select/overrides.py
+++ b/src/select/overrides.py
@@ -5,7 +5,7 @@
clip = {}
clip['get'] = '''\
-static inline uint32_t get_clip(
+static inline uint8_t get_clip(
const css_computed_style *style,
css_computed_clip_rect *rect)
{
@@ -86,3 +86,27 @@ static inline css_error set_clip(
return CSS_OK;
}
'''
+
+line_height = {}
+line_height['get'] = '''\
+static inline uint8_t get_line_height(
+ const css_computed_style *style,
+ css_fixed *length, css_unit *unit)
+{
+ uint32_t bits = style->i.bits[LINE_HEIGHT_INDEX];
+ bits &= LINE_HEIGHT_MASK;
+ bits >>= LINE_HEIGHT_SHIFT;
+
+ /* 6bits: uuuutt : units | type */
+ if ((bits & 0x3) == CSS_LINE_HEIGHT_NUMBER ||
+ (bits & 0x3) == CSS_LINE_HEIGHT_DIMENSION) {
+ *length = style->i.line_height;
+ }
+
+ if ((bits & 0x3) == CSS_LINE_HEIGHT_DIMENSION) {
+ *unit = bits >> 2;
+ }
+
+ return (bits & 0x3);
+}
+'''
diff --git a/src/select/select_config.py b/src/select/select_config.py
new file mode 100644
index 0000000..d5cd525
--- /dev/null
+++ b/src/select/select_config.py
@@ -0,0 +1,167 @@
+# This file is part of LibCSS.
+# Licensed under the MIT License,
+# http://www.opensource.org/licenses/mit-license.php
+# Copyright 2017 Lucas Neves <lcneves(a)gmail.com>
+
+# Configuration of CSS values
+values = {
+ ('length', 'css_fixed', 4, 0, 'unit', 'css_unit', 5, 'CSS_UNIT_PX'),
+ ('integer', 'int32_t', 4, 0),
+ ('fixed', 'css_fixed', 4, 0),
+ ('color', 'css_color', 4, 0),
+ ('string', 'lwc_string*'),
+ ('string_arr', 'lwc_string**'),
+ ('counter', 'css_computed_counter*'),
+ ('content_item', 'css_computed_content_item*')
+}
+
+# Configuration of properties
+style = {
+ # Style group, only opcode
+ ('align_content', 3),
+ ('align_items', 3),
+ ('align_self', 3),
+ ('background_attachment', 2),
+ ('background_repeat', 3),
+ ('border_collapse', 2),
+ ('border_top_style', 4),
+ ('border_right_style', 4),
+ ('border_bottom_style', 4),
+ ('border_left_style', 4),
+ ('box_sizing', 2),
+ ('caption_side', 2),
+ ('clear', 3),
+ ('direction', 2),
+ ('display', 5),
+ ('empty_cells', 2),
+ ('flex_direction', 3),
+ ('flex_wrap', 2),
+ ('float', 2),
+ ('font_style', 2),
+ ('font_variant', 2),
+ ('font_weight', 4),
+ ('justify_content', 3),
+ ('list_style_position', 2),
+ ('list_style_type', 4),
+ ('overflow', 3),
+ ('outline_style', 4),
+ ('position', 3),
+ ('table_layout', 2),
+ ('text_align', 4),
+ ('text_decoration', 5),
+ ('text_transform', 3),
+ ('unicode_bidi', 2),
+ ('visibility', 2),
+ ('white_space', 3),
+ # Style group, with additional value
+ ('background_color', 2, 'color'),
+ ('background_image', 1, 'string'),
+ ('background_position', 1, ('length', 'length'),
+ 'CSS_BACKGROUND_POSITION_SET'),
+ ('border_top_color', 2, 'color'),
+ ('border_right_color', 2, 'color'),
+ ('border_bottom_color', 2, 'color'),
+ ('border_left_color', 2, 'color'),
+ ('border_top_width', 3, 'length', 'CSS_BORDER_WIDTH_WIDTH'),
+ ('border_right_width', 3, 'length', 'CSS_BORDER_WIDTH_WIDTH'),
+ ('border_bottom_width', 3, 'length', 'CSS_BORDER_WIDTH_WIDTH'),
+ ('border_left_width', 3, 'length', 'CSS_BORDER_WIDTH_WIDTH'),
+ ('top', 2, 'length', 'CSS_TOP_SET'),
+ ('right', 2, 'length', 'CSS_RIGHT_SET'),
+ ('bottom', 2, 'length', 'CSS_BOTTOM_SET'),
+ ('left', 2, 'length', 'CSS_LEFT_SET'),
+ ('color', 1, 'color'),
+ ('flex_basis', 2, 'length', 'CSS_FLEX_BASIS_SET'),
+ ('flex_grow', 1, 'fixed', 'CSS_FLEX_GROW_SET'),
+ ('flex_shrink', 1, 'fixed', 'CSS_FLEX_SHRINK_SET'),
+ ('font_size', 4, 'length', 'CSS_FONT_SIZE_DIMENSION'),
+ ('height', 2, 'length', 'CSS_HEIGHT_SET'),
+ ('line_height', 2, 'length', None, None, None, ('get')),
+ ('list_style_image', 1, 'string'),
+ ('margin_top', 2, 'length', 'CSS_MARGIN_SET'),
+ ('margin_right', 2, 'length', 'CSS_MARGIN_SET'),
+ ('margin_bottom', 2, 'length', 'CSS_MARGIN_SET'),
+ ('margin_left', 2, 'length', 'CSS_MARGIN_SET'),
+ ('max_height', 2, 'length', 'CSS_MAX_HEIGHT_SET'),
+ ('max_width', 2, 'length', 'CSS_MAX_WIDTH_SET'),
+ ('min_height', 2, 'length', 'CSS_MIN_HEIGHT_SET'),
+ ('min_width', 2, 'length', 'CSS_MIN_WIDTH_SET'),
+ ('opacity', 1, 'fixed', 'CSS_OPACITY_SET'),
+ ('order', 1, 'integer', 'CSS_ORDER_SET'),
+ ('padding_top', 1, 'length', 'CSS_PADDING_SET'),
+ ('padding_right', 1, 'length', 'CSS_PADDING_SET'),
+ ('padding_left', 1, 'length', 'CSS_PADDING_SET'),
+ ('padding_bottom', 1, 'length', 'CSS_PADDING_SET'),
+ ('text_indent', 1, 'length', 'CSS_TEXT_INDENT_SET'),
+ ('vertical_align', 4, 'length', 'CSS_VERTICAL_ALIGN_SET'),
+ ('width', 2, 'length', 'CSS_WIDTH_SET'),
+ ('z_index', 2, 'integer'),
+ # Style group, arrays
+ ('font_family', 3, 'string_arr', None, None,
+ 'Encode font family as an array of string objects, terminated with a'
+ '\n' 'blank entry.'),
+ ('quotes', 1, 'string_arr', None, None,
+ 'Encode quotes as an array of string objects, terminated with a '
+ 'blank entry.')
+}
+
+page = {
+ # Page group
+ ('page_break_after', 3, None, None, 'CSS_PAGE_BREAK_AFTER_AUTO'),
+ ('page_break_before', 3, None, None, 'CSS_PAGE_BREAK_BEFORE_AUTO'),
+ ('page_break_inside', 2, None, None, 'CSS_PAGE_BREAK_INSIDE_AUTO'),
+ ('widows', 1, 'integer', None, ('CSS_WIDOWS_SET', 2)),
+ ('orphans', 1, 'integer', None, ('CSS_ORPHANS_SET', 2))
+}
+
+uncommon = {
+ # Uncommon group
+ ('border_spacing', 1, ('length', 'length'), 'CSS_BORDER_SPACING_SET',
+ ('CSS_BORDER_SPACING_SET', 0, 'CSS_UNIT_PX', 0, 'CSS_UNIT_PX')),
+ ('break_after', 4, None, None, 'CSS_BREAK_AFTER_AUTO'),
+ ('break_before', 4, None, None, 'CSS_BREAK_BEFORE_AUTO'),
+ ('break_inside', 4, None, None, 'CSS_BREAK_INSIDE_AUTO'),
+ ('clip', 6, ('length, length, length, length'),
+ 'CSS_CLIP_RECT', None, None, ('get', 'set')),
+ ('column_count', 2, 'integer', None, 'CSS_COLUMN_COUNT_AUTO'),
+ ('column_fill', 2, None, None, 'CSS_COLUMN_FILL_BALANCE'),
+ ('column_gap', 2, 'length',
+ 'CSS_COLUMN_GAP_SET', 'CSS_COLUMN_GAP_NORMAL'),
+ ('column_rule_color', 2, 'color', None,
+ ('CSS_COLUMN_RULE_CURRENT_COLOR', 0)),
+ ('column_rule_style', 4, None, None, 'CSS_COLUMN_RULE_STYLE_NONE'),
+ ('column_rule_width', 3, 'length',
+ 'CSS_COLUMN_RULE_WIDTH_WIDTH', 'CSS_COLUMN_RULE_WIDTH_MEDIUM'),
+ ('column_span', 2, None, None, 'CSS_COLUMN_SPAN_NONE'),
+ ('column_width', 2, 'length',
+ 'CSS_COLUMN_WIDTH_SET', 'CSS_COLUMN_WIDTH_AUTO'),
+ ('letter_spacing', 2, 'length',
+ 'CSS_LETTER_SPACING_SET', 'CSS_LETTER_SPACING_NORMAL'),
+ ('outline_color', 2, 'color',
+ 'CSS_OUTLINE_COLOR_COLOR', 'CSS_OUTLINE_COLOR_INVERT'),
+ ('outline_width', 3, 'length',
+ 'CSS_OUTLINE_WIDTH_WIDTH', 'CSS_OUTLINE_WIDTH_MEDIUM'),
+ ('word_spacing', 2, 'length',
+ 'CSS_WORD_SPACING_SET', 'CSS_WORD_SPACING_NORMAL'),
+ # Uncommon group, arrays
+ ('counter_increment', 1, 'counter', None, 'CSS_COUNTER_INCREMENT_NONE',
+ 'Encode counter_increment as an array of name, value pairs,\n'
+ 'terminated with a blank entry.'),
+ ('counter_reset', 1, 'counter', None, 'CSS_COUNTER_RESET_NONE',
+ 'Encode counter_reset as an array of name, value pairs,\n'
+ 'terminated with a blank entry.'),
+ ('cursor', 5, 'string_arr', 'CSS_CURSOR_AUTO', None,
+ 'Encode cursor uri(s) as an array of string objects, terminated\n'
+ 'with a blank entry'),
+ ('content', 2, 'content_item', 'CSS_CONTENT_NORMAL', None,
+ 'Encode content as an array of content items, terminated with '
+ 'a blank entry.')
+}
+
+groups = {
+ 'main': { 'name': 'style', 'props': style },
+ 'others': [
+ { 'name': 'uncommon', 'props': uncommon },
+ { 'name': 'page', 'props': page }
+ ]
+}
diff --git a/src/select/select_generator.py b/src/select/select_generator.py
new file mode 100644
index 0000000..701d7d5
--- /dev/null
+++ b/src/select/select_generator.py
@@ -0,0 +1,123 @@
+# This file is part of LibCSS.
+# Licensed under the MIT License,
+# http://www.opensource.org/licenses/mit-license.php
+# Copyright 2017 Lucas Neves <lcneves(a)gmail.com>
+
+from select_config import values, groups
+from assets import assets
+
+def get_tuple(from_var):
+ 'Accepts tuples and strings, returns a tuple.'
+ if type(from_var) is tuple:
+ return from_var
+ elif type(from_var) is str:
+ return (from_var,)
+ else:
+ return ()
+
+class Bin:
+ def __init__(self, first_object):
+ self.contents = [ first_object ]
+
+ @property
+ def size(self):
+ return sum([ x['size'] for x in self.contents ])
+
+ def push(self, obj):
+ self.contents.append(obj)
+
+def make_bit_map(group):
+ '''Implements a `best fit first` heuristics for the bin packing of
+ property bits in the bits array'''
+
+ bin_size = 32
+ bit_map = []
+ group_props = sorted([ { 'name': p.name, 'size': p.bits_size }
+ for p in group['props'] ], key=(lambda x: x['size']), reverse=True)
+ for p in group_props:
+ for b in bit_map:
+ if b.size + p['size'] <= bin_size:
+ b.push(p)
+ break
+ else:
+ bit_map.append(Bin(p))
+ bit_map.sort(key=(lambda x: x.size), reverse=True)
+
+class FileText:
+ def __init__(self):
+ self._lines = []
+ self._comment = False
+ self._indent = 0
+
+ def indent(self, value, absolute=False):
+ if absolute:
+ self._indent = value
+ else:
+ self._indent += value
+
+ def comment(self):
+ self.append(' */' if self._comment else '/*')
+ self._comment = !self._comment
+
+ def append(self, text):
+ column_max = 80
+ multiline = False
+
+ while text:
+ line = '\t' * self._indent
+ if self._comment:
+ line += ' * '
+ prefix_size = (3 if self._comment else 0) + 8 * self._indent
+ line += text[:column_max - prefix_size]
+ self.lines.append(line)
+ text = text[column_max - prefix_size:]
+ if text and not self._comment and not multiline:
+ self._indent(2)
+ multiline = True
+
+ if multiline:
+ self._indent(-2)
+
+def make_computed_h(group, is_main=false):
+ pass
+
+class CSSValue:
+ 'Values to be associated with properties.'
+ def __init__(self, name, css_type, size=None, default='NULL',
+ bits_name=None, bits_type=None,
+ bits_size=None, bits_default=0):
+ self.name = name
+ self.type = css_type
+ self.size = size # `None` means sizeof(ptr)
+ self.default = default
+ self.bits = None if bits_size is None else {
+ 'name': bits_name,
+ 'type': bits_type,
+ 'size': bits_size,
+ 'default': bits_default
+ }
+
+class CSSProperty:
+ def __init__(self, name, type_size, values=None, condition=None,
+ defaults=None, comments=None, override=None):
+ self.name = name
+ self.type_size = type_size
+ self.values = [ v for v in self.__vals if v.name in get_tuple(values) ]
+ self.defaults = get_tuple(defaults)
+ self.condition = condition
+ self.override = get_tuple(override)
+ self.comments = comments
+
+ __vals = [ CSSValue(*x) for x in values ]
+
+ @property
+ def bits_size(self):
+ return self.type_size + sum([ v.bits['size'] for v in self.values
+ if v.bits is not None ])
+
+groups['main']['props'] = [ CSSProperty(*x) for x in groups['main']['props'] ]
+groups['main']['map'] = make_bit_map(groups['main'])
+for g in groups['others']:
+ g['props'] = [ CSSProperty(*x) for x in g['props'] ]
+ g['map'] = make_bit_map(g)
+
--
Cascading Style Sheets library
5 years, 11 months
netsurf: branch ashmew2/nskolibrios updated. release/3.7-83-g7bd0bd4
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/7bd0bd49538b0ab081058...
...commit http://git.netsurf-browser.org/netsurf.git/commit/7bd0bd49538b0ab0810588e...
...tree http://git.netsurf-browser.org/netsurf.git/tree/7bd0bd49538b0ab0810588ed7...
The branch, ashmew2/nskolibrios has been updated
via 7bd0bd49538b0ab0810588ed7525199797e8daaa (commit)
from 1ffbc36661f162d4801cc27c06de30cae4c7c84e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=7bd0bd49538b0ab0810...
commit 7bd0bd49538b0ab0810588ed7525199797e8daaa
Author: Ashish Gupta <ashmew2(a)gmail.com>
Commit: Ashish Gupta <ashmew2(a)gmail.com>
Clean up Makefile
diff --git a/Makefile b/Makefile
index 4647806..77bd03a 100644
--- a/Makefile
+++ b/Makefile
@@ -531,10 +531,8 @@ $(eval $(call pkg_config_find_and_add,libdom,DOM))
$(eval $(call pkg_config_find_and_add,libnsutils,nsutils))
$(eval $(call pkg_config_find_and_add,libutf8proc,utf8proc))
-ifneq ($(TARGET),kolibrios)
- # Common libraries without pkg-config support
- LDFLAGS += -lz
-endif
+# Common libraries without pkg-config support
+LDFLAGS += -lz
# Optional libraries with pkgconfig
@@ -568,15 +566,6 @@ $(eval $(call pkg_config_find_and_add_enabled,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add_enabled,NSSVG,libsvgtiny,SVG))
$(eval $(call pkg_config_find_and_add_enabled,ROSPRITE,librosprite,Sprite))
$(eval $(call pkg_config_find_and_add_enabled,NSPSL,libnspsl,PSL))
-
-$(eval $(call pkg_config_find_and_add_enabled,OPENSSL,openssl,OpenSSL))
-
-$(eval $(call pkg_config_find_and_add_enabled,PNG,libpng,PNG))
-$(eval $(call pkg_config_find_and_add_enabled,BMP,libnsbmp,BMP))
-$(eval $(call pkg_config_find_and_add_enabled,GIF,libnsgif,GIF))
-$(eval $(call pkg_config_find_and_add_enabled,NSSVG,libsvgtiny,SVG))
-$(eval $(call pkg_config_find_and_add_enabled,ROSPRITE,librosprite,Sprite))
-$(eval $(call pkg_config_find_and_add_enabled,NSPSL,libnspsl,PSL))
$(eval $(call pkg_config_find_and_add_enabled,NSLOG,libnslog,LOG))
# List of directories in which headers are searched for
-----------------------------------------------------------------------
Summary of changes:
Makefile | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/Makefile b/Makefile
index 4647806..77bd03a 100644
--- a/Makefile
+++ b/Makefile
@@ -531,10 +531,8 @@ $(eval $(call pkg_config_find_and_add,libdom,DOM))
$(eval $(call pkg_config_find_and_add,libnsutils,nsutils))
$(eval $(call pkg_config_find_and_add,libutf8proc,utf8proc))
-ifneq ($(TARGET),kolibrios)
- # Common libraries without pkg-config support
- LDFLAGS += -lz
-endif
+# Common libraries without pkg-config support
+LDFLAGS += -lz
# Optional libraries with pkgconfig
@@ -568,15 +566,6 @@ $(eval $(call pkg_config_find_and_add_enabled,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add_enabled,NSSVG,libsvgtiny,SVG))
$(eval $(call pkg_config_find_and_add_enabled,ROSPRITE,librosprite,Sprite))
$(eval $(call pkg_config_find_and_add_enabled,NSPSL,libnspsl,PSL))
-
-$(eval $(call pkg_config_find_and_add_enabled,OPENSSL,openssl,OpenSSL))
-
-$(eval $(call pkg_config_find_and_add_enabled,PNG,libpng,PNG))
-$(eval $(call pkg_config_find_and_add_enabled,BMP,libnsbmp,BMP))
-$(eval $(call pkg_config_find_and_add_enabled,GIF,libnsgif,GIF))
-$(eval $(call pkg_config_find_and_add_enabled,NSSVG,libsvgtiny,SVG))
-$(eval $(call pkg_config_find_and_add_enabled,ROSPRITE,librosprite,Sprite))
-$(eval $(call pkg_config_find_and_add_enabled,NSPSL,libnspsl,PSL))
$(eval $(call pkg_config_find_and_add_enabled,NSLOG,libnslog,LOG))
# List of directories in which headers are searched for
--
NetSurf Browser
5 years, 11 months