Commit 8906700d authored by Alexander Shabarshin's avatar Alexander Shabarshin

local version

parent ba7b298f
Server side source code is written in Hope programming language and considered Public Domain.
It requires Hopeless v0.6 or above that can be downloaded from http://www.hopelog.com or GitHub:
https://github.com/shaos/hopeless
Also it needs SQLite3 ( see www.sqlite.org ).
#!/usr/local/bin/hopeless -f
uses db_sqlite,string,system,lists;
dec sure_num : string -> string;
--- sure_num(l) <= num2str(str2num(l));
dec parse : strings -> string # string # string # string;
--- parse(l) <=
(
sure_num(pairs_get(l,"id")),
sure_num(pairs_get(l,"col")),
sure_num(pairs_get(l,"row")),
sure_num(pairs_get(l,"sym"))
);
dec head2 : list(strings) -> string;
--- head2(nil) <= "";
--- head2(nil::xs) <= "";
--- head2(x::xs) <= head(x);
dec commaconcat : strings -> string;
--- commaconcat(x::nil) <= x;
--- commaconcat(x::xs) <= x<>","<>commaconcat(xs);
dec mapconcat : list(strings) -> strings;
--- mapconcat(nil) <= nil;
--- mapconcat(x::xs) <= commaconcat(x)::mapconcat(xs);
dec action : strings # string -> strings;
--- action(l,a) <=
let (i,c,r,s)==parse(l)
in if equal(i,"0")
then mapconcat(sql("/sqlite3/pcb0.db",
"select sid%100 as x,sid/100 as y,sym,lid from pcb_screen where y<75 and sym!=16"))
else mapconcat(sql("/sqlite3/pcb0.db",
"insert into pcb_action (col,row,sym) values ("<>c<>","<>r<>","<>s<>");"<>
"update pcb_screen set lid=(select max(id) from pcb_action),sym="<>s<>",adr="<>quote(a)<>" where sid="<>num2str(str2num(r)*100+str2num(c))<>";"<>
"select col,row,sym,id from pcb_action where id>"<>i));
write "Content-type: text/plain\n\n";
write action(explode(pairs_get(env,"QUERY_STRING"),'&'),pairs_get(env,"REMOTE_ADDR"));
#!/usr/local/bin/hopeless -f
uses db_sqlite,string,system,lists,range;
dec head2 : list(strings) -> string;
--- head2(nil) <= "";
--- head2(nil::xs) <= "";
--- head2(x::xs) <= head(x);
dec doit : list(num) -> strings;
--- doit(nil) <= nil;
--- doit(x::xs) <= head2(sql("/sqlite3/pcb0.db","insert into pcb_screen (sid,sym,lid,adr) values (" <>
num2str(x) <> ",16,0,NULL)")) :: doit(xs);
write "Content-type: text/plain\n\n";
write sql("/sqlite3/pcb0.db","create table pcb_action ( id integer primary key autoincrement, " <>
"col integer not null, row integer not null, sym integer not null )");
write sql("/sqlite3/pcb0.db","create table pcb_screen ( sid integer primary key, sym integer not null, "<>
"lid integer not null, adr text )");
write doit(0..9999);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.