/* Generate HTML from eCo Market xml listing */ /* eCo Software, 2011/07/22 */ fmain="catalogue.xml" /* do i = 1 to bad.0 say bad.i end */ qty=0 mymode=0 categorylevel=0 do while lines(fmain)>0 s=linein(fmain) nwords=words(s) /* say "words: " nwords */ do i = 1 to nwords iword=translate(word(s, i)) /* say iword */ if pos("0 then do if mymode=2 then do if categorylevel=2 then do mymode=3 end else do mymode=0 say "" say "" say "" end end if mymode=3 then do mymode=2 end categorylevel=categorylevel-1 end if pos("0 then do mymode=2 say "" end if pos("NAME=", iword)>0 then do if mymode=1 then do /* Category */ pos1=pos('"', s)+1 pos2=pos('"', s, pos1+1) shortname=substr(s, pos1, pos2-pos1) say "

"shortname"

" say "" end if mymode=2 then do /* Название программы */ pos1=pos('"', s)+1 pos2=pos('"', s, pos1+1) shortname=substr(s, pos1, pos2-pos1) say " " end end if pos("DESC=", iword)>0 then do if mymode=2 then do /* Описание программы */ pos1=pos('"', s)+1 pos2=pos('"', s, pos1+1) shortname=substr(s, pos1, pos2-pos1) say " " say "" end end if pos("ID=", iword)>0 then do if mymode=2 then do /* PIC */ pos1=pos('"', s)+1 pos2=pos('"', s, pos1+1) shortname=substr(s, pos1, pos2-pos1) say " " end end if pos("0 then do categorylevel=categorylevel+1 if mymode=2 then do /* say iword */ mymode=3 end if mymode=0 then do /* say iword */ mymode=1 end /* e-mail found! */ /* found=0 do j = 1 to qty if pos(iword, database.j.email)>0 then do found=1 database.j.quantity=database.j.quantity+1 end end */ /* не найдено => добавить */ /* if found=0 then do qty=qty+1 database.qty.email=iword database.qty.quantity=1 end */ end end /* найти e-mail */ /* if pos(bad.i, s)>0 then flag=0 do i = 1 to bad.0 if pos(bad.i, s)>0 then do say s flag=1 s=linein(fin) s=linein(fin) end end if flag=0 then call lineout fout, s */ end /* say "" say "Results:" do j = 1 to qty say database.j.quantity database.j.email end */ /* say "" say "Duplicates:" do j = 1 to qty if database.j.quantity>1 then say database.j.quantity database.j.email end */
"shortname""shortname"