This commit is contained in:
Ingy döt Net 2013-04-10 21:29:02 -07:00
parent 764da6cbbb
commit db842d013d
19005 changed files with 197040 additions and 7 deletions

View file

@ -0,0 +1,20 @@
import groovy.xml.MarkupBuilder
def createTable(columns, rowCount) {
def writer = new StringWriter()
new MarkupBuilder(writer).table(style: 'border:1px solid;text-align:center;') {
tr {
th()
columns.each { title -> th(title)}
}
(1..rowCount).each { row ->
tr {
td(row)
columns.each { td((Math.random() * 9999) as int ) }
}
}
}
writer.toString()
}
println createTable(['X', 'Y', 'Z'], 3)

View file

@ -0,0 +1,10 @@
procedure main()
printf("<table>\n <tr><th></th><th>X</th><th>Y</th><th>Z</th>")
every r := 1 to 4 do {
printf("</tr>\n <tr><td>%d</td>",r)
every 1 to 3 do printf("<td>%d</td>",?9999) # random 4 digit numbers per cell
}
printf("</tr>\n</table>\n")
end
link printf

View file

@ -0,0 +1,7 @@
<table>
<tr><th></th><th>X</th><th>Y</th><th>Z</th></tr>
<tr><td>1</td><td>3129</td><td>3294</td><td>7013</td></tr>
<tr><td>2</td><td>5045</td><td>169</td><td>5761</td></tr>
<tr><td>3</td><td>7001</td><td>963</td><td>4183</td></tr>
<tr><td>4</td><td>1695</td><td>1158</td><td>1240</td></tr>
</table>

View file

@ -0,0 +1,10 @@
ele=:4 :0
nm=. x-.LF
lf=. x-.nm
;('<',nm,'>') ,L:0 y ,L:0 '</',nm,'>',lf
)
hTbl=:4 :0
rows=. 'td' <@ele"1 ":&.>y
'table' ele ('tr',LF) <@ele ('th' ele x); rows
)

View file

@ -0,0 +1,8 @@
('';;:'X Y Z') hTbl ":&.>(i.5),.i.5 3
<table><tr><th></th><th>X</th><th>Y</th><th>Z</th></tr>
<tr><td>0</td><td>0</td><td>1</td><td>2</td></tr>
<tr><td>1</td><td>3</td><td>4</td><td>5</td></tr>
<tr><td>2</td><td>6</td><td>7</td><td>8</td></tr>
<tr><td>3</td><td>9</td><td>10</td><td>11</td></tr>
<tr><td>4</td><td>12</td><td>13</td><td>14</td></tr>
</table>

View file

@ -0,0 +1 @@
jhtml ('';;:'X Y Z') hTbl ":&.>(i.5),.i.5 3

View file

@ -0,0 +1,40 @@
nomainwin
quote$ =chr$( 34)
html$ ="<html><head></head><body>"
html$ =html$ +"<table border =" +quote$ +"6"+ quote$ +" solid rules =none ; cellspacing =" +quote$ +"10" +quote$ +"> <th> </th> <th> X </th> <th> Y </th> <th> Z </th>"
for i =1 to 4
d1$ =str$( i)
d2$ =str$( int( 10000 *rnd( 1)))
d3$ =str$( int( 10000 *rnd( 1)))
d4$ =str$( int( 10000 *rnd( 1)))
html$ =html$ +"<tr align ="; quote$; "right"; quote$; "> <th>"; d1$; " </th> <td>" +d2$ +" </td> <td>" +d3$ +" </td> <td>" +d4$ +" </td> </tr>"
next i
html$ =html$ +"</table>"
html$ =html$ +"</body></html>"
open "table.html" for output as #o
#o html$;
close #o
address$ ="table.html"
run "explorer.exe "; address$
timer 5000, [on]
wait
[on]
timer 0
kill "table.html"
wait
sub quit w$
close #w$
end
end sub

View file

@ -0,0 +1,4 @@
x := RandomInteger[10];
Print["<table>", "\n","<tr><th></th><th>X</th><th>Y</th><th>Z</th></tr>"]
Scan[Print["<tr><td>", #, "</td><td>", x, "</td><td>", x, "</td><td>","</td></tr>"] & , Range[3]]
Print["</table>"]

View file

@ -0,0 +1,47 @@
MODULE testCGI;
FROM InOut IMPORT WriteCard, WriteLn, WriteString, WriteBf;
FROM Arguments IMPORT ArgTable, GetEnv;
FROM Strings IMPORT Assign, Length, String;
VAR EnvVars : ArgTable;
PROCEDURE ReadEnvVar;
VAR Value : String;
i : CARDINAL;
BEGIN
WriteString ('<table border="1" cellpadding="4" width="80%" align="center">');
WriteString ('<tr><th>Index</th><th>Length</th><th>Content</th></tr>');
i := 0;
LOOP
IF EnvVars^ [i] = NIL THEN EXIT END;
Assign (Value, EnvVars^ [i]^);
WriteString ('<tr><td align="center">');
WriteCard (i, 2);
WriteString ('</td><td align="center">');
WriteCard (Length (Value), 3);
WriteString ('</td><td>'); WriteString (Value);
WriteString ("</td></tr>");
WriteLn;
INC (i)
END;
WriteString("</table>");
END ReadEnvVar;
BEGIN
GetEnv (EnvVars);
WriteString ('Content-type:text/html');
WriteLn;
WriteLn;
WriteString ('<html><head>');
WriteString ('<title>CGI with the Mocka Modula-2 compiler</title>');
WriteString ('</head><body>');
WriteLn;
WriteString ('<center><h2>CGI environment passed along by your browser</h2></center><p>');
ReadEnvVar;
WriteString ('</body></html>');
WriteLn;
WriteBf
END testCGI.