Jump to content

Rosetta Code/Find unimplemented tasks: Difference between revisions

m
→‎{{header|Wren}}: Minor tidy and rerun
(add task to arm assembly raspberry pi)
m (→‎{{header|Wren}}: Minor tidy and rerun)
(2 intermediate revisions by 2 users not shown)
Line 820:
 
[[Image:Ahk_find_unimplemented.png‎]]
=={{header|BBC BASIC}}==
{{works with|BBC BASIC for Windows}}
<syntaxhighlight lang="bbcbasic"> SYS "LoadLibrary", "URLMON.DLL" TO U%
IF U% == 0 ERROR 100, "DLL not available in your OS"
SYS "GetProcAddress", U%, "URLDownloadToFileA" TO U%
 
Q$=CHR$34 : REM The quote
BlkSize%=256 * 1024 : REM 256k must be enough
DIM Blk% BlkSize% - 1 : REM Reserve memory block to load data into
 
PROCFetchData("Programming_Tasks")
 
REM Count number of tasks and declare and populate Task$() array.
P%=Blk%
REPEAT
I%=INSTR($$P%, "title")
IF I% Tasks%+=1 : P%+=I%
UNTIL I% == 0
DIM Task$(Tasks%-1)
P%=Blk%
FOR I%=0 TO Tasks% - 1
Task$(I%)=FNValue(P%, "title")
NEXT
 
PROCShowUnimplemented("BBC_BASIC")
PROCShowUnimplemented("C++")
END
 
REM -------------------------------------------------------------------------
REM Compare each task title against loaded language data in memory.
DEF PROCShowUnimplemented(language$)
LOCAL i%, j%, mem%, n%
 
PROCFetchData(language$)
mem%=Blk%
PRINT "Unimplemented tasks for the '" language$ "' programming language:"
FOR i%=0 TO Tasks% - 1
j%=INSTR($$mem%, Task$(i%))
IF j% THEN
mem%+=j%
ELSE
n%+=1
PRINT " -" Task$(i%)
ENDIF
NEXT
PRINT "Total is: ";n% '
ENDPROC
 
REM -------------------------------------------------------------------------
REM Stitch the pages for this category together in the memory block.
DEF PROCFetchData(category$)
LOCAL mem%, continue$, e%, f%, tempfile$, url$
 
tempfile$=@tmp$ + "result.json"
mem%=Blk%
REPEAT
url$="http://www.rosettacode.org/w/api.php?" +\
\ "action=query&list=categorymembers&cmtitle=Category:" + category$ +\
\ "&cmlimit=500&format=json&cmcontinue=" + continue$
SYS U%, 0, url$, tempfile$, 0, 0 TO e% : REM Get one page to a file
IF e% ERROR 100, "Can't get data from Rosetta API"
f%=OPENINtempfile$ : e%=EXT#f% : CLOSE#f% : REM Get file size
IF mem% - Blk% + e% > BlkSize% ERROR 100, "Insufficient memory to load data"
OSCLI "LOAD " + tempfile$ + " " + STR$~mem% : REM Append to previous
e%=mem% + e%
?e%=0 : REM Terminating 0x00
continue$=FNValue(mem%, "cmcontinue") : REM Loaded page contains this name?
mem%=e% : REM Advance memory pointer
UNTIL continue$ == ""
ENDPROC
 
REM -------------------------------------------------------------------------
REM Retrieve value for a JSON name from address p% and advance p% afterwards.
DEF FNValue(RETURN p%, name$)
LOCAL s%
 
name$=Q$ + name$ + Q$ + ":"
s%=INSTR($$p%, name$)
IF s% == 0 THEN =""
p%+=s% + LENname$
=LEFT$($$p%, INSTR($$p%, Q$) - 1)</syntaxhighlight>
{{out}}
<pre>
Unimplemented tasks for the 'BBC_BASIC' programming language:
-100 prisoners
-15 puzzle solver
-21 game
......
-Zhang-Suen thinning algorithm
-Zsigmondy numbers
-Zumkeller numbers
Total is: 697
 
Unimplemented tasks for the 'C++' programming language:
-Abelian sandpile model/Identity
-Achilles numbers
-Add a variable to a class instance at runtime
......
-Yahoo! search interface
-Zsigmondy numbers
-Zumkeller numbers
Total is: 172
</pre>
=={{header|C sharp|C#}}==
Using JSON (not parsed, just Regex.)
Line 3,484 ⟶ 3,588:
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
Line 3,512 ⟶ 3,616:
{{libheader|Wren-pattern}}
An embedded program so we can use the libcurl library.
<syntaxhighlight lang="ecmascriptwren">/* rc_find_unimplemented_tasksRosetta_Code_Find_unimplemented_tasks.wren */
 
import "./pattern" for Pattern
Line 3,553 ⟶ 3,657:
 
var findTasks = Fn.new { |category|
var url = "https://www.rosettacode.org/mw/api.php?action=query&list=categorymembers&cmtitle=Category:%(category)&cmlimit=500&format=xml"
var cmcontinue = ""
var tasks = []
Line 3,584 ⟶ 3,688:
<br>
which we embed in the following C program, build and run.
<syntaxhighlight lang="c">/* gcc rc_find_unimplemented_tasksRosetta_Code_Find_unimplemented_tasks.c -o rc_find_unimplemented_tasksRosetta_Code_Find_unimplemented_tasks -lcurl -lwren -lm */
 
#include <stdio.h>
Line 3,758 ⟶ 3,862:
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* fileName = "rc_find_unimplemented_tasksRosetta_Code_Find_unimplemented_tasks.wren";
char *script = readFile(fileName);
WrenInterpretResult result = wrenInterpret(vm, module, script);
Line 3,777 ⟶ 3,881:
 
{{out}}
Confirms that Wren had no unimplemented tasks when this was run.
<pre>
Unimplemented 'full' tasks in Wren:
 
Unimplemented 'draft' tasks in Wren:
Continued fraction convergents
</pre>
 
9,476

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.