[Gd-chatter] r11090 - trunk/libraries/xml-parser

hannes at gwydiondylan.org hannes at gwydiondylan.org
Wed Dec 20 23:05:23 CET 2006


Author: hannes
Date: Wed Dec 20 23:05:21 2006
New Revision: 11090

Modified:
   trunk/libraries/xml-parser/collect.dylan
   trunk/libraries/xml-parser/interface.dylan
   trunk/libraries/xml-parser/printing.dylan
   trunk/libraries/xml-parser/productions.dylan
   trunk/libraries/xml-parser/transform.dylan
Log:
Job: minor
make xml-parser thread-safe (just use thread variables instead of global variables)
I have no idea whether xml-parser still works on gwydion yet, but since I don't know
anyone using xml-parser with gd, I hope this commit is ok. blame me if not.

Modified: trunk/libraries/xml-parser/collect.dylan
==============================================================================
--- trunk/libraries/xml-parser/collect.dylan	(original)
+++ trunk/libraries/xml-parser/collect.dylan	Wed Dec 20 23:05:21 2006
@@ -29,7 +29,7 @@
   slot depth :: <integer> = 0;
 end class <collect-state>;
 
-define variable *original-state* :: false-or(<collect-state>) = #f;
+define thread variable *original-state* :: false-or(<collect-state>) = #f;
 
 define function copy-down(c :: <collect-state>, elt :: <element>)
  => (d :: <collect-state>)

Modified: trunk/libraries/xml-parser/interface.dylan
==============================================================================
--- trunk/libraries/xml-parser/interface.dylan	(original)
+++ trunk/libraries/xml-parser/interface.dylan	Wed Dec 20 23:05:21 2006
@@ -96,7 +96,7 @@
   constant virtual slot entity-value;
 end class <entity-reference>;
 
-define variable *entities* :: <table> = make(<table>);
+define thread variable *entities* :: <table> = make(<table>);
 
 define method entity-value(ent :: <entity-reference>) => (val :: <sequence>)
   *entities*[ent.name];

Modified: trunk/libraries/xml-parser/printing.dylan
==============================================================================
--- trunk/libraries/xml-parser/printing.dylan	(original)
+++ trunk/libraries/xml-parser/printing.dylan	Wed Dec 20 23:05:21 2006
@@ -5,16 +5,16 @@
 
 // these variables provide a way to change the look of element tags in case
 // e.g. they want HTML output, instead.
-define variable *open-the-tag* :: <string> = "<";
-define variable *close-the-tag* :: <string> = ">";
-define variable *ampersand* :: <string> = "&";
+define thread variable *open-the-tag* :: <string> = "<";
+define thread variable *close-the-tag* :: <string> = ">";
+define thread variable *ampersand* :: <string> = "&";
 
 // actually, this printing module depends heavily on the transform module
 // (the printing module may be viewed as a derivative work) ... so pretty
 // printing, etc, is controlled by the transform methods and their helpers
 
 define open class <printing> (<xform-state>) end;
-define variable *printer-state* :: <printing> = make(<printing>);
+define thread variable *printer-state* :: <printing> = make(<printing>);
 
 // xml-name turns out to be a pretty powerful way of printing
 // information about the xml thing being printed

Modified: trunk/libraries/xml-parser/productions.dylan
==============================================================================
--- trunk/libraries/xml-parser/productions.dylan	(original)
+++ trunk/libraries/xml-parser/productions.dylan	Wed Dec 20 23:05:21 2006
@@ -67,10 +67,10 @@
   document;
 end function parse-document;
 
-define variable *modify?* :: <boolean> = #t;
-define variable *show-warnings?* :: <boolean> = #f;
-define variable *ignore-instructions?* :: <boolean> = #t;
-define variable *dtd-paths* :: <sequence> = #(".");
+define thread variable *modify?* :: <boolean> = #t;
+define thread variable *show-warnings?* :: <boolean> = #f;
+define thread variable *ignore-instructions?* :: <boolean> = #t;
+define thread variable *dtd-paths* :: <sequence> = #(".");
 
 define meta document-helper(prolog, elemnt, misc) =>
  (make(<document>,
@@ -464,9 +464,9 @@
 // Production 40 (Stag) has been removed (now handled by 39 (element)).
 
 // a little bit of checking for element-name redundancy:
-define variable *last-tag-name* :: false-or(<symbol>) = #f;
+define thread variable *last-tag-name* :: false-or(<symbol>) = #f;
 // ... and proper capitalization for tag names
-define variable *tag-name-with-proper-capitalization* = make(<deque>);
+define thread variable *tag-name-with-proper-capitalization* = make(<deque>);
 
 // Helper method for parsing opening tags; also adds attributes with
 // default values if there are ones specified in the DTD for this elt
@@ -711,7 +711,7 @@
   loop(scan-att-def(att-def)), scan-s?(s), ">", no!(*last-tag-name*)
 end meta attlist-decl;
 
-define variable *last-attrib* = #f;
+define thread variable *last-attrib* = #f;
 
 // [53] AttDef ::= S Name S AttType S DefaultDecl
 //
@@ -866,9 +866,9 @@
 
 //-------------------------------------------------------
 // entity tables
-define variable *pe-refs* = make(<table>);
-define variable *substitute-entities?* :: <boolean> = #t;
-define variable *defining-entities?* :: <boolean> = #f;
+define thread variable *pe-refs* = make(<table>);
+define thread variable *substitute-entities?* :: <boolean> = #t;
+define thread variable *defining-entities?* :: <boolean> = #f;
 
 define generic do-expand(obj :: <xml>) => (ans :: <list>);
 define method do-expand(obj :: <xml>) => (ans :: <list>) list(obj); end;
@@ -1140,7 +1140,7 @@
 
 //-------------------------------------------------------
 // assigning parents
-define variable *parent* = #f;
+define thread variable *parent* = #f;
 define class <add-parents> (<xform-state>) end;
 
 define method before-transform(node :: type-union(<element>, <document>),

Modified: trunk/libraries/xml-parser/transform.dylan
==============================================================================
--- trunk/libraries/xml-parser/transform.dylan	(original)
+++ trunk/libraries/xml-parser/transform.dylan	Wed Dec 20 23:05:21 2006
@@ -4,7 +4,7 @@
 synopsis:  provides the default way to transform XML (just gets the
            text), and a facility to allow user transformations.
 
-define variable *xml-depth* = 0;
+define thread variable *xml-depth* = 0;
 define open class <xform-state> (<object>) end;
 define constant $no-state = make(<xform-state>);
 



More information about the chatter mailing list