@@ -20,24 +20,24 @@ on extensionInitialize
2020 if the target is not me then
2121 pass extensionInitialize
2222 end if
23-
23+
2424 insert the script of me into back
25-
25+
2626 if the environment contains "development" then
2727 set the _ideoverride of me to true
2828 local tName
2929 put the short name of me into tName
30- revSBAddDependencyForInclusion "extensions" , tName , "externals" , "XML"
30+ revSBAddDependencyForInclusion "extensions" , tName , "externals" , "XML"
3131 end if
32-
32+
3333 svgSpecLoad
3434end extensionInitialize
3535
3636on extensionFinalize
3737 if the target is not me then
3838 pass extensionFinalize
3939 end if
40-
40+
4141 remove the script of me from back
4242end extensionFinalize
4343
@@ -539,7 +539,7 @@ private command _svgFlatten @xContext, @xElement
539539 end if
540540 end if
541541 end if
542-
542+
543543 /* Now all the processing for this element has been done, we process each
544544 * child, in order. */
545545 if xElement["content" ] is an array then
@@ -809,7 +809,7 @@ private command _svgCompileTransform @xContext, pTransform, pBBox, @rCompiledTra
809809 _InternalError format ("unknown transform '%s'" , tTransform [1 ])
810810 break
811811 end switch
812- put _svgTransformConcat(tMatrix , tNextMatrix ) into tMatrix
812+ put _svgTransformConcat(tMatrix , tNextMatrix ) into tMatrix
813813 end repeat
814814 put empty into rCompiledTransform
815815 if not _svgTransformIsIdentity(tMatrix ) then
@@ -1009,7 +1009,7 @@ private command _svgCompileResolveGradient @xContext, pElement, @rGradient
10091009 if the number of elements in tColors > 0 then
10101010 put tColors into rGradient["colors" ]
10111011 put tOffsets into rGradient["offsets" ]
1012- end if
1012+ end if
10131013 end if
10141014end _svgCompileResolveGradient
10151015
@@ -1067,7 +1067,7 @@ private command _svgCompileSvg @xContext, pElement
10671067 else if tPreserveAspectRatio contains "yMax" then
10681068 add (tHeight - tViewBox [4 ] * tVScaleY ) to tVTranslateY
10691069 end if
1070-
1070+
10711071 local tViewportMatrix
10721072 put _svgTransformTranslate(tVTranslateX , tVTranslateY ) into tViewportMatrix
10731073 put _svgTransformConcat(tViewportMatrix , _svgTransformScale(tVScaleX , tVScaleY )) into tViewportMatrix
@@ -1170,7 +1170,7 @@ private command _svgCompileShape @xContext, pType, pBBox
11701170 if param (4 ) is an array then
11711171 put param (4 ) into tOperation [2 ]
11721172 else
1173- repeat with tIndex = 4 to paramCount ()
1173+ repeat with tIndex = 4 to the paramCount
11741174 put param (tIndex ) into tOperation [2 ][tIndex - 3 ]
11751175 end repeat
11761176 end if
@@ -1243,8 +1243,10 @@ private function _svgBoxPoints pPoints
12431243 put pPoints [1 ] into tRight
12441244 put pPoints [2 ] into tTop
12451245 put pPoints [2 ] into tBottom
1246- repeat with i = 1 to the number of elements in pPoints by 2
1247- if pPoints [i] < tLeft then
1246+ local tNumberPoints
1247+ put the number of elements in pPoints into tNumberPoints
1248+ repeat with i = 1 to tNumberPoints step 2
1249+ if pPoints [i] < tLeft then
12481250 put pPoints [i] into tLeft
12491251 else if pPoints [i] > tRight then
12501252 put pPoints [i] into tRight
@@ -2367,7 +2369,7 @@ private function _svgParseTransformValue @xValue
23672369
23682370 local tArity
23692371 put the number of elements in tValues into tArity
2370-
2372+
23712373 switch tType
23722374 case "matrix"
23732375 if tArity is not 6 then
@@ -2886,10 +2888,10 @@ private command svgSpecLoad
28862888
28872889 /* Record the name of the new element. */
28882890 put word 2 of tLine into tCurrentElement ["name" ]
2889-
2891+
28902892 next repeat
28912893 end if
2892-
2894+
28932895 /* The 'property' and 'attribute' lines have the same format and define
28942896 * a feature. */
28952897 if tLineType is "property" or tLineType is "attribute" then
@@ -2899,7 +2901,7 @@ private command svgSpecLoad
28992901 _svgSpecError tCurrentRow , "no current element"
29002902 next repeat
29012903 end if
2902-
2904+
29032905 /* Properties must only be defined against the element with no
29042906 * name. */
29052907 if tLineType is "property" and \
@@ -2978,7 +2980,7 @@ private command svgSpecLoad
29782980
29792981 /* Add the feature to the current element's feature map. */
29802982 put tFeature into tCurrentElement [tLineType ][tFeature ["name" ]]
2981-
2983+
29822984 next repeat
29832985 end if
29842986
@@ -3000,7 +3002,7 @@ private command svgSpecLoad
30003002 /* For named elements, the property array is a set of applicable
30013003 * properties. */
30023004 put true into tCurrentElement ["property" ][word 2 of tLine ]
3003-
3005+
30043006 next repeat
30053007 end if
30063008
@@ -3126,53 +3128,53 @@ end _svgSpecError
31263128 */
31273129private function xmlImportFromFile pXMLFile
31283130 local tArray
3129-
3131+
31303132 local tTreeId
31313133 put revCreateXMLTreeFromFileWithNamespaces(pXMLFile , true , true , false ) into tTreeId
3132-
3134+
31333135 if tTreeId begins with "xmlerr," then
31343136 throw tTreeId
31353137 end if
3136-
3138+
31373139 try
31383140 local tRootNode
31393141 put revXMLRootNode (tTreeId ) into tRootNode
31403142 if tRootNode begins with "xmlerr," then
31413143 throw tRootNode
31423144 end if
3143-
3145+
31443146 put _xmlImportNode(tTreeId , revXMLRootNode (tTreeId )) into tArray
3145-
3147+
31463148 finally
31473149 revDeleteXMLTree tTreeId
31483150 end try
3149-
3151+
31503152 return tArray
31513153end xmlImportFromFile
31523154
31533155private function xmlImportFromText pXMLText
31543156 local tArray
3155-
3157+
31563158 local tTreeId
31573159 put revCreateXMLTreeWithNamespaces(pXMLText , true , true , false ) into tTreeId
3158-
3160+
31593161 if tTreeId begins with "xmlerr," then
31603162 throw tTreeId
31613163 end if
3162-
3164+
31633165 try
31643166 local tRootNode
31653167 put revXMLRootNode (tTreeId ) into tRootNode
31663168 if tRootNode begins with "xmlerr," then
31673169 throw tRootNode
31683170 end if
3169-
3171+
31703172 put _xmlImportNode(tTreeId , revXMLRootNode (tTreeId )) into tArray
3171-
3173+
31723174 finally
31733175 revDeleteXMLTree tTreeId
31743176 end try
3175-
3177+
31763178 return tArray
31773179end xmlImportFromText
31783180
@@ -3195,7 +3197,7 @@ private function _xmlImportNode pTreeId, pNode
31953197 /* Extract the node type and index from the pNode path */
31963198 local tArray
31973199 _xmlImportNodeTypeAndIndex pNode , tArray ["type" ], tArray ["index" ]
3198-
3200+
31993201 -- First extract the attributes, these go into an 'attribute' field
32003202 -- as an array mapping attribute name to value
32013203 local tAttributes
@@ -3205,14 +3207,14 @@ private function _xmlImportNode pTreeId, pNode
32053207 end if
32063208 split tAttributes by return and "="
32073209 put tAttributes into tArray ["features" ]
3208-
3210+
32093211 -- Get the list of child nodes
32103212 local tChildNodes
32113213 put revXMLChildNames (pTreeId , pNode , return, empty , true , true ) into tChildNodes
32123214 if tChildNodes begins with "xmlerr," then
32133215 throw tChildNodes
32143216 end if
3215-
3217+
32163218 /* If the list of child nodes of the element is not empty, then we
32173219 * recursively import each child node into a sequence; otherwise the node
32183220 * only contains text (or has no content) which we import as a string. */
@@ -3234,7 +3236,7 @@ private function _xmlImportNode pTreeId, pNode
32343236 /* The content of the node, whether it be just a string or a sequence of
32353237 * other nodes is placed in the 'content' key of the resulting node array. */
32363238 put tContent into tArray ["content" ]
3237-
3239+
32383240 return tArray
32393241end _xmlImportNode
32403242
0 commit comments