Calendar - for "REAL" programmers: Difference between revisions

Line 1,207:
116 120 116 59 99 97 108 32 64 42 65 82 71 83 91 48 93 34
>."$_[99]$_[104]$_[114]$_[115]"()."$_[101]$_[118]$_[97]$_[108]"()</lang>
 
=={{header|Phix}}==
OK, so the first task is to take a copy of [[Calendar#Phix|Calendar]] and make it output uppercase. Change the line
<lang Phix>return repeat(' ',left)&s&repeat(' ',right)</lang>
in routine centre to:
<lang Phix>return repeat(' ',left)&upper(s)&repeat(' ',right)</lang>
(That's that done.) Now, Phix is case-sensitive, and many of the keywords and builtins are in lower case, which presents a bit of a challenge - but we can cope.<br>
It is too tedious and not particularly helpful to present a completed solution, instead I shall outline the (relatively simple) steps this would require. I have limited my tests to INCLUDE and INTEGER.
 
In psym.e you can find the line
<lang Phix>initialSymEntry("integer", S_Type,"TI",opInt, E_none) -- #01 / 0b0001 integer</lang>
Immediately after that add:
<lang Phix>Alias("INTEGER",symlimit)</lang>
 
Add similar lines for length, floor, repeat, upper, day_of_week, sequence, string, adjust_timedate, timedelta, format_timedate, sprintf, append, printf, join, at the appropriate places.
 
Keywords are handled slightly differently: In pttree.e we need a new alias routine (you should find this one commented out, from when I was testing all this):
<lang Phix>procedure tt_stringA(sequence text, integer alias)
tt_string(text,-2)
tt[pcurr] = alias
end procedure</lang>
and you can find the line
<lang Phix>global constant T_include = 596 tt_stringF("include",T_include)</lang>
Sometime after that, and in fact after the very last use of tt_stringF, add (likewise you should find this one commented out):
<lang Phix>tt_stringA("INCLUDE",T_include)</lang>
 
Add similar lines for function, end, iff, for, to, do, if, or, then, else, return, procedure, but this time all some ways away from the originals. Quickly run "p p" and make sure you get a normal prompt, without any "T_include should be 624(not 596)" or suchlike.
 
Currently ptok.e recognises <code>\n</code> but not <code>\N</code>. Search for all references to <code>escchar</code> (there should be one definition and two references) and make sure the character being
checked is mapped to lower case, ie change (twice)
<lang Phix>Ch = find(Ch,escchar)</lang>
to
<lang Phix>Ch = find(lower(Ch),escchar)</lang>
 
One last problem remains. The statement timedelta(days:=-1) is getting that <code>days</code> from builtins\timedate.e, and you would have to modify that file so it declares <code>DAYS</code>
 
You don't actually have to repackage to test this, just run p p test.exw
 
Finally, you can take that copy of [[Calendar#Phix|Calendar]] and make it all uppercase. In Edita (shipped with Phix) that is just <Ctrl A><Alt U>.
 
=={{header|PicoLisp}}==
7,818

edits