00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 var iXMLdebug=0;
00040
00041
00042 struct XMLfile{
00043
00044 XMLpath (S);
00045 XMLtype (S);
00046 XMLmarks ([XMLmark r1]);
00047 XMLidref (I
00048
00049 );
00050 };
00051 typedef struct mkXMLfile XMLfile;
00052
00053
00054
00055 struct XMLmark{
00056
00057 XMLid (I);
00058 XMLvalue (S);
00059 XMLparams ([[S S] r1]);
00060 XMLdata (S);
00061 XMLfather (XMLmark);
00062 XMLsons ([XMLmark r1]
00063
00064 );
00065 };
00066 typedef struct mkXMLmark XMLmark;
00067
00068
00069 XMLlcat(p, q){
00070 if p==nil
00071 then
00072 q
00073 else let p -> [h nxt] in
00074 h::XMLlcat nxt q;
00075 }
00076
00077
00078
00079 XMLcopyParams(l){
00080 let nil -> newl in
00081 (
00082 let sizelist l -> size in
00083 while size > 0 do
00084 (
00085 let nth_list l (size -1) -> [n p] in
00086 set newl = [n p]::newl;
00087
00088 set size = size -1;
00089 );
00090 newl;
00091 );
00092 }
00093
00094
00095 XMLremove_mark_list(l, elt){
00096 if l==nil
00097 then
00098 nil
00099 else
00100 if (hd l) == elt
00101 then
00102 tl l
00103 else
00104 (hd l)::XMLremove_mark_list tl l elt;
00105 }
00106
00107
00108 XMLgetShortFloatToString(float){
00109 if (absf float) >. (itof (ftoi absf float)) then (ftoa float) else (itoa (ftoi float));
00110 }
00111
00112
00113
00114
00115
00116
00117
00118
00119 XMLgetBoolParam(markstr, name){
00120 let switchstr markstr.XMLparams name -> str in
00121 if (!strcmpi strtrim str "ON") || (!strcmpi strtrim str "true") || (!strcmpi strtrim str "yes") || ((atoi str) == 1) then 1 else 0;
00122 }
00123
00124
00125 XMLgetBoolString(b){
00126 if b then "true" else "false";
00127 }
00128
00129
00130 XMLgetData(markstr){
00131 markstr.XMLdata;
00132 }
00133
00134
00135 XMLsetData(markstr, data){
00136 set markstr.XMLdata = data;
00137 }
00138
00139
00140 XMLgetParam(markstr, name){
00141 switchstr markstr.XMLparams name;
00142 }
00143
00144
00145 XMLsetParam(markstr, name, val){
00146 let 0 -> found in
00147 (
00148 let sizelist markstr.XMLparams -> size in
00149 let 0 -> i in
00150 while (i < size) && !found do
00151 (
00152 let nth_list markstr.XMLparams i -> param in
00153 let param -> [pname pval] in
00154 if strcmp pname name then nil else
00155 (
00156 mutate param <- [_ val];
00157 set found = 1;
00158 );
00159
00160 set i = i + 1;
00161 );
00162
00163
00164 if found then nil else
00165 set markstr.XMLparams = XMLlcat markstr.XMLparams [name val]::nil;
00166 );
00167 0;
00168 }
00169
00170
00171
00172 XMLgetEndMarkPos(fcont, iemark, sncmark){
00173 let iemark - 1 -> i in
00174 let iemark - 1 -> i2 in
00175 let nil -> find in
00176 let 1 -> nbfind in
00177 (
00178 while (i != nil) && (find == nil) do
00179 (
00180 let strfindi strcatn (ctoa 60)::sncmark::" "::nil fcont i + 1 -> ismark in
00181
00182 let strfindi strcatn (ctoa 60)::(ctoa 47)::sncmark::(ctoa 62)::nil fcont i2 + 1 -> iclmark in
00183 (
00184 if (((ismark != nil) && (ismark < iclmark))) then
00185 set nbfind = nbfind + 1
00186 else
00187 set find = iemark - 1;
00188
00189 set i = ismark;
00190 set i2 = iclmark;
00191 );
00192 );
00193
00194 while (nbfind != 0) do
00195 (
00196 let strfindi strcatn (ctoa 60)::(ctoa 47)::sncmark::(ctoa 62)::nil fcont find + 1 -> iclmark in
00197 (
00198 set find = iclmark;
00199 set nbfind = nbfind - 1;
00200 );
00201 );
00202 find;
00203 );
00204 }
00205
00206
00207 XMLgetMark(xmlfilestr, father, fcont, spos){
00208 let strfind ctoa 60 fcont spos -> ismark in
00209 let strfind ctoa 62 fcont ismark -> iemark in
00210 let substr fcont (ismark + 1) ((iemark - ismark) - 1) -> snmark in
00211 let strfind " " snmark 0 -> haveparam in
00212 let if haveparam != nil then substr snmark 0 haveparam else snmark -> sncmark in
00213 let if !strcmpi strcatn (ctoa 47)::(ctoa 62)::nil (substr fcont (iemark -1) 2) then 1 else 0 -> noendmark in
00214 let if noendmark then (iemark + 1) else XMLgetEndMarkPos fcont iemark sncmark -> iclmark in
00215 let substr fcont (iemark + 1) ((iclmark - iemark) - 1) -> mcont in
00216 let mkXMLmark [(set xmlfilestr.XMLidref = xmlfilestr.XMLidref + 1) sncmark nil nil father nil] -> markstr in
00217 (
00218 if haveparam == nil then nil else
00219 (
00220 if !iXMLdebug then nil else
00221 _fooS strcat "XMLPARSER DEBUG : Mark found > " sncmark;
00222
00223 while haveparam != nil do
00224 (
00225 let strfind "=" snmark haveparam -> ppos in
00226 let substr snmark (ppos + 1) 1 -> psep in
00227 let substr snmark (haveparam + 1) ((ppos - haveparam) - 1) -> pname in
00228 let strfind psep snmark ppos -> sppos in
00229 if sppos == nil then
00230 (
00231 set haveparam = nil;
00232 )
00233 else
00234 let strfind psep snmark (sppos + 1) -> eppos in
00235 (
00236 let substr snmark (sppos + 1) ((eppos - sppos) - 1) -> pval in
00237 (
00238 set markstr.XMLparams = XMLlcat markstr.XMLparams [pname (webtostr pval)]::nil;
00239 if !iXMLdebug then nil else
00240 (
00241 _fooS strcat "XMLPARSER DEBUG : Mark param name > " pname;
00242 _fooS strcat "XMLPARSER DEBUG : Mark param value > " (webtostr pval);
00243 );
00244 set haveparam = strfind " " snmark eppos + 1;
00245 );
00246 );
00247 );
00248 );
00249
00250 if (strfind "<![CDATA[" mcont 0 == nil) then nil else
00251 let strfind "]]>" mcont 0 -> edata in
00252 (
00253 let substr mcont 9 ((edata - 8) - 1) -> data in
00254 set markstr.XMLdata = if (strlen data) == 0 then nil else data;
00255 set mcont = substr mcont edata + 3 ((strlen mcont) - (edata + 3));
00256 if !iXMLdebug then nil else
00257 _fooS strcat "XMLPARSER DEBUG : Mark newdata > " mcont;
00258 );
00259
00260 let strfind ctoa 60 mcont 0 -> i in
00261 if (i != nil) then
00262 (
00263 while i != nil do
00264 (
00265 let (XMLgetMark xmlfilestr markstr mcont i) -> [nmark epos] in
00266 (
00267 set markstr.XMLsons = XMLlcat markstr.XMLsons nmark::nil;
00268 set i = strfind ctoa 60 mcont epos + 1;
00269 );
00270 );
00271 0;
00272 )
00273 else if markstr.XMLdata != nil then nil else
00274 (
00275 set markstr.XMLdata = if (strlen mcont) == 0 then nil else mcont;
00276 0;
00277 );
00278 if !iXMLdebug then nil else
00279 _fooS strcatn "XMLPARSER DEBUG : Mark value > "::sncmark::" > "::markstr.XMLdata::nil;
00280
00281 [markstr (if noendmark then iclmark else (iclmark + (strlen (strcatn (ctoa 60)::(ctoa 47)::sncmark::(ctoa 62)::nil))))];
00282 );
00283 }
00284
00285
00286 XMLparse(xmlfilestr, fcont){
00287 let nil -> lmarkstr in
00288 let strfind ctoa 60 fcont 0 -> i in
00289 if (i != nil) then
00290 (
00291 while i != nil do
00292 (
00293 let (XMLgetMark xmlfilestr nil fcont i) -> [nmark epos] in
00294 (
00295 set lmarkstr = XMLlcat lmarkstr nmark::nil;
00296 set i = strfind ctoa 60 fcont epos + 1;
00297 );
00298 );
00299 lmarkstr;
00300 )
00301 else
00302 lmarkstr;
00303 }
00304
00305
00306 XMLcountFathers(markstr){
00307 let 0 -> nb in
00308 (
00309 while markstr.XMLfather != nil do
00310 (
00311 set markstr = markstr.XMLfather;
00312 set nb = nb + 1;
00313 );
00314 nb;
00315 );
00316 }
00317
00318
00319 XMLgetTabs(markstr){
00320 let "" -> tabs in
00321 (
00322 let XMLcountFathers markstr -> nb in
00323 let 0 -> i in
00324 while i < nb do
00325 (
00326 set tabs = strcat tabs (ctoa 9);
00327
00328 set i = i + 1;
00329 );
00330 tabs;
00331 );
00332 }
00333
00334
00335 XMLgetMarksWithIndex(markstr){
00336 let nil -> ncont in
00337 (
00338 set ncont = strcatn (ctoa 10)::(XMLgetTabs markstr)::"<"::markstr.XMLvalue::nil;
00339 set ncont = strcatn ncont::" "::"markindex"::"=\""::(itoa markstr.XMLid)::"\""::nil;
00340
00341 let sizelist markstr.XMLparams -> size in
00342 let 0 -> i in
00343 while i < size do
00344 (
00345 let nth_list markstr.XMLparams i -> [pname pval] in
00346 set ncont = strcatn ncont::" "::pname::"=\""::(strtoweb pval)::"\""::nil;
00347
00348 set i = i + 1;
00349 );
00350
00351 if (markstr.XMLdata == nil) && (markstr.XMLsons == nil) then
00352 set ncont = strcatn ncont::" />"::nil
00353 else if ((strfindi (ctoa 60) markstr.XMLdata 0) == nil) && ((strfindi (ctoa 62) markstr.XMLdata 0) == nil) && ((strfindi (ctoa 38) markstr.XMLdata 0) == nil)
00354 && ((strfindi (ctoa 224) markstr.XMLdata 0) == nil) && ((strfindi (ctoa 225) markstr.XMLdata 0) == nil) && ((strfindi (ctoa 226) markstr.XMLdata 0) == nil)
00355 && ((strfindi (ctoa 227) markstr.XMLdata 0) == nil) && ((strfindi (ctoa 228) markstr.XMLdata 0) == nil) && ((strfindi (ctoa 229) markstr.XMLdata 0) == nil)
00356 && ((strfindi (ctoa 230) markstr.XMLdata 0) == nil) && ((strfindi (ctoa 231) markstr.XMLdata 0) == nil) && ((strfindi (ctoa 232) markstr.XMLdata 0) == nil)
00357 && ((strfindi (ctoa 233) markstr.XMLdata 0) == nil) && ((strfindi (ctoa 234) markstr.XMLdata 0) == nil) && ((strfindi (ctoa 235) markstr.XMLdata 0) == nil)
00358 && ((strfindi (ctoa 244) markstr.XMLdata 0) == nil) && ((strfindi (ctoa 251) markstr.XMLdata 0) == nil)
00359 then
00360 set ncont = strcatn ncont::">"::markstr.XMLdata::nil
00361 else
00362 set ncont = strcatn ncont::"><![CDATA["::markstr.XMLdata::"]]>"::nil;
00363
00364 let sizelist markstr.XMLsons -> size in
00365 let 0 -> i in
00366 while i < size do
00367 (
00368 let nth_list markstr.XMLsons i -> mark in
00369 set ncont = strcat ncont XMLgetMarksWithIndex mark;
00370
00371 set i = i + 1;
00372 );
00373
00374 if (markstr.XMLdata == nil) && (markstr.XMLsons == nil) then
00375 ncont
00376 else if markstr.XMLdata != nil then
00377 set ncont = strcatn ncont::"</"::markstr.XMLvalue::">"::nil
00378 else
00379 set ncont = strcatn ncont::(ctoa 10)::(XMLgetTabs markstr)::"</"::markstr.XMLvalue::">"::nil;
00380 );
00381 }
00382
00383
00384 XMLgetMarks(markstr){
00385 let nil -> ncont in
00386 (
00387 set ncont = strcatn (ctoa 10)::(XMLgetTabs markstr)::"<"::markstr.XMLvalue::nil;
00388
00389 let sizelist markstr.XMLparams -> size in
00390 let 0 -> i in
00391 while i < size do
00392 (
00393 let nth_list markstr.XMLparams i -> [pname pval] in
00394 set ncont = strcatn ncont::" "::pname::"=\""::(strtoweb pval)::"\""::nil;
00395
00396 set i = i + 1;
00397 );
00398
00399 if (markstr.XMLdata == nil) && (markstr.XMLsons == nil) then
00400 set ncont = strcatn ncont::" />"::nil
00401 else if ((strfindi (ctoa 60) markstr.XMLdata 0) == nil) && ((strfindi (ctoa 62) markstr.XMLdata 0) == nil) && ((strfindi (ctoa 38) markstr.XMLdata 0) == nil)
00402 && ((strfindi (ctoa 224) markstr.XMLdata 0) == nil) && ((strfindi (ctoa 225) markstr.XMLdata 0) == nil) && ((strfindi (ctoa 226) markstr.XMLdata 0) == nil)
00403 && ((strfindi (ctoa 227) markstr.XMLdata 0) == nil) && ((strfindi (ctoa 228) markstr.XMLdata 0) == nil) && ((strfindi (ctoa 229) markstr.XMLdata 0) == nil)
00404 && ((strfindi (ctoa 230) markstr.XMLdata 0) == nil) && ((strfindi (ctoa 231) markstr.XMLdata 0) == nil) && ((strfindi (ctoa 232) markstr.XMLdata 0) == nil)
00405 && ((strfindi (ctoa 233) markstr.XMLdata 0) == nil) && ((strfindi (ctoa 234) markstr.XMLdata 0) == nil) && ((strfindi (ctoa 235) markstr.XMLdata 0) == nil)
00406 && ((strfindi (ctoa 244) markstr.XMLdata 0) == nil) && ((strfindi (ctoa 251) markstr.XMLdata 0) == nil)
00407 then
00408 set ncont = strcatn ncont::">"::markstr.XMLdata::nil
00409 else
00410 set ncont = strcatn ncont::"><![CDATA["::markstr.XMLdata::"]]>"::nil;
00411
00412 let sizelist markstr.XMLsons -> size in
00413 let 0 -> i in
00414 while i < size do
00415 (
00416 let nth_list markstr.XMLsons i -> mark in
00417 set ncont = strcat ncont XMLgetMarks mark;
00418
00419 set i = i + 1;
00420 );
00421
00422 if (markstr.XMLdata == nil) && (markstr.XMLsons == nil) then
00423 ncont
00424 else if markstr.XMLdata != nil then
00425 set ncont = strcatn ncont::"</"::markstr.XMLvalue::">"::nil
00426 else
00427 set ncont = strcatn ncont::(ctoa 10)::(XMLgetTabs markstr)::"</"::markstr.XMLvalue::">"::nil;
00428 );
00429 }
00430
00431
00432 XMLaddMarkParam(markstr, paramname, value){
00433 set markstr.XMLparams = XMLlcat markstr.XMLparams [paramname value]::nil;
00434 markstr;
00435 }
00436
00437
00438 XMLaddMark(xmlfilestr, value, father, params, data){
00439 let mkXMLmark [(set xmlfilestr.XMLidref = xmlfilestr.XMLidref + 1) value params data father nil] -> markstr in
00440 (
00441 if father == nil then
00442 set xmlfilestr.XMLmarks = XMLlcat xmlfilestr.XMLmarks markstr::nil
00443 else
00444 set father.XMLsons = XMLlcat father.XMLsons markstr::nil;
00445
00446 markstr;
00447 );
00448 }
00449
00450
00451 XMLcopyMark(xmlfilestr, srcmarkstr, father){
00452 let srcmarkstr.XMLvalue -> value in
00453 let XMLcopyParams srcmarkstr.XMLparams -> params in
00454 let srcmarkstr.XMLdata -> data in
00455 let mkXMLmark [(set xmlfilestr.XMLidref = xmlfilestr.XMLidref + 1) value params data father nil] -> markstr in
00456 (
00457 if father == nil then
00458 set xmlfilestr.XMLmarks = XMLlcat xmlfilestr.XMLmarks markstr::nil
00459 else
00460 set father.XMLsons = XMLlcat father.XMLsons markstr::nil;
00461
00462 let sizelist srcmarkstr.XMLsons -> size in
00463 let 0 -> i in
00464 while i < size do
00465 (
00466 let nth_list srcmarkstr.XMLsons i -> son in
00467 XMLcopyMark xmlfilestr son markstr;
00468
00469 set i = i + 1;
00470 );
00471
00472 markstr;
00473 );
00474 }
00475
00476
00477 XMLdelMark(xmlfilestr, markstr){
00478 if markstr.XMLfather == nil then
00479 set xmlfilestr.XMLmarks = XMLremove_mark_list xmlfilestr.XMLmarks markstr
00480 else
00481 set markstr.XMLfather.XMLsons = XMLremove_mark_list markstr.XMLfather.XMLsons markstr;
00482 0;
00483 }
00484
00485
00486 XMLmoveMark(xmlfilestr, markstr, fatherstr){
00487 if markstr.XMLfather == fatherstr then nil else
00488 (
00489 if markstr.XMLfather == nil then
00490 set xmlfilestr.XMLmarks = XMLremove_mark_list xmlfilestr.XMLmarks markstr
00491 else
00492 set markstr.XMLfather.XMLsons = XMLremove_mark_list markstr.XMLfather.XMLsons markstr;
00493
00494 set markstr.XMLfather = fatherstr;
00495
00496 if markstr.XMLfather == nil then
00497 set xmlfilestr.XMLmarks = XMLlcat xmlfilestr.XMLmarks markstr::nil
00498 else
00499 set markstr.XMLfather.XMLsons = XMLlcat markstr.XMLfather.XMLsons markstr::nil;
00500 );
00501 0;
00502 }
00503
00504
00505 XMLgetMarkByIdFromMark(markstr, id){
00506 let nil -> fmark in
00507 (
00508 if markstr.XMLid == id then
00509 markstr
00510 else
00511 (
00512 let sizelist markstr.XMLsons -> size in
00513 let 0 -> i in
00514 while i < size && fmark == nil do
00515 (
00516 let nth_list markstr.XMLsons i -> mark in
00517 set fmark = XMLgetMarkByIdFromMark mark id;
00518
00519 set i = i + 1;
00520 );
00521 fmark
00522 );
00523 );
00524 }
00525
00526
00527 XMLgetMarkById(xmlfilestr, id){
00528 let nil -> fmark in
00529 (
00530 let sizelist xmlfilestr.XMLmarks -> size in
00531 let 0 -> i in
00532 while i < size && fmark == nil do
00533 (
00534 let nth_list xmlfilestr.XMLmarks i -> mark in
00535 set fmark = XMLgetMarkByIdFromMark mark id;
00536
00537 set i = i + 1;
00538 );
00539 fmark;
00540 );
00541 }
00542
00543
00544 XMLgetMarkByValueFromMark(markstr, value){
00545 let nil -> fmark in
00546 (
00547 if !strcmpi markstr.XMLvalue value then
00548 markstr
00549 else
00550 (
00551 let sizelist markstr.XMLsons -> size in
00552 let 0 -> i in
00553 while i < size && fmark == nil do
00554 (
00555 let nth_list markstr.XMLsons i -> mark in
00556 set fmark = XMLgetMarkByValueFromMark mark value;
00557
00558 set i = i + 1;
00559 );
00560 fmark
00561 );
00562 );
00563 }
00564
00565
00566 XMLgetMarkId(markstr){
00567 markstr.XMLid;
00568 }
00569
00570
00571 XMLgetMarkByValueFromMarkSons(markstr, value){
00572 let nil -> fmark in
00573 (
00574 let sizelist markstr.XMLsons -> size in
00575 let 0 -> i in
00576 while i < size && fmark == nil do
00577 (
00578 let nth_list markstr.XMLsons i -> mark in
00579 if !strcmpi mark.XMLvalue value then
00580 set fmark = mark
00581 else nil;
00582
00583 set i = i + 1;
00584 );
00585 fmark
00586 );
00587 }
00588
00589
00590 XMLgetMarkByValue(xmlfilestr, value){
00591 let nil -> fmark in
00592 (
00593 let sizelist xmlfilestr.XMLmarks -> size in
00594 let 0 -> i in
00595 while i < size && fmark == nil do
00596 (
00597 let nth_list xmlfilestr.XMLmarks i -> mark in
00598 set fmark = XMLgetMarkByValueFromMark mark value;
00599
00600 set i = i + 1;
00601 );
00602 fmark;
00603 );
00604 }
00605
00606
00607 XMLgetMarksByValueFromMark(markstr, value){
00608 let nil -> fmark in
00609 (
00610 if !strcmpi markstr.XMLvalue value then
00611 set fmark = XMLlcat fmark markstr::nil
00612 else nil;
00613
00614 let sizelist markstr.XMLsons -> size in
00615 let 0 -> i in
00616 while i < size do
00617 (
00618 let nth_list markstr.XMLsons i -> mark in
00619 set fmark = XMLlcat fmark (XMLgetMarksByValueFromMark mark value);
00620
00621 set i = i + 1;
00622 );
00623 fmark
00624 );
00625 }
00626
00627
00628 XMLgetMarksByValueFromMarkSons(markstr, value){
00629 let nil -> fmark in
00630 (
00631 let sizelist markstr.XMLsons -> size in
00632 let 0 -> i in
00633 while i < size do
00634 (
00635 let nth_list markstr.XMLsons i -> mark in
00636 if !strcmpi mark.XMLvalue value then
00637 set fmark = XMLlcat fmark mark::nil
00638 else nil;
00639
00640 set i = i + 1;
00641 );
00642 fmark
00643 );
00644 }
00645
00646
00647 XMLgetMarksDataByValueFromMark(markstr, value){
00648 let nil -> ldata in
00649 (
00650 if !strcmpi markstr.XMLvalue value then
00651 set ldata = XMLlcat ldata markstr.XMLdata::nil
00652 else nil;
00653
00654 let sizelist markstr.XMLsons -> size in
00655 let 0 -> i in
00656 while i < size do
00657 (
00658 let nth_list markstr.XMLsons i -> mark in
00659 let (XMLgetMarksDataByValueFromMark mark value) -> fmarkstr in
00660 set ldata = XMLlcat ldata fmarkstr;
00661
00662 set i = i + 1;
00663 );
00664 ldata
00665 );
00666 }
00667
00668
00669 XMLgetMarksDataByValueFromMarkSons(markstr, value){
00670 let nil -> ldata in
00671 (
00672 let sizelist markstr.XMLsons -> size in
00673 let 0 -> i in
00674 while i < size do
00675 (
00676 let nth_list markstr.XMLsons i -> mark in
00677 if !strcmpi mark.XMLvalue value then
00678 set ldata = XMLlcat ldata mark.XMLdata::nil
00679 else nil;
00680
00681 set i = i + 1;
00682 );
00683 ldata
00684 );
00685 }
00686
00687
00688 XMLgetMarksParamByValueFromMarkSons(markstr, value, param){
00689 let nil -> ldata in
00690 (
00691 let sizelist markstr.XMLsons -> size in
00692 let 0 -> i in
00693 while i < size do
00694 (
00695 let nth_list markstr.XMLsons i -> mark in
00696 if !strcmpi mark.XMLvalue value then
00697 set ldata = XMLlcat ldata (XMLgetParam mark param)::nil
00698 else nil;
00699
00700 set i = i + 1;
00701 );
00702 ldata
00703 );
00704 }
00705
00706
00707 XMLgetMarksByValue(xmlfilestr, value){
00708 let nil -> fmark in
00709 (
00710 let sizelist xmlfilestr.XMLmarks -> size in
00711 let 0 -> i in
00712 while i < size && fmark == nil do
00713 (
00714 let nth_list xmlfilestr.XMLmarks i -> mark in
00715 set fmark = XMLlcat fmark (XMLgetMarksByValueFromMark mark value);
00716
00717 set i = i + 1;
00718 );
00719 fmark;
00720 );
00721 }
00722
00723
00724 XMLgetMarksParamValueByParamFromMark(markstr, param){
00725 let nil -> fparams in
00726 (
00727 let XMLgetParam markstr param -> ep in
00728 if ep != nil then
00729 set fparams = XMLlcat fparams ep::nil
00730 else nil;
00731
00732 let sizelist markstr.XMLsons -> size in
00733 let 0 -> i in
00734 while i < size do
00735 (
00736 let nth_list markstr.XMLsons i -> mark in
00737 set fparams = XMLlcat fparams (XMLgetMarksParamValueByParamFromMark mark param);
00738
00739 set i = i + 1;
00740 );
00741 fparams
00742 );
00743 }
00744
00745
00746 XMLgetMarksParamValueByValueAndParamFromMarkSons(markstr, value, param){
00747 let nil -> fparams in
00748 let XMLgetMarksByValueFromMarkSons markstr value -> lmark in
00749 (
00750 let sizelist lmark -> size in
00751 let 0 -> i in
00752 while i < size do
00753 (
00754 let nth_list lmark i -> mark in
00755 let XMLgetParam mark param -> ep in
00756 if ep == nil then nil else
00757 set fparams = XMLlcat fparams ep::nil;
00758
00759 set i = i + 1;
00760 );
00761 fparams
00762 );
00763 }
00764
00765
00766 XMLgetMarksParamValueByValueAndParamFromMark(markstr, value, param){
00767 let nil -> fparams in
00768 let XMLgetMarksByValueFromMark markstr value -> lmark in
00769 (
00770 let sizelist lmark -> size in
00771 let 0 -> i in
00772 while i < size do
00773 (
00774 let nth_list lmark i -> mark in
00775 let XMLgetParam mark param -> ep in
00776 if ep == nil then nil else
00777 set fparams = XMLlcat fparams ep::nil;
00778
00779 set i = i + 1;
00780 );
00781 fparams
00782 );
00783 }
00784
00785
00786 XMLgetMarksParamValueByParam(xmlfilestr, param){
00787 let nil -> fparams in
00788 (
00789 let sizelist xmlfilestr.XMLmarks -> size in
00790 let 0 -> i in
00791 while i < size do
00792 (
00793 let nth_list xmlfilestr.XMLmarks i -> mark in
00794 set fparams = XMLlcat fparams (XMLgetMarksParamValueByParamFromMark mark param);
00795
00796 set i = i + 1;
00797 );
00798 fparams;
00799 );
00800 }
00801
00802
00803 XMLgetMarkByParamValueFromMark(markstr, param, value){
00804 let nil -> fmark in
00805 let XMLgetParam markstr param -> pval in
00806 (
00807 if (!strcmp value pval) then
00808 markstr
00809 else
00810 (
00811 let sizelist markstr.XMLsons -> size in
00812 let 0 -> i in
00813 while i < size && fmark == nil do
00814 (
00815 let nth_list markstr.XMLsons i -> mark in
00816 set fmark = XMLgetMarkByParamValueFromMark mark param value;
00817
00818 set i = i + 1;
00819 );
00820 fmark
00821 );
00822 );
00823 }
00824
00825
00826 XMLgetMarkByParamValue(xmlfilestr, param, value){
00827 let nil -> fmark in
00828 (
00829 let sizelist xmlfilestr.XMLmarks -> size in
00830 let 0 -> i in
00831 while i < size && fmark == nil do
00832 (
00833 let nth_list xmlfilestr.XMLmarks i -> mark in
00834 set fmark = XMLgetMarkByParamValueFromMark mark param value;
00835
00836 set i = i + 1;
00837 );
00838 fmark;
00839 );
00840 }
00841
00842
00843 XMLgetMarkByValueAndParamValue(xmlfilestr, markval, param, value){
00844 let XMLgetMarksByValue xmlfilestr markval -> lmarks in
00845 let nil -> fmark in
00846 (
00847 let sizelist lmarks -> size in
00848 let 0 -> i in
00849 while i < size && fmark == nil do
00850 (
00851 let nth_list lmarks i -> mark in
00852 let XMLgetParam mark param -> pval in
00853 if (!strcmp value pval) then
00854 set fmark = mark
00855 else nil;
00856
00857 set i = i + 1;
00858 );
00859 fmark;
00860 );
00861 }
00862
00863
00864 XMLgetMarksByValueAndParamValue(xmlfilestr, markval, param, value){
00865 let XMLgetMarksByValue xmlfilestr markval -> lmarks in
00866 let nil -> fmark in
00867 (
00868 let sizelist lmarks -> size in
00869 let 0 -> i in
00870 while i < size do
00871 (
00872 let nth_list lmarks i -> mark in
00873 let XMLgetParam mark param -> pval in
00874 if (!strcmp value pval) then
00875 set fmark = mark::fmark
00876 else nil;
00877
00878 set i = i + 1;
00879 );
00880 fmark;
00881 );
00882 }
00883
00884
00885 XMLgetMarksByValueAndListParamValue(xmlfilestr, markval, lp){
00886 let XMLgetMarksByValue xmlfilestr markval -> lmarks in
00887 let nil -> fmark in
00888 (
00889 let sizelist lmarks -> size in
00890 let sizelist lp -> size2 in
00891 let 0 -> i in
00892 while i < size do
00893 (
00894 let nth_list lmarks i -> mark in
00895 let 0 -> i2 in
00896 let 0 -> ret in
00897 (
00898 while i2 < size2 do
00899 (
00900 let nth_list lp i2 -> [param value] in
00901 let XMLgetParam mark param -> pval in
00902 if (!strcmp value pval) then
00903 set ret = ret + 1
00904 else nil;
00905
00906 set i2 = i2 + 1;
00907 );
00908
00909 if ret < size2 then nil else
00910 set fmark = mark::fmark
00911 );
00912
00913 set i = i + 1;
00914 );
00915 fmark;
00916 );
00917 }
00918
00919
00920 XMLgetMarkByValueAndParamValueFromMark(markstr, markval, param, value){
00921 let XMLgetMarksByValueFromMark markstr markval -> lmarks in
00922 let nil -> fmark in
00923 (
00924 let sizelist lmarks -> size in
00925 let 0 -> i in
00926 while i < size && fmark == nil do
00927 (
00928 let nth_list lmarks i -> mark in
00929 let XMLgetParam mark param -> pval in
00930 if (!strcmp value pval) then
00931 set fmark = mark
00932 else nil;
00933
00934 set i = i + 1;
00935 );
00936 fmark;
00937 );
00938 }
00939
00940
00941 XMLgetMarkByValueAndParamValueFromMarkSons(markstr, markval, param, value){
00942 let XMLgetMarksByValueFromMarkSons markstr markval -> lmarks in
00943 let nil -> fmark in
00944 (
00945 let sizelist lmarks -> size in
00946 let 0 -> i in
00947 while i < size && fmark == nil do
00948 (
00949 let nth_list lmarks i -> mark in
00950 let XMLgetParam mark param -> pval in
00951 if (!strcmp value pval) then
00952 set fmark = mark
00953 else nil;
00954
00955 set i = i + 1;
00956 );
00957 fmark;
00958 );
00959 }
00960
00961
00962 XMLserializeFromMark(markstr){
00963 XMLgetMarks markstr;
00964 }
00965
00966
00967 XMLserializeWithIndexFromMark(markstr){
00968 XMLgetMarksWithIndex markstr;
00969 }
00970
00971
00972 XMLserializeWithIndex(xmlfilestr){
00973 let nil -> ncont in
00974 (
00975 if xmlfilestr.XMLtype == nil then nil else
00976 set ncont = strcatn "<?xml"::xmlfilestr.XMLtype::"?>"::nil;
00977
00978 let sizelist xmlfilestr.XMLmarks -> size in
00979 let 0 -> i in
00980 while i < size do
00981 (
00982 let nth_list xmlfilestr.XMLmarks i -> mark in
00983 set ncont = strcat ncont XMLgetMarksWithIndex mark;
00984
00985 set i = i + 1;
00986 );
00987
00988 ncont;
00989 );
00990 }
00991
00992
00993 XMLserialize(xmlfilestr){
00994 let nil -> ncont in
00995 (
00996 if xmlfilestr.XMLtype == nil then nil else
00997 set ncont = strcatn "<?xml"::xmlfilestr.XMLtype::"?>"::nil;
00998
00999 let sizelist xmlfilestr.XMLmarks -> size in
01000 let 0 -> i in
01001 while i < size do
01002 (
01003 let nth_list xmlfilestr.XMLmarks i -> mark in
01004 set ncont = strcat ncont XMLgetMarks mark;
01005
01006 set i = i + 1;
01007 );
01008
01009 ncont;
01010 );
01011 }
01012
01013
01014 XMLwrite(xmlfilestr, path){
01015 let XMLserialize xmlfilestr -> ncont in
01016 if ncont == nil then nil else
01017 _storepack ncont path;
01018 0;
01019 }
01020
01021
01022 XMLload(path){
01023 let (_checkpack path) -> pfile in
01024 if pfile == nil then
01025 (
01026 _fooS strcat "XMLPARSER ERROR : file not found > " path;
01027 nil;
01028 )
01029 else
01030 (
01031 let _getpack pfile -> fcont in
01032 let mkXMLfile [path nil nil 0] -> xmlfilestr in
01033 (
01034 let strfindi "<?xml" fcont 0 -> shp in
01035 let strfind "?>" fcont 0 -> ehp in
01036 if ehp == nil then nil else
01037 (
01038 set xmlfilestr.XMLtype = substr fcont (shp + 5) ((ehp - shp) - 5);
01039 set fcont = substr fcont (ehp + 2) ((((strlen fcont) - 1) - ehp) -1);
01040 );
01041 if !iXMLdebug then nil else
01042 _fooS strcat "XMLPARSER DEBUG : type > " xmlfilestr.XMLtype;
01043
01044 set xmlfilestr.XMLmarks = (XMLparse xmlfilestr fcont);
01045 xmlfilestr;
01046 );
01047 );
01048 }
01049
01050
01051 XMLloadString(fcont){
01052 let mkXMLfile [nil nil nil 0] -> xmlfilestr in
01053 (
01054 let strfindi "<?xml" fcont 0 -> shp in
01055 let strfind "?>" fcont 0 -> ehp in
01056 if ehp == nil then nil else
01057 (
01058 set xmlfilestr.XMLtype = substr fcont (shp + 5) ((ehp - shp) - 5);
01059 set fcont = substr fcont (ehp + 2) ((((strlen fcont) - 1) - ehp) -1);
01060 );
01061 if !iXMLdebug then nil else
01062 _fooS strcat "XMLPARSER DEBUG : type > " xmlfilestr.XMLtype;
01063
01064 set xmlfilestr.XMLmarks = (XMLparse xmlfilestr fcont);
01065 xmlfilestr;
01066 );
01067 }
01068
01069
01070 XMLdiff(xmlfilestr1, xmlfilestr2){
01071 let strmd5 XMLserialize xmlfilestr1 -> nsign1 in
01072 let strmd5 XMLserialize xmlfilestr2 -> nsign2 in
01073 strcmpi nsign1 nsign2;
01074 }
01075
01076
01077 XMLcopy(xmlfilestr){
01078 XMLloadString XMLserialize xmlfilestr;
01079 }
01080
01081
01082 XMLcreate(path, type){
01083 let mkXMLfile [path type nil 0] -> xmlfilestr in
01084 (
01085 xmlfilestr;
01086 );
01087 }
01088
01089
01090 XMLsetPath(xmlfilestr, path){
01091 set xmlfilestr.XMLpath = path;
01092 }
01093
01094
01095
01096
01097
01098
01099
01100
01101
01102
01103
01104
01105
01106
01107
01108