Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
55
Task/XML-Output/Commodore-BASIC/xml-output.basic
Normal file
55
Task/XML-Output/Commodore-BASIC/xml-output.basic
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
1 rem xml/output - commodore basic
|
||||
2 rem rosetta code
|
||||
5 print chr$(147);chr$(14):gosub 900
|
||||
10 rem set up array structure for data
|
||||
11 rem we'll use a multi-dimensional array:
|
||||
12 rem c$(x,y) where x is the rows and y is the fields
|
||||
13 rem two fields: 0 = character name, 1 = remarks
|
||||
15 dim c$(10,1):x=0:q$=chr$(34)
|
||||
19 rem now read the data to populate the structure
|
||||
20 for y=0 to 1
|
||||
25 read t$
|
||||
30 if t$="[end]" then x=x-1:goto 45
|
||||
35 c$(x,y)=t$:print t$
|
||||
40 next y:x=x+1:print:goto 20
|
||||
45 rem need to sanitize for html entities
|
||||
50 gosub 500
|
||||
55 rem now we parse it out to xml format
|
||||
60 print:print:gosub 150
|
||||
70 end
|
||||
75 :
|
||||
150 print "<CharacterRemarks>"
|
||||
155 for i=0 to x
|
||||
160 t$="<Character name="+q$+c$(i,0)+q$+">"
|
||||
165 t$=t$+c$(i,1)+"</Character>"
|
||||
170 print " ";t$
|
||||
175 next i
|
||||
180 print "</CharacterRemarks>"
|
||||
185 print
|
||||
190 return
|
||||
195 :
|
||||
500 rem code html entities
|
||||
505 for i=0 to x
|
||||
510 for j=0 to 1
|
||||
515 tm$=c$(i,j):tl=len(tm$):zz$=""
|
||||
520 for tc=1 to tl
|
||||
525 tc$=mid$(tm$,tc,1):cv=asc(tc$) and 127
|
||||
530 zz$=zz$+et$(cv)
|
||||
535 next tc
|
||||
540 c$(i,j)=zz$
|
||||
545 next j,i
|
||||
550 return
|
||||
555 :
|
||||
900 rem set up entity lookup table
|
||||
905 dim et$(127):for i=0 to 127:et$(i)=chr$(i):next
|
||||
910 for i=1 to 15:read ci,et$(ci):next i:return
|
||||
915 data 34,""",63,"?",35,"#",64,"@",47,"/"
|
||||
920 data 60,"<",62,">",91,"[",93,"rsqb;",92,"£"
|
||||
925 data 36,"$",37,"%",94,"↑",95,"←"
|
||||
930 data 38,"&"
|
||||
935 :
|
||||
1000 data "April","Bubble: I'm > Tam and <= Emily"
|
||||
1005 data "Tam O'Shanter","Burns: 'When chapman billies leave the street...'"
|
||||
1010 data "Emily","Short & shrift"
|
||||
1015 data "Joey","Always look ^."
|
||||
1999 data "[end]","[end]"
|
||||
Loading…
Add table
Add a link
Reference in a new issue