Changed ref to Unsynchronized.ref.

This commit is contained in:
Achim D. Brucker 2021-04-28 09:27:40 +01:00
parent 69277ff885
commit 46af09bc1f
13 changed files with 157 additions and 155 deletions

View File

@ -1,11 +1,11 @@
signature CatOptions = signature CatOptions =
sig sig
val O_CATALOG_FILES : Uri.Uri list ref val O_CATALOG_FILES : Uri.Uri list Unsynchronized.ref
val O_PREFER_SOCAT : bool ref val O_PREFER_SOCAT : bool Unsynchronized.ref
val O_PREFER_SYSID : bool ref val O_PREFER_SYSID : bool Unsynchronized.ref
val O_PREFER_CATALOG : bool ref val O_PREFER_CATALOG : bool Unsynchronized.ref
val O_SUPPORT_REMAP : bool ref val O_SUPPORT_REMAP : bool Unsynchronized.ref
val O_CATALOG_ENC : Encoding.Encoding ref val O_CATALOG_ENC : Encoding.Encoding Unsynchronized.ref
val setCatalogDefaults : unit -> unit val setCatalogDefaults : unit -> unit
val setCatalogOptions : Options.Option list * (string -> unit) -> Options.Option list val setCatalogOptions : Options.Option list * (string -> unit) -> Options.Option list
@ -17,12 +17,12 @@ functor CatOptions () : CatOptions =
struct struct
open Encoding Options Uri open Encoding Options Uri
val O_CATALOG_FILES = ref nil: Uri list ref val O_CATALOG_FILES = Unsynchronized.ref nil: Uri list Unsynchronized.ref
val O_PREFER_SOCAT = ref false val O_PREFER_SOCAT = Unsynchronized.ref false
val O_PREFER_SYSID = ref false val O_PREFER_SYSID = Unsynchronized.ref false
val O_PREFER_CATALOG = ref true val O_PREFER_CATALOG = Unsynchronized.ref true
val O_SUPPORT_REMAP = ref true val O_SUPPORT_REMAP = Unsynchronized.ref true
val O_CATALOG_ENC = ref LATIN1 val O_CATALOG_ENC = Unsynchronized.ref LATIN1
fun setCatalogDefaults() = fun setCatalogDefaults() =
let let
@ -45,7 +45,7 @@ functor CatOptions () : CatOptions =
fun setCatalogOptions (opts,doError) = fun setCatalogOptions (opts,doError) =
let let
val catalogs = ref nil:string list ref val catalogs = Unsynchronized.ref nil:string list Unsynchronized.ref
fun hasNoArg key = "option "^key^" has no argument" fun hasNoArg key = "option "^key^" has no argument"
fun mustHave key = String.concat ["option ",key," must have an argument"] fun mustHave key = String.concat ["option ",key," must have an argument"]

View File

@ -5,12 +5,12 @@
signature CatParams = signature CatParams =
sig sig
val O_CATALOG_FILES : Uri.Uri list ref val O_CATALOG_FILES : Uri.Uri list Unsynchronized.ref
val O_PREFER_SOCAT : bool ref val O_PREFER_SOCAT : bool Unsynchronized.ref
val O_PREFER_SYSID : bool ref val O_PREFER_SYSID : bool Unsynchronized.ref
val O_PREFER_CATALOG : bool ref val O_PREFER_CATALOG : bool Unsynchronized.ref
val O_SUPPORT_REMAP : bool ref val O_SUPPORT_REMAP : bool Unsynchronized.ref
val O_CATALOG_ENC : Encoding.Encoding ref val O_CATALOG_ENC : Encoding.Encoding Unsynchronized.ref
val catError : CatError.Position * CatError.CatError -> unit val catError : CatError.Position * CatError.CatError -> unit
end end

View File

@ -68,9 +68,9 @@ structure BaseData =
AD_IMPLIED AD_IMPLIED
| AD_REQUIRED | AD_REQUIRED
| AD_DEFAULT of (UniChar.Vector * UniChar.Vector * AttValue option) | AD_DEFAULT of (UniChar.Vector * UniChar.Vector * AttValue option)
* (Errors.Position * bool ref) * (Errors.Position * bool Unsynchronized.ref)
| AD_FIXED of (UniChar.Vector * UniChar.Vector * AttValue option) | AD_FIXED of (UniChar.Vector * UniChar.Vector * AttValue option)
* (Errors.Position * bool ref) * (Errors.Position * bool Unsynchronized.ref)
(*--- attribute definition (list) ---*) (*--- attribute definition (list) ---*)
(*--- the boolean says whether it was externally declared ---*) (*--- the boolean says whether it was externally declared ---*)
@ -103,7 +103,7 @@ structure BaseData =
(*--------------------------------------------------------------------*) (*--------------------------------------------------------------------*)
(* the id info tells whether an id value has occurred for a name and *) (* the id info tells whether an id value has occurred for a name and *)
(* the list of all positions where it occurred as an idref value. *) (* the list of all positions where it occurred as an idUnsynchronized.ref value. *)
(*--------------------------------------------------------------------*) (*--------------------------------------------------------------------*)
type IdInfo = bool * Errors.Position list type IdInfo = bool * Errors.Position list
val nullIdInfo : IdInfo = (false,nil) val nullIdInfo : IdInfo = (false,nil)

View File

