September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,3 +1,6 @@
|
|||
--
|
||||
-- demo/rosetta/Number_names.exw
|
||||
--
|
||||
constant twenties = {"zero","one","two","three","four","five","six","seven","eight","nine","ten",
|
||||
"eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"}
|
||||
|
||||
|
|
@ -67,7 +70,7 @@ integer n
|
|||
return res
|
||||
end function
|
||||
|
||||
function spell(atom N)
|
||||
global function spell(atom N)
|
||||
string res = ""
|
||||
if N<0 then
|
||||
res = "minus "
|
||||
|
|
@ -77,11 +80,14 @@ string res = ""
|
|||
return res
|
||||
end function
|
||||
|
||||
global
|
||||
constant Samples = {99, 300, 310, 417,1_501, 12_609, 200000000000100, 999999999999999,
|
||||
-123456787654321,102003000400005,1020030004,102003,102,1,0,-1,-99,
|
||||
-1501,1234,12.34,10000001.2,1E-3,-2.7182818}
|
||||
-1501,1234,12.34,10000001.2,1E-3,-2.7182818,
|
||||
201021002001,-20102100200,2010210020,-201021002,20102100,-2010210,
|
||||
201021,-20102,2010,-201,20,-2}
|
||||
|
||||
function smartp(atom N)
|
||||
global function smartp(atom N)
|
||||
string res
|
||||
if N=floor(N) then return sprintf("%d",N) end if
|
||||
res = sprintf("%18.8f",N)
|
||||
|
|
@ -91,14 +97,32 @@ string res
|
|||
return res
|
||||
end function
|
||||
|
||||
procedure main()
|
||||
atom si
|
||||
for i=1 to length(Samples) do
|
||||
si = Samples[i]
|
||||
printf(1,"%18s %s\n",{smartp(si),spell(si)})
|
||||
end for
|
||||
for i=1 to length(Samples) do
|
||||
si = Samples[i]
|
||||
printf(1,"%18s %s\n",{smartp(si),spell(si)})
|
||||
end for
|
||||
end procedure
|
||||
|
||||
si = 201021002001
|
||||
while si!=0 do
|
||||
printf(1,"%18s %s\n",{smartp(si),spell(si)})
|
||||
si = trunc(si/-10)
|
||||
end while
|
||||
-- from Executable_library#Phix --
|
||||
function isMainOrInclude()
|
||||
-- returns 1 if called from the main file, 0 if from an include
|
||||
integer res
|
||||
#ilASM{
|
||||
[32]
|
||||
mov eax,[ebp+20] -- prev_ebp
|
||||
mov eax,[eax+8] -- rtn
|
||||
mov [res],eax
|
||||
[64]
|
||||
mov rax,[rbp+40] -- prev_ebp
|
||||
mov rax,[rax+16] -- rtn
|
||||
mov [res],rax
|
||||
[]
|
||||
}
|
||||
return res=21 -- (21=T_maintls)
|
||||
end function
|
||||
|
||||
if isMainOrInclude() then
|
||||
main()
|
||||
end if
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue