{ 0101000001010010010000010100100001001110 0 1 0 PRAHN Version 1.2 BETA 1 0 0 0 An interpreter 0 0 1 0 PRAHN is a scripting language 1 0 which allows massive amounts of 0 1 HTML code to be generated with 0 0 minimal input. This is the only 1 0 existing interpreter for PRAHN. 0 0 0 0 PRAHN 1 0 Created By: Brett Lajzer 1 0 Coded by: 0 1 Brett Lajzer 0 0 0 0 1 0 Site: prahn.sourceforge.net 0 1 1 1 0 0101000001010010010000010100100001001110 } program prahn(input,output); uses crt; const version = 'PRAHN Version 1.2 Almost Not BETA RELEASE 2'; var inputfile, outputfile:text; {============Script Parser============} procedure parseHTML(var inn,outt:text); var temp,temp2,bgcolor,br,ictemp,imgtemp,imgtemp2:string; done,brr,brnum2,brnum,colonpos,prnum,prnum2:integer; brerr:word; ic:text; begin {Parse Header} readln(inn,temp); readln(inn,temp); if upcase(temp) = 'DEFAULT' then begin writeln(outt,''); writeln(outt,''); readln(inn,temp2); writeln(outt,'',temp2,''); end else begin writeln(outt,''); writeln(outt,''); readln(inn,temp2); writeln(outt,'',temp2,''); writeln(outt,''); end; readln(inn,bgcolor); readln(inn,br); delete(br,1,3); val(br,brnum,brerr); {start interpreting the rest of the file} while NOT(EOF(inn)) do begin done := 0; readln(inn,temp); {=====BEG TAG======} if (pos('BEG',upcase(temp)) <> 0) and (done = 0) then begin writeln(outt,''); writeln(outt,''); done := 1; end; {=====END TAG======} if (pos('END',upcase(temp)) <> 0) and (done = 0) then begin writeln(outt,''); writeln(outt,''); done := 1; end; {=====BR TAG======} if (pos('BR_',upcase(temp)) <> 0) and (done = 0) then begin val(copy(temp,4,80),brnum2,brerr); for brr := 1 to brnum2 do writeln(outt,'
'); done := 1; end; {=====H1 TAG======} if (pos('H1_',upcase(temp)) <> 0) and (done = 0) then begin writeln(outt,'

',copy(temp,4,80),'

'); for brr := 1 to brnum do writeln(outt,'
'); done := 1; end; {=====H2 TAG======} if (pos('H2_',upcase(temp)) <> 0) and (done = 0) then begin writeln(outt,'

',copy(temp,4,80),'

'); for brr := 1 to brnum do writeln(outt,'
'); done := 1; end; {=====H3 TAG======} if (pos('H3_',upcase(temp)) <> 0) and (done = 0) then begin writeln(outt,'

',copy(temp,4,80),'

'); for brr := 1 to brnum do writeln('
'); done := 1; end; {=====H4 TAG======} if (pos('H4_',upcase(temp)) <> 0) and (done = 0) then begin writeln(outt,'

',copy(temp,4,80),'

'); for brr := 1 to brnum do writeln(outt,'
'); done := 1; end; {=====H5 TAG======} if (pos('H5_',upcase(temp)) <> 0) and (done = 0) then begin writeln(outt,'
',copy(temp,4,80),'
'); for brr := 1 to brnum do writeln(outt,'
'); done := 1; end; {=====CE Begining TAG======} if (pos('CE_',upcase(temp)) <> 0) and (done = 0) then begin writeln(outt,'
'); done := 1; end; {=====CE Ending TAG======} if (pos('_CE',upcase(temp)) <> 0) and (done = 0) then begin writeln(outt,'
'); done := 1; end; {=====BO Begining TAG======} if (pos('BO_',upcase(temp)) <> 0) and (done = 0) then begin writeln(outt,''); done := 1; end; {=====BO Ending TAG======} if (pos('_BO',upcase(temp)) <> 0) and (done = 0) then begin writeln(outt,''); done := 1; end; {=====IT Begining TAG======} if (pos('IT_',upcase(temp)) <> 0) and (done = 0) then begin writeln(outt,''); done := 1; end; {=====IT Ending TAG======} if (pos('_IT',upcase(temp)) <> 0) and (done = 0) then begin writeln(outt,''); done := 1; end; {=====UL Begining TAG======} if (pos('UL_',upcase(temp)) <> 0) and (done = 0) then begin writeln(outt,''); done := 1; end; {=====UL Ending TAG======} if (pos('_UL',upcase(temp)) <> 0) and (done = 0) then begin writeln(outt,''); done := 1; end; {=====SL Begining TAG======} if (pos('SL_',upcase(temp)) <> 0) and (done = 0) then begin writeln(outt,''); done := 1; end; {=====SL Ending TAG======} if (pos('_SL',upcase(temp)) <> 0) and (done = 0) then begin writeln(outt,''); done := 1; end; {=====IC TAG======} if (pos('IC_',upcase(temp)) <> 0) and (done = 0) then begin assign(ic,copy(temp,4,80)); reset(ic); while NOT(EOF(IC)) do begin readln(ic,ictemp); writeln(outt,ictemp); end; done := 1; end; {=====AA TAG======} if (pos('AA_',upcase(temp)) <> 0) and (done = 0) then begin delete(temp,1,3); colonpos := pos(':',temp); writeln(outt,'',copy(temp,colonpos+1,80),''); for brr := 1 to brnum do writeln(outt,'
'); done := 1; end; {=====AW Begining TAG======} if (pos('AW_',upcase(temp)) <> 0) and (done = 0) then begin delete(temp,1,3); writeln(outt,''); done := 1; end; {=====SL Ending TAG======} if (pos('_AW',upcase(temp)) <> 0) and (done = 0) then begin writeln(outt,''); done := 1; end; {=====PR TAG======} if (pos('PR_',upcase(temp)) <> 0) and (done = 0) then begin assign(ic,copy(temp,4,80)); reset(ic); writeln(outt,'

'); prnum := 0; while NOT(EOF(IC)) do begin readln(ic,ictemp); prnum := prnum + 1; end; reset(ic); while NOT(EOF(IC)) do begin prnum2 := prnum2 + 1; readln(ic,ictemp); if (ictemp = '') and (prnum2 <> prnum) then begin writeln(outt,'

'); end else begin writeln(outt,ictemp); end; if (ictemp = '') and (prnum2 = prnum) then begin writeln(outt,'

'); end; if (ictemp <> '') and (prnum2 = prnum) then writeln(outt,'

'); end; done := 1; end; {=====PB TAG======} if (pos('PB_',upcase(temp)) <> 0) and (done = 0) then begin assign(ic,copy(temp,4,80)); reset(ic); writeln(outt,'

'); prnum := 0; prnum2 := 0; while NOT(EOF(IC)) do begin readln(ic,ictemp); prnum := prnum + 1; end; reset(ic); writeln(prnum); while NOT(EOF(IC)) do begin prnum2 := prnum2 + 1; readln(ic,ictemp); if (ictemp = '') and (prnum2 <> prnum) then begin writeln(outt,'

'); end else begin writeln(outt,ictemp); for brr := 1 to brnum do writeln(outt,'
'); end; if (prnum2 = prnum) then writeln(outt,'

'); end; writeln(prnum2); done := 1; end; {=====IM TAG======} if (pos('IM_',upcase(temp)) <> 0) and (done = 0) then begin delete(temp,1,3); colonpos := pos(':',temp); imgtemp := copy(temp,1,colonpos-1); delete(temp,1,colonpos); colonpos := pos(':',temp); imgtemp2 := copy(temp,1,colonpos-1); delete(temp,1,colonpos); writeln(outt,'',temp,''); for brr := 1 to brnum do writeln(outt,'
'); done := 1; end; {=====FN Beginning TAG======} if (pos('FN_',upcase(temp)) <> 0) and (done = 0) then begin delete(temp,1,3); colonpos := pos(':',temp); writeln(outt,''); done := 1; end; {=====FN Ending TAG======} if (pos('_FN',upcase(temp)) <> 0) and (done = 0) then begin writeln(outt,''); done := 1; end; {=====TX TAG======} if (pos('TX_',upcase(temp)) <> 0) and (done = 0) then begin writeln(outt,copy(temp,4,255)); done := 1; end; end; end; {========Parses a Batch file========} procedure batch(var ifi:text); var ofile,ifile:text; tempora,fstr,lstr:string; cpos:integer; begin readln(ifi,tempora); while NOT(EOF(ifi)) do begin readln(ifi,tempora); cpos := pos(':',tempora); fstr := copy(tempora,1,cpos-1); lstr := copy(tempora,cpos+1,80); if upcase(lstr) <> 'BATCH' then begin Assign(ifile,fstr); reset(ifile); Assign(ofile,lstr); rewrite(ofile); readln(ifile,tempora); if upcase(tempora) = 'PRAHNSCRIPT' then begin reset(ifile); parseHTML(ifile,ofile); close(ofile); end; end else begin Assign(ifile,fstr); reset(ifile); batch(ifile); end; end; end; begin if (paramcount <> 2) and ((copy(paramstr(1),1,2) = '-h') or (copy(paramstr(1),1,2) = '--') or (paramcount =0)) then begin writeln('PRAHN Interpreter Version 1.2 Almost Not BETA RELEASE 2'); writeln('PRAHN comes with absolutely NO WARRANTY!'); writeln('visit: http://prahn.sourceforge.net for details'); writeln; writeln('Usage: prahn