@ -1,8 +1,8 @@
signature DfaOptions = signature DfaOptions =
sig sig
val O_DFA_INITIAL_WIDTH : int ref val O_DFA_INITIAL_WIDTH : int Unsynchronized.ref
val O_DFA_MAX_STATES : int ref val O_DFA_MAX_STATES : int Unsynchronized.ref
val O_DFA_WARN_TOO_LARGE : bool ref val O_DFA_WARN_TOO_LARGE : bool Unsynchronized.ref
val setDfaDefaults : unit -> unit val setDfaDefaults : unit -> unit
val setDfaOptions : Options.Option list * (string -> unit) -> Options.Option list val setDfaOptions : Options.Option list * (string -> unit) -> Options.Option list
@ -14,9 +14,9 @@ functor DfaOptions () : DfaOptions =
struct struct
open Options UtilInt open Options UtilInt
val O_DFA_INITIAL_WIDTH = ref 4 val O_DFA_INITIAL_WIDTH = Unsynchronized.ref 4
val O_DFA_MAX_STATES = ref 256 val O_DFA_MAX_STATES = Unsynchronized.ref 256
val O_DFA_WARN_TOO_LARGE = ref true val O_DFA_WARN_TOO_LARGE = Unsynchronized.ref true
fun setDfaDefaults() = fun setDfaDefaults() =
let let

View File

@ -55,12 +55,14 @@ structure ErrorString : ErrorString =
fun errorVector2String vec = fun errorVector2String vec =
errorData2String (Vector.foldr (op ::) nil vec) errorData2String (Vector.foldr (op ::) nil vec)
val QUOTE = "'"
fun quoteErrorChar0 c = QUOTE^errorChar2String c^QUOTE (* val QUOTE = "'" *)
fun quoteErrorChar c = if c=0wx0 then "entity end" else QUOTE^errorChar2String c^QUOTE
fun quoteErrorData cs = QUOTE^errorData2String cs^QUOTE fun quoteErrorChar0 c = ("'"^(errorChar2String c)^"'")
fun quoteErrorString s = QUOTE^s^QUOTE fun quoteErrorChar c = if c=0wx0 then "entity end" else "'"^(errorChar2String c)^"'"
fun quoteErrorVector v = QUOTE^errorVector2String v^QUOTE fun quoteErrorData cs = "'"^(errorData2String cs)^"'"
fun quoteErrorString s = "'"^s^"'"
fun quoteErrorVector v = "'"^(errorVector2String v)^"'"
fun Position2String (fname,l,c) = fun Position2String (fname,l,c) =
if fname="" then "" if fname="" then ""

View File

