diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2014-12-17 04:47:58 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2014-12-17 04:47:58 +0000 |
commit | 337bf3b64c04dd0da174a912a0f39b8b0c72e66c (patch) | |
tree | b728879115747580b612b8bb180212c83928cf3a | |
parent | f35e59d21bed013bcd74f4910edba9041726b0ab (diff) |
web2c/luatexdir: Sync with the upstream.
git-svn-id: svn://tug.org/texlive/trunk@35848 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/web2c/luatexdir/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/tex/texnodes.w | 45 |
2 files changed, 41 insertions, 9 deletions
diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog index ecf25ff2947..228955a9e06 100644 --- a/Build/source/texk/web2c/luatexdir/ChangeLog +++ b/Build/source/texk/web2c/luatexdir/ChangeLog @@ -1,3 +1,8 @@ +2014-12-17 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + * tex/texnodes.w: Sync with the upstream. + Luigi fixes a bug on cached attributes. + 2014-12-12 Peter Breitenlohner <peb@mppmu.mpg.de> Avoid implicit function declarations. diff --git a/Build/source/texk/web2c/luatexdir/tex/texnodes.w b/Build/source/texk/web2c/luatexdir/tex/texnodes.w index e5c4e1cacfd..411deb9af5c 100644 --- a/Build/source/texk/web2c/luatexdir/tex/texnodes.w +++ b/Build/source/texk/web2c/luatexdir/tex/texnodes.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: texnodes.w 4911 2014-03-20 14:00:02Z luigi $" + "$Id: texnodes.w 5106 2014-12-17 01:54:37Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/texnodes.w $"; #include "ptexlib.h" @@ -2276,8 +2276,10 @@ void set_attribute(halfword n, int i, int val) { register halfword p; register int j = 0; + /* not all nodes can have an attribute list */ if (!nodetype_has_attributes(type(n))) return; + /* if we have no list, we create one and quit */ p = node_attr(n); if (p == null) { /* add a new head \& node */ p = get_node(attribute_node_size); @@ -2288,6 +2290,7 @@ void set_attribute(halfword n, int i, int val) vlink(node_attr(n)) = p; return; } + /* we check if we have this attribute already and quite if the value stays the same */ assert(vlink(p) != null); while (vlink(p) != null) { int t = attribute_id(vlink(p)); @@ -2298,22 +2301,43 @@ void set_attribute(halfword n, int i, int val) j++; p = vlink(p); } + /* j has now the position (if found) .. we assume a sorted list ! */ p = node_attr(n); - if (attr_list_ref(p) != 1) { - if (attr_list_ref(p) > 1) { + + if (attr_list_ref(p) == 0 ) { + /* the list is invalid i.e. freed already */ + fprintf(stdout,"Node %d has an attribute list that is free already\n",(int) n); + /* the still dangling list gets ref count 1 */ + attr_list_ref(p) = 1; + } else if (attr_list_ref(p) == 1) { + /* this can really happen HH-LS */ + if (p == attr_list_cache) { + /* + attr_list_cache = cache_disabled; + + or (saved a list creation): + + */ p = copy_attribute_list(p); - delete_attribute_ref(node_attr(n)); node_attr(n) = p; - } else { - fprintf(stdout, - "Node %d has an attribute list that is free already\n", - (int) n); + /* the copied list gets ref count 1 */ + attr_list_ref(p) = 1; } + } else { + /* the list is used multiple times so we make a copy */ + p = copy_attribute_list(p); + /* we decrement the ref count or the original */ + delete_attribute_ref(node_attr(n)); + node_attr(n) = p; + /* the copied list gets ref count 1 */ attr_list_ref(p) = 1; } + + + /* we go to position j in the list */ while (j-- > 0) p = vlink(p); - + /* if we have a hit we just set the value otherwise we add a new node */ if (attribute_id(vlink(p)) == i) { attribute_value(vlink(p)) = val; } else { /* add a new node */ @@ -2325,6 +2349,9 @@ void set_attribute(halfword n, int i, int val) } + + + @ @c int unset_attribute(halfword n, int i, int val) { |