Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -420,7 +420,7 @@ extChaine:
add r0,r3 @ r0 return the last position of extraction
@ it is possible o search another text
100:
pop {r2-r8,pc} @ restaur registers
pop {r2-r8,pc} @ restaur registers
/******************************************************************/
/* search substring in string */

View file

@ -1,119 +0,0 @@
with AWS.Client, AWS.Messages, AWS.Response, AWS.URL;
with DOM.Readers, DOM.Core, DOM.Core.Documents, DOM.Core.Nodes, DOM.Core.Attrs;
with Input_Sources.Strings, Unicode, Unicode.CES.Utf8;
with Ada.Strings.Unbounded, Ada.Text_IO, Ada.Command_Line;
with Ada.Containers.Vectors;
use AWS.Client, AWS.Messages, AWS.Response;
use DOM.Readers, DOM.Core, DOM.Core.Documents, DOM.Core.Nodes, DOM.Core.Attrs;
use AWS, Ada.Strings.Unbounded, Input_Sources.Strings;
use Ada.Text_IO, Ada.Command_Line;
procedure Not_Coded is
package Members_Vectors is new Ada.Containers.Vectors
(Index_Type => Positive, Element_Type => Unbounded_String);
use Members_Vectors;
All_Tasks, Language_Members : Vector;
procedure Get_Vector (Category : in String; Mbr_Vector : in out Vector) is
Reader : Tree_Reader;
Doc : Document;
List : Node_List;
N : Node;
A : Attr;
Page : AWS.Response.Data;
S : Messages.Status_Code;
-- Query has cmlimit value of 500, so we need 2 calls to
-- retrieve the complete list of Programming_category
Uri_Xml : constant String :=
"https://rosettacode.org/w/api.php?action=query&list=categorymembers" &
"&format=xml&cmlimit=500&cmtitle=Category:";
Cmcontinue : Unbounded_String := Null_Unbounded_String;
begin
loop
Page :=
AWS.Client.Get (Uri_Xml & Category & (To_String (Cmcontinue)));
S := AWS.Response.Status_Code (Page);
if S not in Messages.Success then
Put_Line
("Unable to retrieve data => Status Code :" & Image (S) &
" Reason :" & Reason_Phrase (S));
raise Connection_Error;
end if;
declare
Xml : constant String := Message_Body (Page);
Source : String_Input;
begin
Open
(Xml'Unrestricted_Access, Unicode.CES.Utf8.Utf8_Encoding,
Source);
Parse (Reader, Source);
Close (Source);
end;
Doc := Get_Tree (Reader);
List := Get_Elements_By_Tag_Name (Doc, "cm");
for Index in 1 .. Length (List) loop
N := Item (List, Index - 1);
A := Get_Named_Item (Attributes (N), "title");
Members_Vectors.Append
(Mbr_Vector, To_Unbounded_String (Value (A)));
end loop;
Free (List);
List := Get_Elements_By_Tag_Name (Doc, "continue");
if Length (List) = 0 then
-- we are done
Free (List);
Free (Reader);
exit;
end if;
N := Item (List, 0);
A := Get_Named_Item (Attributes (N), "cmcontinue");
Cmcontinue :=
To_Unbounded_String ("&cmcontinue=" & AWS.URL.Encode (Value (A)));
Free (List);
Free (Reader);
end loop;
end Get_Vector;
procedure Quick_Diff (From : in out Vector; Substract : in Vector) is
Beginning, Position : Extended_Index;
begin
-- take adavantage that both lists are already sorted
Beginning := First_Index (From);
for I in First_Index (Substract) .. Last_Index (Substract) loop
Position :=
Find_Index
(Container => From,
Item => Members_Vectors.Element (Substract, I),
Index => Beginning);
if not (Position = No_Index) then
Delete (From, Position);
Beginning := Position;
end if;
end loop;
end Quick_Diff;
begin
if Argument_Count = 0 then
Put_Line ("Can't process : No language given!");
return;
else
Put ("Language given: ");
Put_Line (Argument (1));
Get_Vector (Argument (1), Language_Members);
end if;
Get_Vector ("Programming_Tasks", All_Tasks);
Quick_Diff (All_Tasks, Language_Members);
for I in First_Index (All_Tasks) .. Last_Index (All_Tasks) loop
Put_Line (To_String (Members_Vectors.Element (All_Tasks, I)));
end loop;
Put_Line
("Numbers of tasks not implemented :=" &
Integer'Image (Last_Index ((All_Tasks))));
end Not_Coded;

View file

@ -4,28 +4,28 @@
-export( [init_http/0, per_language/1, rosetta_code_list_of/1] ).
init_http() ->
application:start( inets ).
application:start( inets ).
per_language( Language ) ->
ok = init_http(),
Tasks = rosetta_code_list_of( "Programming_Tasks" ),
Uninplemented = Tasks -- rosetta_code_list_of( Language ),
io:fwrite( "Unimplemented total: ~p~n", [erlang:length(Uninplemented)] ),
[io:fwrite("~p~n", [X]) || X <- Uninplemented].
ok = init_http(),
Tasks = rosetta_code_list_of( "Programming_Tasks" ),
Uninplemented = Tasks -- rosetta_code_list_of( Language ),
io:fwrite( "Unimplemented total: ~p~n", [erlang:length(Uninplemented)] ),
[io:fwrite("~p~n", [X]) || X <- Uninplemented].
rosetta_code_list_of( Category ) ->
URL = "http://rosettacode.org/mw/api.php?action=query&list=categorymembers&cmlimit=500&format=xml&cmtitle=Category:"
++ Category,
title_contents( URL, "", [] ).
URL = "http://rosettacode.org/mw/api.php?action=query&list=categorymembers&cmlimit=500&format=xml&cmtitle=Category:"
++ Category,
title_contents( URL, "", [] ).
title_contents( URL, Continue, Acc ) ->
{ok, {{_HTTP,200,"OK"}, _Headers, Body}} = httpc:request( URL ++ Continue ),
{XML, _} = xmerl_scan:string( Body ),
News = xml_selection( "title", XML ),
New_continue = title_contents_url_continue( xml_selection("cmcontinue", XML) ),
title_contents_continue( URL, New_continue, Acc ++ News ).
{ok, {{_HTTP,200,"OK"}, _Headers, Body}} = httpc:request( URL ++ Continue ),
{XML, _} = xmerl_scan:string( Body ),
News = xml_selection( "title", XML ),
New_continue = title_contents_url_continue( xml_selection("cmcontinue", XML) ),
title_contents_continue( URL, New_continue, Acc ++ News ).
title_contents_continue( _URL, "", Acc ) -> Acc;
title_contents_continue( URL, Continue, Acc ) -> title_contents( URL, Continue, Acc ).
@ -34,7 +34,7 @@ title_contents_url_continue( [] ) -> "";
title_contents_url_continue( [Continue | _] ) -> "&cmcontinue=" ++ Continue.
xml_selection( Selection, XML ) ->
[lists:map( fun xml_8211/1, X) || #xmlAttribute{value=X} <- xmerl_xpath:string("//@" ++ Selection, XML)].
[lists:map( fun xml_8211/1, X) || #xmlAttribute{value=X} <- xmerl_xpath:string("//@" ++ Selection, XML)].
xml_8211( 8211 ) -> $-;
xml_8211( 924 ) -> $\s;

View file

@ -1,75 +1,46 @@
$define RCINDEX "http://rosettacode.org/mw/api.php?format=xml&action=query&list=categorymembers&cmtitle=Category:Programming_Tasks&cmlimit=500"
$define RCTASK "http://rosettacode.org/mw/index.php?action=raw&title="
$define RCUA "User-Agent: Unicon Rosetta 0.1"
$define RCXUA "X-Unicon: http://unicon.org/"
$define TASKTOT "* Total Tasks *"
$define TOTTOT "* Total Headers*"
link strings
link hexcvt
$define RCPREFIX "https://rosettacode.org/w/api.php?action=query&list=categorymembers&format=xml&cmlimit=5000&cmtitle=Category:"
$define RCSUFFIX1 "Programming%20Tasks"
procedure main(A) # simple single threaded read all at once implementation
lang := \A[1] | "Unicon"
write("Unimplemented tasks for ",lang," as of ",&date)
every task := taskNames() do {
if lang == languages(task) then next
write(task)
}
all_tasks := set([: taskNames() :])
tasks_for_lang := set([: tasksForLang(lang) :])
every write(!sort(all_tasks -- tasks_for_lang))
end
# Generate task names
procedure taskNames()
continue := ""
while \(txt := ReadURL(RCINDEX||continue)) do {
while \(txt := ReadURL(RCPREFIX||RCSUFFIX1||continue)) do {
txt ? {
while tab(find("<cm ") & find(s :="title=\"")+*s) do
while tab((find("<cm "),find(s :="title=\""))+*s) do
suspend tab(find("\""))\1
if tab(find("cmcontinue=")) then {
continue := "&"||tab(upto(' \t'))
}
else break
continue := getContinue() | break
}
}
end
# Generate language headers in a task
procedure languages(task)
static WS
initial WS := ' \t'
page := ReadURL(RCTASK||CleanURI(task))
page ? while (tab(find("\n==")),tab(many(WS))|"",tab(find("{{"))) do {
header := tab(find("=="))
header ? {
while tab(find("{{header|")) do {
suspend 2(="{{header|",tab(find("}}")))\1
}
}
}
# Generate all tasks for a language
procedure tasksForLang(lang)
continue := ""
while \(txt := ReadURL(RCPREFIX||lang||continue)) do {
txt ? {
while tab(find(s :="title=\"")+*s) do
suspend tab(find("\""))\1
continue := getContinue() | break
}
}
end
procedure CleanURI(u) #: clean up a URI
static tr,dxml # xml & http translation
initial {
tr := table()
every c := !string(~(&digits++&letters++'-_.!~*()/\'`')) do
tr[c] := "%"||hexstring(ord(c),2)
every /tr[c := !string(&cset)] := c
tr[" "] := "_" # wiki convention
every push(dxml := [],"&#"||right(ord(c := !"&<>'\""),3,"0")||";",c)
}
dxml[1] := u # insert URI as 1st arg
u := replacem!dxml # de-xml it
every (c := "") ||:= tr[!u] # reencode everything
c := replace(c,"%3E","'") # Hack to put single quotes back in
c := replace(c,"%26quot%3B","\"") # Hack to put double quotes back in
return c
procedure getContinue()
gcm := "cmcontinue="
return (tab(1),"&"||2(tab(find(gcm)),=gcm,="\"")||tab(upto('"')))
end
procedure ReadURL(url) #: read URL into string
page := open(url,"m",RCUA,RCXUA) | stop("Unable to open ",url)
text := ""
if page["Status-Code"] < 300 then while text ||:= reads(page,-1)
page := open(url,"m-") | stop("Unable to open ",url," -> ",&errortext)
if page["Status-Code"] < 300 then text := reads(page,-1)
else write(&errout,image(url),": ",
page["Status-Code"]," ",page["Reason-Phrase"])
close(page)

View file

@ -5,5 +5,5 @@ x := StringTools:-StringSplit(x, "<h2><span class=\"mw-headline\" id=\"Not_imple
x := StringTools:-StringSplit(x, "<span class=\"mw-headline\" id=\"Draft_tasks_without_implementation\">Draft tasks without implementation</span>")[1]:
x := StringTools:-StringSplit(x,"<li><a href=\"/wiki/")[2..]:
for problem in x do
printf("%s\n", StringTools:-SubstituteAll(StringTools:-Decode(StringTools:-StringSplit(problem, "\" title=")[1], 'percent'), "_", " "));
printf("%s\n", StringTools:-SubstituteAll(StringTools:-Decode(StringTools:-StringSplit(problem, "\" title=")[1], 'percent'), "_", " "));
end do:

View file

@ -1,20 +0,0 @@
function Find-UnimplementedTask
{
[CmdletBinding()]
[OutputType([string[]])]
Param
(
[Parameter(Mandatory=$true,
Position=0)]
[string]
$Language
)
$url = "http://rosettacode.org/wiki/Reports:Tasks_not_implemented_in_$Language"
$web = Invoke-WebRequest $url
$unimplemented = 1
[string[]](($web.AllElements |
Where-Object {$_.class -eq "mw-content-ltr"})[$unimplemented].outerText -split "`r`n" |
Select-String -Pattern "[^0-9A-Z]$" -CaseSensitive)
}

View file

@ -1,4 +0,0 @@
$tasks = Find-UnimplementedTask -Language PowerShell
$tasks[0..5],".`n.`n.",$tasks[-6..-1]
Write-Host "`nTotal unimplemented Tasks: $($tasks.Count)"

View file

@ -1,4 +1,6 @@
import logging
from typing import Any
from typing import Dict
from typing import Iterable
from typing import NamedTuple
from typing import Set
@ -49,11 +51,12 @@ def get_session() -> requests.Session:
session = requests.Session()
session.mount("https://", adapter)
session.mount("http://", adapter)
session.headers["User-Agent"] = "Rosetta Code Task bot"
return session
def category_members(category: str, url: str = URL) -> Iterable[PageInfo]:
params = {**CM_QUERY, "gcmtitle": category}
params: Dict[str, Any] = {**CM_QUERY, "gcmtitle": category}
session = get_session()
response = session.get(url, params=params)

View file

@ -1,14 +1,14 @@
library(XML)
find.unimplemented.tasks <- function(lang="R"){
PT <- xmlInternalTreeParse( paste("http://www.rosettacode.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Programming_Tasks&cmlimit=500&format=xml",sep="") )
PT.nodes <- getNodeSet(PT,"//cm")
PT.titles = as.character( sapply(PT.nodes, xmlGetAttr, "title") )
language <- xmlInternalTreeParse( paste("http://www.rosettacode.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:",
lang, "&cmlimit=500&format=xml",sep="") )
lang.nodes <- getNodeSet(language,"//cm")
lang.titles = as.character( sapply(lang.nodes, xmlGetAttr, "title") )
unimplemented <- setdiff(PT.titles, lang.titles)
unimplemented
PT <- xmlInternalTreeParse( paste("http://www.rosettacode.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Programming_Tasks&cmlimit=500&format=xml",sep="") )
PT.nodes <- getNodeSet(PT,"//cm")
PT.titles = as.character( sapply(PT.nodes, xmlGetAttr, "title") )
language <- xmlInternalTreeParse( paste("http://www.rosettacode.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:",
lang, "&cmlimit=500&format=xml",sep="") )
lang.nodes <- getNodeSet(language,"//cm")
lang.titles = as.character( sapply(lang.nodes, xmlGetAttr, "title") )
unimplemented <- setdiff(PT.titles, lang.titles)
unimplemented
}
# Usage
find.unimplemented.tasks(lang="Python")

View file

@ -1,18 +1,18 @@
WordWrap$ = "style='white-space: pre-wrap;white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap;word-wrap: break-word'"
a$ = httpGet$("http://rosettacode.org/wiki/Category:Programming_Languages")
a$ = word$(a$,2,"mw-subcategories")
a$ = word$(a$,1,"</table>")
i = instr(a$,"/wiki/Category:")
a$ = httpGet$("http://rosettacode.org/wiki/Category:Programming_Languages")
a$ = word$(a$,2,"mw-subcategories")
a$ = word$(a$,1,"</table>")
i = instr(a$,"/wiki/Category:")
html "<B> Select language from list<BR>"
html "<SELECT name='lang'>"
while i <> 0
j = instr(a$,""" title=""Category:",i)
lang$ = mid$(a$,i+15,j-i-15)
k = instr(a$,""">",j + 18)
j = instr(a$,""" title=""Category:",i)
lang$ = mid$(a$,i+15,j-i-15)
k = instr(a$,""">",j + 18)
langName$ = mid$(a$,j + 18,k-(j+18))
count = count + 1
count = count + 1
html "<option value='";lang$;"'>";langName$;"</option>"
i = instr(a$,"/wiki/Category:",k)
i = instr(a$,"/wiki/Category:",k)
wend
html "</select>"
html "<p>Number of Languages:";count;"<BR> "
@ -23,19 +23,19 @@ wait
[go]
cls
lang$ = #request get$("lang")
h$ = "http://rosettacode.org/wiki/Reports:Tasks_not_implemented_in_";lang$
a$ = httpGet$(h$)
a$ = word$(a$,3,"mw-content-ltr")
lang$ = #request get$("lang")
h$ = "http://rosettacode.org/wiki/Reports:Tasks_not_implemented_in_";lang$
a$ = httpGet$(h$)
a$ = word$(a$,3,"mw-content-ltr")
html "<table border=1><tr>"
i = instr(a$,"<a href=""/wiki/")
i = instr(a$,"<a href=""/wiki/")
while i > 0
i = instr(a$,"title=""",i)
j = instr(a$,""">",i+7)
if c mod 4 = 0 then html "</tr><tr ";WordWrap$;">"
c = c + 1
i = instr(a$,"title=""",i)
j = instr(a$,""">",i+7)
if c mod 4 = 0 then html "</tr><tr ";WordWrap$;">"
c = c + 1
html "<td>";mid$(a$,i+7,j-(i+7));"</td>"
i = instr(a$,"<a href=""/wiki/",i+7)
i = instr(a$,"<a href=""/wiki/",i+7)
wend
html "</tr></table>"
print "Total unImplemented Tasks:";c

View file

@ -14,15 +14,15 @@ proc log msg {
proc get_tasks {category} {
global cache
if {[info exists cache($category)]} {
return $cache($category)
return $cache($category)
}
set base_url http://www.rosettacode.org/mw/api.php
set query {
action query
list categorymembers
cmtitle Category:%s
format json
cmlimit 500
action query
list categorymembers
cmtitle Category:%s
format json
cmlimit 500
}
set query [list {*}$query]; # remove excess whitespace
set this_query [dict create {*}[split [format $query $category]]]
@ -32,7 +32,7 @@ proc get_tasks {category} {
set url [join [list $base_url [http::formatQuery {*}$this_query]] ?]
while 1 {
set response [http::geturl $url]
# Process redirects
# Process redirects
if {[http::ncode $response] == 301} {
set newurl [dict get [http::meta $response] Location]
if {[string match http://* $newurl]} {
@ -43,17 +43,17 @@ proc get_tasks {category} {
}
continue
}
# Check for oopsies!
# Check for oopsies!
if {
[set s [http::status $response]] ne "ok"
|| [http::ncode $response] != 200
} then {
[set s [http::status $response]] ne "ok"
|| [http::ncode $response] != 200
} then {
error "Oops: url=$url\nstatus=$s\nhttp code=[http::code $response]"
}
break
}
# Get the data out of the message
# Get the data out of the message
set data [json::json2dict [http::data $response]]
http::cleanup $response
@ -63,8 +63,8 @@ proc get_tasks {category} {
}
if {[catch {
dict get $data query-continue categorymembers cmcontinue
} continue_task]} then {
dict get $data query-continue categorymembers cmcontinue
} continue_task]} then {
# no more continuations, we're done
break
}
@ -88,7 +88,7 @@ proc get_unimplemented {lang} {
puts "\n$lang has [llength $unimplemented] unimplemented programming tasks:"
if {[llength $unimplemented]} {
puts " [join [lsort $unimplemented] "\n "]"
puts " [join [lsort $unimplemented] "\n "]"
}
}

View file

@ -1,67 +0,0 @@
Set http= CreateObject("WinHttp.WinHttpRequest.5.1")
Set oDic = WScript.CreateObject("scripting.dictionary")
start="https://rosettacode.org"
Const lang="VBScript"
Dim oHF
gettaskslist "about:/wiki/Category:Programming_Tasks" ,True
print odic.Count
gettaskslist "about:/wiki/Category:Draft_Programming_Tasks",True
print "total tasks " & odic.Count
gettaskslist "about:/wiki/Category:"&lang,False
print "total tasks not in " & lang & " " &odic.Count & vbcrlf
For Each d In odic.keys
print d &vbTab & Replace(odic(d),"about:", start)
next
WScript.Quit(1)
Sub print(s):
On Error Resume Next
WScript.stdout.WriteLine (s)
If err= &h80070006& Then WScript.echo " Please run this script with CScript": WScript.quit
End Sub
Function getpage(name)
Set oHF=Nothing
Set oHF = CreateObject("HTMLFILE")
http.open "GET",name,False ''synchronous!
http.send
oHF.write "<html><body></body></html>"
oHF.body.innerHTML = http.responsetext
Set getpage=Nothing
End Function
Sub gettaskslist(b,build)
nextpage=b
While nextpage <>""
nextpage=Replace(nextpage,"about:", start)
WScript.Echo nextpage
getpage(nextpage)
Set xtoc = oHF.getElementbyId("mw-pages")
nextpage=""
For Each ch In xtoc.children
If ch.innertext= "next page" Then
nextpage=ch.attributes("href").value
': WScript.Echo nextpage
ElseIf ch.attributes("class").value="mw-content-ltr" Then
Set ytoc=ch.children(0)
'WScript.Echo ytoc.attributes("class").value '"mw-category mw-category-columns"
Exit For
End If
Next
For Each ch1 In ytoc.children 'mw-category-group
'WScript.Echo ">" &ch1.children(0).innertext &"<"
For Each ch2 In ch1.children(1).children '"mw_category_group".ul
Set ch=ch2.children(0)
If build Then
odic.Add ch.innertext , ch.attributes("href").value
else
if odic.exists(ch.innertext) then odic.Remove ch.innertext
End if
'WScript.Echo ch.innertext , ch.attributes("href").value
Next
Next
Wend
End Sub

View file

@ -5,10 +5,10 @@ fcn getTasks(language){
do{
page:=CURL().get(("http://rosettacode.org/mw/api.php?"
"action=query&cmlimit=500"
"&format=json"
"&list=categorymembers"
"&cmtitle=Category:%s"
"&cmcontinue=%s").fmt(language,continueValue));
"&format=json"
"&list=categorymembers"
"&cmtitle=Category:%s"
"&cmcontinue=%s").fmt(language,continueValue));
page=page[0].del(0,page[1]); // get rid of HTML header
json:=YAJL().write(page).close();
json["query"]["categorymembers"].pump(tasks,T("get","title"));