Rosetta Code/Rank languages by popularity: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: updated the number of computer programming languages that are on Rosetta Code.) |
m (→REXX program: optimized the program, added suppression on the ranking messages to the terminal.) |
||
Line 4,714: | Line 4,714: | ||
<lang rexx>/*REXX program reads two files and displays a ranked list of Rosetta Code languages.*/ |
<lang rexx>/*REXX program reads two files and displays a ranked list of Rosetta Code languages.*/ |
||
sep= '█'; L.=0; #.=0; u.=0; catHeap=; old.= /*assign some REXX variable defaults. */ |
sep= '█'; L.=0; #.=0; u.=0; catHeap=; old.= /*assign some REXX variable defaults. */ |
||
term= 1 /*show some early messages to terminal.*/ |
|||
parse arg catFID lanFID outFID . /*obtain optional arguments from the CL*/ |
parse arg catFID lanFID outFID . /*obtain optional arguments from the CL*/ |
||
if catFID=='' then catFID = "RC_POP.CAT" /*Not specified? Then use the default.*/ |
if catFID=='' then catFID = "RC_POP.CAT" /*Not specified? Then use the default.*/ |
||
Line 4,724: | Line 4,725: | ||
do j=1 until catHeap=='' /*process the heap of categories. */ |
do j=1 until catHeap=='' /*process the heap of categories. */ |
||
parse var catHeap cat.j (sep) catHeap /*get a category from the catHeap. */ |
parse var catHeap cat.j (sep) catHeap /*get a category from the catHeap. */ |
||
parse var cat.j cat.j '<' "(" mems . /*untangle the |
parse var cat.j cat.j '<' "(" mems . /*untangle the strange─looking string. */ |
||
cat.j= space(cat.j); ?= cat.j; upper ? /*remove any superfluous blanks. */ |
cat.j= space(cat.j); ?= cat.j; upper ? /*remove any superfluous blanks. */ |
||
if ?=='' | \L.? then iterate /*it's blank or it's not a language. */ |
if ?=='' | \L.? then iterate /*it's blank or it's not a language. */ |
||
Line 4,740: | Line 4,741: | ||
call tell right(commas(langs),9) ' " " " " " " " language " ,' |
call tell right(commas(langs),9) ' " " " " " " " language " ,' |
||
call tell right(commas(#.0), 9) '(total) number of entries detected.', , 1 |
call tell right(commas(#.0), 9) '(total) number of entries detected.', , 1 |
||
term= 0 /*don't show any more messages to term.*/ |
|||
call eSort #,0 /*sort the languages along with number.*/ |
call eSort #,0 /*sort the languages along with number.*/ |
||
tied= /*add true rank (tR) ───► the entries. */ |
tied= /*add true rank (tR) ───► the entries. */ |
||
Line 4,780: | Line 4,782: | ||
Formulae = 'F┼ìrmul├ª' /*Unicode (in text) name for Fôrmulæ */ |
Formulae = 'F┼ìrmul├ª' /*Unicode (in text) name for Fôrmulæ */ |
||
Uyir = 'உயிர்/Uyir' /*Unicode (in text) name for Uyir */ |
Uyir = 'உயிர்/Uyir' /*Unicode (in text) name for Uyir */ |
||
old.1= '╬£C++' ; new.1= "µC++" /*Unicode ╬£C++ ───► |
old.1= '╬£C++' ; new.1= "µC++" /*Unicode ╬£C++ ───► ASCII─8: µC++ */ |
||
old.2= 'UC++' ; new.2= "µC++" /*old UC++ ───► |
old.2= 'UC++' ; new.2= "µC++" /*old UC++ ───► ASCII─8: µC++ */ |
||
old.3= '╨£╨Ü-' ; new.3= "MK-" /*Unicode ╨£╨Ü- ───► |
old.3= '╨£╨Ü-' ; new.3= "MK-" /*Unicode ╨£╨Ü- ───► ASCII─8: MK- */ |
||
old.4= 'D├⌐j├á' ; new.4= "Déjà" /*Unicode ├⌐j├á ───► |
old.4= 'D├⌐j├á' ; new.4= "Déjà" /*Unicode ├⌐j├á ───► ASCII─8: Déjà */ |
||
old.5= 'Cach├⌐' ; new.5= "Caché" /*Unicode Cach├⌐ ───► |
old.5= 'Cach├⌐' ; new.5= "Caché" /*Unicode Cach├⌐ ───► ASCII─8: Caché */ |
||
old.6= '??-61/52' ; new.6= "MK-61/52" /*somewhere past, a mis─translated: MK-*/ |
old.6= '??-61/52' ; new.6= "MK-61/52" /*somewhere past, a mis─translated: MK-*/ |
||
old.7= Formulae ; new.7= 'Fôrmulæ' /*Unicode ───► ASCII─8: Fôrmulæ */ |
old.7= Formulae ; new.7= 'Fôrmulæ' /*Unicode ───► ASCII─8: Fôrmulæ */ |
||
Line 4,797: | Line 4,799: | ||
end /*v*/ /* [↑] handle different lang spellings*/ |
end /*v*/ /* [↑] handle different lang spellings*/ |
||
if igAst then do; igAst= pos(' * ',$)==0; if igAst then iterate; end |
if igAst then do; igAst= pos(' * ',$)==0; if igAst then iterate; end |
||
$$u = $$; upper $$u /*define uppercase version of $$*/ |
|||
if pos('RETRIEVED FROM', |
if pos('RETRIEVED FROM',$$u)\==0 then leave /*is this a pseudo End─Of─Data? */ |
||
if which=='L' then do |
if which=='L' then do |
||
if left($$, 1)\=='*' then iterate /*lang not legitimate?*/ |
if left($$, 1)\=='*' then iterate /*lang not legitimate?*/ |
||
parse |
parse var $$u '*' $$ "<"; $$= space($$); L.$$= 1 |
||
langs= langs+1 /*bump the number of languages found. */ |
langs= langs+1 /*bump the number of languages found. */ |
||
iterate /*iterates the DO recs loop. */ |
iterate /*iterates the DO recs loop. */ |
||
Line 4,813: | Line 4,816: | ||
s: if arg(1)==1 then return arg(3); return word(arg(2) 's',1) /*pluralizer.*/ |
s: if arg(1)==1 then return arg(3); return word(arg(2) 's',1) /*pluralizer.*/ |
||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
||
tell: |
tell: do '0'arg(2); call lineout outFID," " ; if term then say; end |
||
call lineout outFID,arg(1) ; if term then say arg(1) |
|||
do '0'arg(3); call lineout outFID," " ; if term then say; end |
|||
return /*show BEFORE blank lines (if any), message, show AFTER blank lines.*/</lang> |
return /*show BEFORE blank lines (if any), message, show AFTER blank lines.*/</lang> |
||
Some older REXXes don't have a '''changestr''' BIF, so one is included here: ───► [[CHANGESTR.REX]]. |
Some older REXXes don't have a '''changestr''' BIF, so one is included here: ───► [[CHANGESTR.REX]]. |