Changeset 241 for trunk/lingosource/castlib2/PseudoXMLPS.ls
- Timestamp:
- 12/18/09 15:27:43 (2 years ago)
- File:
-
- 1 edited
-
trunk/lingosource/castlib2/PseudoXMLPS.ls (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lingosource/castlib2/PseudoXMLPS.ls
r228 r241 77 77 ----------------------------------- 78 78 79 80 79 on _____________________PROPERTY_DECLARATION me 80 end 81 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 82 property pXMLParserXtra 83 property pXmlxtraversion, pVersionNumber 84 85 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 81 86 on ___________PUBLIC_EVENTS me 82 87 end … … 87 92 end 88 93 94 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 95 96 on mDestroy me 97 pXMLParserXtra = void 98 end 99 100 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 89 101 90 102 … … 174 186 175 187 if not(string(docName).length) then docName = "Untitled" 188 if not("abcdefghijklmnopqrstuvwxyz_" contains char 1 of docname) then put "a" before docname 176 189 put "<" & docName & ">" & RETURN after str 177 190 … … 238 251 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 239 252 240 241 property pXmlxtraversion242 253 243 254 on mGetListFromXMLStringX me, str, convertValues, withParams … … 318 329 end if 319 330 320 xt= new(xtra "XmlParser")321 xt.parseString(str)322 323 if not(voidP( xt.getError())) then324 put "Script: PseudoXMLPS; Handler: mGetListFromXMLStringX; error:" && xt.getError()331 if not(objectP(pXMLParserXtra)) then pXMLParserXtra = new(xtra "XmlParser") 332 pXMLParserXtra.parseString(str) 333 334 if not(voidP(pXMLParserXtra.getError())) then 335 put "Script: PseudoXMLPS; Handler: mGetListFromXMLStringX; error:" && pXMLParserXtra.getError() 325 336 return mGetListFromXMLString(me, str, convertValues, withParams) 326 337 end if 327 338 328 xx = xt.makePropList()339 xx = pXMLParserXtra.makePropList() 329 340 dontEscapeSpecialChars = 1 -- we do not need to do this, as the xmlparser xtra already did it for us 330 341 li = mConvertXMLPropList(me, [xx], convertValues, dontEscapeSpecialChars) … … 351 362 ----------------------------------- 352 363 353 dertext = xscr(#FileIOFunktionen).mGetTextFromFile(thePath )364 dertext = xscr(#FileIOFunktionen).mGetTextFromFile(thePath, void, "windows-1252") 354 365 if length(dertext) > 0 then return mGetListFromXMLStringX(me, dertext) 355 366 return [:] … … 800 811 v2 = value(val) 801 812 802 if ilk(v2) = #vectorthen return v2813 if [#vector, #rect, #point, #float].getPos(ilk(v2)) then return v2 803 814 804 815 if abs(length(string(v2)) - length(val)) > 1 then return void -- in case of symbols the # gets stripped, when we use the string() function … … 1295 1306 end if 1296 1307 1297 alreadyProcessed = [] 1308 if getVersionNumber(me) > 10.99 then 1309 -- director 11 will have unicode numbers for the chars 1310 indFrom = 3 1311 end if 1312 1298 1313 1299 1314 newStr = str … … 1301 1316 tstr = str 1302 1317 vers = 0 1303 rmac= numToChar(repl[indFrom])1304 r win= numToChar(repl[indTo])1305 offs = offset( rmac, tstr)1318 searchChar = numToChar(repl[indFrom]) 1319 replaceChar = numToChar(repl[indTo]) 1320 offs = offset(searchChar, tstr) 1306 1321 repeat while offs > 0 1307 1322 ctn = charToNum(char offs of tstr) 1308 1323 delete char 1 to offs of tstr 1309 1324 vers = vers + offs 1310 if ctn = repl[ 1] then1311 put r wininto char vers of newStr1325 if ctn = repl[indFrom] then 1326 put replaceChar into char vers of newStr 1312 1327 end if 1313 offs = offset( rmac, tstr)1328 offs = offset(searchChar, tstr) 1314 1329 end repeat 1315 1330 end repeat … … 1323 1338 end repeat 1324 1339 1325 1326 1340 return newStr 1327 1341 end … … 1354 1368 fromStr = "" 1355 1369 toStr = "" 1370 1371 if getVersionNumber(me) > 10.99 then 1372 -- director 11 will have unicode numbers for the chars 1373 fromIndex = 3 1374 else 1375 fromIndex = 1 1376 end if 1377 1356 1378 repeat with repl in replLi 1357 put numToChar(repl[ 1]) after fromStr1379 put numToChar(repl[fromIndex]) after fromStr 1358 1380 put numToChar(repl[2]) after toStr 1359 1381 end repeat … … 1367 1389 on mGetCharMapList me 1368 1390 li = [] 1369 li.add([128, 196 ])1370 li.add([129, 197 ])1371 li.add([130, 199 ])1372 li.add([131, 201 ])1373 li.add([132, 209 ])1374 li.add([133, 214 ])1375 li.add([134, 220 ])1376 li.add([135, 225 ])1377 li.add([136, 224 ])1378 li.add([137, 226 ])1379 li.add([138, 228 ])1380 li.add([139, 227 ])1381 li.add([140, 229 ])1382 li.add([141, 231 ])1383 li.add([142, 233 ])1384 li.add([143, 232 ])1385 li.add([144, 234 ])1386 li.add([145, 235 ])1387 li.add([146, 237 ])1388 li.add([147, 236 ])1389 li.add([148, 238 ])1390 li.add([149, 239 ])1391 li.add([150, 241 ])1392 li.add([151, 243 ])1393 li.add([152, 242 ])1394 li.add([153, 244 ])1395 li.add([154, 246 ])1396 li.add([155, 245 ])1397 li.add([156, 250 ])1398 li.add([157, 249 ])1399 li.add([158, 251 ])1400 li.add([159, 252 ])1401 li.add([160, 134 ])1402 li.add([161, 176 ])1403 li.add([164, 167 ])1404 li.add([165, 149 ])1405 li.add([166, 182 ])1406 li.add([167, 223 ])1407 li.add([168, 174 ])1408 li.add([170, 153 ])1409 li.add([171, 180 ])1410 li.add([172, 168 ])1411 li.add([173, 141 ])1412 li.add([174, 198 ])1413 li.add([175, 216 ])1414 li.add([176, 144 ])1415 li.add([178, 143 ])1416 li.add([179, 142 ])1417 li.add([180, 165 ])1418 li.add([182, 240 ])1419 li.add([183, 221 ])1420 li.add([184, 222 ])1421 li.add([185, 254 ])1422 li.add([186, 138 ])1423 li.add([187, 170 ])1424 li.add([188, 186 ])1425 li.add([189, 253 ])1426 li.add([190, 230 ])1427 li.add([191, 248 ])1428 li.add([192, 191 ])1429 li.add([193, 161 ])1430 li.add([194, 172 ])1431 li.add([195, 175 ])1432 li.add([196, 131 ])1433 li.add([197, 188 ])1434 li.add([198, 208 ])1435 li.add([199, 171 ])1436 li.add([200, 187 ])1437 li.add([201, 133 ])1438 li.add([202, 160 ])1439 li.add([203, 192 ])1440 li.add([204, 195 ])1441 li.add([205, 213 ])1442 li.add([206, 140 ])1443 li.add([207, 156 ])1444 li.add([208, 173 ])1445 li.add([209, 151 ])1446 li.add([210, 147 ])1447 li.add([211, 148 ])1448 li.add([212, 145 ])1449 li.add([213, 146 ])1450 li.add([214, 247 ])1451 li.add([216, 255 ])1452 li.add([217, 159 ])1453 li.add([218, 158 ])1454 li.add([219, 128 ])1455 li.add([220, 139 ])1456 li.add([221, 155 ])1457 li.add([222, 128 ])1458 li.add([223, 129 ])1459 li.add([224, 135 ])1460 li.add([225, 183 ])1461 li.add([226, 130 ])1462 li.add([227, 132 ])1463 li.add([228, 137 ])1464 li.add([229, 194 ])1465 li.add([230, 202 ])1466 li.add([231, 193 ])1467 li.add([232, 203 ])1468 li.add([233, 200 ])1469 li.add([234, 205 ])1470 li.add([235, 206 ])1471 li.add([236, 207 ])1472 li.add([237, 204 ])1473 li.add([238, 211 ])1474 li.add([239, 212 ])1475 li.add([240, 157 ])1476 li.add([241, 210 ])1477 li.add([242, 218 ])1478 li.add([243, 219 ])1479 li.add([244, 217 ])1480 li.add([245, 166 ])1481 li.add([246, 136 ])1482 li.add([247, 152 ])1483 li.add([248, 150 ])1484 li.add([249, 154 ])1485 li.add([250, 178 ])1486 li.add([251, 190 ])1487 li.add([252, 184 ])1488 li.add([253, 189 ])1489 li.add([254, 179 ])1490 li.add([255, 185 ])1391 li.add([128, 196, 402]) 1392 li.add([129, 197, 8776]) 1393 li.add([130, 199, 171]) 1394 li.add([131, 201, 8230]) 1395 li.add([132, 209, 8212]) 1396 li.add([133, 214, 247]) 1397 li.add([134, 220, 8249]) 1398 li.add([135, 225, 183]) 1399 li.add([136, 224, 8225]) 1400 li.add([137, 226, 8218]) 1401 li.add([138, 228, 8240]) 1402 li.add([139, 227, 8222]) 1403 li.add([140, 229, 194]) 1404 li.add([141, 231, 193]) 1405 li.add([142, 233, 200]) 1406 li.add([143, 232, 203]) 1407 li.add([144, 234, 205]) 1408 li.add([145, 235, 206]) 1409 li.add([146, 237, 204]) 1410 li.add([147, 236, 207]) 1411 li.add([148, 238, 211]) 1412 li.add([149, 239, 212]) 1413 li.add([150, 241, 210]) 1414 li.add([151, 243, 219]) 1415 li.add([152, 242, 218]) 1416 li.add([153, 244, 217]) 1417 li.add([154, 246, 710]) 1418 li.add([155, 245, 305]) 1419 li.add([156, 250, 729]) 1420 li.add([157, 249, 728]) 1421 li.add([158, 251, 730]) 1422 li.add([159, 252, 184]) 1423 li.add([160, 134, 220]) 1424 li.add([161, 176, 8734]) 1425 li.add([164, 167, 223]) 1426 li.add([165, 149, 239]) 1427 li.add([166, 182, 8706]) 1428 li.add([167, 223, 64258]) 1429 li.add([168, 174, 198]) 1430 li.add([170, 153, 244]) 1431 li.add([171, 180, 165]) 1432 li.add([172, 168, 174]) 1433 li.add([173, 141, 231]) 1434 li.add([174, 198, 8710]) 1435 li.add([175, 216, 255]) 1436 li.add([176, 144, 234]) 1437 li.add([178, 143, 232]) 1438 li.add([179, 142, 233]) 1439 li.add([180, 165, 8226]) 1440 li.add([182, 240, 63743]) 1441 li.add([183, 221, 8250]) 1442 li.add([184, 222, 64257]) 1443 li.add([185, 254, 731]) 1444 li.add([186, 138, 228]) 1445 li.add([187, 170, 8482]) 1446 li.add([188, 186, 8747]) 1447 li.add([189, 253, 733]) 1448 li.add([190, 230, 202]) 1449 li.add([191, 248, 175]) 1450 li.add([192, 191, 248]) 1451 li.add([193, 161, 176]) 1452 li.add([194, 172, 168]) 1453 li.add([195, 175, 216]) 1454 li.add([196, 131, 201]) 1455 li.add([197, 188, 186]) 1456 li.add([198, 208, 8211]) 1457 li.add([199, 171, 180]) 1458 li.add([200, 187, 170]) 1459 li.add([201, 133, 214]) 1460 li.add([202, 160, 8224]) 1461 li.add([203, 192, 191]) 1462 li.add([204, 195, 8730]) 1463 li.add([205, 213, 8217]) 1464 li.add([206, 140, 229]) 1465 li.add([207, 156, 250]) 1466 li.add([208, 173, 8800]) 1467 li.add([209, 151, 243]) 1468 li.add([210, 147, 236]) 1469 li.add([211, 148, 238]) 1470 li.add([212, 145, 235]) 1471 li.add([213, 146, 237]) 1472 li.add([214, 247, 732]) 1473 li.add([216, 255, 711]) 1474 li.add([217, 159, 252]) 1475 li.add([218, 158, 251]) 1476 li.add([219, 128, 196]) 1477 li.add([220, 139, 227]) 1478 li.add([221, 155, 245]) 1479 li.add([222, 128, 196]) 1480 li.add([223, 129, 197]) 1481 li.add([224, 135, 225]) 1482 li.add([225, 183, 8721]) 1483 li.add([226, 130, 199]) 1484 li.add([227, 132, 209]) 1485 li.add([228, 137, 226]) 1486 li.add([229, 194, 172]) 1487 li.add([230, 202, 160]) 1488 li.add([231, 193, 161]) 1489 li.add([232, 203, 192]) 1490 li.add([233, 200, 187]) 1491 li.add([234, 205, 213]) 1492 li.add([235, 206, 338]) 1493 li.add([236, 207, 339]) 1494 li.add([237, 204, 195]) 1495 li.add([238, 211, 8221]) 1496 li.add([239, 212, 8216]) 1497 li.add([240, 157, 249]) 1498 li.add([241, 210, 8220]) 1499 li.add([242, 218, 8260]) 1500 li.add([243, 219, 8364]) 1501 li.add([244, 217, 376]) 1502 li.add([245, 166, 182]) 1503 li.add([246, 136, 224]) 1504 li.add([247, 152, 242]) 1505 li.add([248, 150, 241]) 1506 li.add([249, 154, 246]) 1507 li.add([250, 178, 8804]) 1508 li.add([251, 190, 230]) 1509 li.add([252, 184, 8719]) 1510 li.add([253, 189, 937]) 1511 li.add([254, 179, 8805]) 1512 li.add([255, 185, 960]) 1491 1513 return li 1492 1514 end 1515 1516 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1517 1518 on getVersionNumber me 1519 if voidP(pVersionNumber) then 1520 pVersionNumber = getFloatVersionNumber(me, the productVersion) 1521 end if 1522 return pVersionNumber 1523 end 1524 1525 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1526 1527 on getFloatVersionNumber me, prodVers 1528 offs = offset(".", prodVers) 1529 if offs > 0 then 1530 intVers = char 1 to offs of prodVers 1531 delete char 1 to offs of prodVers 1532 else 1533 intVers = "" 1534 end if 1535 cnt = length(prodVers) 1536 repeat with n = 1 to cnt 1537 c = prodVers.char[n] 1538 if integerP(integer(c)) then 1539 put c after intVers 1540 else if c <> "." then 1541 exit repeat 1542 end if 1543 end repeat 1544 return value(intVers) 1545 end
Note: See TracChangeset
for help on using the changeset viewer.
