netsurf: branch master updated. 7b868e4287591671163efafbe46c61f5ae9ac249
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/7b868e4287591671163ef...
...commit http://git.netsurf-browser.org/netsurf.git/commit/7b868e4287591671163efaf...
...tree http://git.netsurf-browser.org/netsurf.git/tree/7b868e4287591671163efafbe...
The branch, master has been updated
via 7b868e4287591671163efafbe46c61f5ae9ac249 (commit)
via 1c1ac7f5a170a080f0967cd25d2f6b3a4d8b8635 (commit)
from 607c06c96d0215f383d271afa92e1cfbeb4f50c7 (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/commitdiff/7b868e4287591671163...
commit 7b868e4287591671163efafbe46c61f5ae9ac249
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Default to download font from http://ftp.gnome.org
diff --git a/atari/Makefile.target b/atari/Makefile.target
index afc44cf..9c7157e 100644
--- a/atari/Makefile.target
+++ b/atari/Makefile.target
@@ -90,8 +90,8 @@ ATARI_TARGET_DIR := netsurf/
ATARI_RES_DIR := atari/res/
ATARI_DOC_DIR := atari/doc/
ATARI_FONT_NAME := ttf-bitstream-vera-1.10
-#ATARI_FONT_SOURCE_URL := http://ftp.gnome.org/pub/GNOME/sources/ttf-bitstream-vera/1.10/$(ATARI_FO...
-ATARI_FONT_SOURCE_URL := http://localhost/$(ATARI_FONT_NAME).tar.gz
+ATARI_FONT_SOURCE_URL := http://ftp.gnome.org/pub/GNOME/sources/ttf-bitstream-vera/1.10/$(ATARI_FO...
+#ATARI_FONT_SOURCE_URL := http://localhost/$(ATARI_FONT_NAME).tar.gz
ATARI_FONT_TMP_DIR := $(DEPROOT)/../
ATARI_FONT_SOURCE_DIR := $(ATARI_FONT_TMP_DIR)$(ATARI_FONT_NAME)/
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/1c1ac7f5a170a080f09...
commit 1c1ac7f5a170a080f0967cd25d2f6b3a4d8b8635
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Download fonts to build directory and copy from there.
diff --git a/atari/Makefile.target b/atari/Makefile.target
index edc8ce3..afc44cf 100644
--- a/atari/Makefile.target
+++ b/atari/Makefile.target
@@ -89,8 +89,11 @@ EXETARGET := ns$(SUBTARGET)$(PRGSUFFIX)
ATARI_TARGET_DIR := netsurf/
ATARI_RES_DIR := atari/res/
ATARI_DOC_DIR := atari/doc/
-ATARI_FONT_SOURCE_DIR := /usr/share/fonts/truetype/ttf-bitstream-vera/
-ATARI_FONT_DOC_DIR := /usr/share/doc/ttf-bitstream-vera/
+ATARI_FONT_NAME := ttf-bitstream-vera-1.10
+#ATARI_FONT_SOURCE_URL := http://ftp.gnome.org/pub/GNOME/sources/ttf-bitstream-vera/1.10/$(ATARI_FO...
+ATARI_FONT_SOURCE_URL := http://localhost/$(ATARI_FONT_NAME).tar.gz
+ATARI_FONT_TMP_DIR := $(DEPROOT)/../
+ATARI_FONT_SOURCE_DIR := $(ATARI_FONT_TMP_DIR)$(ATARI_FONT_NAME)/
ifeq ($(HOST),mint)
STRIP := strip
@@ -113,7 +116,11 @@ install-atari:
# Package target
# ----------------------------------------------------------------------------
-package-atari: $(PKGNAME)
+$(ATARI_FONT_TMP_DIR)$(ATARI_FONT_NAME):
+ $(Q)wget $(ATARI_FONT_SOURCE_URL) -O $(ATARI_FONT_TMP_DIR)$(ATARI_FONT_NAME).tar.gz
+ tar xfz $(ATARI_FONT_TMP_DIR)/$(ATARI_FONT_NAME).tar.gz -C $(ATARI_FONT_TMP_DIR)
+
+package-atari: $(ATARI_FONT_TMP_DIR)$(ATARI_FONT_NAME) $(PKGNAME)
$(VQ)echo Creating $(PKGNAME)
$(PKGNAME): $(EXETARGET)
@@ -121,6 +128,7 @@ $(PKGNAME): $(EXETARGET)
$(Q)$(STACK) -S 256k $(EXETARGET)
$(Q)rm -rf $(ATARI_TARGET_DIR)
$(Q)rm -rf $(PKGNAME)
+# $(Q)rm -rf $(ATARI_FONT_SOURCE_DIR)
$(Q)mkdir $(ATARI_TARGET_DIR)
$(Q)mkdir $(ATARI_TARGET_DIR)doc
$(Q)mkdir $(ATARI_TARGET_DIR)download
@@ -151,9 +159,13 @@ $(PKGNAME): $(EXETARGET)
$(Q)cp \!NetSurf/Resources/ca-bundle $(ATARI_TARGET_DIR)res/cabundle
# copy "Bitstream Vera" font:
- $(Q)cp $(ATARI_FONT_DOC_DIR)copyright $(ATARI_TARGET_DIR)res/fonts/
- $(Q)cp $(ATARI_FONT_DOC_DIR)README.TXT $(ATARI_TARGET_DIR)res/fonts/
- $(Q)cp $(ATARI_FONT_DOC_DIR)COPYRIGHT-FAQ.TXT $(ATARI_TARGET_DIR)res/fonts/
+# try "cp
+# /path/to/local/copy/font.ttf /path/to/pkg/font.ttf || wget -O
+# /path/to/pkg/font.ttf http://foo/font.ttf"
+
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)RELEASENOTES.TXT $(ATARI_TARGET_DIR)res/fonts/
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)README.TXT $(ATARI_TARGET_DIR)res/fonts/
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)COPYRIGHT.TXT $(ATARI_TARGET_DIR)res/fonts/
$(Q)cp $(ATARI_FONT_SOURCE_DIR)Vera.ttf $(ATARI_TARGET_DIR)res/fonts/ss.ttf
$(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraBd.ttf $(ATARI_TARGET_DIR)res/fonts/ssb.ttf
@@ -171,5 +183,6 @@ $(PKGNAME): $(EXETARGET)
# zip files
$(Q)zip $(PKGNAME) -9 -r ./$(ATARI_TARGET_DIR)
-# delete temporary folder
+# delete temporary folders
$(Q)rm -rf $(ATARI_TARGET_DIR)
+# $(Q)rm -rf $(ATARI_FONT_SOURCE_DIR)
-----------------------------------------------------------------------
Summary of changes:
atari/Makefile.target | 27 ++++++++++++++++++++-------
1 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/atari/Makefile.target b/atari/Makefile.target
index edc8ce3..9c7157e 100644
--- a/atari/Makefile.target
+++ b/atari/Makefile.target
@@ -89,8 +89,11 @@ EXETARGET := ns$(SUBTARGET)$(PRGSUFFIX)
ATARI_TARGET_DIR := netsurf/
ATARI_RES_DIR := atari/res/
ATARI_DOC_DIR := atari/doc/
-ATARI_FONT_SOURCE_DIR := /usr/share/fonts/truetype/ttf-bitstream-vera/
-ATARI_FONT_DOC_DIR := /usr/share/doc/ttf-bitstream-vera/
+ATARI_FONT_NAME := ttf-bitstream-vera-1.10
+ATARI_FONT_SOURCE_URL := http://ftp.gnome.org/pub/GNOME/sources/ttf-bitstream-vera/1.10/$(ATARI_FO...
+#ATARI_FONT_SOURCE_URL := http://localhost/$(ATARI_FONT_NAME).tar.gz
+ATARI_FONT_TMP_DIR := $(DEPROOT)/../
+ATARI_FONT_SOURCE_DIR := $(ATARI_FONT_TMP_DIR)$(ATARI_FONT_NAME)/
ifeq ($(HOST),mint)
STRIP := strip
@@ -113,7 +116,11 @@ install-atari:
# Package target
# ----------------------------------------------------------------------------
-package-atari: $(PKGNAME)
+$(ATARI_FONT_TMP_DIR)$(ATARI_FONT_NAME):
+ $(Q)wget $(ATARI_FONT_SOURCE_URL) -O $(ATARI_FONT_TMP_DIR)$(ATARI_FONT_NAME).tar.gz
+ tar xfz $(ATARI_FONT_TMP_DIR)/$(ATARI_FONT_NAME).tar.gz -C $(ATARI_FONT_TMP_DIR)
+
+package-atari: $(ATARI_FONT_TMP_DIR)$(ATARI_FONT_NAME) $(PKGNAME)
$(VQ)echo Creating $(PKGNAME)
$(PKGNAME): $(EXETARGET)
@@ -121,6 +128,7 @@ $(PKGNAME): $(EXETARGET)
$(Q)$(STACK) -S 256k $(EXETARGET)
$(Q)rm -rf $(ATARI_TARGET_DIR)
$(Q)rm -rf $(PKGNAME)
+# $(Q)rm -rf $(ATARI_FONT_SOURCE_DIR)
$(Q)mkdir $(ATARI_TARGET_DIR)
$(Q)mkdir $(ATARI_TARGET_DIR)doc
$(Q)mkdir $(ATARI_TARGET_DIR)download
@@ -151,9 +159,13 @@ $(PKGNAME): $(EXETARGET)
$(Q)cp \!NetSurf/Resources/ca-bundle $(ATARI_TARGET_DIR)res/cabundle
# copy "Bitstream Vera" font:
- $(Q)cp $(ATARI_FONT_DOC_DIR)copyright $(ATARI_TARGET_DIR)res/fonts/
- $(Q)cp $(ATARI_FONT_DOC_DIR)README.TXT $(ATARI_TARGET_DIR)res/fonts/
- $(Q)cp $(ATARI_FONT_DOC_DIR)COPYRIGHT-FAQ.TXT $(ATARI_TARGET_DIR)res/fonts/
+# try "cp
+# /path/to/local/copy/font.ttf /path/to/pkg/font.ttf || wget -O
+# /path/to/pkg/font.ttf http://foo/font.ttf"
+
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)RELEASENOTES.TXT $(ATARI_TARGET_DIR)res/fonts/
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)README.TXT $(ATARI_TARGET_DIR)res/fonts/
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)COPYRIGHT.TXT $(ATARI_TARGET_DIR)res/fonts/
$(Q)cp $(ATARI_FONT_SOURCE_DIR)Vera.ttf $(ATARI_TARGET_DIR)res/fonts/ss.ttf
$(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraBd.ttf $(ATARI_TARGET_DIR)res/fonts/ssb.ttf
@@ -171,5 +183,6 @@ $(PKGNAME): $(EXETARGET)
# zip files
$(Q)zip $(PKGNAME) -9 -r ./$(ATARI_TARGET_DIR)
-# delete temporary folder
+# delete temporary folders
$(Q)rm -rf $(ATARI_TARGET_DIR)
+# $(Q)rm -rf $(ATARI_FONT_SOURCE_DIR)
--
NetSurf Browser
10 years, 5 months
libcss: branch master updated. 3c973e0136779959d95f3ff578fbd5d46bc53530
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libcss.git/shortlog/3c973e0136779959d95f3f...
...commit http://git.netsurf-browser.org/libcss.git/commit/3c973e0136779959d95f3ff5...
...tree http://git.netsurf-browser.org/libcss.git/tree/3c973e0136779959d95f3ff578...
The branch, master has been updated
via 3c973e0136779959d95f3ff578fbd5d46bc53530 (commit)
from 71d28981207beb72b3ca68a9fa24948615a6a9bd (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/commitdiff/3c973e0136779959d95f...
commit 3c973e0136779959d95f3ff578fbd5d46bc53530
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Prioritise id and class hashes over element hash when inserting rules.
diff --git a/src/select/hash.c b/src/select/hash.c
index 2cc6f4a..37492c1 100644
--- a/src/select/hash.c
+++ b/src/select/hash.c
@@ -198,27 +198,27 @@ css_error css__selector_hash_insert(css_selector_hash *hash,
return CSS_BADPARM;
/* Work out which hash to insert into */
- if (lwc_string_length(selector->data.qname.name) != 1 ||
- lwc_string_data(selector->data.qname.name)[0] != '*') {
- /* Named element */
- mask = hash->elements.n_slots - 1;
- index = _hash_name(selector->data.qname.name) & mask;
+ if ((name = _id_name(selector)) != NULL) {
+ /* Named ID */
+ mask = hash->ids.n_slots - 1;
+ index = _hash_name(name) & mask;
- error = _insert_into_chain(hash, &hash->elements.slots[index],
+ error = _insert_into_chain(hash, &hash->ids.slots[index],
selector);
} else if ((name = _class_name(selector)) != NULL) {
/* Named class */
mask = hash->classes.n_slots - 1;
index = _hash_name(name) & mask;
- error = _insert_into_chain(hash, &hash->classes.slots[index],
+ error = _insert_into_chain(hash, &hash->classes.slots[index],
selector);
- } else if ((name = _id_name(selector)) != NULL) {
- /* Named ID */
- mask = hash->ids.n_slots - 1;
- index = _hash_name(name) & mask;
+ } else if (lwc_string_length(selector->data.qname.name) != 1 ||
+ lwc_string_data(selector->data.qname.name)[0] != '*') {
+ /* Named element */
+ mask = hash->elements.n_slots - 1;
+ index = _hash_name(selector->data.qname.name) & mask;
- error = _insert_into_chain(hash, &hash->ids.slots[index],
+ error = _insert_into_chain(hash, &hash->elements.slots[index],
selector);
} else {
/* Universal chain */
@@ -245,28 +245,28 @@ css_error css__selector_hash_remove(css_selector_hash *hash,
if (hash == NULL || selector == NULL)
return CSS_BADPARM;
- /* Work out which hash to insert into */
- if (lwc_string_length(selector->data.qname.name) != 1 ||
- lwc_string_data(selector->data.qname.name)[0] != '*') {
- /* Named element */
- mask = hash->elements.n_slots - 1;
- index = _hash_name(selector->data.qname.name) & mask;
+ /* Work out which hash to remove from */
+ if ((name = _id_name(selector)) != NULL) {
+ /* Named ID */
+ mask = hash->ids.n_slots - 1;
+ index = _hash_name(name) & mask;
- error = _remove_from_chain(hash, &hash->elements.slots[index],
+ error = _remove_from_chain(hash, &hash->ids.slots[index],
selector);
} else if ((name = _class_name(selector)) != NULL) {
/* Named class */
mask = hash->classes.n_slots - 1;
index = _hash_name(name) & mask;
- error = _remove_from_chain(hash, &hash->classes.slots[index],
+ error = _remove_from_chain(hash, &hash->classes.slots[index],
selector);
- } else if ((name = _id_name(selector)) != NULL) {
- /* Named ID */
- mask = hash->ids.n_slots - 1;
- index = _hash_name(name) & mask;
+ } else if (lwc_string_length(selector->data.qname.name) != 1 ||
+ lwc_string_data(selector->data.qname.name)[0] != '*') {
+ /* Named element */
+ mask = hash->elements.n_slots - 1;
+ index = _hash_name(selector->data.qname.name) & mask;
- error = _remove_from_chain(hash, &hash->ids.slots[index],
+ error = _remove_from_chain(hash, &hash->elements.slots[index],
selector);
} else {
/* Universal chain */
diff --git a/src/select/select.c b/src/select/select.c
index ba35262..5c007af 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -97,6 +97,19 @@ typedef struct css_select_font_faces_state {
css_select_font_faces_list author_font_faces;
} css_select_font_faces_state;
+/**
+ * CSS rule source
+ */
+typedef struct css_select_rule_source {
+ enum {
+ CSS_SELECT_RULE_SRC_ELEMENT,
+ CSS_SELECT_RULE_SRC_CLASS,
+ CSS_SELECT_RULE_SRC_ID,
+ CSS_SELECT_RULE_SRC_UNIVERSAL
+ } source;
+ uint32_t class;
+} css_select_rule_source;
+
static css_error set_hint(css_select_state *state, uint32_t prop);
static css_error set_initial(css_select_state *state,
@@ -1285,31 +1298,66 @@ static inline bool _selector_less_specific(const css_selector *ref,
static const css_selector *_selector_next(const css_selector **node,
const css_selector **id, const css_selector ***classes,
- uint32_t n_classes, const css_selector **univ)
+ uint32_t n_classes, const css_selector **univ,
+ css_select_rule_source *src)
{
const css_selector *ret = NULL;
- if (_selector_less_specific(ret, *node))
+ if (_selector_less_specific(ret, *node)) {
ret = *node;
+ src->source = CSS_SELECT_RULE_SRC_ELEMENT;
+ }
- if (_selector_less_specific(ret, *id))
+ if (_selector_less_specific(ret, *id)) {
ret = *id;
+ src->source = CSS_SELECT_RULE_SRC_ID;
+ }
- if (_selector_less_specific(ret, *univ))
+ if (_selector_less_specific(ret, *univ)) {
ret = *univ;
+ src->source = CSS_SELECT_RULE_SRC_UNIVERSAL;
+ }
if (classes != NULL && n_classes > 0) {
uint32_t i;
for (i = 0; i < n_classes; i++) {
- if (_selector_less_specific(ret, *(classes[i])))
+ if (_selector_less_specific(ret, *(classes[i]))) {
ret = *(classes[i]);
+ src->source = CSS_SELECT_RULE_SRC_CLASS;
+ src->class = i;
+ }
}
}
return ret;
}
+static bool _rule_good_for_element_name(const css_selector *selector,
+ css_select_rule_source *src, css_select_state *state)
+{
+ /* If source of rule is element or universal hash, we know the
+ * element name is a match. If it comes from the class or id hash,
+ * we have to test for a match */
+ if (src->source == CSS_SELECT_RULE_SRC_ID ||
+ src->source == CSS_SELECT_RULE_SRC_CLASS) {
+ if (lwc_string_length(selector->data.qname.name) != 1 ||
+ lwc_string_data(
+ selector->data.qname.name)[0] != '*') {
+ bool match;
+ if (lwc_string_caseless_isequal(
+ selector->data.qname.name,
+ state->element.name,
+ &match) == lwc_error_ok &&
+ match == false) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
css_error match_selectors_in_sheet(css_select_ctx *ctx,
const css_stylesheet *sheet, css_select_state *state)
{
@@ -1324,6 +1372,7 @@ css_error match_selectors_in_sheet(css_select_ctx *ctx,
css_selector_hash_iterator class_iterator;
const css_selector **univ_selectors = &empty_selector;
css_selector_hash_iterator univ_iterator;
+ css_select_rule_source src = { CSS_SELECT_RULE_SRC_ELEMENT, 0 };
css_error error;
/* Find hash chain that applies to current node */
@@ -1377,7 +1426,12 @@ css_error match_selectors_in_sheet(css_select_ctx *ctx,
* Pick the least specific/earliest occurring selector.
*/
selector = _selector_next(node_selectors, id_selectors,
- class_selectors, n_classes, univ_selectors);
+ class_selectors, n_classes, univ_selectors,
+ &src);
+
+ /* We know there are selectors pending, so should have a
+ * selector here */
+ assert(selector != NULL);
/* No bytecode if rule body is empty or wholly invalid --
* Only interested in rules with bytecode */
@@ -1387,33 +1441,40 @@ css_error match_selectors_in_sheet(css_select_ctx *ctx,
* current media requirements. */
if (_rule_applies_to_media(selector->rule,
state->media)) {
- error = match_selector_chain(ctx, selector,
- state);
- if (error != CSS_OK)
- goto cleanup;
+ if (_rule_good_for_element_name(selector, &src,
+ state)) {
+ error = match_selector_chain(
+ ctx, selector,
+ state);
+ if (error != CSS_OK)
+ goto cleanup;
+ }
}
}
/* Advance to next selector in whichever chain we extracted
* the processed selector from. */
- if (selector == *node_selectors) {
+ switch (src.source) {
+ case CSS_SELECT_RULE_SRC_ELEMENT:
error = node_iterator(
node_selectors, &node_selectors);
- } else if (selector == *id_selectors) {
+ break;
+
+ case CSS_SELECT_RULE_SRC_ID:
error = id_iterator(
id_selectors, &id_selectors);
- } else if (selector == *univ_selectors) {
+ break;
+
+ case CSS_SELECT_RULE_SRC_UNIVERSAL:
error = univ_iterator(
univ_selectors, &univ_selectors);
- } else {
- for (i = 0; i < n_classes; i++) {
- if (selector == *(class_selectors[i])) {
- error = class_iterator(
- class_selectors[i],
- &class_selectors[i]);
- break;
- }
- }
+ break;
+
+ case CSS_SELECT_RULE_SRC_CLASS:
+ error = class_iterator(
+ class_selectors[src.class],
+ &class_selectors[src.class]);
+ break;
}
if (error != CSS_OK)
-----------------------------------------------------------------------
Summary of changes:
src/select/hash.c | 50 ++++++++++++------------
src/select/select.c | 105 ++++++++++++++++++++++++++++++++++++++++-----------
2 files changed, 108 insertions(+), 47 deletions(-)
diff --git a/src/select/hash.c b/src/select/hash.c
index 2cc6f4a..37492c1 100644
--- a/src/select/hash.c
+++ b/src/select/hash.c
@@ -198,27 +198,27 @@ css_error css__selector_hash_insert(css_selector_hash *hash,
return CSS_BADPARM;
/* Work out which hash to insert into */
- if (lwc_string_length(selector->data.qname.name) != 1 ||
- lwc_string_data(selector->data.qname.name)[0] != '*') {
- /* Named element */
- mask = hash->elements.n_slots - 1;
- index = _hash_name(selector->data.qname.name) & mask;
+ if ((name = _id_name(selector)) != NULL) {
+ /* Named ID */
+ mask = hash->ids.n_slots - 1;
+ index = _hash_name(name) & mask;
- error = _insert_into_chain(hash, &hash->elements.slots[index],
+ error = _insert_into_chain(hash, &hash->ids.slots[index],
selector);
} else if ((name = _class_name(selector)) != NULL) {
/* Named class */
mask = hash->classes.n_slots - 1;
index = _hash_name(name) & mask;
- error = _insert_into_chain(hash, &hash->classes.slots[index],
+ error = _insert_into_chain(hash, &hash->classes.slots[index],
selector);
- } else if ((name = _id_name(selector)) != NULL) {
- /* Named ID */
- mask = hash->ids.n_slots - 1;
- index = _hash_name(name) & mask;
+ } else if (lwc_string_length(selector->data.qname.name) != 1 ||
+ lwc_string_data(selector->data.qname.name)[0] != '*') {
+ /* Named element */
+ mask = hash->elements.n_slots - 1;
+ index = _hash_name(selector->data.qname.name) & mask;
- error = _insert_into_chain(hash, &hash->ids.slots[index],
+ error = _insert_into_chain(hash, &hash->elements.slots[index],
selector);
} else {
/* Universal chain */
@@ -245,28 +245,28 @@ css_error css__selector_hash_remove(css_selector_hash *hash,
if (hash == NULL || selector == NULL)
return CSS_BADPARM;
- /* Work out which hash to insert into */
- if (lwc_string_length(selector->data.qname.name) != 1 ||
- lwc_string_data(selector->data.qname.name)[0] != '*') {
- /* Named element */
- mask = hash->elements.n_slots - 1;
- index = _hash_name(selector->data.qname.name) & mask;
+ /* Work out which hash to remove from */
+ if ((name = _id_name(selector)) != NULL) {
+ /* Named ID */
+ mask = hash->ids.n_slots - 1;
+ index = _hash_name(name) & mask;
- error = _remove_from_chain(hash, &hash->elements.slots[index],
+ error = _remove_from_chain(hash, &hash->ids.slots[index],
selector);
} else if ((name = _class_name(selector)) != NULL) {
/* Named class */
mask = hash->classes.n_slots - 1;
index = _hash_name(name) & mask;
- error = _remove_from_chain(hash, &hash->classes.slots[index],
+ error = _remove_from_chain(hash, &hash->classes.slots[index],
selector);
- } else if ((name = _id_name(selector)) != NULL) {
- /* Named ID */
- mask = hash->ids.n_slots - 1;
- index = _hash_name(name) & mask;
+ } else if (lwc_string_length(selector->data.qname.name) != 1 ||
+ lwc_string_data(selector->data.qname.name)[0] != '*') {
+ /* Named element */
+ mask = hash->elements.n_slots - 1;
+ index = _hash_name(selector->data.qname.name) & mask;
- error = _remove_from_chain(hash, &hash->ids.slots[index],
+ error = _remove_from_chain(hash, &hash->elements.slots[index],
selector);
} else {
/* Universal chain */
diff --git a/src/select/select.c b/src/select/select.c
index ba35262..5c007af 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -97,6 +97,19 @@ typedef struct css_select_font_faces_state {
css_select_font_faces_list author_font_faces;
} css_select_font_faces_state;
+/**
+ * CSS rule source
+ */
+typedef struct css_select_rule_source {
+ enum {
+ CSS_SELECT_RULE_SRC_ELEMENT,
+ CSS_SELECT_RULE_SRC_CLASS,
+ CSS_SELECT_RULE_SRC_ID,
+ CSS_SELECT_RULE_SRC_UNIVERSAL
+ } source;
+ uint32_t class;
+} css_select_rule_source;
+
static css_error set_hint(css_select_state *state, uint32_t prop);
static css_error set_initial(css_select_state *state,
@@ -1285,31 +1298,66 @@ static inline bool _selector_less_specific(const css_selector *ref,
static const css_selector *_selector_next(const css_selector **node,
const css_selector **id, const css_selector ***classes,
- uint32_t n_classes, const css_selector **univ)
+ uint32_t n_classes, const css_selector **univ,
+ css_select_rule_source *src)
{
const css_selector *ret = NULL;
- if (_selector_less_specific(ret, *node))
+ if (_selector_less_specific(ret, *node)) {
ret = *node;
+ src->source = CSS_SELECT_RULE_SRC_ELEMENT;
+ }
- if (_selector_less_specific(ret, *id))
+ if (_selector_less_specific(ret, *id)) {
ret = *id;
+ src->source = CSS_SELECT_RULE_SRC_ID;
+ }
- if (_selector_less_specific(ret, *univ))
+ if (_selector_less_specific(ret, *univ)) {
ret = *univ;
+ src->source = CSS_SELECT_RULE_SRC_UNIVERSAL;
+ }
if (classes != NULL && n_classes > 0) {
uint32_t i;
for (i = 0; i < n_classes; i++) {
- if (_selector_less_specific(ret, *(classes[i])))
+ if (_selector_less_specific(ret, *(classes[i]))) {
ret = *(classes[i]);
+ src->source = CSS_SELECT_RULE_SRC_CLASS;
+ src->class = i;
+ }
}
}
return ret;
}
+static bool _rule_good_for_element_name(const css_selector *selector,
+ css_select_rule_source *src, css_select_state *state)
+{
+ /* If source of rule is element or universal hash, we know the
+ * element name is a match. If it comes from the class or id hash,
+ * we have to test for a match */
+ if (src->source == CSS_SELECT_RULE_SRC_ID ||
+ src->source == CSS_SELECT_RULE_SRC_CLASS) {
+ if (lwc_string_length(selector->data.qname.name) != 1 ||
+ lwc_string_data(
+ selector->data.qname.name)[0] != '*') {
+ bool match;
+ if (lwc_string_caseless_isequal(
+ selector->data.qname.name,
+ state->element.name,
+ &match) == lwc_error_ok &&
+ match == false) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
css_error match_selectors_in_sheet(css_select_ctx *ctx,
const css_stylesheet *sheet, css_select_state *state)
{
@@ -1324,6 +1372,7 @@ css_error match_selectors_in_sheet(css_select_ctx *ctx,
css_selector_hash_iterator class_iterator;
const css_selector **univ_selectors = &empty_selector;
css_selector_hash_iterator univ_iterator;
+ css_select_rule_source src = { CSS_SELECT_RULE_SRC_ELEMENT, 0 };
css_error error;
/* Find hash chain that applies to current node */
@@ -1377,7 +1426,12 @@ css_error match_selectors_in_sheet(css_select_ctx *ctx,
* Pick the least specific/earliest occurring selector.
*/
selector = _selector_next(node_selectors, id_selectors,
- class_selectors, n_classes, univ_selectors);
+ class_selectors, n_classes, univ_selectors,
+ &src);
+
+ /* We know there are selectors pending, so should have a
+ * selector here */
+ assert(selector != NULL);
/* No bytecode if rule body is empty or wholly invalid --
* Only interested in rules with bytecode */
@@ -1387,33 +1441,40 @@ css_error match_selectors_in_sheet(css_select_ctx *ctx,
* current media requirements. */
if (_rule_applies_to_media(selector->rule,
state->media)) {
- error = match_selector_chain(ctx, selector,
- state);
- if (error != CSS_OK)
- goto cleanup;
+ if (_rule_good_for_element_name(selector, &src,
+ state)) {
+ error = match_selector_chain(
+ ctx, selector,
+ state);
+ if (error != CSS_OK)
+ goto cleanup;
+ }
}
}
/* Advance to next selector in whichever chain we extracted
* the processed selector from. */
- if (selector == *node_selectors) {
+ switch (src.source) {
+ case CSS_SELECT_RULE_SRC_ELEMENT:
error = node_iterator(
node_selectors, &node_selectors);
- } else if (selector == *id_selectors) {
+ break;
+
+ case CSS_SELECT_RULE_SRC_ID:
error = id_iterator(
id_selectors, &id_selectors);
- } else if (selector == *univ_selectors) {
+ break;
+
+ case CSS_SELECT_RULE_SRC_UNIVERSAL:
error = univ_iterator(
univ_selectors, &univ_selectors);
- } else {
- for (i = 0; i < n_classes; i++) {
- if (selector == *(class_selectors[i])) {
- error = class_iterator(
- class_selectors[i],
- &class_selectors[i]);
- break;
- }
- }
+ break;
+
+ case CSS_SELECT_RULE_SRC_CLASS:
+ error = class_iterator(
+ class_selectors[src.class],
+ &class_selectors[src.class]);
+ break;
}
if (error != CSS_OK)
--
Cascading Style Sheets library
10 years, 5 months
libcss: branch master updated. 71d28981207beb72b3ca68a9fa24948615a6a9bd
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libcss.git/shortlog/71d28981207beb72b3ca68...
...commit http://git.netsurf-browser.org/libcss.git/commit/71d28981207beb72b3ca68a9...
...tree http://git.netsurf-browser.org/libcss.git/tree/71d28981207beb72b3ca68a9fa...
The branch, master has been updated
via 71d28981207beb72b3ca68a9fa24948615a6a9bd (commit)
from 18aea52cfc1086999ce2463ccd08c5813341d32f (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/commitdiff/71d28981207beb72b3ca...
commit 71d28981207beb72b3ca68a9fa24948615a6a9bd
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Skip empty/broken rules early, before we match their selector chains.
diff --git a/src/select/select.c b/src/select/select.c
index 3543dd5..ba35262 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -1379,13 +1379,19 @@ css_error match_selectors_in_sheet(css_select_ctx *ctx,
selector = _selector_next(node_selectors, id_selectors,
class_selectors, n_classes, univ_selectors);
- /* Ignore any selectors contained in rules which are a child
- * of an @media block that doesn't match the current media
- * requirements. */
- if (_rule_applies_to_media(selector->rule, state->media)) {
- error = match_selector_chain(ctx, selector, state);
- if (error != CSS_OK)
- goto cleanup;
+ /* No bytecode if rule body is empty or wholly invalid --
+ * Only interested in rules with bytecode */
+ if (((css_rule_selector *) selector->rule)->style != NULL) {
+ /* Ignore any selectors contained in rules which are a
+ * child of an @media block that doesn't match the
+ * current media requirements. */
+ if (_rule_applies_to_media(selector->rule,
+ state->media)) {
+ error = match_selector_chain(ctx, selector,
+ state);
+ if (error != CSS_OK)
+ goto cleanup;
+ }
}
/* Advance to next selector in whichever chain we extracted
@@ -1531,10 +1537,6 @@ css_error match_selector_chain(css_select_ctx *ctx,
/* If we got here, then the entire selector chain matched, so cascade */
state->current_specificity = selector->specificity;
- /* No bytecode if rule body is empty or wholly invalid */
- if (((css_rule_selector *) selector->rule)->style == NULL)
- return CSS_OK;
-
/* Ensure that the appropriate computed style exists */
if (state->results->styles[pseudo] == NULL) {
error = css_computed_style_create(ctx->alloc, ctx->pw,
-----------------------------------------------------------------------
Summary of changes:
src/select/select.c | 24 +++++++++++++-----------
1 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/src/select/select.c b/src/select/select.c
index 3543dd5..ba35262 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -1379,13 +1379,19 @@ css_error match_selectors_in_sheet(css_select_ctx *ctx,
selector = _selector_next(node_selectors, id_selectors,
class_selectors, n_classes, univ_selectors);
- /* Ignore any selectors contained in rules which are a child
- * of an @media block that doesn't match the current media
- * requirements. */
- if (_rule_applies_to_media(selector->rule, state->media)) {
- error = match_selector_chain(ctx, selector, state);
- if (error != CSS_OK)
- goto cleanup;
+ /* No bytecode if rule body is empty or wholly invalid --
+ * Only interested in rules with bytecode */
+ if (((css_rule_selector *) selector->rule)->style != NULL) {
+ /* Ignore any selectors contained in rules which are a
+ * child of an @media block that doesn't match the
+ * current media requirements. */
+ if (_rule_applies_to_media(selector->rule,
+ state->media)) {
+ error = match_selector_chain(ctx, selector,
+ state);
+ if (error != CSS_OK)
+ goto cleanup;
+ }
}
/* Advance to next selector in whichever chain we extracted
@@ -1531,10 +1537,6 @@ css_error match_selector_chain(css_select_ctx *ctx,
/* If we got here, then the entire selector chain matched, so cascade */
state->current_specificity = selector->specificity;
- /* No bytecode if rule body is empty or wholly invalid */
- if (((css_rule_selector *) selector->rule)->style == NULL)
- return CSS_OK;
-
/* Ensure that the appropriate computed style exists */
if (state->results->styles[pseudo] == NULL) {
error = css_computed_style_create(ctx->alloc, ctx->pw,
--
Cascading Style Sheets library
10 years, 5 months
netsurf: branch master updated. 607c06c96d0215f383d271afa92e1cfbeb4f50c7
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/607c06c96d0215f383d27...
...commit http://git.netsurf-browser.org/netsurf.git/commit/607c06c96d0215f383d271a...
...tree http://git.netsurf-browser.org/netsurf.git/tree/607c06c96d0215f383d271afa...
The branch, master has been updated
via 607c06c96d0215f383d271afa92e1cfbeb4f50c7 (commit)
via d97eb2f52054e8f77adb16d2a8afbf5fd0e576a1 (commit)
from 836c13f87d792f074c6c5ad7a3da3fa8f7237175 (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/commitdiff/607c06c96d0215f383d...
commit 607c06c96d0215f383d271afa92e1cfbeb4f50c7
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Implemented atari-package target
diff --git a/atari/Makefile.target b/atari/Makefile.target
index 283d634..edc8ce3 100644
--- a/atari/Makefile.target
+++ b/atari/Makefile.target
@@ -86,15 +86,28 @@ EXETARGET := ns$(SUBTARGET)$(PRGSUFFIX)
# Install target
# ----------------------------------------------------------------------------
-ATARI_INSTALL_TARGET_DIR := nsatari.package
-ATARI_RES_DIR := atari/res
+ATARI_TARGET_DIR := netsurf/
+ATARI_RES_DIR := atari/res/
+ATARI_DOC_DIR := atari/doc/
+ATARI_FONT_SOURCE_DIR := /usr/share/fonts/truetype/ttf-bitstream-vera/
+ATARI_FONT_DOC_DIR := /usr/share/doc/ttf-bitstream-vera/
+
+ifeq ($(HOST),mint)
+ STRIP := strip
+ STACK := stack
+endif
+
+ifneq ($(HOST),mint)
+ STRIP := m68k-atari-mint-strip
+ STACK := m68k-atari-mint-stack
+endif
# ----------------------------------------------------------------------------
# Install target
# ----------------------------------------------------------------------------
-install-atari:
+install-atari:
# ----------------------------------------------------------------------------
# Package target
@@ -104,17 +117,59 @@ package-atari: $(PKGNAME)
$(VQ)echo Creating $(PKGNAME)
$(PKGNAME): $(EXETARGET)
- $(Q)rm -rf $(ATARI_INSTALL_TARGET_DIR)
- $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/
- $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf
- $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/doc
- $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/download
- $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/res
- $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/fonts
- #$(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/icons
- $(Q)touch $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/cookies
- $(Q)cp $(ATARI_RES_DIR)/netsurf.rsc $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/netsurf.rsc
- $(Q)cp $(ATARI_RES_DIR)/icons/ $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/icons/ -R
-
-
- $(Q)cp $(EXETARGET) $(ATARI_INSTALL_TARGET_DIR)/netsurf
+ $(Q)$(STRIP) $(EXETARGET)
+ $(Q)$(STACK) -S 256k $(EXETARGET)
+ $(Q)rm -rf $(ATARI_TARGET_DIR)
+ $(Q)rm -rf $(PKGNAME)
+ $(Q)mkdir $(ATARI_TARGET_DIR)
+ $(Q)mkdir $(ATARI_TARGET_DIR)doc
+ $(Q)mkdir $(ATARI_TARGET_DIR)download
+ $(Q)mkdir $(ATARI_TARGET_DIR)res
+ $(Q)mkdir $(ATARI_TARGET_DIR)res/fonts
+ $(Q)mkdir $(ATARI_TARGET_DIR)res/icons
+ $(Q)touch $(ATARI_TARGET_DIR)cookies
+ $(Q)touch $(ATARI_TARGET_DIR)url.db
+
+ $(Q)cp $(ATARI_DOC_DIR)bugs $(ATARI_TARGET_DIR)doc/
+ $(Q)cp $(ATARI_DOC_DIR)faq.txt $(ATARI_TARGET_DIR)doc/
+ $(Q)cp $(ATARI_DOC_DIR)readme.txt $(ATARI_TARGET_DIR)doc/
+ $(Q)cp $(ATARI_DOC_DIR)todo.txt $(ATARI_TARGET_DIR)doc/
+
+# GUI resources:
+ $(Q)cp $(ATARI_RES_DIR)/netsurf.rsc $(ATARI_TARGET_DIR)res/netsurf.rsc
+ $(Q)cp $(ATARI_RES_DIR)/icons -R $(ATARI_TARGET_DIR)res/icons
+ $(Q)cp \!NetSurf/Resources/Icons/content.png -R $(ATARI_TARGET_DIR)res/icons/
+ $(Q)cp \!NetSurf/Resources/Icons/directory.png -R $(ATARI_TARGET_DIR)res/icons/dir.png
+
+ $(Q)cp \!NetSurf/Resources/AdBlock,f79 $(ATARI_TARGET_DIR)res/adblock.css
+ $(Q)cp \!NetSurf/Resources/CSS,f79 $(ATARI_TARGET_DIR)res/default.css
+ $(Q)cp \!NetSurf/Resources/Quirks,f79 $(ATARI_TARGET_DIR)res/quirks.css
+ $(Q)cp \!NetSurf/Resources/internal.css,f79 $(ATARI_TARGET_DIR)res/internal.css
+ $(Q)cp \!NetSurf/Resources/SearchEngines $(ATARI_TARGET_DIR)res/search
+ $(Q)cp \!NetSurf/Resources/ca-bundle $(ATARI_TARGET_DIR)res/cabundle
+ $(Q)cp resources/FatMessages $(ATARI_TARGET_DIR)res/messages
+ $(Q)cp \!NetSurf/Resources/ca-bundle $(ATARI_TARGET_DIR)res/cabundle
+
+# copy "Bitstream Vera" font:
+ $(Q)cp $(ATARI_FONT_DOC_DIR)copyright $(ATARI_TARGET_DIR)res/fonts/
+ $(Q)cp $(ATARI_FONT_DOC_DIR)README.TXT $(ATARI_TARGET_DIR)res/fonts/
+ $(Q)cp $(ATARI_FONT_DOC_DIR)COPYRIGHT-FAQ.TXT $(ATARI_TARGET_DIR)res/fonts/
+
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)Vera.ttf $(ATARI_TARGET_DIR)res/fonts/ss.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraBd.ttf $(ATARI_TARGET_DIR)res/fonts/ssb.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraIt.ttf $(ATARI_TARGET_DIR)res/fonts/ssi.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraBI.ttf $(ATARI_TARGET_DIR)res/fonts/ssib.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraSe.ttf $(ATARI_TARGET_DIR)res/fonts/s.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraSeBd.ttf $(ATARI_TARGET_DIR)res/fonts/sb.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraMono.ttf $(ATARI_TARGET_DIR)res/fonts/mono.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraMoBd.ttf $(ATARI_TARGET_DIR)res/fonts/monob.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraMoIt.ttf $(ATARI_TARGET_DIR)res/fonts/cursive.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraMoBI.ttf $(ATARI_TARGET_DIR)res/fonts/fantasy.ttf
+
+ $(Q)cp $(EXETARGET) $(ATARI_TARGET_DIR)$(EXETARGET)
+
+# zip files
+ $(Q)zip $(PKGNAME) -9 -r ./$(ATARI_TARGET_DIR)
+
+# delete temporary folder
+ $(Q)rm -rf $(ATARI_TARGET_DIR)
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/d97eb2f52054e8f77ad...
commit d97eb2f52054e8f77adb16d2a8afbf5fd0e576a1
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Updated default options
diff --git a/atari/options.h b/atari/options.h
index 3ec2646..56be492 100755
--- a/atari/options.h
+++ b/atari/options.h
@@ -49,13 +49,13 @@
char *tree_icons_path
#define NSOPTION_EXTRA_DEFAULTS \
- .atari_font_driver = (char*)"vdi", \
+ .atari_font_driver = (char*)"freetype", \
.atari_font_monochrom = 0, \
.atari_dither = 1, \
.atari_transparency = 1, \
.atari_image_toolbar_folder = (char*)"default", \
- .atari_image_toolbar = 0, \
- .atari_toolbar_bg = 0xFFFFFF, \
+ .atari_image_toolbar = 1, \
+ .atari_toolbar_bg = 0xbbbbbb, \
.atari_face_sans_serif = NULL, \
.atari_face_sans_serif_bold = NULL, \
.atari_face_sans_serif_italic = NULL, \
-----------------------------------------------------------------------
Summary of changes:
atari/Makefile.target | 89 +++++++++++++++++++++++++++++++++++++++---------
atari/options.h | 6 ++--
2 files changed, 75 insertions(+), 20 deletions(-)
diff --git a/atari/Makefile.target b/atari/Makefile.target
index 283d634..edc8ce3 100644
--- a/atari/Makefile.target
+++ b/atari/Makefile.target
@@ -86,15 +86,28 @@ EXETARGET := ns$(SUBTARGET)$(PRGSUFFIX)
# Install target
# ----------------------------------------------------------------------------
-ATARI_INSTALL_TARGET_DIR := nsatari.package
-ATARI_RES_DIR := atari/res
+ATARI_TARGET_DIR := netsurf/
+ATARI_RES_DIR := atari/res/
+ATARI_DOC_DIR := atari/doc/
+ATARI_FONT_SOURCE_DIR := /usr/share/fonts/truetype/ttf-bitstream-vera/
+ATARI_FONT_DOC_DIR := /usr/share/doc/ttf-bitstream-vera/
+
+ifeq ($(HOST),mint)
+ STRIP := strip
+ STACK := stack
+endif
+
+ifneq ($(HOST),mint)
+ STRIP := m68k-atari-mint-strip
+ STACK := m68k-atari-mint-stack
+endif
# ----------------------------------------------------------------------------
# Install target
# ----------------------------------------------------------------------------
-install-atari:
+install-atari:
# ----------------------------------------------------------------------------
# Package target
@@ -104,17 +117,59 @@ package-atari: $(PKGNAME)
$(VQ)echo Creating $(PKGNAME)
$(PKGNAME): $(EXETARGET)
- $(Q)rm -rf $(ATARI_INSTALL_TARGET_DIR)
- $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/
- $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf
- $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/doc
- $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/download
- $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/res
- $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/fonts
- #$(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/icons
- $(Q)touch $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/cookies
- $(Q)cp $(ATARI_RES_DIR)/netsurf.rsc $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/netsurf.rsc
- $(Q)cp $(ATARI_RES_DIR)/icons/ $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/icons/ -R
-
-
- $(Q)cp $(EXETARGET) $(ATARI_INSTALL_TARGET_DIR)/netsurf
+ $(Q)$(STRIP) $(EXETARGET)
+ $(Q)$(STACK) -S 256k $(EXETARGET)
+ $(Q)rm -rf $(ATARI_TARGET_DIR)
+ $(Q)rm -rf $(PKGNAME)
+ $(Q)mkdir $(ATARI_TARGET_DIR)
+ $(Q)mkdir $(ATARI_TARGET_DIR)doc
+ $(Q)mkdir $(ATARI_TARGET_DIR)download
+ $(Q)mkdir $(ATARI_TARGET_DIR)res
+ $(Q)mkdir $(ATARI_TARGET_DIR)res/fonts
+ $(Q)mkdir $(ATARI_TARGET_DIR)res/icons
+ $(Q)touch $(ATARI_TARGET_DIR)cookies
+ $(Q)touch $(ATARI_TARGET_DIR)url.db
+
+ $(Q)cp $(ATARI_DOC_DIR)bugs $(ATARI_TARGET_DIR)doc/
+ $(Q)cp $(ATARI_DOC_DIR)faq.txt $(ATARI_TARGET_DIR)doc/
+ $(Q)cp $(ATARI_DOC_DIR)readme.txt $(ATARI_TARGET_DIR)doc/
+ $(Q)cp $(ATARI_DOC_DIR)todo.txt $(ATARI_TARGET_DIR)doc/
+
+# GUI resources:
+ $(Q)cp $(ATARI_RES_DIR)/netsurf.rsc $(ATARI_TARGET_DIR)res/netsurf.rsc
+ $(Q)cp $(ATARI_RES_DIR)/icons -R $(ATARI_TARGET_DIR)res/icons
+ $(Q)cp \!NetSurf/Resources/Icons/content.png -R $(ATARI_TARGET_DIR)res/icons/
+ $(Q)cp \!NetSurf/Resources/Icons/directory.png -R $(ATARI_TARGET_DIR)res/icons/dir.png
+
+ $(Q)cp \!NetSurf/Resources/AdBlock,f79 $(ATARI_TARGET_DIR)res/adblock.css
+ $(Q)cp \!NetSurf/Resources/CSS,f79 $(ATARI_TARGET_DIR)res/default.css
+ $(Q)cp \!NetSurf/Resources/Quirks,f79 $(ATARI_TARGET_DIR)res/quirks.css
+ $(Q)cp \!NetSurf/Resources/internal.css,f79 $(ATARI_TARGET_DIR)res/internal.css
+ $(Q)cp \!NetSurf/Resources/SearchEngines $(ATARI_TARGET_DIR)res/search
+ $(Q)cp \!NetSurf/Resources/ca-bundle $(ATARI_TARGET_DIR)res/cabundle
+ $(Q)cp resources/FatMessages $(ATARI_TARGET_DIR)res/messages
+ $(Q)cp \!NetSurf/Resources/ca-bundle $(ATARI_TARGET_DIR)res/cabundle
+
+# copy "Bitstream Vera" font:
+ $(Q)cp $(ATARI_FONT_DOC_DIR)copyright $(ATARI_TARGET_DIR)res/fonts/
+ $(Q)cp $(ATARI_FONT_DOC_DIR)README.TXT $(ATARI_TARGET_DIR)res/fonts/
+ $(Q)cp $(ATARI_FONT_DOC_DIR)COPYRIGHT-FAQ.TXT $(ATARI_TARGET_DIR)res/fonts/
+
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)Vera.ttf $(ATARI_TARGET_DIR)res/fonts/ss.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraBd.ttf $(ATARI_TARGET_DIR)res/fonts/ssb.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraIt.ttf $(ATARI_TARGET_DIR)res/fonts/ssi.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraBI.ttf $(ATARI_TARGET_DIR)res/fonts/ssib.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraSe.ttf $(ATARI_TARGET_DIR)res/fonts/s.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraSeBd.ttf $(ATARI_TARGET_DIR)res/fonts/sb.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraMono.ttf $(ATARI_TARGET_DIR)res/fonts/mono.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraMoBd.ttf $(ATARI_TARGET_DIR)res/fonts/monob.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraMoIt.ttf $(ATARI_TARGET_DIR)res/fonts/cursive.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraMoBI.ttf $(ATARI_TARGET_DIR)res/fonts/fantasy.ttf
+
+ $(Q)cp $(EXETARGET) $(ATARI_TARGET_DIR)$(EXETARGET)
+
+# zip files
+ $(Q)zip $(PKGNAME) -9 -r ./$(ATARI_TARGET_DIR)
+
+# delete temporary folder
+ $(Q)rm -rf $(ATARI_TARGET_DIR)
diff --git a/atari/options.h b/atari/options.h
index 3ec2646..56be492 100755
--- a/atari/options.h
+++ b/atari/options.h
@@ -49,13 +49,13 @@
char *tree_icons_path
#define NSOPTION_EXTRA_DEFAULTS \
- .atari_font_driver = (char*)"vdi", \
+ .atari_font_driver = (char*)"freetype", \
.atari_font_monochrom = 0, \
.atari_dither = 1, \
.atari_transparency = 1, \
.atari_image_toolbar_folder = (char*)"default", \
- .atari_image_toolbar = 0, \
- .atari_toolbar_bg = 0xFFFFFF, \
+ .atari_image_toolbar = 1, \
+ .atari_toolbar_bg = 0xbbbbbb, \
.atari_face_sans_serif = NULL, \
.atari_face_sans_serif_bold = NULL, \
.atari_face_sans_serif_italic = NULL, \
--
NetSurf Browser
10 years, 5 months
netsurf: branch master updated. 836c13f87d792f074c6c5ad7a3da3fa8f7237175
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/836c13f87d792f074c6c5...
...commit http://git.netsurf-browser.org/netsurf.git/commit/836c13f87d792f074c6c5ad...
...tree http://git.netsurf-browser.org/netsurf.git/tree/836c13f87d792f074c6c5ad7a...
The branch, master has been updated
via 836c13f87d792f074c6c5ad7a3da3fa8f7237175 (commit)
from bae65c18a907cd43ad21dc30c2dfa8f0f003eec7 (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/commitdiff/836c13f87d792f074c6...
commit 836c13f87d792f074c6c5ad7a3da3fa8f7237175
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Set default cookie filename when not set.
diff --git a/atari/gui.c b/atari/gui.c
index e500ad6..8478bd3 100755
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -951,13 +951,18 @@ static void gui_init(int argc, char** argv)
LOG(("Enabling core select menu"));
nsoption_set_bool(core_select_menu, true);
-
+
+ LOG(("Loading url.db from: %s", nsoption_charp(url_file) ));
if( strlen(nsoption_charp(url_file)) ){
urldb_load(nsoption_charp(url_file));
- }
+ }
+
+ if (nsoption_charp(cookie_file) == NULL ){
+ nsoption_set_charp(cookie_file, "cookies");
+ }
+ LOG(("Loading cookies from: %s", nsoption_charp(cookie_file) ));
if( strlen(nsoption_charp(cookie_file)) ){
urldb_load_cookies(nsoption_charp(cookie_file));
- LOG(("Loading cookies from: %s", nsoption_charp(cookie_file) ));
}
if (process_cmdline(argc,argv) != true)
-----------------------------------------------------------------------
Summary of changes:
atari/gui.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/atari/gui.c b/atari/gui.c
index e500ad6..8478bd3 100755
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -951,13 +951,18 @@ static void gui_init(int argc, char** argv)
LOG(("Enabling core select menu"));
nsoption_set_bool(core_select_menu, true);
-
+
+ LOG(("Loading url.db from: %s", nsoption_charp(url_file) ));
if( strlen(nsoption_charp(url_file)) ){
urldb_load(nsoption_charp(url_file));
- }
+ }
+
+ if (nsoption_charp(cookie_file) == NULL ){
+ nsoption_set_charp(cookie_file, "cookies");
+ }
+ LOG(("Loading cookies from: %s", nsoption_charp(cookie_file) ));
if( strlen(nsoption_charp(cookie_file)) ){
urldb_load_cookies(nsoption_charp(cookie_file));
- LOG(("Loading cookies from: %s", nsoption_charp(cookie_file) ));
}
if (process_cmdline(argc,argv) != true)
--
NetSurf Browser
10 years, 5 months
netsurf: branch master updated. bae65c18a907cd43ad21dc30c2dfa8f0f003eec7
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/bae65c18a907cd43ad21d...
...commit http://git.netsurf-browser.org/netsurf.git/commit/bae65c18a907cd43ad21dc3...
...tree http://git.netsurf-browser.org/netsurf.git/tree/bae65c18a907cd43ad21dc30c...
The branch, master has been updated
via bae65c18a907cd43ad21dc30c2dfa8f0f003eec7 (commit)
from 10e5597a946bc76a52b761d7652805aa89409a21 (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/commitdiff/bae65c18a907cd43ad2...
commit bae65c18a907cd43ad21dc30c2dfa8f0f003eec7
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Default truetype package is now Bitstream Vera.
Truetype font package can now be switched by defines.
diff --git a/atari/plot/font_freetype.c b/atari/plot/font_freetype.c
index 56d350d..2339cd6 100755
--- a/atari/plot/font_freetype.c
+++ b/atari/plot/font_freetype.c
@@ -53,8 +53,40 @@ cursive.ttf => Cursive
fantasy.ttf => Fantasy
*/
-
-#define DEJAVU_PATH "/usr/share/fonts/truetype/ttf-dejavu/"
+#define FONT_RESOURCE_PATH "fonts/"
+#define DEJAVU_PATH "/usr/share/fonts/truetype/ttf-dejavu/"
+#define BITSTREAM_PATH "/usr/share/fonts/truetype/ttf-bitstream-vera/"
+
+#if !defined(USE_BITSTREAM_FONT_PACKAGE) && !defined(USE_DEJAVU_FONT_PACKAGE)
+# define USE_BITSTREAM_FONT_PACKAGE
+#endif
+
+#if defined(USE_DEJAVU_FONT_PACKAGE)
+# define FONT_PKG_PATH DEJAVU_PATH
+# define FONT_FILE_SANS "DejaVuSans.ttf"
+# define FONT_FILE_SANS_BOLD "DejaVuSans-Bold.ttf"
+# define FONT_FILE_SANS_OBLIQUE "DejaVuSans-Oblique.ttf"
+# define FONT_FILE_SANS_BOLD_OBLIQUE "DejaVuSans-BoldOblique.ttf"
+# define FONT_FILE_SERIF "DejaVuSerif.ttf"
+# define FONT_FILE_SERIF_BOLD "DejaVuSerif-Bold.ttf"
+# define FONT_FILE_MONO "DejaVuSansMono.ttf"
+# define FONT_FILE_MONO_BOLD "DejaVuSerif-Bold.ttf"
+# define FONT_FILE_OBLIQUE "DejaVuSansMono-Oblique.ttf"
+# define FONT_FILE_FANTASY "DejaVuSerifCondensed-Bold.ttf"
+#elif defined(USE_BITSTREAM_FONT_PACKAGE)
+# define FONT_PKG_PATH BITSTREAM_PATH
+# define FONT_FILE_SANS "Vera.ttf"
+# define FONT_FILE_SANS_BOLD "VeraBd.ttf"
+# define FONT_FILE_SANS_OBLIQUE "VeraIt.ttf"
+# define FONT_FILE_SANS_BOLD_OBLIQUE "VeraBI.ttf"
+# define FONT_FILE_SERIF "VeraSe.ttf"
+# define FONT_FILE_SERIF_BOLD "VeraSeBd.ttf"
+# define FONT_FILE_MONO "VeraMono.ttf"
+# define FONT_FILE_MONO_BOLD "VeraMoBd.ttf"
+# define FONT_FILE_OBLIQUE "VeraMoIt.ttf"
+# define FONT_FILE_FANTASY "VeraMoBI.ttf"
+
+#endif
#define CACHE_SIZE 2048
#define CACHE_MIN_SIZE (100 * 1024)
@@ -212,9 +244,11 @@ static void ft_fill_scalar(const plot_font_style_t *fstyle, FTC_Scaler srec)
srec->width = srec->height = (fstyle->size * 64) / FONT_SIZE_SCALE;
srec->pixel = 0;
- /* calculate x/y resolution, when nscss_screen_dpi isn't available */
- /* 72 is an good value. */
- srec->x_res = srec->y_res = FIXTOINT(nscss_screen_dpi);
+ /* calculate x/y resolution, when nscss_screen_dpi isn't available */
+ /* 72 is an good value. */
+ /* TODO: because nscss_screen_dpi is to large, calculate that value */
+ /* by VDI values. */
+ srec->x_res = srec->y_res = 72; // FIXTOINT(nscss_screen_dpi);
}
static FT_Glyph ft_getglyph(const plot_font_style_t *fstyle, uint32_t ucs4)
@@ -240,14 +274,13 @@ static FT_Glyph ft_getglyph(const plot_font_style_t *fstyle, uint32_t ucs4)
}
-
/* initialise font handling */
static bool ft_font_init(void)
{
FT_Error error;
FT_ULong max_cache_size;
FT_UInt max_faces = 6;
- int i;
+ int i;
/* freetype library initialise */
error = FT_Init_FreeType( &library );
@@ -286,8 +319,8 @@ static bool ft_font_init(void)
font_faces[FONT_FACE_SANS_SERIF] = NULL;
font_faces[FONT_FACE_SANS_SERIF] = ft_new_face(
nsoption_charp(atari_face_sans_serif),
- "fonts/ss.ttf",
- DEJAVU_PATH"DejaVuSans.ttf"
+ FONT_RESOURCE_PATH "ss.ttf",
+ FONT_PKG_PATH FONT_FILE_SANS
);
if (font_faces[FONT_FACE_SANS_SERIF] == NULL) {
LOG(("Could not find default font (code %d)\n", error));
@@ -299,56 +332,56 @@ static bool ft_font_init(void)
/* Sans Serif Bold*/
font_faces[FONT_FACE_SANS_SERIF_BOLD] =
ft_new_face(nsoption_charp(atari_face_sans_serif_bold),
- "fonts/ssb.ttf",
- DEJAVU_PATH"DejaVuSans-Bold.ttf");
+ FONT_RESOURCE_PATH "ssb.ttf",
+ FONT_PKG_PATH FONT_FILE_SANS_BOLD);
/* Sans Serif Italic */
font_faces[FONT_FACE_SANS_SERIF_ITALIC] =
ft_new_face(nsoption_charp(atari_face_sans_serif_italic),
- "fonts/ssi.ttf",
- DEJAVU_PATH"DejaVuSans-Oblique.ttf");
+ FONT_RESOURCE_PATH "ssi.ttf",
+ FONT_PKG_PATH FONT_FILE_SANS_OBLIQUE);
/* Sans Serif Italic Bold */
font_faces[FONT_FACE_SANS_SERIF_ITALIC_BOLD] =
ft_new_face(nsoption_charp(atari_face_sans_serif_italic_bold),
- "fonts/ssib.ttf",
- DEJAVU_PATH"DejaVuSans-BoldOblique.ttf");
+ FONT_RESOURCE_PATH "ssib.ttf",
+ FONT_PKG_PATH FONT_FILE_SANS_BOLD_OBLIQUE);
/* Monospaced */
font_faces[FONT_FACE_MONOSPACE] =
ft_new_face(nsoption_charp(atari_face_monospace),
- "fonts/mono.ttf",
- DEJAVU_PATH"DejaVuSansMono.ttf");
+ FONT_RESOURCE_PATH "mono.ttf",
+ FONT_PKG_PATH FONT_FILE_MONO);
/* Mospaced Bold */
font_faces[FONT_FACE_MONOSPACE_BOLD] =
ft_new_face(nsoption_charp(atari_face_monospace_bold),
- "fonts/monob.ttf",
- DEJAVU_PATH"DejaVuSansMono-Bold.ttf");
+ FONT_RESOURCE_PATH "monob.ttf",
+ FONT_PKG_PATH FONT_FILE_MONO_BOLD);
/* Serif */
font_faces[FONT_FACE_SERIF] =
ft_new_face(nsoption_charp(atari_face_serif),
- "fonts/s.ttf",
- DEJAVU_PATH"DejaVuSerif.ttf");
+ FONT_RESOURCE_PATH "s.ttf",
+ FONT_PKG_PATH FONT_FILE_SERIF);
/* Serif Bold */
font_faces[FONT_FACE_SERIF_BOLD] =
ft_new_face(nsoption_charp(atari_face_serif_bold),
- "fonts/sb.ttf",
- DEJAVU_PATH"DejaVuSerif-Bold.ttf");
+ FONT_RESOURCE_PATH "sb.ttf",
+ FONT_PKG_PATH FONT_FILE_SERIF_BOLD);
/* Cursive */
font_faces[FONT_FACE_CURSIVE] =
ft_new_face(nsoption_charp(atari_face_cursive),
- "fonts/cursive.ttf",
- DEJAVU_PATH"DejaVuSansMono-Oblique.ttf");
+ FONT_RESOURCE_PATH "cursive.ttf",
+ FONT_PKG_PATH FONT_FILE_OBLIQUE);
/* Fantasy */
font_faces[FONT_FACE_FANTASY] =
ft_new_face(nsoption_charp(atari_face_fantasy),
- "fonts/fantasy.ttf",
- DEJAVU_PATH"DejaVuSerifCondensed-Bold.ttf");
+ FONT_RESOURCE_PATH "fantasy.ttf",
+ FONT_PKG_PATH FONT_FILE_FANTASY);
for (i=1; i<FONT_FACE_COUNT; i++) {
if (font_faces[i] == NULL){
-----------------------------------------------------------------------
Summary of changes:
atari/plot/font_freetype.c | 87 ++++++++++++++++++++++++++++++--------------
1 files changed, 60 insertions(+), 27 deletions(-)
diff --git a/atari/plot/font_freetype.c b/atari/plot/font_freetype.c
index 56d350d..2339cd6 100755
--- a/atari/plot/font_freetype.c
+++ b/atari/plot/font_freetype.c
@@ -53,8 +53,40 @@ cursive.ttf => Cursive
fantasy.ttf => Fantasy
*/
-
-#define DEJAVU_PATH "/usr/share/fonts/truetype/ttf-dejavu/"
+#define FONT_RESOURCE_PATH "fonts/"
+#define DEJAVU_PATH "/usr/share/fonts/truetype/ttf-dejavu/"
+#define BITSTREAM_PATH "/usr/share/fonts/truetype/ttf-bitstream-vera/"
+
+#if !defined(USE_BITSTREAM_FONT_PACKAGE) && !defined(USE_DEJAVU_FONT_PACKAGE)
+# define USE_BITSTREAM_FONT_PACKAGE
+#endif
+
+#if defined(USE_DEJAVU_FONT_PACKAGE)
+# define FONT_PKG_PATH DEJAVU_PATH
+# define FONT_FILE_SANS "DejaVuSans.ttf"
+# define FONT_FILE_SANS_BOLD "DejaVuSans-Bold.ttf"
+# define FONT_FILE_SANS_OBLIQUE "DejaVuSans-Oblique.ttf"
+# define FONT_FILE_SANS_BOLD_OBLIQUE "DejaVuSans-BoldOblique.ttf"
+# define FONT_FILE_SERIF "DejaVuSerif.ttf"
+# define FONT_FILE_SERIF_BOLD "DejaVuSerif-Bold.ttf"
+# define FONT_FILE_MONO "DejaVuSansMono.ttf"
+# define FONT_FILE_MONO_BOLD "DejaVuSerif-Bold.ttf"
+# define FONT_FILE_OBLIQUE "DejaVuSansMono-Oblique.ttf"
+# define FONT_FILE_FANTASY "DejaVuSerifCondensed-Bold.ttf"
+#elif defined(USE_BITSTREAM_FONT_PACKAGE)
+# define FONT_PKG_PATH BITSTREAM_PATH
+# define FONT_FILE_SANS "Vera.ttf"
+# define FONT_FILE_SANS_BOLD "VeraBd.ttf"
+# define FONT_FILE_SANS_OBLIQUE "VeraIt.ttf"
+# define FONT_FILE_SANS_BOLD_OBLIQUE "VeraBI.ttf"
+# define FONT_FILE_SERIF "VeraSe.ttf"
+# define FONT_FILE_SERIF_BOLD "VeraSeBd.ttf"
+# define FONT_FILE_MONO "VeraMono.ttf"
+# define FONT_FILE_MONO_BOLD "VeraMoBd.ttf"
+# define FONT_FILE_OBLIQUE "VeraMoIt.ttf"
+# define FONT_FILE_FANTASY "VeraMoBI.ttf"
+
+#endif
#define CACHE_SIZE 2048
#define CACHE_MIN_SIZE (100 * 1024)
@@ -212,9 +244,11 @@ static void ft_fill_scalar(const plot_font_style_t *fstyle, FTC_Scaler srec)
srec->width = srec->height = (fstyle->size * 64) / FONT_SIZE_SCALE;
srec->pixel = 0;
- /* calculate x/y resolution, when nscss_screen_dpi isn't available */
- /* 72 is an good value. */
- srec->x_res = srec->y_res = FIXTOINT(nscss_screen_dpi);
+ /* calculate x/y resolution, when nscss_screen_dpi isn't available */
+ /* 72 is an good value. */
+ /* TODO: because nscss_screen_dpi is to large, calculate that value */
+ /* by VDI values. */
+ srec->x_res = srec->y_res = 72; // FIXTOINT(nscss_screen_dpi);
}
static FT_Glyph ft_getglyph(const plot_font_style_t *fstyle, uint32_t ucs4)
@@ -240,14 +274,13 @@ static FT_Glyph ft_getglyph(const plot_font_style_t *fstyle, uint32_t ucs4)
}
-
/* initialise font handling */
static bool ft_font_init(void)
{
FT_Error error;
FT_ULong max_cache_size;
FT_UInt max_faces = 6;
- int i;
+ int i;
/* freetype library initialise */
error = FT_Init_FreeType( &library );
@@ -286,8 +319,8 @@ static bool ft_font_init(void)
font_faces[FONT_FACE_SANS_SERIF] = NULL;
font_faces[FONT_FACE_SANS_SERIF] = ft_new_face(
nsoption_charp(atari_face_sans_serif),
- "fonts/ss.ttf",
- DEJAVU_PATH"DejaVuSans.ttf"
+ FONT_RESOURCE_PATH "ss.ttf",
+ FONT_PKG_PATH FONT_FILE_SANS
);
if (font_faces[FONT_FACE_SANS_SERIF] == NULL) {
LOG(("Could not find default font (code %d)\n", error));
@@ -299,56 +332,56 @@ static bool ft_font_init(void)
/* Sans Serif Bold*/
font_faces[FONT_FACE_SANS_SERIF_BOLD] =
ft_new_face(nsoption_charp(atari_face_sans_serif_bold),
- "fonts/ssb.ttf",
- DEJAVU_PATH"DejaVuSans-Bold.ttf");
+ FONT_RESOURCE_PATH "ssb.ttf",
+ FONT_PKG_PATH FONT_FILE_SANS_BOLD);
/* Sans Serif Italic */
font_faces[FONT_FACE_SANS_SERIF_ITALIC] =
ft_new_face(nsoption_charp(atari_face_sans_serif_italic),
- "fonts/ssi.ttf",
- DEJAVU_PATH"DejaVuSans-Oblique.ttf");
+ FONT_RESOURCE_PATH "ssi.ttf",
+ FONT_PKG_PATH FONT_FILE_SANS_OBLIQUE);
/* Sans Serif Italic Bold */
font_faces[FONT_FACE_SANS_SERIF_ITALIC_BOLD] =
ft_new_face(nsoption_charp(atari_face_sans_serif_italic_bold),
- "fonts/ssib.ttf",
- DEJAVU_PATH"DejaVuSans-BoldOblique.ttf");
+ FONT_RESOURCE_PATH "ssib.ttf",
+ FONT_PKG_PATH FONT_FILE_SANS_BOLD_OBLIQUE);
/* Monospaced */
font_faces[FONT_FACE_MONOSPACE] =
ft_new_face(nsoption_charp(atari_face_monospace),
- "fonts/mono.ttf",
- DEJAVU_PATH"DejaVuSansMono.ttf");
+ FONT_RESOURCE_PATH "mono.ttf",
+ FONT_PKG_PATH FONT_FILE_MONO);
/* Mospaced Bold */
font_faces[FONT_FACE_MONOSPACE_BOLD] =
ft_new_face(nsoption_charp(atari_face_monospace_bold),
- "fonts/monob.ttf",
- DEJAVU_PATH"DejaVuSansMono-Bold.ttf");
+ FONT_RESOURCE_PATH "monob.ttf",
+ FONT_PKG_PATH FONT_FILE_MONO_BOLD);
/* Serif */
font_faces[FONT_FACE_SERIF] =
ft_new_face(nsoption_charp(atari_face_serif),
- "fonts/s.ttf",
- DEJAVU_PATH"DejaVuSerif.ttf");
+ FONT_RESOURCE_PATH "s.ttf",
+ FONT_PKG_PATH FONT_FILE_SERIF);
/* Serif Bold */
font_faces[FONT_FACE_SERIF_BOLD] =
ft_new_face(nsoption_charp(atari_face_serif_bold),
- "fonts/sb.ttf",
- DEJAVU_PATH"DejaVuSerif-Bold.ttf");
+ FONT_RESOURCE_PATH "sb.ttf",
+ FONT_PKG_PATH FONT_FILE_SERIF_BOLD);
/* Cursive */
font_faces[FONT_FACE_CURSIVE] =
ft_new_face(nsoption_charp(atari_face_cursive),
- "fonts/cursive.ttf",
- DEJAVU_PATH"DejaVuSansMono-Oblique.ttf");
+ FONT_RESOURCE_PATH "cursive.ttf",
+ FONT_PKG_PATH FONT_FILE_OBLIQUE);
/* Fantasy */
font_faces[FONT_FACE_FANTASY] =
ft_new_face(nsoption_charp(atari_face_fantasy),
- "fonts/fantasy.ttf",
- DEJAVU_PATH"DejaVuSerifCondensed-Bold.ttf");
+ FONT_RESOURCE_PATH "fantasy.ttf",
+ FONT_PKG_PATH FONT_FILE_FANTASY);
for (i=1; i<FONT_FACE_COUNT; i++) {
if (font_faces[i] == NULL){
--
NetSurf Browser
10 years, 5 months
netsurf: branch master updated. 10e5597a946bc76a52b761d7652805aa89409a21
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/10e5597a946bc76a52b76...
...commit http://git.netsurf-browser.org/netsurf.git/commit/10e5597a946bc76a52b761d...
...tree http://git.netsurf-browser.org/netsurf.git/tree/10e5597a946bc76a52b761d76...
The branch, master has been updated
via 10e5597a946bc76a52b761d7652805aa89409a21 (commit)
from 2988193e44c183542a8f7cf52dc63f76ec3c5249 (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/commitdiff/10e5597a946bc76a52b...
commit 10e5597a946bc76a52b761d7652805aa89409a21
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Removed junk
diff --git a/atari/plot/font_freetype.c b/atari/plot/font_freetype.c
index ad21d0f..56d350d 100755
--- a/atari/plot/font_freetype.c
+++ b/atari/plot/font_freetype.c
@@ -53,18 +53,6 @@ cursive.ttf => Cursive
fantasy.ttf => Fantasy
*/
- /* Cursive */
- font_faces[FONT_FACE_CURSIVE] =
- ft_new_face(nsoption_charp(atari_face_cursive),
- "fonts/cursive.ttf",
- DEJAVU_PATH"DejaVuSansMono-Oblique.ttf");
-
- /* Fantasy */
- font_faces[FONT_FACE_FANTASY] =
- ft_new_face(nsoption_charp(atari_face_fantasy),
- "fonts/fantasy.ttf",
-
-
#define DEJAVU_PATH "/usr/share/fonts/truetype/ttf-dejavu/"
-----------------------------------------------------------------------
Summary of changes:
atari/plot/font_freetype.c | 12 ------------
1 files changed, 0 insertions(+), 12 deletions(-)
diff --git a/atari/plot/font_freetype.c b/atari/plot/font_freetype.c
index ad21d0f..56d350d 100755
--- a/atari/plot/font_freetype.c
+++ b/atari/plot/font_freetype.c
@@ -53,18 +53,6 @@ cursive.ttf => Cursive
fantasy.ttf => Fantasy
*/
- /* Cursive */
- font_faces[FONT_FACE_CURSIVE] =
- ft_new_face(nsoption_charp(atari_face_cursive),
- "fonts/cursive.ttf",
- DEJAVU_PATH"DejaVuSansMono-Oblique.ttf");
-
- /* Fantasy */
- font_faces[FONT_FACE_FANTASY] =
- ft_new_face(nsoption_charp(atari_face_fantasy),
- "fonts/fantasy.ttf",
-
-
#define DEJAVU_PATH "/usr/share/fonts/truetype/ttf-dejavu/"
--
NetSurf Browser
10 years, 5 months
netsurf: branch master updated. 2988193e44c183542a8f7cf52dc63f76ec3c5249
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/2988193e44c183542a8f7...
...commit http://git.netsurf-browser.org/netsurf.git/commit/2988193e44c183542a8f7cf...
...tree http://git.netsurf-browser.org/netsurf.git/tree/2988193e44c183542a8f7cf52...
The branch, master has been updated
via 2988193e44c183542a8f7cf52dc63f76ec3c5249 (commit)
from c5a84e17f78ff82d98af155c9d075e7b0f4978cf (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/commitdiff/2988193e44c183542a8...
commit 2988193e44c183542a8f7cf52dc63f76ec3c5249
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Documented font loading / font names.
diff --git a/atari/plot/font_freetype.c b/atari/plot/font_freetype.c
index 8eb15e2..ad21d0f 100755
--- a/atari/plot/font_freetype.c
+++ b/atari/plot/font_freetype.c
@@ -18,6 +18,7 @@
*/
#ifdef WITH_FREETYPE_FONT_DRIVER
+
#include <ft2build.h>
#include FT_CACHE_H
@@ -25,12 +26,52 @@
#include "atari/plot/plot.h"
#include "atari/plot/font_freetype.h"
#include "atari/findfile.h"
-
+
+/* -------------------------------------------------------------------------- */
+/* Font Loading & Mapping scheme */
+/* -------------------------------------------------------------------------- */
+/*
+
+Truetype fonts are loaded in the following priority order:
+
+1. Option values.
+2. default resouce names (8.3 compatible).
+3. default font package installation path.
+
+
+Resource font names & their meanings:
+--------------------------------------------
+s.ttf => Serif
+sb.ttf => Serif Bold
+ss.ttf => Sans Serif *Default Font
+ssb.ttf => Sans Serif Bold
+ssi.ttf => Sans Serif Italic
+ssib.ttf => Sans Serif Italic Bold
+mono.ttf => Monospaced
+monob.ttf => Monospaced Bold
+cursive.ttf => Cursive
+fantasy.ttf => Fantasy
+*/
+
+ /* Cursive */
+ font_faces[FONT_FACE_CURSIVE] =
+ ft_new_face(nsoption_charp(atari_face_cursive),
+ "fonts/cursive.ttf",
+ DEJAVU_PATH"DejaVuSansMono-Oblique.ttf");
+
+ /* Fantasy */
+ font_faces[FONT_FACE_FANTASY] =
+ ft_new_face(nsoption_charp(atari_face_fantasy),
+ "fonts/fantasy.ttf",
+
+
+
#define DEJAVU_PATH "/usr/share/fonts/truetype/ttf-dejavu/"
+
#define CACHE_SIZE 2048
#define CACHE_MIN_SIZE (100 * 1024)
#define BOLD_WEIGHT 700
-
+
extern css_fixed nscss_screen_dpi;
extern unsigned long atari_plot_flags;
-----------------------------------------------------------------------
Summary of changes:
atari/plot/font_freetype.c | 45 ++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/atari/plot/font_freetype.c b/atari/plot/font_freetype.c
index 8eb15e2..ad21d0f 100755
--- a/atari/plot/font_freetype.c
+++ b/atari/plot/font_freetype.c
@@ -18,6 +18,7 @@
*/
#ifdef WITH_FREETYPE_FONT_DRIVER
+
#include <ft2build.h>
#include FT_CACHE_H
@@ -25,12 +26,52 @@
#include "atari/plot/plot.h"
#include "atari/plot/font_freetype.h"
#include "atari/findfile.h"
-
+
+/* -------------------------------------------------------------------------- */
+/* Font Loading & Mapping scheme */
+/* -------------------------------------------------------------------------- */
+/*
+
+Truetype fonts are loaded in the following priority order:
+
+1. Option values.
+2. default resouce names (8.3 compatible).
+3. default font package installation path.
+
+
+Resource font names & their meanings:
+--------------------------------------------
+s.ttf => Serif
+sb.ttf => Serif Bold
+ss.ttf => Sans Serif *Default Font
+ssb.ttf => Sans Serif Bold
+ssi.ttf => Sans Serif Italic
+ssib.ttf => Sans Serif Italic Bold
+mono.ttf => Monospaced
+monob.ttf => Monospaced Bold
+cursive.ttf => Cursive
+fantasy.ttf => Fantasy
+*/
+
+ /* Cursive */
+ font_faces[FONT_FACE_CURSIVE] =
+ ft_new_face(nsoption_charp(atari_face_cursive),
+ "fonts/cursive.ttf",
+ DEJAVU_PATH"DejaVuSansMono-Oblique.ttf");
+
+ /* Fantasy */
+ font_faces[FONT_FACE_FANTASY] =
+ ft_new_face(nsoption_charp(atari_face_fantasy),
+ "fonts/fantasy.ttf",
+
+
+
#define DEJAVU_PATH "/usr/share/fonts/truetype/ttf-dejavu/"
+
#define CACHE_SIZE 2048
#define CACHE_MIN_SIZE (100 * 1024)
#define BOLD_WEIGHT 700
-
+
extern css_fixed nscss_screen_dpi;
extern unsigned long atari_plot_flags;
--
NetSurf Browser
10 years, 5 months
netsurf: branch master updated. c5a84e17f78ff82d98af155c9d075e7b0f4978cf
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/c5a84e17f78ff82d98af1...
...commit http://git.netsurf-browser.org/netsurf.git/commit/c5a84e17f78ff82d98af155...
...tree http://git.netsurf-browser.org/netsurf.git/tree/c5a84e17f78ff82d98af155c9...
The branch, master has been updated
via c5a84e17f78ff82d98af155c9d075e7b0f4978cf (commit)
from ff2f1f1836f4a3b33bbfaafbb2bbdc2c1dba4d63 (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/commitdiff/c5a84e17f78ff82d98a...
commit c5a84e17f78ff82d98af155c9d075e7b0f4978cf
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Merged some features from framebuffer freetype impl.
- Set default font for font faces which failed to
load.
- Lookup more font faces (Cursive, Fantasy).
diff --git a/atari/plot/font_freetype.c b/atari/plot/font_freetype.c
index 8b526a7..8eb15e2 100755
--- a/atari/plot/font_freetype.c
+++ b/atari/plot/font_freetype.c
@@ -23,11 +23,16 @@
#include "desktop/options.h"
#include "atari/plot/plot.h"
-#include "atari/plot/font_freetype.h"
+#include "atari/plot/font_freetype.h"
+#include "atari/findfile.h"
+#define DEJAVU_PATH "/usr/share/fonts/truetype/ttf-dejavu/"
+#define CACHE_SIZE 2048
+#define CACHE_MIN_SIZE (100 * 1024)
+#define BOLD_WEIGHT 700
-#define DEJAVU_PATH "/usr/share/fonts/truetype/ttf-dejavu/"
-
+extern css_fixed nscss_screen_dpi;
+
extern unsigned long atari_plot_flags;
extern int atari_plot_vdi_handle;
@@ -123,50 +128,64 @@ ft_new_face(const char *option, const char *resname, const char *fontfile)
newf = font_faces[FONT_FACE_DEFAULT]; /* use default */
}
return newf;
-}
-
-static void ft_fill_scalar(const plot_font_style_t *fstyle, FTC_Scaler srec)
-{
- int selected_face = FONT_FACE_DEFAULT;
-
- switch (fstyle->family) {
-/*
- case PLOT_FONT_FAMILY_CURSIVE:
- break;
- case PLOT_FONT_FAMILY_FANTASY:
- break;
-*/
- case PLOT_FONT_FAMILY_SERIF:
- if (fstyle->weight >= 700)
- selected_face = FONT_FACE_SERIF_BOLD;
- else
- selected_face = FONT_FACE_SERIF;
-
- break;
-
- case PLOT_FONT_FAMILY_MONOSPACE:
- selected_face = FONT_FACE_MONOSPACE;
- break;
-
- case PLOT_FONT_FAMILY_SANS_SERIF:
- default:
- if ((fstyle->flags & FONTF_ITALIC) || (fstyle->flags & FONTF_OBLIQUE)) {
- if (fstyle->weight >= 700)
- selected_face = FONT_FACE_SANS_SERIF_ITALIC_BOLD;
- else
- selected_face = FONT_FACE_SANS_SERIF_ITALIC;
- } else {
- if (fstyle->weight >= 700)
- selected_face = FONT_FACE_SANS_SERIF_BOLD;
- else
- selected_face = FONT_FACE_SANS_SERIF;
- }
- }
-
- srec->face_id = (FTC_FaceID)font_faces[selected_face];
- srec->width = srec->height = (fstyle->size * 64) / FONT_SIZE_SCALE;
- srec->pixel = 0;
- srec->x_res = srec->y_res = 72;
+}
+
+static void ft_fill_scalar(const plot_font_style_t *fstyle, FTC_Scaler srec)
+{
+ int selected_face = FONT_FACE_DEFAULT;
+
+ switch (fstyle->family) {
+
+ case PLOT_FONT_FAMILY_SERIF:
+ if (fstyle->weight >= BOLD_WEIGHT) {
+ selected_face = FONT_FACE_SERIF_BOLD;
+ } else {
+ selected_face = FONT_FACE_SERIF;
+ }
+ break;
+
+ case PLOT_FONT_FAMILY_MONOSPACE:
+ if (fstyle->weight >= BOLD_WEIGHT) {
+ selected_face = FONT_FACE_MONOSPACE_BOLD;
+ } else {
+ selected_face = FONT_FACE_MONOSPACE;
+ }
+ break;
+
+ case PLOT_FONT_FAMILY_CURSIVE:
+ selected_face = FONT_FACE_CURSIVE;
+ break;
+
+ case PLOT_FONT_FAMILY_FANTASY:
+ selected_face = FONT_FACE_FANTASY;
+ break;
+
+ case PLOT_FONT_FAMILY_SANS_SERIF:
+ default:
+ if ((fstyle->flags & FONTF_ITALIC) ||
+ (fstyle->flags & FONTF_OBLIQUE)) {
+ if (fstyle->weight >= BOLD_WEIGHT) {
+ selected_face = FONT_FACE_SANS_SERIF_ITALIC_BOLD;
+ } else {
+ selected_face = FONT_FACE_SANS_SERIF_ITALIC;
+ }
+ } else {
+ if (fstyle->weight >= BOLD_WEIGHT) {
+ selected_face = FONT_FACE_SANS_SERIF_BOLD;
+ } else {
+ selected_face = FONT_FACE_SANS_SERIF;
+ }
+ }
+ }
+
+ srec->face_id = (FTC_FaceID)font_faces[selected_face];
+
+ srec->width = srec->height = (fstyle->size * 64) / FONT_SIZE_SCALE;
+ srec->pixel = 0;
+
+ /* calculate x/y resolution, when nscss_screen_dpi isn't available */
+ /* 72 is an good value. */
+ srec->x_res = srec->y_res = FIXTOINT(nscss_screen_dpi);
}
static FT_Glyph ft_getglyph(const plot_font_style_t *fstyle, uint32_t ucs4)
@@ -198,7 +217,8 @@ static bool ft_font_init(void)
{
FT_Error error;
FT_ULong max_cache_size;
- FT_UInt max_faces = 6;
+ FT_UInt max_faces = 6;
+ int i;
/* freetype library initialise */
error = FT_Init_FreeType( &library );
@@ -206,8 +226,12 @@ static bool ft_font_init(void)
LOG(("Freetype could not initialised (code %d)\n", error));
return false;
}
-
- max_cache_size = 2 * 1024 *1024; /* 2MB should be enough */
+
+ /* set the Glyph cache size up */
+ max_cache_size = CACHE_SIZE * 1024;
+ if (max_cache_size < CACHE_MIN_SIZE) {
+ max_cache_size = CACHE_MIN_SIZE;
+ }
/* cache manager initialise */
error = FTC_Manager_New(library,
@@ -225,7 +249,11 @@ static bool ft_font_init(void)
error = FTC_CMapCache_New(ft_cmanager, &ft_cmap_cache);
error = FTC_ImageCache_New(ft_cmanager, &ft_image_cache);
-
+
+ /* Optain font faces */
+
+
+ /* Default font, Sans Serif */
font_faces[FONT_FACE_SANS_SERIF] = NULL;
font_faces[FONT_FACE_SANS_SERIF] = ft_new_face(
nsoption_charp(atari_face_sans_serif),
@@ -234,55 +262,70 @@ static bool ft_font_init(void)
);
if (font_faces[FONT_FACE_SANS_SERIF] == NULL) {
LOG(("Could not find default font (code %d)\n", error));
- FTC_Manager_Done(ft_cmanager );
+ FTC_Manager_Done(ft_cmanager);
FT_Done_FreeType(library);
return false;
}
-
+
+ /* Sans Serif Bold*/
font_faces[FONT_FACE_SANS_SERIF_BOLD] =
ft_new_face(nsoption_charp(atari_face_sans_serif_bold),
"fonts/ssb.ttf",
- DEJAVU_PATH"DejaVuSans-Bold.ttf");
-
+ DEJAVU_PATH"DejaVuSans-Bold.ttf");
+
+ /* Sans Serif Italic */
font_faces[FONT_FACE_SANS_SERIF_ITALIC] =
ft_new_face(nsoption_charp(atari_face_sans_serif_italic),
"fonts/ssi.ttf",
DEJAVU_PATH"DejaVuSans-Oblique.ttf");
-
+
+ /* Sans Serif Italic Bold */
font_faces[FONT_FACE_SANS_SERIF_ITALIC_BOLD] =
ft_new_face(nsoption_charp(atari_face_sans_serif_italic_bold),
"fonts/ssib.ttf",
DEJAVU_PATH"DejaVuSans-BoldOblique.ttf");
-
+
+ /* Monospaced */
font_faces[FONT_FACE_MONOSPACE] =
ft_new_face(nsoption_charp(atari_face_monospace),
"fonts/mono.ttf",
DEJAVU_PATH"DejaVuSansMono.ttf");
-
+
+ /* Mospaced Bold */
font_faces[FONT_FACE_MONOSPACE_BOLD] =
ft_new_face(nsoption_charp(atari_face_monospace_bold),
"fonts/monob.ttf",
DEJAVU_PATH"DejaVuSansMono-Bold.ttf");
-
+
+ /* Serif */
font_faces[FONT_FACE_SERIF] =
ft_new_face(nsoption_charp(atari_face_serif),
"fonts/s.ttf",
DEJAVU_PATH"DejaVuSerif.ttf");
-
+
+ /* Serif Bold */
font_faces[FONT_FACE_SERIF_BOLD] =
ft_new_face(nsoption_charp(atari_face_serif_bold),
"fonts/sb.ttf",
DEJAVU_PATH"DejaVuSerif-Bold.ttf");
-
+
+ /* Cursive */
font_faces[FONT_FACE_CURSIVE] =
ft_new_face(nsoption_charp(atari_face_cursive),
"fonts/cursive.ttf",
DEJAVU_PATH"DejaVuSansMono-Oblique.ttf");
-
+
+ /* Fantasy */
font_faces[FONT_FACE_FANTASY] =
ft_new_face(nsoption_charp(atari_face_fantasy),
"fonts/fantasy.ttf",
DEJAVU_PATH"DejaVuSerifCondensed-Bold.ttf");
+
+ for (i=1; i<FONT_FACE_COUNT; i++) {
+ if (font_faces[i] == NULL){
+ font_faces[i] = font_faces[FONT_FACE_SANS_SERIF];
+ }
+ }
return true;
}
diff --git a/atari/plot/font_freetype.h b/atari/plot/font_freetype.h
index bca6d99..1e64ebc 100755
--- a/atari/plot/font_freetype.h
+++ b/atari/plot/font_freetype.h
@@ -48,4 +48,4 @@ struct font_desc {
/* extern int ft_load_type; */
int ctor_font_plotter_freetype( FONT_PLOTTER self );
-#endif
\ No newline at end of file
+#endif
-----------------------------------------------------------------------
Summary of changes:
atari/plot/font_freetype.c | 167 +++++++++++++++++++++++++++----------------
atari/plot/font_freetype.h | 2 +-
2 files changed, 106 insertions(+), 63 deletions(-)
diff --git a/atari/plot/font_freetype.c b/atari/plot/font_freetype.c
index 8b526a7..8eb15e2 100755
--- a/atari/plot/font_freetype.c
+++ b/atari/plot/font_freetype.c
@@ -23,11 +23,16 @@
#include "desktop/options.h"
#include "atari/plot/plot.h"
-#include "atari/plot/font_freetype.h"
+#include "atari/plot/font_freetype.h"
+#include "atari/findfile.h"
+#define DEJAVU_PATH "/usr/share/fonts/truetype/ttf-dejavu/"
+#define CACHE_SIZE 2048
+#define CACHE_MIN_SIZE (100 * 1024)
+#define BOLD_WEIGHT 700
-#define DEJAVU_PATH "/usr/share/fonts/truetype/ttf-dejavu/"
-
+extern css_fixed nscss_screen_dpi;
+
extern unsigned long atari_plot_flags;
extern int atari_plot_vdi_handle;
@@ -123,50 +128,64 @@ ft_new_face(const char *option, const char *resname, const char *fontfile)
newf = font_faces[FONT_FACE_DEFAULT]; /* use default */
}
return newf;
-}
-
-static void ft_fill_scalar(const plot_font_style_t *fstyle, FTC_Scaler srec)
-{
- int selected_face = FONT_FACE_DEFAULT;
-
- switch (fstyle->family) {
-/*
- case PLOT_FONT_FAMILY_CURSIVE:
- break;
- case PLOT_FONT_FAMILY_FANTASY:
- break;
-*/
- case PLOT_FONT_FAMILY_SERIF:
- if (fstyle->weight >= 700)
- selected_face = FONT_FACE_SERIF_BOLD;
- else
- selected_face = FONT_FACE_SERIF;
-
- break;
-
- case PLOT_FONT_FAMILY_MONOSPACE:
- selected_face = FONT_FACE_MONOSPACE;
- break;
-
- case PLOT_FONT_FAMILY_SANS_SERIF:
- default:
- if ((fstyle->flags & FONTF_ITALIC) || (fstyle->flags & FONTF_OBLIQUE)) {
- if (fstyle->weight >= 700)
- selected_face = FONT_FACE_SANS_SERIF_ITALIC_BOLD;
- else
- selected_face = FONT_FACE_SANS_SERIF_ITALIC;
- } else {
- if (fstyle->weight >= 700)
- selected_face = FONT_FACE_SANS_SERIF_BOLD;
- else
- selected_face = FONT_FACE_SANS_SERIF;
- }
- }
-
- srec->face_id = (FTC_FaceID)font_faces[selected_face];
- srec->width = srec->height = (fstyle->size * 64) / FONT_SIZE_SCALE;
- srec->pixel = 0;
- srec->x_res = srec->y_res = 72;
+}
+
+static void ft_fill_scalar(const plot_font_style_t *fstyle, FTC_Scaler srec)
+{
+ int selected_face = FONT_FACE_DEFAULT;
+
+ switch (fstyle->family) {
+
+ case PLOT_FONT_FAMILY_SERIF:
+ if (fstyle->weight >= BOLD_WEIGHT) {
+ selected_face = FONT_FACE_SERIF_BOLD;
+ } else {
+ selected_face = FONT_FACE_SERIF;
+ }
+ break;
+
+ case PLOT_FONT_FAMILY_MONOSPACE:
+ if (fstyle->weight >= BOLD_WEIGHT) {
+ selected_face = FONT_FACE_MONOSPACE_BOLD;
+ } else {
+ selected_face = FONT_FACE_MONOSPACE;
+ }
+ break;
+
+ case PLOT_FONT_FAMILY_CURSIVE:
+ selected_face = FONT_FACE_CURSIVE;
+ break;
+
+ case PLOT_FONT_FAMILY_FANTASY:
+ selected_face = FONT_FACE_FANTASY;
+ break;
+
+ case PLOT_FONT_FAMILY_SANS_SERIF:
+ default:
+ if ((fstyle->flags & FONTF_ITALIC) ||
+ (fstyle->flags & FONTF_OBLIQUE)) {
+ if (fstyle->weight >= BOLD_WEIGHT) {
+ selected_face = FONT_FACE_SANS_SERIF_ITALIC_BOLD;
+ } else {
+ selected_face = FONT_FACE_SANS_SERIF_ITALIC;
+ }
+ } else {
+ if (fstyle->weight >= BOLD_WEIGHT) {
+ selected_face = FONT_FACE_SANS_SERIF_BOLD;
+ } else {
+ selected_face = FONT_FACE_SANS_SERIF;
+ }
+ }
+ }
+
+ srec->face_id = (FTC_FaceID)font_faces[selected_face];
+
+ srec->width = srec->height = (fstyle->size * 64) / FONT_SIZE_SCALE;
+ srec->pixel = 0;
+
+ /* calculate x/y resolution, when nscss_screen_dpi isn't available */
+ /* 72 is an good value. */
+ srec->x_res = srec->y_res = FIXTOINT(nscss_screen_dpi);
}
static FT_Glyph ft_getglyph(const plot_font_style_t *fstyle, uint32_t ucs4)
@@ -198,7 +217,8 @@ static bool ft_font_init(void)
{
FT_Error error;
FT_ULong max_cache_size;
- FT_UInt max_faces = 6;
+ FT_UInt max_faces = 6;
+ int i;
/* freetype library initialise */
error = FT_Init_FreeType( &library );
@@ -206,8 +226,12 @@ static bool ft_font_init(void)
LOG(("Freetype could not initialised (code %d)\n", error));
return false;
}
-
- max_cache_size = 2 * 1024 *1024; /* 2MB should be enough */
+
+ /* set the Glyph cache size up */
+ max_cache_size = CACHE_SIZE * 1024;
+ if (max_cache_size < CACHE_MIN_SIZE) {
+ max_cache_size = CACHE_MIN_SIZE;
+ }
/* cache manager initialise */
error = FTC_Manager_New(library,
@@ -225,7 +249,11 @@ static bool ft_font_init(void)
error = FTC_CMapCache_New(ft_cmanager, &ft_cmap_cache);
error = FTC_ImageCache_New(ft_cmanager, &ft_image_cache);
-
+
+ /* Optain font faces */
+
+
+ /* Default font, Sans Serif */
font_faces[FONT_FACE_SANS_SERIF] = NULL;
font_faces[FONT_FACE_SANS_SERIF] = ft_new_face(
nsoption_charp(atari_face_sans_serif),
@@ -234,55 +262,70 @@ static bool ft_font_init(void)
);
if (font_faces[FONT_FACE_SANS_SERIF] == NULL) {
LOG(("Could not find default font (code %d)\n", error));
- FTC_Manager_Done(ft_cmanager );
+ FTC_Manager_Done(ft_cmanager);
FT_Done_FreeType(library);
return false;
}
-
+
+ /* Sans Serif Bold*/
font_faces[FONT_FACE_SANS_SERIF_BOLD] =
ft_new_face(nsoption_charp(atari_face_sans_serif_bold),
"fonts/ssb.ttf",
- DEJAVU_PATH"DejaVuSans-Bold.ttf");
-
+ DEJAVU_PATH"DejaVuSans-Bold.ttf");
+
+ /* Sans Serif Italic */
font_faces[FONT_FACE_SANS_SERIF_ITALIC] =
ft_new_face(nsoption_charp(atari_face_sans_serif_italic),
"fonts/ssi.ttf",
DEJAVU_PATH"DejaVuSans-Oblique.ttf");
-
+
+ /* Sans Serif Italic Bold */
font_faces[FONT_FACE_SANS_SERIF_ITALIC_BOLD] =
ft_new_face(nsoption_charp(atari_face_sans_serif_italic_bold),
"fonts/ssib.ttf",
DEJAVU_PATH"DejaVuSans-BoldOblique.ttf");
-
+
+ /* Monospaced */
font_faces[FONT_FACE_MONOSPACE] =
ft_new_face(nsoption_charp(atari_face_monospace),
"fonts/mono.ttf",
DEJAVU_PATH"DejaVuSansMono.ttf");
-
+
+ /* Mospaced Bold */
font_faces[FONT_FACE_MONOSPACE_BOLD] =
ft_new_face(nsoption_charp(atari_face_monospace_bold),
"fonts/monob.ttf",
DEJAVU_PATH"DejaVuSansMono-Bold.ttf");
-
+
+ /* Serif */
font_faces[FONT_FACE_SERIF] =
ft_new_face(nsoption_charp(atari_face_serif),
"fonts/s.ttf",
DEJAVU_PATH"DejaVuSerif.ttf");
-
+
+ /* Serif Bold */
font_faces[FONT_FACE_SERIF_BOLD] =
ft_new_face(nsoption_charp(atari_face_serif_bold),
"fonts/sb.ttf",
DEJAVU_PATH"DejaVuSerif-Bold.ttf");
-
+
+ /* Cursive */
font_faces[FONT_FACE_CURSIVE] =
ft_new_face(nsoption_charp(atari_face_cursive),
"fonts/cursive.ttf",
DEJAVU_PATH"DejaVuSansMono-Oblique.ttf");
-
+
+ /* Fantasy */
font_faces[FONT_FACE_FANTASY] =
ft_new_face(nsoption_charp(atari_face_fantasy),
"fonts/fantasy.ttf",
DEJAVU_PATH"DejaVuSerifCondensed-Bold.ttf");
+
+ for (i=1; i<FONT_FACE_COUNT; i++) {
+ if (font_faces[i] == NULL){
+ font_faces[i] = font_faces[FONT_FACE_SANS_SERIF];
+ }
+ }
return true;
}
diff --git a/atari/plot/font_freetype.h b/atari/plot/font_freetype.h
index bca6d99..1e64ebc 100755
--- a/atari/plot/font_freetype.h
+++ b/atari/plot/font_freetype.h
@@ -48,4 +48,4 @@ struct font_desc {
/* extern int ft_load_type; */
int ctor_font_plotter_freetype( FONT_PLOTTER self );
-#endif
\ No newline at end of file
+#endif
--
NetSurf Browser
10 years, 5 months
netsurf: branch vince/genbind created. eb8612ec758807ed3e53d7fb39ce5a93f5ddfd4e
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/eb8612ec758807ed3e53d...
...commit http://git.netsurf-browser.org/netsurf.git/commit/eb8612ec758807ed3e53d7f...
...tree http://git.netsurf-browser.org/netsurf.git/tree/eb8612ec758807ed3e53d7fb3...
The branch, vince/genbind has been created
at eb8612ec758807ed3e53d7fb39ce5a93f5ddfd4e (commit)
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/eb8612ec758807ed3e5...
commit eb8612ec758807ed3e53d7fb39ce5a93f5ddfd4e
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
initial webIDL to jsapi binding generator lexer and parser
diff --git a/javascript/idl/Makefile b/javascript/idl/Makefile
new file mode 100644
index 0000000..a6a3eba
--- /dev/null
+++ b/javascript/idl/Makefile
@@ -0,0 +1,17 @@
+#
+
+.PHONY: all clean
+
+all: genbind
+
+genbind: webidl-parser.o webidl-lexer.o
+ $(CC) -o $@ $^
+
+webidl-parser.c: webidl.y
+ bison -t $<
+
+webidl-lexer.c: webidl.l
+ flex $<
+
+clean:
+ $(RM) genbind webidl-parser.c webidl-lexer.c webidl-lexer.h webidl-parser.h *.o
diff --git a/javascript/idl/document.idl b/javascript/idl/document.idl
new file mode 100644
index 0000000..afab566
--- /dev/null
+++ b/javascript/idl/document.idl
@@ -0,0 +1,37 @@
+interface Document : Node {
+ readonly attribute DOMImplementation implementation;
+ readonly attribute DOMString URL;
+ readonly attribute DOMString documentURI;
+ readonly attribute DOMString compatMode;
+ readonly attribute DOMString characterSet;
+ readonly attribute DOMString contentType;
+
+ readonly attribute DocumentType? doctype;
+ readonly attribute Element? documentElement;
+ HTMLCollection getElementsByTagName(DOMString localName);
+ HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
+ HTMLCollection getElementsByClassName(DOMString classNames);
+ Element? getElementById(DOMString elementId);
+
+ Element createElement(DOMString localName);
+ Element createElementNS(DOMString? namespace, DOMString qualifiedName);
+ DocumentFragment createDocumentFragment();
+ Text createTextNode(DOMString data);
+ Comment createComment(DOMString data);
+ ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
+
+ Node importNode(Node node, optional boolean deep = true);
+ Node adoptNode(Node node);
+
+ Event createEvent(DOMString interface);
+
+ Range createRange();
+
+ // NodeFilter.SHOW_ALL = 0xFFFFFFFF
+ NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
+ TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
+
+ // NEW
+ void prepend((Node or DOMString)... nodes);
+ void append((Node or DOMString)... nodes);
+};
diff --git a/javascript/idl/eventtarget.idl b/javascript/idl/eventtarget.idl
new file mode 100644
index 0000000..2cfd15e
--- /dev/null
+++ b/javascript/idl/eventtarget.idl
@@ -0,0 +1,5 @@
+interface EventTarget {
+ void addEventListener(DOMString type, EventListener? callback, optional boolean capture = false);
+ void removeEventListener(DOMString type, EventListener? callback, optional boolean capture = false);
+ boolean dispatchEvent(Event event);
+};
diff --git a/javascript/idl/htmldocument.idl b/javascript/idl/htmldocument.idl
new file mode 100644
index 0000000..923aa08
--- /dev/null
+++ b/javascript/idl/htmldocument.idl
@@ -0,0 +1,108 @@
+[OverrideBuiltins]
+partial interface Document {
+ // resource metadata management
+ [PutForwards=href] readonly attribute Location? location;
+ attribute DOMString domain;
+ readonly attribute DOMString referrer;
+ attribute DOMString cookie;
+ readonly attribute DOMString lastModified;
+ readonly attribute DOMString readyState;
+
+ // DOM tree accessors
+ getter object (DOMString name);
+ attribute DOMString title;
+ attribute DOMString dir;
+ attribute HTMLElement? body;
+ readonly attribute HTMLHeadElement? head;
+ readonly attribute HTMLCollection images;
+ readonly attribute HTMLCollection embeds;
+ readonly attribute HTMLCollection plugins;
+ readonly attribute HTMLCollection links;
+ readonly attribute HTMLCollection forms;
+ readonly attribute HTMLCollection scripts;
+ NodeList getElementsByName(DOMString elementName);
+ NodeList getItems(optional DOMString typeNames); // microdata
+ readonly attribute DOMElementMap cssElementMap;
+
+ // dynamic markup insertion
+ Document open(optional DOMString type, optional DOMString replace);
+ WindowProxy open(DOMString url, DOMString name, DOMString features, optional boolean replace);
+ void close();
+ void write(DOMString... text);
+ void writeln(DOMString... text);
+
+ // user interaction
+ readonly attribute WindowProxy? defaultView;
+ readonly attribute Element? activeElement;
+ boolean hasFocus();
+ attribute DOMString designMode;
+ boolean execCommand(DOMString commandId);
+ boolean execCommand(DOMString commandId, boolean showUI);
+ boolean execCommand(DOMString commandId, boolean showUI, DOMString value);
+ boolean queryCommandEnabled(DOMString commandId);
+ boolean queryCommandIndeterm(DOMString commandId);
+ boolean queryCommandState(DOMString commandId);
+ boolean queryCommandSupported(DOMString commandId);
+ DOMString queryCommandValue(DOMString commandId);
+ readonly attribute HTMLCollection commands;
+
+ // event handler IDL attributes
+ attribute EventHandler onabort;
+ attribute EventHandler onblur;
+ attribute EventHandler oncancel;
+ attribute EventHandler oncanplay;
+ attribute EventHandler oncanplaythrough;
+ attribute EventHandler onchange;
+ attribute EventHandler onclick;
+ attribute EventHandler onclose;
+ attribute EventHandler oncontextmenu;
+ attribute EventHandler oncuechange;
+ attribute EventHandler ondblclick;
+ attribute EventHandler ondrag;
+ attribute EventHandler ondragend;
+ attribute EventHandler ondragenter;
+ attribute EventHandler ondragleave;
+ attribute EventHandler ondragover;
+ attribute EventHandler ondragstart;
+ attribute EventHandler ondrop;
+ attribute EventHandler ondurationchange;
+ attribute EventHandler onemptied;
+ attribute EventHandler onended;
+ attribute OnErrorEventHandler onerror;
+ attribute EventHandler onfocus;
+ attribute EventHandler oninput;
+ attribute EventHandler oninvalid;
+ attribute EventHandler onkeydown;
+ attribute EventHandler onkeypress;
+ attribute EventHandler onkeyup;
+ attribute EventHandler onload;
+ attribute EventHandler onloadeddata;
+ attribute EventHandler onloadedmetadata;
+ attribute EventHandler onloadstart;
+ attribute EventHandler onmousedown;
+ attribute EventHandler onmousemove;
+ attribute EventHandler onmouseout;
+ attribute EventHandler onmouseover;
+ attribute EventHandler onmouseup;
+ attribute EventHandler onmousewheel;
+ attribute EventHandler onpause;
+ attribute EventHandler onplay;
+ attribute EventHandler onplaying;
+ attribute EventHandler onprogress;
+ attribute EventHandler onratechange;
+ attribute EventHandler onreset;
+ attribute EventHandler onscroll;
+ attribute EventHandler onseeked;
+ attribute EventHandler onseeking;
+ attribute EventHandler onselect;
+ attribute EventHandler onshow;
+ attribute EventHandler onstalled;
+ attribute EventHandler onsubmit;
+ attribute EventHandler onsuspend;
+ attribute EventHandler ontimeupdate;
+ attribute EventHandler onvolumechange;
+ attribute EventHandler onwaiting;
+
+ // special event handler IDL attributes that only apply to Document objects
+ [LenientThis] attribute EventHandler onreadystatechange;
+};
diff --git a/javascript/idl/webidl.l b/javascript/idl/webidl.l
new file mode 100644
index 0000000..9518876
--- /dev/null
+++ b/javascript/idl/webidl.l
@@ -0,0 +1,321 @@
+/*
+ * Copyright 2011, 2012 Esrille Inc.
+ * Copyright 2008-2010 Google Inc.
+ * Copyright 2007 Nintendo Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/*
+ * This is a unicode capable lexer for web IDL mostly derived from:
+ *
+ * W3C WEB IDL - http://www.w3.org/TR/WebIDL/ (especially the grammar
+ * in apendix A)
+ *
+ * The ECMA script spec -
+ * http://ecma-international.org/ecma-262/5.1/#sec-7.2 (expecially
+ * section 7.2 for unicode value handling)
+ *
+ * Some ideas taken from the es-operating-system esidl tool
+ */
+
+/* lexer options */
+%option outfile="webidl-lexer.c"
+%option header-file="webidl-lexer.h"
+%option never-interactive
+%option yylineno
+%option bison-bridge
+%option bison-locations
+
+/* header block */
+%{
+/*
+ * webidl.l file
+ * To generate the lexical analyzer run: "flex webidl.l"
+ *
+ */
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "webidl-parser.h"
+
+#define YY_USER_ACTION yylloc->first_line = yylloc->last_line; \
+ yylloc->first_column = yylloc->last_column + 1; \
+ yylloc->last_column += yyleng;
+
+static bool pp_mode = false;
+
+%}
+
+/* regular definitions */
+
+ /* ecmascript section 7.2 defines whitespace http://ecma-international.org/ecma-262/5.1/#sec-7.2
+ * Web IDL appendix A has the IDL grammar http://www.w3.org/TR/WebIDL/#idl-grammar
+ */
+
+ /* we do not define space, line feed, carriage return, tab, vertical
+ * tab or form feed here as they are the standard C escapes
+ */
+
+ /* other Unicode “space separator” */
+USP (\xe1\x9a\x80)|(\xe1\xa0\x8e)|(\xe2\x80[\x80-\x8a])|(\xe2\x80\xaf)|(\xe2\x81\x9f)|(\xe3\x80\x80)
+
+/* Line separator \u2028 */
+LS (\xe2\x80\xa8)
+
+/* paragraph separator \u2029 */
+PS (\xe2\x80\xa9)
+
+/* non breaking space \u00A0 */
+NBSP (\xc2\xa0)
+
+/* Lu is the set of Unicode characters up to \u00ff */
+/* Lu (\xc3[\x80-\x9e])*/
+
+/* Ll is set of Unicode lower case letters up to \u00ff */
+/* Ll (\xc2[\xaa\xb5\xba])|(\xc3[\x9f-\xbf]) */
+
+/* Unicode string excluding USP, LS, PS, Lu and Ll */
+/*Unicode ([\xc4-\xdf][\x80-\xbf])|(\xe0[\xa0-\xbf][\x80-\xbf])|(\e1[\x80-\x99][\x80-\xbf])|(\e1\9a[\x81-\xbf])|(\e1[\x9b-\x9f][\x80-\xbf])|(\e1\xa0[\x80-\x8d\x8f-\xbf])|(\e1[\xa1-\xbf][\x80-\xbf])|(\e2\x80[\x8b-\xa7\xaa-\xbf])|(\e2\x81[\x80-\x9e\xa0-\xbf])|(\e2[\x82-\xbf][\x80-\xbf])|(\e3\x80[\x81-\xbf])|(\e3[\x81-\xbf][\x80-\xbf])|([\xe4-\xec][\x80-\xbf][\x80-\xbf])|(\xed[\x80-\x9f][\x80-\xbf])|([\xee-\xef][\x80-\xbf][\x80-\xbf])|(\xf0[\x90-\xbf][\x80-\xbf][\x80-\xbf])|([\xf1-\xf3][\x80-\xbf][\x80-\xbf][\x80-\xbf])|(\xf4[\x80-\x8f][\x80-\xbf][\x80-\xbf])*/
+
+/* web idl grammar for whitespace matches single and multiline
+ * comments too. Here there are separate definitions for both single
+ * and multiline comments.
+ */
+whitespace ([ \t\v\f]|{NBSP}|{USP})
+multicomment \/\*(([^*])|(\*[^/]))*\*\/
+singlecomment \/\/
+
+lineend ([\n\r]|{LS}|{PS})
+HexDigit [0-9A-Fa-f]
+DecimalDigit [0-9]
+HexIntegerLiteral 0(x|X){HexDigit}+
+DecimalLiteral ({DecimalIntegerLiteral}\.[0-9]*{ExponentPart}?)|(\.[0-9]+{ExponentPart}?)|({DecimalIntegerLiteral}{ExponentPart}?)
+
+ExponentPart (e|E)[\+\-]?[0-9]+
+DecimalIntegerLiteral 0|([1-9][0-9]*)
+OctalIntegerLiteral (0[0-8]+)
+
+SingleEscapeCharacter ['\"\\bfnrtv]
+NonEscapeCharacter [^'\"\\bfnrtv\n\r]
+HexEscapeSequence x{HexDigit}{2}
+UnicodeEscapeSequence u{HexDigit}{4}
+CharacterEscapeSequence {SingleEscapeCharacter}|{NonEscapeCharacter}
+EscapeSequence {CharacterEscapeSequence}|0|{HexEscapeSequence}|{UnicodeEscapeSequence}
+DoubleStringCharacter ([^\"\\\n\r]|\\{EscapeSequence})
+Identifier [A-Z_a-z][0-9A-Z_a-z]*
+
+PoundSign ^{whitespace}*#
+
+%%
+
+{whitespace} ++yylloc->last_column; /* skip whitespace */
+
+{lineend} if (yytext[0] == '\n') {
+ /* update position counts */
+ ++yylloc->last_line;
+ yylloc->last_column = 0;
+ if (pp_mode) {
+ /* in preprocessor mode emit an EOL token */
+ pp_mode = false;
+ return EOL;
+ }
+ }
+
+ /* PrimitiveType terminals */
+boolean return BOOLEAN;
+
+byte return BYTE;
+
+octet return OCTET;
+
+
+ /* ArgumentNameKeyword terminals */
+
+attribute return ATTRIBUTE;
+
+callback return CALLBACK;
+
+const return CONST;
+
+creator return CREATOR;
+
+deleter return DELETER;
+
+dictionary return DICTIONARY;
+
+enum return ENUM;
+
+exception return EXCEPTION;
+
+getter return GETTER;
+
+implements return IMPLEMENTS;
+
+inherit return INHERIT;
+
+interface return INTERFACE;
+
+legacycaller return LEGACYCALLER;
+
+partial return PARTIAL;
+
+setter return SETTER;
+
+static return STATIC;
+
+stringifier return STRINGIFIER;
+
+typedef return TYPEDEF;
+
+unrestricted return UNRESTRICTED;
+
+ /* Other terminals - single characters are handled by the final . rule */
+
+"..." return ELLIPSIS;
+
+Date return DATE;
+
+DOMString return STRING; /* dom strings are just strings */
+
+Infinity return INFINITY;
+
+NaN return NAN;
+
+any return ANY;
+
+double return DOUBLE;
+
+false return FALSE;
+
+float return FLOAT;
+
+long return LONG;
+
+null return NULL_LITERAL;
+
+object yylval->name = strdup(yytext); return IDENTIFIER;
+
+or return OR;
+
+optional return OPTIONAL;
+
+sequence return SEQUENCE;
+
+short return SHORT;
+
+true return TRUE;
+
+unsigned return UNSIGNED;
+
+void return VOID;
+
+ /* Terminals not in the Other and ArgumentNameKeyword terminal lists */
+
+readonly return READONLY;
+
+
+ /*
+getraises {
+
+ return GETRAISES;
+ }
+in {
+
+ return IN;
+ }
+module {
+
+ return MODULE;
+ }
+native {
+
+ return NATIVE;
+ }
+omittable {
+
+ return OMITTABLE;
+ }
+
+raises {
+
+ return RAISES;
+ }
+setraises {
+
+ return SETRAISES;
+ }
+string {
+
+ return STRING;
+ }
+ */
+
+{Identifier} {
+ // A leading "_" is used to escape an identifier from looking like a reserved word terminal.
+ yylval->name = (yytext[0] == '_') ? strdup(yytext + 1) : strdup(yytext);
+ return IDENTIFIER;
+ }
+
+{DecimalIntegerLiteral} yylval->name = strdup(yytext); return INTEGER_LITERAL;
+
+{OctalIntegerLiteral} yylval->name = strdup(yytext); return INTEGER_LITERAL;
+
+{HexIntegerLiteral} yylval->name = strdup(yytext); return INTEGER_LITERAL;
+
+{DecimalLiteral} yylval->name = strdup(yytext); return FLOATING_PT_LITERAL;
+
+\"{DoubleStringCharacter}*\" yylval->name = strdup(yytext); return STRING_LITERAL;
+
+{multicomment} {
+ /* multicomment */
+ char* s = yytext;
+ for (; *s; ++s)
+ {
+ if (*s == '\n')
+ {
+ ++yylloc->last_line;
+ yylloc->last_column = 0;
+ }
+ else
+ {
+ ++yylloc->last_column;
+ }
+ }
+ if (strncmp(yytext, "/**", 3) == 0)
+ {
+ /* Javadoc style comment */
+ yylval->name = strdup(yytext);
+ return JAVADOC;
+ }
+ }
+
+{singlecomment} {
+ /* singlecomment */
+ int c;
+
+ do {
+ c = input();
+ } while (c != '\n' && c != '\r' && c != EOF);
+ ++yylloc->last_line;
+ yylloc->last_column = 0;
+ }
+
+{PoundSign} pp_mode = true; return POUND_SIGN;
+
+. return (int) yytext[0];
+
+%%
diff --git a/javascript/idl/webidl.y b/javascript/idl/webidl.y
new file mode 100644
index 0000000..a584a8f
--- /dev/null
+++ b/javascript/idl/webidl.y
@@ -0,0 +1,146 @@
+/*
+ * Copyright 2011, 2012 Esrille Inc.
+ * Copyright 2008-2010 Google Inc.
+ * Copyright 2007 Nintendo Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * These coded instructions, statements, and computer programs contain
+ * software derived from the following specifications:
+ *
+ * W3C,
+ * Web IDL,
+ * W3C Candidate Recommendation 19 April 2012.
+ * http://dev.w3.org/2006/webapi/WebIDL/
+ */
+
+%{
+
+/*
+ * Parser.y file
+ * To generate the parser run: "bison webidl.y"
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include "webidl-parser.h"
+#include "webidl-lexer.h"
+
+ extern int yydebug;
+
+void yyerror(const char *str)
+{
+ fprintf(stderr,"error: %s\n",str);
+}
+
+int yywrap()
+{
+ return 1;
+}
+
+main()
+{
+ yydebug = 1;
+ yyparse();
+}
+
+
+%}
+
+%output "webidl-parser.c"
+%defines "webidl-parser.h"
+
+%locations
+%define api.pure
+
+%union
+{
+ int attr;
+ char* name;
+}
+
+
+%token ANY
+%token ATTRIBUTE
+%token BOOLEAN
+%token BYTE
+%token CALLBACK
+%token LEGACYCALLER
+%token CONST
+%token CREATOR
+%token DATE
+%token DELETER
+%token DICTIONARY
+%token DOUBLE
+%token ELLIPSIS
+%token ENUM
+%token EOL
+%token EXCEPTION
+%token FALSE
+%token FLOAT
+%token GETRAISES
+%token GETTER
+%token IMPLEMENTS
+%token IN
+%token INFINITY
+%token INHERIT
+%token INTERFACE
+%token LONG
+%token MODULE
+%token NAN
+%token NATIVE
+%token NULL_LITERAL
+%token OBJECT
+%token OCTET
+%token OMITTABLE
+%token OPTIONAL
+%token OR
+%token PARTIAL
+%token RAISES
+%token READONLY
+%token SETRAISES
+%token SETTER
+%token SEQUENCE
+%token SHORT
+%token STATIC
+%token STRING
+%token STRINGIFIER
+%token TRUE
+%token TYPEDEF
+%token UNRESTRICTED
+%token UNSIGNED
+%token VOID
+
+%token POUND_SIGN
+
+%token <name> IDENTIFIER
+%token <name> INTEGER_LITERAL
+%token <name> FLOATING_PT_LITERAL
+%token <name> STRING_LITERAL
+%token <name> JAVADOC
+
+%%
+
+anything:
+ |
+ anything any;
+
+any: ANY | ATTRIBUTE | BOOLEAN | BYTE | CALLBACK | LEGACYCALLER | CONST | CREATOR | DATE | DELETER | DICTIONARY | DOUBLE | ELLIPSIS | ENUM | EOL | EXCEPTION | FALSE | FLOAT | GETRAISES | GETTER | IMPLEMENTS | IN | INFINITY | INHERIT | INTERFACE | LONG | MODULE | NAN | NATIVE | NULL_LITERAL | OBJECT | OCTET | OMITTABLE | OPTIONAL | OR | PARTIAL | RAISES | READONLY | SETRAISES | SETTER | SEQUENCE | SHORT | STATIC | STRING | STRINGIFIER | TRUE | TYPEDEF | UNRESTRICTED | UNSIGNED | VOID | POUND_SIGN | IDENTIFIER | INTEGER_LITERAL | FLOATING_PT_LITERAL | STRING_LITERAL | JAVADOC | ':' | ';' | '{' | '}' | '(' | ')' | '[' | ']' | '<' | '>'| '=' | ',' | '?'
+;
+
+
+
+%%
diff --git a/javascript/idl/webidl.y.orig b/javascript/idl/webidl.y.orig
new file mode 100644
index 0000000..0050421
--- /dev/null
+++ b/javascript/idl/webidl.y.orig
@@ -0,0 +1,1814 @@
+/*
+ * Copyright 2011, 2012 Esrille Inc.
+ * Copyright 2008-2010 Google Inc.
+ * Copyright 2007 Nintendo Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * These coded instructions, statements, and computer programs contain
+ * software derived from the following specifications:
+ *
+ * W3C,
+ * Web IDL,
+ * W3C Candidate Recommendation 19 April 2012.
+ * http://dev.w3.org/2006/webapi/WebIDL/
+ */
+
+%{
+
+#include "esidl.h"
+
+extern FILE* yyin;
+
+extern "C" int yyparse(void);
+
+void yyerror(const char* message, ...);
+
+extern "C" int yywrap()
+{
+ return 1;
+}
+
+static long stdinOffset;
+static long stdinLine;
+
+%}
+
+%locations
+
+%union
+{
+ int attr;
+ char* name;
+ Node* node;
+ NodeList* nodeList;
+ std::list<std::string>* nameList;
+}
+
+%{
+
+int yylex();
+
+%}
+
+%token ANY
+%token ATTRIBUTE
+%token BOOLEAN
+%token BYTE
+%token CALLBACK
+%token CALLER
+%token CONST
+%token CREATOR
+%token DATE
+%token DELETER
+%token DICTIONARY
+%token DOUBLE
+%token ELLIPSIS
+%token ENUM
+%token EOL
+%token EXCEPTION
+%token FALSE
+%token FLOAT
+%token GETRAISES
+%token GETTER
+%token IMPLEMENTS
+%token IN
+%token INFINITY
+%token INHERIT
+%token INTERFACE
+%token LONG
+%token MODULE
+%token NAN
+%token NATIVE
+%token NULL_LITERAL
+%token OBJECT
+%token OCTET
+%token OMITTABLE
+%token OPTIONAL
+%token OR
+%token PARTIAL
+%token RAISES
+%token READONLY
+%token SETRAISES
+%token SETTER
+%token SEQUENCE
+%token SHORT
+%token STATIC
+%token STRING
+%token STRINGIFIER
+%token TRUE
+%token TYPEDEF
+%token UNRESTRICTED
+%token UNSIGNED
+%token VOID
+
+%token OP_SCOPE
+%token OP_SHL
+%token OP_SHR
+
+%token POUND_SIGN
+
+%token <name> IDENTIFIER
+%token <name> INTEGER_LITERAL
+%token <name> FLOATING_PT_LITERAL
+%token <name> STRING_LITERAL
+%token <name> JAVADOC
+
+%type <node> Definition
+%type <node> Module
+%type <node> CallbackOrInterface
+%type <node> CallbackRestOrInterface
+%type <node> Interface
+%type <node> PartialInterface
+%type <node> InterfaceMember
+%type <node> Dictionary
+%type <node> DictionaryMember
+%type <node> Default
+%type <node> DefaultValue
+%type <node> Exception
+%type <node> Inheritance
+%type <node> Enum
+%type <node> EnumValueList
+%type <node> EnumValues
+%type <node> CallbackRest
+%type <node> Typedef
+%type <node> ImplementsStatement
+%type <node> Const
+%type <node> ConstExpr
+%type <node> Literal
+%type <node> BooleanLiteral
+%type <node> FloatLiteral
+%type <node> AttributeOrOperation
+%type <node> StringifierAttributeOrOperation
+%type <node> Attribute
+%type <attr> Inherit
+%type <attr> ReadOnly
+%type <node> GetRaises
+%type <node> SetRaises
+%type <node> Operation
+%type <attr> Qualifiers
+%type <attr> Specials
+%type <attr> Special
+%type <node> OperationRest
+%type <name> OptionalIdentifier
+%type <node> Raises
+%type <node> ExceptionList
+%type <node> OptionalOrRequiredArgument
+%type <name> ArgumentName
+%type <attr> Ellipsis
+%type <node> ExceptionMember
+%type <node> ExceptionField
+%type <nodeList> ExtendedAttributeList
+%type <nodeList> ExtendedAttributes
+%type <name> ArgumentNameKeyword
+%type <node> Type
+%type <node> SingleType
+%type <node> UnionType
+%type <node> UnionMemberType
+%type <node> UnionMemberTypes
+%type <node> NonAnyType
+%type <node> ConstType
+%type <node> PrimitiveType
+%type <node> UnrestrictedFloatType
+%type <node> FloatType
+%type <node> UnsignedIntegerType
+%type <node> IntegerType
+%type <attr> OptionalLong
+%type <node> TypeSuffix
+%type <attr> Null
+%type <node> ReturnType
+%type <node> ScopedNameList
+%type <node> ScopedName
+%type <node> AbsoluteScopedName
+%type <node> RelativeScopedName
+%type <node> ScopedNameParts
+%type <node> ScopedNamePartList
+%type <node> ExtendedAttribute
+%type <node> ExtendedAttributeNoArg
+%type <node> ExtendedAttributeArgList
+%type <node> ExtendedAttributeNamedArgList
+%type <node> ExtendedAttributeScopedName
+
+/* ES extensions */
+%type <node> InterfaceDcl
+%type <node> ForwardDcl
+%type <node> OrExpr
+%type <node> XorExpr
+%type <node> AndExpr
+%type <node> ShiftExpr
+%type <node> AddExpr
+%type <node> MultExpr
+%type <node> UnaryExpr
+%type <node> PrimaryExpr
+%type <name> UnaryOperator
+%type <node> Preprocessor
+%type <node> positive_int_const
+%type <name> JavaDoc
+
+%%
+
+Definitions :
+ /* empty */
+ | JavaDoc
+ {
+ setJavadoc($1);
+ free($1);
+ }
+ ExtendedAttributeList Definition
+ {
+ if ($4)
+ {
+ $4->setExtendedAttributes($3);
+ }
+ setJavadoc(0);
+ }
+ Definitions
+ ;
+
+Definition :
+ Module /* backward compatibility */
+ | CallbackOrInterface
+ | PartialInterface
+ | Dictionary
+ | Exception
+ | Enum
+ | Typedef
+ | ImplementsStatement
+ | Preprocessor /* esidl extension */
+ ;
+
+Module :
+ MODULE IDENTIFIER
+ {
+ if (!Node::getFlatNamespace())
+ {
+ Node* node = getCurrent()->search($2);
+ if (node)
+ {
+ if (Module* module = dynamic_cast<Module*>(node))
+ {
+ setCurrent(module);
+ }
+ else
+ {
+ fprintf(stderr, "%d.%d-%d.%d: '%s' is not a valid module name.\n",
+ @1.first_line, @1.first_column, @2.last_line, @2.last_column,
+ $2);
+ exit(EXIT_FAILURE);
+ }
+ }
+ else
+ {
+ Module* module = new Module($2);
+ getCurrent()->add(module);
+ setCurrent(module);
+ }
+ }
+ free($2);
+ }
+ '{' Definitions '}' ';'
+ {
+ $$ = getCurrent();
+ if (!Node::getFlatNamespace())
+ {
+ setCurrent(getCurrent()->getParent());
+ }
+ }
+ ;
+
+CallbackOrInterface :
+ CALLBACK CallbackRestOrInterface
+ {
+ if ($2)
+ {
+ if (Interface* node = dynamic_cast<Interface*>($2)) {
+ node->setAttr(node->getAttr() | Interface::Callback);
+ $$ = $2;
+ } else if (OpDcl* op = dynamic_cast<OpDcl*>($2)) {
+ Node* node = op->getParent();
+ node->setAttr(node->getAttr() | Interface::CallbackIsFunctionOnly);
+ $$ = node;
+ }
+ }
+
+ }
+ | InterfaceDcl
+ ;
+
+CallbackRestOrInterface :
+ CallbackRest
+ | InterfaceDcl
+ ;
+
+InterfaceDcl :
+ Interface
+ | ForwardDcl /* esidl extension */
+ ;
+
+Interface :
+ INTERFACE IDENTIFIER Inheritance
+ {
+ Node* extends = $3;
+ if (!extends)
+ {
+ if (strcmp($2, Node::getBaseObjectName()) == 0)
+ {
+ assert($2[0] == ':' && $2[1] == ':');
+ strcpy($2, strrchr($2, ':') + 1);
+ }
+ else
+ {
+ std::string qualifiedName = getCurrent()->getQualifiedName();
+ qualifiedName += "::";
+ qualifiedName += $2;
+ if (qualifiedName != Node::getBaseObjectName())
+ {
+ ScopedName* name = new ScopedName(Node::getBaseObjectName());
+ extends = new Node();
+ extends->add(name);
+ }
+ }
+ }
+ Interface* node = new Interface($2, extends);
+ if (Node::getFlatNamespace() && !extends)
+ {
+ setCurrent(getSpecification());
+ }
+ getCurrent()->add(node);
+ setCurrent(node);
+ free($2);
+ }
+ '{' InterfaceMembers '}' ';'
+ {
+ getCurrent()->setLocation(&@1, &@8);
+ $$ = getCurrent();
+ setCurrent(getCurrent()->getParent());
+ if (Node::getFlatNamespace() && getCurrent() == getSpecification())
+ {
+ setCurrent(dynamic_cast<Module*>(getSpecification()->search(Node::getFlatNamespace())));
+ }
+ }
+ ;
+
+PartialInterface :
+ PARTIAL INTERFACE IDENTIFIER
+ {
+ Interface* node = new Interface($3);
+ if (Node::getFlatNamespace())
+ {
+ setCurrent(getSpecification());
+ }
+ getCurrent()->add(node);
+ setCurrent(node);
+ node->setAttr(node->getAttr() | Interface::Supplemental);
+ free($3);
+ }
+ '{' InterfaceMembers '}' ';'
+ {
+ getCurrent()->setLocation(&@1, &@8);
+ $$ = getCurrent();
+ setCurrent(getCurrent()->getParent());
+ if (Node::getFlatNamespace() && getCurrent() == getSpecification())
+ {
+ setCurrent(dynamic_cast<Module*>(getSpecification()->search(Node::getFlatNamespace())));
+ }
+ }
+ ;
+
+InterfaceMembers :
+ /* empty */
+ | JavaDoc
+ {
+ setJavadoc($1);
+ free($1);
+ }
+ ExtendedAttributeList InterfaceMember
+ {
+ if ($4)
+ {
+ $4->setExtendedAttributes($3);
+ }
+ setJavadoc(0);
+ }
+ InterfaceMembers
+ ;
+
+InterfaceMember :
+ Const
+ | AttributeOrOperation
+ | Preprocessor
+ ;
+
+Dictionary :
+ DICTIONARY IDENTIFIER Inheritance
+ {
+ Node* extends = $3;
+ if (!extends)
+ {
+ std::string qualifiedName = getCurrent()->getQualifiedName();
+ qualifiedName += "::";
+ qualifiedName += $2;
+ assert((qualifiedName != Node::getBaseObjectName())); // TODO: make this runtime check
+ ScopedName* name = new ScopedName(Node::getBaseObjectName());
+ extends = new Node();
+ extends->add(name);
+ }
+ Interface* node = new Dictionary($2, extends);
+ if (Node::getFlatNamespace() && !extends)
+ {
+ setCurrent(getSpecification());
+ }
+ getCurrent()->add(node);
+ setCurrent(node);
+ free($2);
+ }
+ '{' DictionaryMembers '}' ';'
+ {
+ getCurrent()->setLocation(&@1, &@8);
+ $$ = getCurrent();
+ setCurrent(getCurrent()->getParent());
+ if (Node::getFlatNamespace() && getCurrent() == getSpecification())
+ {
+ setCurrent(dynamic_cast<Module*>(getSpecification()->search(Node::getFlatNamespace())));
+ }
+ }
+ ;
+
+DictionaryMembers :
+ /* empty */
+ | JavaDoc
+ {
+ setJavadoc($1);
+ free($1);
+ }
+ ExtendedAttributeList DictionaryMember
+ {
+ if ($4)
+ {
+ $4->setExtendedAttributes($3);
+ }
+ setJavadoc(0);
+ }
+ DictionaryMembers
+ ;
+
+DictionaryMember :
+ Type IDENTIFIER Default ';'
+ {
+ Attribute* attr = new Attribute($2, $1);
+ if ($3)
+ {
+ attr->setDefaultValue($3);
+ }
+ getCurrent()->add(attr);
+ $$ = attr;
+ }
+
+ ;
+
+Default:
+ /* empty */
+ {
+ $$ = 0;
+ }
+ | '=' DefaultValue
+ {
+ $$ = $2;
+ }
+ ;
+
+DefaultValue :
+ ConstExpr
+ {
+ $$ = $1;
+ }
+ | STRING_LITERAL
+ {
+ $$ = new Literal($1); /* TODO: Verify this still works */
+ free($1);
+ }
+ ;
+
+Exception :
+ EXCEPTION IDENTIFIER Inheritance
+ {
+ ExceptDcl* exc = new ExceptDcl($2, $3);
+ getCurrent()->add(exc);
+ setCurrent(exc);
+ free($2);
+ }
+ '{' ExceptionMembers '}' ';'
+ {
+ $$ = getCurrent();
+ setCurrent(getCurrent()->getParent());
+ }
+ ;
+
+ExceptionMembers :
+ /* empty */
+ | JavaDoc
+ {
+ setJavadoc($1);
+ free($1);
+ }
+ ExtendedAttributeList ExceptionMember
+ {
+ if ($4)
+ {
+ $4->setExtendedAttributes($3);
+ }
+ setJavadoc(0);
+ }
+ ExceptionMembers
+ ;
+
+Inheritance :
+ /* empty */
+ {
+ $$ = 0;
+ }
+ | ':' ScopedNameList
+ {
+ $$ = $2;
+ }
+ ;
+
+Enum :
+ ENUM IDENTIFIER
+ {
+ Enum* node = new Enum($2);
+ if (Node::getFlatNamespace())
+ {
+ setCurrent(getSpecification());
+ }
+ getCurrent()->add(node);
+ setCurrent(node);
+ free($2);
+ }
+ '{' EnumValueList '}' ';'
+ {
+ getCurrent()->setLocation(&@1, &@7);
+ $$ = getCurrent();
+ setCurrent(getCurrent()->getParent());
+ if (Node::getFlatNamespace() && getCurrent() == getSpecification())
+ {
+ setCurrent(dynamic_cast<Module*>(getSpecification()->search(Node::getFlatNamespace())));
+ }
+ }
+ ;
+
+EnumValueList :
+ STRING_LITERAL EnumValues
+ {
+ Literal* literal = new Literal($1);
+ getCurrent()->addFront(literal);
+ $$ = literal;
+ }
+ ;
+
+EnumValues :
+ /* empty */
+ {
+ $$ = 0;
+ }
+ | ',' STRING_LITERAL EnumValues
+ {
+ Literal* literal = new Literal($2);
+ getCurrent()->add(literal);
+ $$ = literal;
+ }
+ ;
+
+CallbackRest :
+ IDENTIFIER '=' ReturnType
+ {
+ ScopedName* name = new ScopedName(Node::getBaseObjectName());
+ Node* extends = new Node();
+ extends->add(name);
+
+ Interface* node = new Interface($1, extends);
+ if (Node::getFlatNamespace())
+ {
+ setCurrent(getSpecification());
+ }
+ getCurrent()->add(node);
+ setCurrent(node);
+
+ OpDcl* op = new OpDcl("", $3, OpDcl::Caller);
+ node->add(op);
+ setCurrent(op);
+ }
+ '(' ArgumentList ')' ';'
+ {
+ $$ = getCurrent();
+ setCurrent(getCurrent()->getParent()->getParent());
+ if (Node::getFlatNamespace() && getCurrent() == getSpecification())
+ {
+ setCurrent(dynamic_cast<Module*>(getSpecification()->search(Node::getFlatNamespace())));
+ }
+
+ free($1);
+ }
+ ;
+
+Typedef :
+ TYPEDEF Type IDENTIFIER ';'
+ {
+ Member* m = new Member($3);
+ // In flat namespace mode, even a valid typedef can define a new type for the spec using the exactly same name.
+ if (!dynamic_cast<ScopedName*>($2) || m->getQualifiedName() != $2->getQualifiedName())
+ {
+ m->setSpec($2);
+ m->setTypedef(true);
+ getCurrent()->add(m);
+ }
+ $$ = m;
+ }
+ | NATIVE IDENTIFIER ';' /* esidl extension */
+ {
+ NativeType* nativeType = new NativeType($2);
+ getCurrent()->add(nativeType);
+ $$ = nativeType;
+ }
+ ;
+
+ImplementsStatement :
+ ScopedName IMPLEMENTS ScopedName ';'
+ {
+ Implements* implements = new Implements(static_cast<ScopedName*>($1), static_cast<ScopedName*>($3));
+ getCurrent()->add(implements);
+ implements->setLocation(&@1, &@4);
+ $$ = implements;
+ }
+ ;
+
+Const :
+ CONST ConstType IDENTIFIER '=' ConstExpr ';'
+ {
+ ConstDcl* constDcl = new ConstDcl($2, $3, $5);
+ getCurrent()->add(constDcl);
+ $$ = constDcl;
+ }
+ ;
+
+ConstExpr :
+ OrExpr
+ ;
+
+OrExpr :
+ XorExpr
+ | OrExpr '|' XorExpr
+ {
+ $$ = new BinaryExpr("|", $1, $3);
+ }
+ ;
+
+XorExpr :
+ AndExpr
+ | XorExpr '^' AndExpr
+ {
+ $$ = new BinaryExpr("^", $1, $3);
+ }
+ ;
+
+AndExpr :
+ ShiftExpr
+ | AndExpr '&' ShiftExpr
+ {
+ $$ = new BinaryExpr("&", $1, $3);
+ }
+ ;
+
+ShiftExpr :
+ AddExpr
+ | ShiftExpr OP_SHR AddExpr
+ {
+ $$ = new BinaryExpr(">>", $1, $3);
+ }
+ | ShiftExpr OP_SHL AddExpr
+ {
+ $$ = new BinaryExpr("<<", $1, $3);
+ }
+ ;
+
+AddExpr :
+ MultExpr
+ | AddExpr '+' MultExpr
+ {
+ $$ = new BinaryExpr("+", $1, $3);
+ }
+ | AddExpr '-' MultExpr
+ {
+ $$ = new BinaryExpr("-", $1, $3);
+ }
+ ;
+
+MultExpr :
+ UnaryExpr
+ | MultExpr '*' UnaryExpr
+ {
+ $$ = new BinaryExpr("*", $1, $3);
+ }
+ | MultExpr '/' UnaryExpr
+ {
+ $$ = new BinaryExpr("/", $1, $3);
+ }
+ | MultExpr '%' UnaryExpr
+ {
+ $$ = new BinaryExpr("%", $1, $3);
+ }
+ ;
+
+UnaryExpr :
+ UnaryOperator PrimaryExpr
+ {
+ $$ = new UnaryExpr($1, $2);
+ }
+ | PrimaryExpr
+ ;
+
+UnaryOperator :
+ '-'
+ {
+ $$ = "-";
+ }
+ | '+'
+ {
+ $$ = "+";
+ }
+ | '~'
+ {
+ $$ = "~";
+ }
+ ;
+
+PrimaryExpr :
+ ScopedName
+ | Literal
+ | '(' ConstExpr ')'
+ {
+ $$ = new GroupingExpression($2);
+ }
+ ;
+
+Literal :
+ INTEGER_LITERAL
+ {
+ $$ = new Literal($1);
+ free($1);
+ }
+ | BooleanLiteral
+ | FloatLiteral
+ | NULL_LITERAL
+ {
+ $$ = new Literal("null");
+ }
+ ;
+
+BooleanLiteral :
+ TRUE
+ {
+ $$ = new Literal("true");
+ }
+ | FALSE
+ {
+ $$ = new Literal("false");
+ }
+ ;
+
+FloatLiteral :
+ FLOATING_PT_LITERAL
+ {
+ $$ = new Literal($1);
+ free($1);
+ }
+ | INFINITY
+ {
+ $$ = new Literal("Infinity");
+ }
+ | NAN
+ {
+ $$ = new Literal("NaN");
+ }
+ ;
+
+AttributeOrOperation :
+ STRINGIFIER StringifierAttributeOrOperation
+ {
+ if ($2)
+ {
+ Member* m = static_cast<Member*>($2);
+ uint32_t attr = m->getAttr();
+ attr |= Member::Stringifier;
+ m->setAttr(attr);
+ }
+ /* TODO: else mark Interface::Stringifier */
+ $$ = $2;
+ }
+ | Attribute
+ | Operation
+ ;
+
+StringifierAttributeOrOperation :
+ Attribute
+ | OperationRest
+ | ';'
+ {
+ $$ = 0;
+ }
+ ;
+
+/* TODO: Support 'Inherit' */
+Attribute :
+ Inherit ReadOnly ATTRIBUTE Type IDENTIFIER GetRaises SetRaises /* backward compatibility */ ';'
+ {
+ Attribute* attr = new Attribute($5, $4, $2);
+ attr->setGetRaises($6);
+ attr->setSetRaises($7);
+ getCurrent()->add(attr);
+ $$ = attr;
+ }
+ ;
+
+Inherit :
+ /* empty */
+ {
+ $$ = false;
+ }
+ | INHERIT
+ {
+ $$ = true;
+ }
+ ;
+
+ReadOnly :
+ /* empty */
+ {
+ $$ = false;
+ }
+ | READONLY
+ {
+ $$ = true;
+ }
+ ;
+
+GetRaises : /* backward compatibility */
+ /* empty */
+ {
+ $$ = 0;
+ }
+ | GETRAISES ExceptionList
+ {
+ $$ = $2;
+ }
+ ;
+
+SetRaises : /* backward compatibility */
+ /* empty */
+ {
+ $$ = 0;
+ }
+ | SETRAISES ExceptionList
+ {
+ $$ = $2;
+ }
+ ;
+
+Operation :
+ Qualifiers OperationRest
+ {
+ OpDcl* op = static_cast<OpDcl*>($2);
+ if (op)
+ {
+ op->setLocation(&@1, &@2);
+ uint32_t attr = op->getAttr();
+ /* TODO: Check attr is valid */
+ if (($1 & OpDcl::IndexGetter) || ($1 & OpDcl::IndexDeleter))
+ {
+ op->check(op->getParamCount() == 1,
+ "Getters and deleters MUST be declared to take a single argument.");
+ }
+ if (($1 & OpDcl::IndexCreator) || ($1 & OpDcl::IndexSetter))
+ {
+ op->check(op->getParamCount() == 2,
+ "Setters and creators MUST be declared to take two arguments.");
+ }
+ if ($1 & OpDcl::IndexMask)
+ {
+ Node* spec = dynamic_cast<ParamDcl*>(*(op->begin()))->getSpec();
+ op->check(spec->getName() == "unsigned long" || spec->getName() == "string",
+ "The first argument MUST be an unsigned long or a DOMString.");
+ }
+ attr |= $1;
+ op->setAttr(attr);
+ }
+ $$ = $2;
+ }
+ ;
+
+Qualifiers :
+ STATIC
+ {
+ $$ = OpDcl::Static;
+ }
+ | OMITTABLE Specials
+ {
+ $$ = OpDcl::Omittable | $2;
+ }
+ | Specials
+ ;
+
+Specials :
+ /* empty */
+ {
+ $$ = 0;
+ }
+ | Specials Special /* Use left recursion */
+ {
+ $$ = $1 | $2;
+ }
+ ;
+
+Special :
+ GETTER
+ {
+ $$ = OpDcl::IndexGetter;
+ }
+ | SETTER
+ {
+ $$ = OpDcl::IndexSetter;
+ }
+ | CREATOR
+ {
+ $$ = OpDcl::IndexCreator;
+ }
+ | DELETER
+ {
+ $$ = OpDcl::IndexDeleter;
+ }
+ | CALLER
+ {
+ $$ = OpDcl::Caller;
+ }
+ ;
+
+OperationRest :
+ ReturnType OptionalIdentifier
+ {
+ OpDcl* op = new OpDcl($2 ? $2 : "", $1);
+ getCurrent()->add(op);
+ setCurrent(op);
+ free($2);
+ }
+ '(' ArgumentList ')' Raises ';'
+ {
+ OpDcl* op = static_cast<OpDcl*>(getCurrent());
+ op->setRaises($7);
+ setCurrent(op->getParent());
+ $$ = op;
+ }
+ ;
+
+OptionalIdentifier :
+ /* empty */
+ {
+ $$ = 0;
+ }
+ | IDENTIFIER
+ ;
+
+Raises : /* backward compatibility */
+ /* empty */
+ {
+ $$ = 0;
+ }
+ | RAISES ExceptionList
+ {
+ $$ = $2;
+ }
+ ;
+
+ExceptionList :
+ '(' ScopedNameList ')'
+ {
+ $$ = $2;
+ }
+ ;
+
+ArgumentList :
+ /* empty */
+ | Arguments
+ ;
+
+Arguments :
+ Argument
+ | Arguments ',' Argument /* Use left recursion */
+ ;
+
+Argument :
+ ExtendedAttributeList In OptionalOrRequiredArgument
+ {
+ if ($3)
+ $3->setExtendedAttributes($1);
+ }
+ ;
+
+In : /* backward compatibility */
+ /* empty */
+ | IN
+ ;
+
+OptionalOrRequiredArgument:
+ OPTIONAL Type ArgumentName Default
+ {
+ ParamDcl* param = new ParamDcl($3, $2, ParamDcl::Optional | ParamDcl::AttrIn);
+ getCurrent()->add(param);
+ /* TODO: process Default */
+ free($3);
+ $$ = param;
+ }
+ | Type Ellipsis ArgumentName
+ {
+ ParamDcl* param = new ParamDcl($3, $1, ParamDcl::AttrIn | $2);
+ getCurrent()->add(param);
+ free($3);
+ $$ = param;
+ }
+ ;
+
+ArgumentName:
+ ArgumentNameKeyword
+ | IDENTIFIER
+ ;
+
+Ellipsis :
+ /* empty */
+ {
+ $$ = 0;
+ }
+ | ELLIPSIS
+ {
+ $$ = ParamDcl::Variadic;
+ }
+ ;
+
+ExceptionMember :
+ Const
+ | ExceptionField
+ ;
+
+ExceptionField :
+ Type IDENTIFIER ';'
+ {
+ Member* m = new Member($2);
+ free($2);
+ m->setSpec($1);
+ getCurrent()->add(m);
+ $$ = m;
+ }
+ ;
+
+ExtendedAttributeList :
+ /* empty */
+ {
+ $$ = 0;
+ }
+ |
+ {
+ pushJavadoc();
+ }
+ '[' ExtendedAttributes ']'
+ {
+ $$ = $3;
+ popJavadoc();
+ }
+ ;
+
+ExtendedAttributes :
+ JavaDoc
+ {
+ setJavadoc($1);
+ free($1);
+ }
+ ExtendedAttribute
+ {
+ $$ = new NodeList;
+ $$->push_back($3);
+ }
+ | ExtendedAttributes ',' JavaDoc /* Use left recursion */
+ {
+ setJavadoc($3);
+ free($3);
+ }
+ ExtendedAttribute
+ {
+ assert($1);
+ $$ = $1;
+ $$->push_back($5);
+ }
+ ;
+
+ExtendedAttribute :
+ ExtendedAttributeNoArg
+ {
+ $$->setLocation(&@1);
+ }
+ | ExtendedAttributeArgList
+ {
+ $$->setLocation(&@1);
+ }
+ | ExtendedAttributeNamedArgList
+ {
+ $$->setLocation(&@1);
+ }
+ | ExtendedAttributeScopedName
+ {
+ $$->setLocation(&@1);
+ }
+ ;
+
+ArgumentNameKeyword:
+ ATTRIBUTE
+ {
+ $$ = strdup("attribute");
+ }
+ | CALLBACK
+ {
+ $$ = strdup("callback");
+ }
+ | CONST
+ {
+ $$ = strdup("const");
+ }
+ | CREATOR
+ {
+ $$ = strdup("creator");
+ }
+ | DELETER
+ {
+ $$ = strdup("deleter");
+ }
+ | DICTIONARY
+ {
+ $$ = strdup("dictionary");
+ }
+ | ENUM
+ {
+ $$ = strdup("enum");
+ }
+ | EXCEPTION
+ {
+ $$ = strdup("exception");
+ }
+ | GETTER
+ {
+ $$ = strdup("getter");
+ }
+ | IMPLEMENTS
+ {
+ $$ = strdup("implements");
+ }
+ | INHERIT
+ {
+ $$ = strdup("inherit");
+ }
+ | INTERFACE
+ {
+ $$ = strdup("interface");
+ }
+ | CALLER
+ {
+ $$ = strdup("legacycaller");
+ }
+ | PARTIAL
+ {
+ $$ = strdup("partial");
+ }
+ | SETTER
+ {
+ $$ = strdup("setter");
+ }
+ | STATIC
+ {
+ $$ = strdup("static");
+ }
+ | STRINGIFIER
+ {
+ $$ = strdup("stringifier");
+ }
+ | TYPEDEF
+ {
+ $$ = strdup("typedef");
+ }
+ | UNRESTRICTED
+ {
+ $$ = strdup("unrestricted");
+ }
+ ;
+
+Type :
+ SingleType
+ | UnionType Null TypeSuffix
+ {
+ $1->setAttr($1->getAttr() | $2);
+ if ($3)
+ {
+ static_cast<ArrayType*>($3)->setSpec($1);
+ $$ = $3;
+ $$->setParent(getCurrent());
+ }
+ else
+ {
+ $$ = $1;
+ }
+ }
+ ;
+
+SingleType :
+ NonAnyType
+ | ANY TypeSuffix
+ {
+ $$ = new Type("any");
+ if ($2)
+ {
+ static_cast<ArrayType*>($2)->setSpec($$);
+ $$ = $2;
+ $$->setParent(getCurrent());
+ }
+ $$->setLocation(&@1);
+ }
+ ;
+
+UnionType :
+ '(' UnionMemberType OR UnionMemberType
+ {
+ UnionType* u = new UnionType();
+ u->setParent(getCurrent());
+ setCurrent(u);
+ u->add($2);
+ u->add($4);
+ }
+ UnionMemberTypes ')'
+ {
+ $$ = getCurrent();
+ setCurrent(getCurrent()->getParent());
+ $$->setLocation(&@1, &@7);
+ }
+ ;
+
+UnionMemberType :
+ NonAnyType
+ | UnionType Null TypeSuffix
+ {
+ $1->setAttr($1->getAttr() | $2);
+ if ($3)
+ {
+ static_cast<ArrayType*>($3)->setSpec($1);
+ $$ = $3;
+ $$->setParent(getCurrent());
+ }
+ else
+ {
+ $$ = $1;
+ }
+ }
+ | ANY '[' ']' Null TypeSuffix
+ {
+ ArrayType* array = new ArrayType;
+ array->setAttr(array->getAttr() | $4);
+ array->setSpec(new Type("any"));
+ if ($5)
+ {
+ static_cast<ArrayType*>($5)->setSpec(array);
+ $$ = $5;
+ }
+ else
+ {
+ $$ = array;
+ }
+ $$->setParent(getCurrent());
+ }
+ ;
+
+UnionMemberTypes :
+ /* empty */
+ | OR UnionMemberType UnionMemberTypes
+ {
+ getCurrent()->add($2);
+ $$ = $2;
+ }
+ ;
+
+NonAnyType :
+ PrimitiveType Null TypeSuffix
+ {
+ $1->setAttr($1->getAttr() | $2);
+ if ($3)
+ {
+ static_cast<ArrayType*>($3)->setSpec($1);
+ $$ = $3;
+ $$->setParent(getCurrent());
+ }
+ else
+ {
+ $$ = $1;
+ }
+ }
+ | STRING Null TypeSuffix
+ {
+ $$ = new Type("string");
+ $$->setAttr($$->getAttr() | $2);
+ if ($3)
+ {
+ static_cast<ArrayType*>($3)->setSpec($$);
+ $$ = $3;
+ $$->setParent(getCurrent());
+ }
+ $$->setLocation(&@1);
+ }
+ | ScopedName Null TypeSuffix /* in esidl, "object" is treatetd as one of ScopedNames. */
+ {
+ $1->setAttr($1->getAttr() | $2);
+ if ($3)
+ {
+ static_cast<ArrayType*>($3)->setSpec($1);
+ $$ = $3;
+ $$->setParent(getCurrent());
+ }
+ else
+ {
+ $$ = $1;
+ }
+ }
+ | SEQUENCE '<' Type '>' Null
+ {
+ $$ = new SequenceType($3);
+ $$->setAttr($$->getAttr() | $5);
+ $$->setParent(getCurrent());
+ $$->setLocation(&@1, &@4);
+ }
+ | SEQUENCE '<' Type ',' positive_int_const '>' Null /* esidl extension */
+ {
+ $$ = new SequenceType($3, $5);
+ $$->setAttr($$->getAttr() | $7);
+ $$->setParent(getCurrent());
+ $$->setLocation(&@1, &@7);
+ }
+ | DATE TypeSuffix
+ {
+ $$ = new Type("Date");
+ if ($2)
+ {
+ static_cast<ArrayType*>($2)->setSpec($$);
+ $$ = $2;
+ $$->setParent(getCurrent());
+ }
+ $$->setLocation(&@1);
+ }
+ ;
+
+ConstType :
+ PrimitiveType Null
+ {
+ $1->setAttr($1->getAttr() | $2);
+ $$ = $1;
+ }
+ | ScopedName Null
+ {
+ $1->setAttr($1->getAttr() | $2);
+ $$ = $1;
+ }
+ ;
+
+PrimitiveType :
+ UnsignedIntegerType
+ | UnrestrictedFloatType
+ | BOOLEAN
+ {
+ $$ = new Type("boolean");
+ $$->setLocation(&@1);
+ }
+ | OCTET
+ {
+ $$ = new Type("octet");
+ $$->setLocation(&@1);
+ }
+ ;
+
+UnrestrictedFloatType:
+ UNRESTRICTED FloatType
+ {
+ /* Support 'unrestricted'. */
+ $2->getName() = "unrestricted " + $2->getName();
+ $$ = $2;
+ $$->setLocation(&@1, &@2);
+ }
+ | FloatType
+ ;
+
+FloatType :
+ FLOAT
+ {
+ $$ = new Type("float");
+ $$->setLocation(&@1);
+ }
+ | DOUBLE
+ {
+ $$ = new Type("double");
+ $$->setLocation(&@1);
+ }
+ ;
+
+UnsignedIntegerType :
+ IntegerType
+ | UNSIGNED IntegerType
+ {
+ $2->getName() = "unsigned " + $2->getName();
+ $$ = $2;
+ $$->setLocation(&@1, &@2);
+ }
+ ;
+
+IntegerType :
+ BYTE
+ {
+ $$ = new Type("byte");
+ $$->setLocation(&@1);
+ }
+ | SHORT
+ {
+ $$ = new Type("short");
+ $$->setLocation(&@1);
+ }
+ | LONG OptionalLong
+ {
+ $$ = new Type($2 ? "long long" : "long");
+ $$->setLocation(&@1);
+ }
+ ;
+
+OptionalLong :
+ /* empty */
+ {
+ $$ = false;
+ }
+ | LONG
+ {
+ $$ = true;
+ }
+ ;
+
+TypeSuffix :
+ /* empty */
+ {
+ $$ = 0;
+ }
+ | '[' ']' Null TypeSuffix
+ {
+ ArrayType* array = new ArrayType;
+ array->setSpec($4);
+ $$ = array;
+ $$->setAttr($$->getAttr() | $3);
+ }
+ | '[' positive_int_const ']' Null TypeSuffix /* Note positive_int_const is an esidl extension. */
+ {
+ ArrayType* array = new ArrayType($2);
+ array->setSpec($5);
+ $$ = array;
+ $$->setAttr($$->getAttr() | $4);
+ }
+ ;
+
+Null :
+ /* empty */
+ {
+ $$ = 0;
+ }
+ | '?'
+ {
+ $$ = Node::Nullable;
+ }
+ ;
+
+ReturnType :
+ Type
+ | VOID
+ {
+ $$ = new Type("void");
+ $$->setLocation(&@1);
+ }
+ ;
+
+ScopedNameList :
+ ScopedName
+ {
+ $$ = new Node();
+ $$->add($1);
+ }
+ | ScopedNameList ',' ScopedName /* Use left recursion */
+ {
+ assert($1);
+ $$ = $1;
+ $$->add($3);
+ }
+ ;
+
+ScopedName :
+ AbsoluteScopedName
+ {
+ $$->setLocation(&@1);
+ }
+ | RelativeScopedName
+ {
+ $$->setLocation(&@1);
+ }
+ ;
+
+AbsoluteScopedName :
+ OP_SCOPE IDENTIFIER ScopedNameParts
+ {
+ if (!Node::getFlatNamespace())
+ {
+ if (!$3)
+ {
+ ScopedName* name = new ScopedName("::");
+ name->getName() += $2;
+ $$ = name;
+ }
+ else
+ {
+ ScopedName* name = static_cast<ScopedName*>($3);
+ name->getName() = $2 + name->getName();
+ name->getName() = "::" + name->getName();
+ $$ = name;
+ }
+ }
+ else
+ {
+ if ($3)
+ {
+ $$ = $3;
+ }
+ else
+ {
+ $$ = new ScopedName($2);
+ }
+ }
+ free($2);
+ }
+ ;
+
+RelativeScopedName :
+ IDENTIFIER ScopedNameParts
+ {
+ if (!Node::getFlatNamespace())
+ {
+ if (!$2)
+ {
+ $$ = new ScopedName($1);
+ }
+ else
+ {
+ ScopedName* name = static_cast<ScopedName*>($2);
+ name->getName() = $1 + name->getName();
+ $$ = name;
+ }
+ }
+ else
+ {
+ if ($2)
+ {
+ $$ = $2;
+ }
+ else
+ {
+ $$ = new ScopedName($1);
+ }
+ }
+ free($1);
+ }
+ ;
+
+ScopedNameParts :
+ /* empty */
+ {
+ $$ = 0;
+ }
+ | ScopedNamePartList
+ ;
+
+ScopedNamePartList :
+ OP_SCOPE IDENTIFIER
+ {
+ if (!Node::getFlatNamespace())
+ {
+ ScopedName* name = new ScopedName("::");
+ name->getName() += $2;
+ $$ = name;
+ }
+ else
+ {
+ $$ = new ScopedName($2);
+ }
+ free($2);
+ }
+ | ScopedNamePartList OP_SCOPE IDENTIFIER /* Use left recursion */
+ {
+ if (!Node::getFlatNamespace())
+ {
+ ScopedName* name = static_cast<ScopedName*>($1);
+ name->getName() += "::";
+ name->getName() += $3;
+ $$ = name;
+ }
+ else
+ {
+ $$ = new ScopedName($3);
+ }
+ free($3);
+ }
+ ;
+
+ExtendedAttributeNoArg :
+ IDENTIFIER
+ {
+ $$ = new ExtendedAttribute($1, 0);
+ free($1);
+ setJavadoc(0);
+ }
+ ;
+
+ExtendedAttributeArgList :
+ IDENTIFIER
+ {
+ $<node>$ = getCurrent();
+ OpDcl* op = new OpDcl("", 0);
+ // We need to set parent for op here. Otherwise, some names cannot be resolved.
+ op->setParent(getCurrent());
+ setCurrent(op);
+ }
+ '(' ArgumentList ')'
+ {
+ $$ = new ExtendedAttribute($1, getCurrent());
+ setCurrent($<node>2);
+ free($1);
+ setJavadoc(0);
+ }
+ ;
+
+ExtendedAttributeNamedArgList :
+ IDENTIFIER '=' IDENTIFIER
+ {
+ $<node>$ = getCurrent();
+ OpDcl* op = new OpDcl($3, 0);
+ // We need to set parent for op here. Otherwise, some names cannot be resolved.
+ op->setParent(getCurrent());
+ setCurrent(op);
+ free($3);
+ }
+ '(' ArgumentList ')'
+ {
+ $$ = new ExtendedAttribute($1, getCurrent());
+ setCurrent($<node>4);
+ free($1);
+ setJavadoc(0);
+ }
+ ;
+
+ExtendedAttributeScopedName :
+ IDENTIFIER '=' ScopedName
+ {
+ $$ = new ExtendedAttribute($1, $3);
+ free($1);
+ setJavadoc(0);
+ }
+ ;
+
+/* ES extensions */
+
+/* Note the forward declaration is dropped in Web IDL */
+ForwardDcl :
+ INTERFACE IDENTIFIER ';'
+ {
+ Interface* node = new Interface($2, 0, true);
+ getCurrent()->add(node);
+ free($2);
+ $$ = node;
+ }
+ ;
+
+positive_int_const :
+ ConstExpr
+ ;
+
+Preprocessor :
+ POUND_SIGN INTEGER_LITERAL STRING_LITERAL INTEGER_LITERAL EOL
+ {
+ // # LINENUM FILENAME FLAGS
+ // FLAGS: 1) new file 2) return
+ switch (atoi($4))
+ {
+ case 1: // New file
+ getCurrent()->add(new Include($3));
+ setFilename($3);
+ break;
+ case 2: // Return
+ setFilename($3);
+ break;
+ }
+ if (strcmp($3, "\"<stdin>\"") == 0)
+ {
+ stdinLine = atol($2);
+ yylloc.last_line = stdinLine - stdinOffset;
+ }
+ else
+ {
+ yylloc.last_line = atol($2);
+ }
+ free($2);
+ free($3);
+ free($4);
+ $$ = 0;
+ }
+ | POUND_SIGN INTEGER_LITERAL STRING_LITERAL INTEGER_LITERAL INTEGER_LITERAL INTEGER_LITERAL EOL
+ {
+ // # LINENUM FILENAME FLAGS
+ // FLAGS: 1) new file 2) return
+ switch (atoi($4))
+ {
+ case 1: // New file
+ getCurrent()->add(new Include($3, strcmp("3", $5) == 0));
+ setFilename($3);
+ break;
+ case 2: // Return
+ setFilename($3);
+ break;
+ }
+ if (strcmp($3, "\"<stdin>\"") == 0)
+ {
+ stdinLine = atol($2);
+ yylloc.last_line = stdinLine - stdinOffset;
+ }
+ else
+ {
+ yylloc.last_line = atol($2);
+ }
+ free($2);
+ free($3);
+ free($4);
+ $$ = 0;
+ }
+ | POUND_SIGN INTEGER_LITERAL STRING_LITERAL EOL
+ {
+ // # LINENUM FILENAME
+ if (strcmp("1", $2) == 0)
+ {
+ setFilename($3);
+ }
+ if (strcmp($3, "\"<stdin>\"") == 0)
+ {
+ stdinLine = atol($2);
+ yylloc.last_line = stdinLine - stdinOffset;
+ }
+ else
+ {
+ yylloc.last_line = atol($2);
+ }
+ free($2);
+ free($3);
+ $$ = 0;
+ }
+ | POUND_SIGN IDENTIFIER IDENTIFIER STRING_LITERAL EOL
+ {
+ if (strcmp($2, "pragma") == 0 && strcmp($3, "source") == 0)
+ {
+ setBaseFilename($4);
+ }
+ free($2);
+ free($3);
+ free($4);
+ $$ = 0;
+ stdinOffset = stdinLine;
+ yylloc.last_line = 1;
+ }
+ ;
+
+JavaDoc :
+ /* empty */
+ {
+ $$ = 0;
+ }
+ | JAVADOC
+ ;
diff --git a/javascript/idl/window.idl b/javascript/idl/window.idl
new file mode 100644
index 0000000..1cb6721
--- /dev/null
+++ b/javascript/idl/window.idl
@@ -0,0 +1,119 @@
+#include "eventtarget.h"
+
+[NamedPropertiesObject]
+interface Window : EventTarget {
+ // the current browsing context
+ [Unforgeable] readonly attribute WindowProxy window;
+ [Replaceable] readonly attribute WindowProxy self;
+ [Unforgeable] readonly attribute Document document;
+ attribute DOMString name;
+ [PutForwards=href, Unforgeable] readonly attribute Location location;
+ readonly attribute History history;
+ [Replaceable] readonly attribute BarProp locationbar;
+ [Replaceable] readonly attribute BarProp menubar;
+ [Replaceable] readonly attribute BarProp personalbar;
+ [Replaceable] readonly attribute BarProp scrollbars;
+ [Replaceable] readonly attribute BarProp statusbar;
+ [Replaceable] readonly attribute BarProp toolbar;
+ attribute DOMString status;
+ void close();
+ void stop();
+ void focus();
+ void blur();
+
+ // other browsing contexts
+ [Replaceable] readonly attribute WindowProxy frames;
+ [Replaceable] readonly attribute unsigned long length;
+ [Unforgeable] readonly attribute WindowProxy top;
+ attribute WindowProxy? opener;
+ readonly attribute WindowProxy parent;
+ readonly attribute Element? frameElement;
+ WindowProxy open(optional DOMString url, optional DOMString target, optional DOMString features, optional boolean replace);
+ getter WindowProxy (unsigned long index);
+ getter object (DOMString name);
+
+ // the user agent
+ readonly attribute Navigator navigator;
+ readonly attribute External external;
+ readonly attribute ApplicationCache applicationCache;
+
+ // user prompts
+ void alert(DOMString message);
+ boolean confirm(DOMString message);
+ DOMString? prompt(DOMString message, optional DOMString default);
+ void print();
+ any showModalDialog(DOMString url, optional any argument);
+
+ // cross-document messaging
+ void postMessage(any message, DOMString targetOrigin, optional sequence<Transferable> transfer);
+
+ // event handler IDL attributes
+ attribute EventHandler onabort;
+ attribute EventHandler onafterprint;
+ attribute EventHandler onbeforeprint;
+ attribute EventHandler onbeforeunload;
+ attribute EventHandler onblur;
+ attribute EventHandler oncancel;
+ attribute EventHandler oncanplay;
+ attribute EventHandler oncanplaythrough;
+ attribute EventHandler onchange;
+ attribute EventHandler onclick;
+ attribute EventHandler onclose;
+ attribute EventHandler oncontextmenu;
+ attribute EventHandler oncuechange;
+ attribute EventHandler ondblclick;
+ attribute EventHandler ondrag;
+ attribute EventHandler ondragend;
+ attribute EventHandler ondragenter;
+ attribute EventHandler ondragleave;
+ attribute EventHandler ondragover;
+ attribute EventHandler ondragstart;
+ attribute EventHandler ondrop;
+ attribute EventHandler ondurationchange;
+ attribute EventHandler onemptied;
+ attribute EventHandler onended;
+ attribute OnErrorEventHandler onerror;
+ attribute EventHandler onfocus;
+ attribute EventHandler onhashchange;
+ attribute EventHandler oninput;
+ attribute EventHandler oninvalid;
+ attribute EventHandler onkeydown;
+ attribute EventHandler onkeypress;
+ attribute EventHandler onkeyup;
+ attribute EventHandler onload;
+ attribute EventHandler onloadeddata;
+ attribute EventHandler onloadedmetadata;
+ attribute EventHandler onloadstart;
+ attribute EventHandler onmessage;
+ attribute EventHandler onmousedown;
+ attribute EventHandler onmousemove;
+ attribute EventHandler onmouseout;
+ attribute EventHandler onmouseover;
+ attribute EventHandler onmouseup;
+ attribute EventHandler onmousewheel;
+ attribute EventHandler onoffline;
+ attribute EventHandler ononline;
+ attribute EventHandler onpause;
+ attribute EventHandler onplay;
+ attribute EventHandler onplaying;
+ attribute EventHandler onpagehide;
+ attribute EventHandler onpageshow;
+ attribute EventHandler onpopstate;
+ attribute EventHandler onprogress;
+ attribute EventHandler onratechange;
+ attribute EventHandler onreset;
+ attribute EventHandler onresize;
+ attribute EventHandler onscroll;
+ attribute EventHandler onseeked;
+ attribute EventHandler onseeking;
+ attribute EventHandler onselect;
+ attribute EventHandler onshow;
+ attribute EventHandler onstalled;
+ attribute EventHandler onstorage;
+ attribute EventHandler onsubmit;
+ attribute EventHandler onsuspend;
+ attribute EventHandler ontimeupdate;
+ attribute EventHandler onunload;
+ attribute EventHandler onvolumechange;
+ attribute EventHandler onwaiting;
+};
\ No newline at end of file
-----------------------------------------------------------------------
--
NetSurf Browser
10 years, 5 months