@ -111,11 +111,11 @@ structure Dtd : Dtd =
Base UniChar Base UniChar
DataDict DataSymTab DataDict DataSymTab
val O_TS_ELEM = ref 6 (* Initial size of element table *) val O_TS_ELEM = Unsynchronized.ref 6 (* Initial size of element table *)
val O_TS_GEN_ENT = ref 6 (* Initial size of general entity table *) val O_TS_GEN_ENT = Unsynchronized.ref 6 (* Initial size of general entity table *)
val O_TS_ID = ref 6 (* Initial size of id attribute table *) val O_TS_ID = Unsynchronized.ref 6 (* Initial size of id attribute table *)
val O_TS_ATT_NOT = ref 6 (* Initial size of notation table *) val O_TS_ATT_NOT = Unsynchronized.ref 6 (* Initial size of notation table *)
val O_TS_PAR_ENT = ref 6 (* Initial size of parameter entity table *) val O_TS_PAR_ENT = Unsynchronized.ref 6 (* Initial size of parameter entity table *)
(*--------------------------------------------------------------------*) (*--------------------------------------------------------------------*)
(* this is how the predefined entities must be declared. *) (* this is how the predefined entities must be declared. *)
@ -133,9 +133,9 @@ structure Dtd : Dtd =
(*--------------------------------------------------------------------*) (*--------------------------------------------------------------------*)
(* this type holds all information relevent to the DTD. *) (* this type holds all information relevent to the DTD. *)
(*--------------------------------------------------------------------*) (*--------------------------------------------------------------------*)
type Dtd = {hasDtdFlag : bool ref, type Dtd = {hasDtdFlag : bool Unsynchronized.ref,
standAloneFlag : bool ref, standAloneFlag : bool Unsynchronized.ref,
externalFlag : bool ref, externalFlag : bool Unsynchronized.ref,
elDict : ElemInfo DataDict.Dict, elDict : ElemInfo DataDict.Dict,
genDict : GenEntInfo DataDict.Dict, genDict : GenEntInfo DataDict.Dict,
idDict : IdInfo DataDict.Dict, idDict : IdInfo DataDict.Dict,
@ -144,9 +144,9 @@ structure Dtd : Dtd =
preRedef : bool array preRedef : bool array
} }
fun newDtd() = {hasDtdFlag = ref false, fun newDtd() = {hasDtdFlag = Unsynchronized.ref false,
standAloneFlag = ref false, standAloneFlag = Unsynchronized.ref false,
externalFlag = ref false, externalFlag = Unsynchronized.ref false,
elDict = nullDict ("element",nullElemInfo), elDict = nullDict ("element",nullElemInfo),
idDict = nullDict ("ID name",nullIdInfo), idDict = nullDict ("ID name",nullIdInfo),
genDict = nullDict ("general entity",(GE_NULL,false)), genDict = nullDict ("general entity",(GE_NULL,false)),
@ -163,7 +163,7 @@ structure Dtd : Dtd =
(*--------------------------------------------------------------------*) (*--------------------------------------------------------------------*)
(* standalone status, existance of a DTD and of external declarations *) (* standalone status, existance of a DTD and of external declarations *)
(* externalFlag is true if there is an external subset or a (not nece-*) (* externalFlag is true if there is an external subset or a (not nece-*)
(* ssarily external) parameter entity reference in the DTD. (cf. 4.1) *) (* ssarily external) parameter entity Unsynchronized.reference in the DTD. (cf. 4.1) *)
(*--------------------------------------------------------------------*) (*--------------------------------------------------------------------*)
fun standsAlone (dtd:Dtd) = !(#standAloneFlag dtd) fun standsAlone (dtd:Dtd) = !(#standAloneFlag dtd)
fun hasExternal (dtd:Dtd) = !(#externalFlag dtd) fun hasExternal (dtd:Dtd) = !(#externalFlag dtd)
@ -178,16 +178,16 @@ structure Dtd : Dtd =
(* 4.1: *) (* 4.1: *)
(* Well-Formedness Constraint: Entity Declared *) (* Well-Formedness Constraint: Entity Declared *)
(* In a document without any DTD, a document with only an internal *) (* In a document without any DTD, a document with only an internal *)
(* DTD subset which contains no parameter entity references, or a *) (* DTD subset which contains no parameter entity Unsynchronized.references, or a *)
(* document with "standalone='yes'", the Name given in the entity *) (* document with "standalone='yes'", the Name given in the entity *)
(* reference must match that in an entity declaration ... Note that *) (* Unsynchronized.reference must match that in an entity declaration ... Note that *)
(* if entities are declared in the external subset or in external *) (* if entities are declared in the external subset or in external *)
(* parameter entities, a non-validating processor is not obligated *) (* parameter entities, a non-validating processor is not obligated *)
(* to read and process their declarations; for such documents, the *) (* to read and process their declarations; for such documents, the *)
(* rule that an entity must be declared is a well-formedness *) (* rule that an entity must be declared is a well-formedness *)
(* constraint only if standalone='yes'. *) (* constraint only if standalone='yes'. *)
(* *) (* *)
(* Thus a reference to an undeclared entity is a well-formedness *) (* Thus a Unsynchronized.reference to an undeclared entity is a well-formedness *)
(* error if either #hasDtdFlag or #externalFlag is false, or if *) (* error if either #hasDtdFlag or #externalFlag is false, or if *)
(* #standaloneFlag is true *) (* #standaloneFlag is true *)
(*--------------------------------------------------------------------*) (*--------------------------------------------------------------------*)

View File

@ -7,30 +7,30 @@ signature ParserOptions =
sig sig
structure DfaOptions : DfaOptions structure DfaOptions : DfaOptions
val O_CHECK_ISO639 : bool ref val O_CHECK_ISO639 : bool Unsynchronized.ref
val O_CHECK_LANGID : bool ref val O_CHECK_LANGID : bool Unsynchronized.ref
val O_CHECK_PREDEFINED : bool ref val O_CHECK_PREDEFINED : bool Unsynchronized.ref
val O_CHECK_RESERVED : bool ref val O_CHECK_RESERVED : bool Unsynchronized.ref
val O_CHECK_VERSION : bool ref val O_CHECK_VERSION : bool Unsynchronized.ref
val O_WARN_MULT_ENUM : bool ref val O_WARN_MULT_ENUM : bool Unsynchronized.ref
val O_WARN_XML_DECL : bool ref val O_WARN_XML_DECL : bool Unsynchronized.ref
val O_WARN_ATT_NO_ELEM : bool ref val O_WARN_ATT_NO_ELEM : bool Unsynchronized.ref
val O_WARN_MULT_ENT_DECL : bool ref val O_WARN_MULT_ENT_DECL : bool Unsynchronized.ref
val O_WARN_MULT_NOT_DECL : bool ref val O_WARN_MULT_NOT_DECL : bool Unsynchronized.ref
val O_WARN_MULT_ATT_DEF : bool ref val O_WARN_MULT_ATT_DEF : bool Unsynchronized.ref
val O_WARN_MULT_ATT_DECL : bool ref val O_WARN_MULT_ATT_DECL : bool Unsynchronized.ref
val O_WARN_SHOULD_DECLARE : bool ref val O_WARN_SHOULD_DECLARE : bool Unsynchronized.ref
val O_WARN_NON_ASCII_URI : bool ref val O_WARN_NON_ASCII_URI : bool Unsynchronized.ref
val O_ERROR_MINIMIZE : bool ref val O_ERROR_MINIMIZE : bool Unsynchronized.ref
val O_VALIDATE : bool ref val O_VALIDATE : bool Unsynchronized.ref
val O_COMPATIBILITY : bool ref val O_COMPATIBILITY : bool Unsynchronized.ref
val O_INTEROPERABILITY : bool ref val O_INTEROPERABILITY : bool Unsynchronized.ref
val O_INCLUDE_EXT_PARSED : bool ref val O_INCLUDE_EXT_PARSED : bool Unsynchronized.ref
val O_INCLUDE_PARAM_ENTS : bool ref val O_INCLUDE_PARAM_ENTS : bool Unsynchronized.ref
val setParserDefaults : unit -> unit val setParserDefaults : unit -> unit
val setParserOptions : Options.Option list * (string -> unit) -> Options.Option list val setParserOptions : Options.Option list * (string -> unit) -> Options.Option list
@ -44,41 +44,41 @@ functor ParserOptions () : ParserOptions =
open DfaOptions Options UtilInt UtilList open DfaOptions Options UtilInt UtilList
val O_CHECK_VERSION = ref true (* check for conforming xml version? *) val O_CHECK_VERSION = Unsynchronized.ref true (* check for conforming xml version? *)
val O_CHECK_ISO639 = ref true (* check whether a two-letter LangCode *) val O_CHECK_ISO639 = Unsynchronized.ref true (* check whether a two-letter LangCode *)
(* is acording to ISO 639? *) (* is acording to ISO 639? *)
val O_CHECK_LANGID = ref true (* check whether a LangCode fullfills *) val O_CHECK_LANGID = Unsynchronized.ref true (* check whether a LangCode fullfills *)
(* IETF RFC 1766? *) (* IETF RFC 1766? *)
val O_CHECK_RESERVED = ref false(* check for names starting with xml? *) val O_CHECK_RESERVED = Unsynchronized.ref false(* check for names starting with xml? *)
val O_CHECK_PREDEFINED = ref true (* check declarations of predefined *) val O_CHECK_PREDEFINED = Unsynchronized.ref true (* check declarations of predefined *)
val O_WARN_MULT_ENUM = ref true (* check whether a token occurs *) val O_WARN_MULT_ENUM = Unsynchronized.ref true (* check whether a token occurs *)
(* twice in the enumerated attribute *) (* twice in the enumerated attribute *)
(* types of the same element *) (* types of the same element *)
val O_WARN_XML_DECL = ref false (* warn if the XML decl is missing? *) val O_WARN_XML_DECL = Unsynchronized.ref false (* warn if the XML decl is missing? *)
val O_WARN_ATT_NO_ELEM = ref true (* warn for undeclared elements *) val O_WARN_ATT_NO_ELEM = Unsynchronized.ref true (* warn for undeclared elements *)
(* in att def list declarations? *) (* in att def list declarations? *)
val O_WARN_MULT_ENT_DECL = ref true (* warn about redefined entities *) val O_WARN_MULT_ENT_DECL = Unsynchronized.ref true (* warn about redefined entities *)
val O_WARN_MULT_NOT_DECL = ref true (* warn about redefined notations*) val O_WARN_MULT_NOT_DECL = Unsynchronized.ref true (* warn about redefined notations*)
val O_WARN_SHOULD_DECLARE = ref true (* warn if predefined entities *) val O_WARN_SHOULD_DECLARE = Unsynchronized.ref true (* warn if predefined entities *)
(* are not declared in the dtd *) (* are not declared in the dtd *)
val O_WARN_MULT_ATT_DEF = ref true (* warn if an attributes is defd *) val O_WARN_MULT_ATT_DEF = Unsynchronized.ref true (* warn if an attributes is defd *)
(* twice for the same element? *) (* twice for the same element? *)
val O_WARN_MULT_ATT_DECL = ref true (* warn if there are multiple att *) val O_WARN_MULT_ATT_DECL = Unsynchronized.ref true (* warn if there are multiple att *)
(* def lists for one element? *) (* def lists for one element? *)
val O_WARN_NON_ASCII_URI = ref true (* warn about non-ascii chars in *) val O_WARN_NON_ASCII_URI = Unsynchronized.ref true (* warn about non-ascii chars in *)
(* system identifiers? *) (* system identifiers? *)
val O_ERROR_MINIMIZE = ref true (* try to avoid repeating errors? *) val O_ERROR_MINIMIZE = Unsynchronized.ref true (* try to avoid repeating errors? *)
val O_VALIDATE = ref true val O_VALIDATE = Unsynchronized.ref true
val O_COMPATIBILITY = ref true val O_COMPATIBILITY = Unsynchronized.ref true
val O_INTEROPERABILITY = ref false val O_INTEROPERABILITY = Unsynchronized.ref false
val O_INCLUDE_EXT_PARSED = ref false val O_INCLUDE_EXT_PARSED = Unsynchronized.ref false
val O_INCLUDE_PARAM_ENTS = ref false val O_INCLUDE_PARAM_ENTS = Unsynchronized.ref false
fun setParserDefaults() = fun setParserDefaults() =
let let

View File

@ -232,7 +232,7 @@ struct
(* appear in their literal form only when used as markup delimiters,*) (* appear in their literal form only when used as markup delimiters,*)
(* or within a comment, a processing instruction, or a CDATA *) (* or within a comment, a processing instruction, or a CDATA *)
(* section... If they are needed elsewhere, they must be escaped *) (* section... If they are needed elsewhere, they must be escaped *)
(* using either numeric character references or the strings "&" *) (* using either numeric character Unsynchronized.references or the strings "&" *)
(* and "<" respectively... *) (* and "<" respectively... *)
(* *) (* *)
(* consume the content of the element, accumulating it via the user *) (* consume the content of the element, accumulating it via the user *)
@ -319,19 +319,19 @@ struct
end end
end end
(*--------------------------------------------------------------*) (*--------------------------------------------------------------*)
(* consume a reference, handling errors by ignoring them. *) (* consume a Unsynchronized.reference, handling errors by ignoring them. *)
(*--------------------------------------------------------------*) (*--------------------------------------------------------------*)
fun do_ref (q,(c1,a1,q1)) = fun do_ref (q,(c1,a1,q1)) =
if c1=0wx23 (* #"#" *) if c1=0wx23 (* #"#" *)
(*------------------------------------------------------*) (*------------------------------------------------------*)
(* it's a character reference. *) (* it's a character Unsynchronized.reference. *)
(*------------------------------------------------------*) (*------------------------------------------------------*)
then let val err = ERR_ELEM_CONTENT IT_CHAR_REF then let val err = ERR_ELEM_CONTENT IT_CHAR_REF
val a2 = hookError(a1,(getPos q,err)) val a2 = hookError(a1,(getPos q,err))
in skipCharRef(a2,q1) in skipCharRef(a2,q1)
end end
(*---------------------------------------------------------*) (*---------------------------------------------------------*)
(* it's a general entity reference. *) (* it's a general entity Unsynchronized.reference. *)
(*---------------------------------------------------------*) (*---------------------------------------------------------*)
else let val ((id,ent),(a2,q2)) = parseGenRef dtd (c1,a1,q1) else let val ((id,ent),(a2,q2)) = parseGenRef dtd (c1,a1,q1)
in case ent in case ent
@ -368,7 +368,7 @@ struct
"parseGenRef returned GE_UNPARSED") "parseGenRef returned GE_UNPARSED")
end end
(*-------------------------------------------------------*) (*-------------------------------------------------------*)
(* handle any errors in references by ignoring them. *) (* handle any errors in Unsynchronized.references by ignoring them. *)
(*-------------------------------------------------------*) (*-------------------------------------------------------*)
handle SyntaxError caq => caq handle SyntaxError caq => caq
| NoSuchEntity aq => getChar aq | NoSuchEntity aq => getChar aq
@ -552,10 +552,10 @@ struct
(* appear in their literal form only when used as markup delimiters,*) (* appear in their literal form only when used as markup delimiters,*)
(* or within a comment, a processing instruction, or a CDATA *) (* or within a comment, a processing instruction, or a CDATA *)
(* section... If they are needed elsewhere, they must be escaped *) (* section... If they are needed elsewhere, they must be escaped *)
(* using either numeric character references or the strings "&" *) (* using either numeric character Unsynchronized.references or the strings "&" *)
(* and "<" respectively. The right angle bracket (>) may be *) (* and "<" respectively. The right angle bracket (>) may be *)
(* represented using the string ">", and must, for compatibility,*) (* represented using the string ">", and must, for compatibility,*)
(* be escaped using ">" or a character reference when it appears *) (* be escaped using ">" or a character Unsynchronized.reference when it appears *)
(* in the string "]]>" in content, when that string is not marking *) (* in the string "]]>" in content, when that string is not marking *)
(* the end of a CDATA section. *) (* the end of a CDATA section. *)
(* *) (* *)
@ -583,7 +583,7 @@ struct
(*--------------------------------------------------------------*) (*--------------------------------------------------------------*)
fun do_data (br,(c0,a0,q0)) = fun do_data (br,(c0,a0,q0)) =
let let
val pos0 = ref (getPos q0) val pos0 = Unsynchronized.ref (getPos q0)
val _ = Array.update(dataBuffer,0,c0) val _ = Array.update(dataBuffer,0,c0)
fun data_hook (i,(a,q)) = fun data_hook (i,(a,q)) =
@ -663,12 +663,12 @@ struct
*) *)
(*--------------------------------------------------------------*) (*--------------------------------------------------------------*)
(* consume a reference, handling errors by ignoring them. *) (* consume a Unsynchronized.reference, handling errors by ignoring them. *)
(*--------------------------------------------------------------*) (*--------------------------------------------------------------*)
fun do_ref (q0,(c,a,q)) = fun do_ref (q0,(c,a,q)) =
if c=0wx23 (* #"#" *) if c=0wx23 (* #"#" *)
(*------------------------------------------------------*) (*------------------------------------------------------*)
(* it's a character reference. *) (* it's a character Unsynchronized.reference. *)
(*------------------------------------------------------*) (*------------------------------------------------------*)
then let val (cs,(ch,a1,q1)) = parseCharRefLit [0wx23,0wx26] (a,q) then let val (cs,(ch,a1,q1)) = parseCharRefLit [0wx23,0wx26] (a,q)
val cv = Data2Vector(rev cs) val cv = Data2Vector(rev cs)
@ -678,7 +678,7 @@ struct
handle SyntaxError caq => caq handle SyntaxError caq => caq
| NoSuchChar aq => getChar aq | NoSuchChar aq => getChar aq
(*---------------------------------------------------------*) (*---------------------------------------------------------*)
(* it's a general entity reference. *) (* it's a general entity Unsynchronized.reference. *)
(*---------------------------------------------------------*) (*---------------------------------------------------------*)
else let val ((id,ent),(a1,q1)) = parseGenRef dtd (c,a,q) else let val ((id,ent),(a1,q1)) = parseGenRef dtd (c,a,q)
in case ent in case ent
@ -715,7 +715,7 @@ struct
"parseGenRef returned GE_UNPARSED") "parseGenRef returned GE_UNPARSED")
end end
(*-------------------------------------------------------*) (*-------------------------------------------------------*)
(* handle any errors in references by ignoring them. *) (* handle any errors in Unsynchronized.references by ignoring them. *)
(*-------------------------------------------------------*) (*-------------------------------------------------------*)
handle SyntaxError caq => caq handle SyntaxError caq => caq
| NoSuchEntity aq => getChar aq | NoSuchEntity aq => getChar aq

View File

@ -897,7 +897,7 @@ struct
(*--------------------------------------------------------------------*) (*--------------------------------------------------------------------*)
(* parse an attribute type, the 1st arg being the element this decl. *) (* parse an attribute type, the 1st arg being the element this decl. *)
(* refers to. 3.3.1: *) (* Unsynchronized.refers to. 3.3.1: *)
(* *) (* *)
(* [54] AttType ::= StringType | TokenizedType | EnumeratedType *) (* [54] AttType ::= StringType | TokenizedType | EnumeratedType *)
(* *) (* *)
@ -1026,7 +1026,7 @@ struct
else else
let val (cv,(av,a4)) = makeAttValue dtd (a3,q2) let val (cv,(av,a4)) = makeAttValue dtd (a3,q2)
(aidx,attType,false,true,text) (aidx,attType,false,true,text)
in (AD_FIXED((lit,cv,av),(getPos q2,ref false)),(c3,a4,q3)) in (AD_FIXED((lit,cv,av),(getPos q2,Unsynchronized.ref false)),(c3,a4,q3))
end end
handle AttValue a => (AD_IMPLIED,(c3,a,q3)) handle AttValue a => (AD_IMPLIED,(c3,a,q3))
end end
@ -1052,13 +1052,13 @@ struct
in (AD_IMPLIED,(c1,a2,q1)) in (AD_IMPLIED,(c1,a2,q1))
end end
else let val (cv,(av,a2)) = makeAttValue dtd (a1,q) (aidx,attType,false,true,text) else let val (cv,(av,a2)) = makeAttValue dtd (a1,q) (aidx,attType,false,true,text)
in (AD_DEFAULT((lit,cv,av),(getPos q,ref false)),(c1,a2,q1)) in (AD_DEFAULT((lit,cv,av),(getPos q,Unsynchronized.ref false)),(c1,a2,q1))
end end
handle AttValue a => (AD_IMPLIED,(c1,a,q1)) handle AttValue a => (AD_IMPLIED,(c1,a,q1))
end end
(*--------------------------------------------------------------------*) (*--------------------------------------------------------------------*)
(* parse an attribute definition, the referred element given as 1st *) (* parse an attribute definition, the Unsynchronized.referred element given as 1st *)
(* argument. 3.3: *) (* argument. 3.3: *)
(* *) (* *)
(* [53] AttDef ::= S Name S AttType S DefaultDecl *) (* [53] AttDef ::= S Name S AttType S DefaultDecl *)

View File

@ -46,7 +46,7 @@
(* *) (* *)
(* The characters #x85 and #x2028 cannot be reliably recognized and *) (* The characters #x85 and #x2028 cannot be reliably recognized and *)
(* translated until an entity's encoding declaration (if present) has *) (* translated until an entity's encoding declaration (if present) has *)
(* been read. Therefore, it is a fatal error to use them within the XML *) (* been read. TheUnsynchronized.refore, it is a fatal error to use them within the XML *)
(* declaration or text declaration. *) (* declaration or text declaration. *)
(****************************************************************************) (****************************************************************************)
(* *) (* *)
@ -86,7 +86,7 @@ signature Entities =
val getChar : AppData * State -> UniChar.Char * AppData * State val getChar : AppData * State -> UniChar.Char * AppData * State
val getChar11 : AppData * State -> UniChar.Char * AppData * State val getChar11 : AppData * State -> UniChar.Char * AppData * State
val getCharRef : (AppData * State -> UniChar.Char * AppData * State) ref val getCharRef : (AppData * State -> UniChar.Char * AppData * State) Unsynchronized.ref
val ungetChars : State * UniChar.Data -> State val ungetChars : State * UniChar.Data -> State
val isOpen : int * bool * State -> bool val isOpen : int * bool * State -> bool
@ -489,7 +489,7 @@ functor Entities (structure Hooks : Hooks) : Entities =
else else
if c<0wx7F orelse c>0wx9F then (c,a,EXT1(dec1,l,col+1,false,typ)) if c<0wx7F orelse c>0wx9F then (c,a,EXT1(dec1,l,col+1,false,typ))
else (* in XML 1.1 the control characters 0wx7F through 0wx9F must appear else (* in XML 1.1 the control characters 0wx7F through 0wx9F must appear
only as chracter references *) only as chracter Unsynchronized.references *)
let let
val a1 = hookError(a,(getPos q,ERR_MUST_CHARREF c)) val a1 = hookError(a,(getPos q,ERR_MUST_CHARREF c))
in in
@ -530,7 +530,7 @@ functor Entities (structure Hooks : Hooks) : Entities =
else else
if c<0wx7F orelse c>0wx9F then (c,a,EXT2(arr,s,i+1,l,col+1,false,det)) if c<0wx7F orelse c>0wx9F then (c,a,EXT2(arr,s,i+1,l,col+1,false,det))
else (* in XML 1.1 the control characters 0wx7F through 0wx9F must appear else (* in XML 1.1 the control characters 0wx7F through 0wx9F must appear
only as chracter references *) only as chracter Unsynchronized.references *)
let let
val a1 = hookError(a,(getPos q,ERR_MUST_CHARREF c)) val a1 = hookError(a,(getPos q,ERR_MUST_CHARREF c))
in in
@ -557,7 +557,7 @@ functor Entities (structure Hooks : Hooks) : Entities =
| LOOKED(nil,q) => getChar11(a,q) | LOOKED(nil,q) => getChar11(a,q)
| LOOKED(c::cs,q) => (c,a,LOOKED(cs,q)) | LOOKED(c::cs,q) => (c,a,LOOKED(cs,q))
val getCharRef = ref getChar val getCharRef = Unsynchronized.ref getChar
fun getChar x = !getCharRef x fun getChar x = !getCharRef x

View File

@ -30,13 +30,13 @@ signature UniClasses =
sig sig
val isName : UniChar.Char -> bool val isName : UniChar.Char -> bool
val isName11 : UniChar.Char -> bool val isName11 : UniChar.Char -> bool
val isNameRef : (UniChar.Char -> bool) ref val isNameRef : (UniChar.Char -> bool) Unsynchronized.ref
val isNms : UniChar.Char -> bool val isNms : UniChar.Char -> bool
val isNms11 : UniChar.Char -> bool val isNms11 : UniChar.Char -> bool
val isNmsRef : (UniChar.Char -> bool) ref val isNmsRef : (UniChar.Char -> bool) Unsynchronized.ref
val isXml : UniChar.Char -> bool val isXml : UniChar.Char -> bool
val isXml11 : UniChar.Char -> bool val isXml11 : UniChar.Char -> bool
val isXmlRef : (UniChar.Char -> bool) ref val isXmlRef : (UniChar.Char -> bool) Unsynchronized.ref
val isPubid : UniChar.Char -> bool val isPubid : UniChar.Char -> bool
val isS : UniChar.Char -> bool val isS : UniChar.Char -> bool
val isEnc : UniChar.Char -> bool val isEnc : UniChar.Char -> bool
@ -112,7 +112,7 @@ structure UniClasses : UniClasses =
fun isNms11 c = if c<=0wxFFFF then inCharClass(c,nms11Class) fun isNms11 c = if c<=0wxFFFF then inCharClass(c,nms11Class)
else c>=0wx10000 andalso c<=0wxEFFFF else c>=0wx10000 andalso c<=0wxEFFFF
val isNmsRef = ref isNms val isNmsRef = Unsynchronized.ref isNms
fun isNms x = (!isNmsRef) x fun isNms x = (!isNmsRef) x
@ -129,7 +129,7 @@ structure UniClasses : UniClasses =
fun isName11 c = if c<=0wxFFFF then inCharClass(c,name11Class) fun isName11 c = if c<=0wxFFFF then inCharClass(c,name11Class)
else c>=0wx10000 andalso c<=0wxEFFFF else c>=0wx10000 andalso c<=0wxEFFFF
val isNameRef = ref isName val isNameRef = Unsynchronized.ref isName
fun isName x = (!isNameRef) x fun isName x = (!isNameRef) x
@ -150,7 +150,7 @@ structure UniClasses : UniClasses =
c>=0wxE000 andalso c<=0wxFFFD orelse c>=0wxE000 andalso c<=0wxFFFD orelse
c>=0wx10000 andalso c<=0wx10FFFF c>=0wx10000 andalso c<=0wx10FFFF
val isXmlRef = ref isXml val isXmlRef = Unsynchronized.ref isXml
fun isXml x = (!isXmlRef) x fun isXml x = (!isXmlRef) x

View File

@ -108,21 +108,21 @@ functor Dict (structure Key : Key) : Dict =
(* - a default value for the value table *) (* - a default value for the value table *)
(*--------------------------------------------------------------------*) (*--------------------------------------------------------------------*)
type 'a Dict = {desc : string, type 'a Dict = {desc : string,
tab : (Key * 'a) array ref, tab : (Key * 'a) array Unsynchronized.ref,
hashTab : Bucket array ref, hashTab : Bucket array Unsynchronized.ref,
hashFun : (Key -> int) ref, hashFun : (Key -> int) Unsynchronized.ref,
width : int ref, (* bit width *) width : int Unsynchronized.ref, (* bit width *)
size : int ref, (* tab size=2^width, hash size is double *) size : int Unsynchronized.ref, (* tab size=2^width, hash size is double *)
count : int ref, (* number of entries *) count : int Unsynchronized.ref, (* number of entries *)
def : 'a (* default for values *) def : 'a (* default for values *)
} }
fun nullDict (desc,def) = {desc = desc, fun nullDict (desc,def) = {desc = desc,
tab = ref (Array.array(1,(Key.null,def))), tab = Unsynchronized.ref (Array.array(1,(Key.null,def))),
hashTab = ref (Array.array(2,nullBucket)), hashTab = Unsynchronized.ref (Array.array(2,nullBucket)),
hashFun = ref (fn _ => 0), hashFun = Unsynchronized.ref (fn _ => 0),
count = ref 0, count = Unsynchronized.ref 0,
size = ref 1, size = Unsynchronized.ref 1,
width = ref 0, width = Unsynchronized.ref 0,
def = def} def = def}
(*--------------------------------------------------------------------*) (*--------------------------------------------------------------------*)
@ -168,12 +168,12 @@ functor Dict (structure Key : Key) : Dict =
val width= Int.min(Int.max(1,w),MAX_WIDTH) val width= Int.min(Int.max(1,w),MAX_WIDTH)
val size = Word.toInt(Word.<<(0w1,Word.fromInt(width-1))) val size = Word.toInt(Word.<<(0w1,Word.fromInt(width-1)))
in {desc = desc, in {desc = desc,
tab = ref (Array.array(size,(Key.null,def))), tab = Unsynchronized.ref (Array.array(size,(Key.null,def))),
hashTab = ref (Array.array(2*size,nullBucket)), hashTab = Unsynchronized.ref (Array.array(2*size,nullBucket)),
hashFun = ref (makeHashFun(size,width)), hashFun = Unsynchronized.ref (makeHashFun(size,width)),
width = ref width, width = Unsynchronized.ref width,
size = ref size, size = Unsynchronized.ref size,
count = ref 0, count = Unsynchronized.ref 0,
def = def} def = def}
end end
@ -184,7 +184,7 @@ functor Dict (structure Key : Key) : Dict =
case widthOpt case widthOpt
of NONE => of NONE =>
let let
val {tab=ref tab,hashTab=ref hashTab,size,count,def,...} = dict val {tab=Unsynchronized.ref tab,hashTab=Unsynchronized.ref hashTab,size,count,def,...} = dict
val _ = appInterval (fn i => Array.update(tab,i,(Key.null,def))) (0,!count-1) val _ = appInterval (fn i => Array.update(tab,i,(Key.null,def))) (0,!count-1)
val _ = appInterval (fn i => Array.update(hashTab,i,nullBucket)) (0,!size*2-1) val _ = appInterval (fn i => Array.update(hashTab,i,nullBucket)) (0,!size*2-1)
in in

View File

@ -99,21 +99,21 @@ functor SymTable (structure Key : Key) : SymTable =
(* - an integer count holding the next free index *) (* - an integer count holding the next free index *)
(*--------------------------------------------------------------------*) (*--------------------------------------------------------------------*)
type SymTable = {desc : string, type SymTable = {desc : string,
tab : Key array ref, tab : Key array Unsynchronized.ref,
hash : Bucket array ref, hash : Bucket array Unsynchronized.ref,
hashFun : (Key -> int) ref, hashFun : (Key -> int) Unsynchronized.ref,
width : int ref, (* bit width *) width : int Unsynchronized.ref, (* bit width *)
size : int ref, (* tab size=2^width, hash size is double *) size : int Unsynchronized.ref, (* tab size=2^width, hash size is double *)
count : int ref (* number of entries *) count : int Unsynchronized.ref (* number of entries *)
} }
fun nullSymTable desc = {desc = desc, fun nullSymTable desc = {desc = desc,
tab = ref (Array.array(1,Key.null)), tab = Unsynchronized.ref (Array.array(1,Key.null)),
hash = ref (Array.array(2,nullBucket)), hash = Unsynchronized.ref (Array.array(2,nullBucket)),
hashFun = ref (fn _ => 0), hashFun = Unsynchronized.ref (fn _ => 0),
count = ref 0, count = Unsynchronized.ref 0,
size = ref 1, size = Unsynchronized.ref 1,
width = ref 0} : SymTable width = Unsynchronized.ref 0} : SymTable
(*--------------------------------------------------------------------*) (*--------------------------------------------------------------------*)
(* how many entries are in the symtable? *) (* how many entries are in the symtable? *)
@ -158,12 +158,12 @@ functor SymTable (structure Key : Key) : SymTable =
val width= Int.min(Int.max(1,w),MAX_WIDTH) val width= Int.min(Int.max(1,w),MAX_WIDTH)
val size = Word.toInt(Word.<<(0w1,Word.fromInt(width-1))) val size = Word.toInt(Word.<<(0w1,Word.fromInt(width-1)))
in {desc = desc, in {desc = desc,
tab = ref (Array.array(size,Key.null)), tab = Unsynchronized.ref (Array.array(size,Key.null)),
hash = ref (Array.array(2*size,nullBucket)), hash = Unsynchronized.ref (Array.array(2*size,nullBucket)),
hashFun = ref (makeHashFun(size,width)), hashFun = Unsynchronized.ref (makeHashFun(size,width)),
width = ref width, width = Unsynchronized.ref width,
size = ref size, size = Unsynchronized.ref size,
count = ref 0} count = Unsynchronized.ref 0}
end end
(*--------------------------------------------------------------------*) (*--------------------------------------------------------------------*)
@ -173,7 +173,7 @@ functor SymTable (structure Key : Key) : SymTable =
case widthOpt case widthOpt
of NONE => of NONE =>
let let
val {tab=ref tab,hash=ref hash,size,count,...} = symTab val {tab=Unsynchronized.ref tab,hash=Unsynchronized.ref hash,size,count,...} = symTab
val _ = appInterval (fn i => Array.update(tab,i,Key.null)) (0,!count-1) val _ = appInterval (fn i => Array.update(tab,i,Key.null)) (0,!count-1)
val _ = appInterval (fn i => Array.update(hash,i,nullBucket)) (0,!size*2-1) val _ = appInterval (fn i => Array.update(hash,i,nullBucket)) (0,!size*2-1)
in in
@ -276,7 +276,7 @@ functor SymTable (structure Key : Key) : SymTable =
(*--------------------------------------------------------------------*) (*--------------------------------------------------------------------*)
(* reserve an index for a (yet unknown) key. *) (* reserve an index for a (yet unknown) key. *)
(*--------------------------------------------------------------------*) (*--------------------------------------------------------------------*)
fun reserveSymIndex(st as {size,count=count as ref i,...}:SymTable) = fun reserveSymIndex(st as {size,count=count as Unsynchronized.ref i,...}:SymTable) =
let let
val _ = if !size>i then () else growTable st val _ = if !size>i then () else growTable st
val _ = count := i+1 val _ = count := i+1