Jump to content

Calendar - for "REAL" programmers: Difference between revisions

m
oops, timedate is not an autoincude
m (moved PicoLisp below PHP)
m (oops, timedate is not an autoincude)
Line 1,222:
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 (it should now be there commented out) 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):
Line 1,234:
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>
 
Line 1,245:
<lang Phix>Ch = find(lower(Ch),escchar)</lang>
 
Lastly, the calendar example includes builtins\timedate.e, which contains some lower-case definitions. So copy it to (say) TIMEDATEUPPER.E and change adjust_timedate, timedelta, days (the 2nd param to timedelta), and format_timedate to their uppercase equivalents, and of course change that include to <code>INCLUDE BUILTINS\TIMEDATEUPPER.E</code>.
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>. There is probably some change in ptok.e/pttree.e even simpler than the steps outlined above that makes everything case insensitive, but locating that is left as an exercise for the reader!
 
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>. There is probably some change in ptok.e/pttree.e even simpler than the steps outlined above that makes everything case insensitive, but locating that is left as an exercise for the reader!.
You don't actually have to repackage to test this, just run p p test.exw
 
You don't actually have to repackage to test this, just run p p test.exw - percentagewise it might be ten times slower (as p.exw is much bigger than test.exw), but it'll still only be a fraction of a second.
 
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>.
7,820

edits

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