Calendar - for "REAL" programmers: Difference between revisions
m
syntax highlighting fixup automation
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
|||
Line 37:
This is for real programmers who code only in assembler :). The code could have been run in april 1964, punched on
80-column cards, read on a card reader, and printed with a 132-column line printer on fan-folded paper with perforated edges.
<
CALENDAR CSECT
USING CALENDAR,R13 BASE REGISTER
Line 217:
DA DS 12CL144
YREGS
END CALENDAR</
{{out}}
<pre> INSERT SNOOPY HERE
Line 243:
Instead of doing that, the implementation below reuses the package "PRINTABLE_CALENDAR" (same as "Printable_Calendar" or "printable_calendar") from [[Calendar#Ada|the calendar task]]:
<
PROCEDURE REAL_CAL IS
Line 263:
C.NEW_LINE;
C.PRINT(1969, "NINETEEN-SIXTY-NINE");
END REAL_CAL;</
{{out}}
Line 296:
Note: to run this code with [[ALGOL 68G]] you need to use the '''--quote-stropping''' option.
<
'PROC' PRINT CALENDAR = ('INT' YEAR, PAGE WIDTH)'VOID': 'BEGIN'
Line 403:
LINE PRINTER WIDTH = 132; # AS AT 1969! #
PRINT CALENDAR(MANKIND STEPPED ON THE MOON, LINE PRINTER WIDTH)
'END'</
{{out}}
<pre>
Line 428:
=={{header|AutoHotkey}}==
<
LASTDAY := [], DAY := []
TITLES =
Line 466:
STRINGREPLACE, RES, RES,%A_SPACE%0,%A_SPACE%%A_SPACE%, ALL
RETURN RES
}</
Examples:<
GUI, FONT,S8, COURIER
GUI, ADD, EDIT, VYR W40 R1 LIMIT4 NUMBER, 1969
Line 482:
GUICLOSE:
EXITAPP
RETURN</
{{out}}
<pre> 1969
Line 525:
=={{header|BaCon}}==
Choosing 132 character output. Same as the "Calendar" from [[Calendar#BaCon|the calendar task]] but using all capitals:
<
DECLARE MON[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
Y$ = "1969"
Line 557:
PRINT D;
NEXT
NEXT</
{{out}}
Line 582:
=={{header|BBC BASIC}}==
{{works with|BBC BASIC for Windows}}
<
YEAR = 1969
Line 628:
WHEN 4,6,9,11: = 30
OTHERWISE = 31
ENDCASE</
{{out}}
<pre>
Line 670:
tcc -DSTRUCT=struct -DCONST=const -DINT=int -DCHAR=char -DVOID=void -DMAIN=main -DIF=if -DELSE=else -DWHILE=while -DFOR=for -DDO=do -DBREAK=break -DRETURN=return -DPUTCHAR=putchar UCCALENDAR.c
</pre>
<
/* ERROR MESSAGES GO TO STDOUT TO SLIGHTLY SIMPLIFY THE I/O HANDLING */
/* WHEN COMPILING THIS, THE COMMAND LINE SHOULD SPECIFY -D OPTIONS FOR THE FOLLOWING WORDS: */
Line 835:
}
RETURN RESULT;
}</
=={{header|COBOL}}==
Line 842:
=={{header|Common Lisp}}==
<
(DEFPARAMETER *DAY-ROW* "SU MO TU WE TH FR SA")
Line 916:
(LAMBDA (&REST HEADS)
(FORMAT T FORMAT-STRING HEADS))
ROW))))</
{{out}}
<pre>CL-USER> (PRINT-CALENDAR 1969)
Line 1,012:
Then in another source code file there is a little loader, that imports it and mixes-in it (for safety this program must be compiled with <code>-Jsomepath</code>):
<
{{out}}
<pre> [Snoopy Picture]
Line 1,055:
=={{header|Elena}}==
ELENA 5.0 :
<
import system'routines;
import system'calendar;
Line 1,215:
console.readChar()
}</
{{out}}
<pre>
Line 1,257:
=={{header|Fortran}}==
Alas, the header "FORTRAN" is not recognised - REAL programmers were absent that day? Even upon the apperance of lower case, I have preferred to use shouting for programme source, and normal upper/lower case for commentary. Aside from petty details such as 1 and l being nowhere as distinct as 1 and L, this allows the two sorts of blather to be identifiably different without ratiocination as the hours drag past. Further, the names of variables can easily be distinguished from the same word in discussion, as in ... the text in TEXT will be printed as the subtitle to the text in TITLE ... Anyway, in the spirit of old, herewith the source without tedious commentary:
<
MODULE DATEGNASH
Line 1,433:
END DO
END
</syntaxhighlight>
And for output, the wide form:
Line 1,458:
=={{header|FreeBASIC}}==
<
' COMPILE WITH: FBC -S CONSOLE
Line 1,554:
PRINT : PRINT "HIT ANY KEY TO END PROGRAM"
SLEEP
END</
{{out}}
<pre> INSERT YOUR SNOOPY PICTURE HERE
Line 1,584:
This is realcal_UC.txt:
<
IMPORT (
Line 1,654:
FMT.PRINTLN()
}
}</
and this is realcal.go:
<
import (
Line 1,696:
cmd.Stderr = os.Stderr
check(cmd.Run())
}</
which produces (as expected) this output:
Line 1,745:
In Graphical User Interface Support Script, we utilize applications that are already written. So for this task, we shall just display the calendar that sets the system clock.
<
=={{header|Icon}} and {{header|Unicon}}==
Line 1,768:
Also it makes me go all nostalgic for my old [[WATFIVE]] compiler. And an IBM 129 keypunch. And 5 hole paper tape.
<
LINK DATETIME
Line 1,816:
IF M = 2 & ISLEAPYEAR(YEAR) THEN SUSPEND (DAY +:= 1, 29)
EVERY DAY TO (6*7) DO SUSPEND ""
END</
Where REALIZE.ICN would be something like this (this example is incomplete but sufficient for this program):
<
$define END end
$define WRITE write
Line 1,846:
$define BY by
$define DATETIME datetime
$define RETURN return</
{{libheader|Icon Programming Library}}
Line 1,854:
For added "real"ness, we also only use 1 character names:
<
M=: 28+ 3, (10$5$3 2),~ 0 ~:/@:= 4 100 400 | ]
R=: (7 -@| B+ 0, +/\@}:@M) |."0 1 (0,#\#~41) (]&:>: *"1 >/)~ M
Line 1,863:
L=: |."0 1~ +/ .(*./\@:=)"1&' '
E=: (|."0 1~ _2 <.@%~ +/ .(*./\.@:=)"1&' ')@:({."1) L
F=: 0 _1 }. 0 1 }. (2+[) E '[INSERT SNOOPY HERE]', ":@], D</
B: given a year returns a number which when added to numeric values indexing days that year, mod 7, index the proper day names within a week. (In other words 7 | 0 + B 1969 gives the day of week index for the first day of 1969.)
Line 1,885:
Here's an example calendar (the first line <code>132 F 1969</code> being the command that build this calendar):
<syntaxhighlight lang=text> 132 F 1969
[INSERT SNOOPY HERE]
1969
Line 1,907:
│ │31 │ │ │30 │ │
└────────────────────┴────────────────────┴────────────────────┴────────────────────┴────────────────────┴────────────────────┘
</syntaxhighlight>
Note that this version of F will work fine with a left argument of 20 (why anyone felt that this was important to mention is perhaps best thought of as an issue lost in history).
Line 1,914:
Julia code is a valid data type in Julia. Executable code can be created from a String with Meta.parse() and run with eval.
This example does require a small function with Julia's lowercase keywords, perhaps loaded on startup from a separate file.
<
# IF THIS SMALL FUNCTION IS PLACED IN THE STARTUP.JL
# FILE, IT WILL BE LOADED ON STARTUP. THE REST OF
Line 1,972:
RUNUPPERCASECODE(CODE)
</
1969
JANUARY FEBRUARY MARCH APRIL MAY JUNE
Line 2,004:
This is calendar_UC.txt:
<
IMPORT JAVA.UTIL.*
IMPORT JAVA.IO.PRINTSTREAM
Line 2,055:
FUN MAIN(ARGS: ARRAY<STRING>) {
SYSTEM.OUT.PRINTCALENDAR(1969, 3, LOCALE.US)
}</
and this is real_calendar.kt:
<
import java.io.File
Line 2,142:
br.close()
println(out.toString())
}</
which generates (on disk) calendar_NC.kt:
<
import java.util.*
import java.io.PrintStream
Line 2,197:
fun main(args: Array<String>) {
System.out.PRINTCALENDAR(1969, 3, Locale.US)
}</
which when compiled and run produces output of:
Line 2,249:
The upper case Lua source - stored in a file called UCCALENDAR.LUU:
<br>
<
LOCAL MONTHS={"JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE",
"JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER"}
Line 2,312:
PRINT_CAL(1969)
</syntaxhighlight>
The following "one-liner" standard Lua source will down-case and run the program in the source file specified as it's parameter (file luu.lua):
<
</syntaxhighlight>
The following command will execute the UCCALENDAR.LUU source (replace lua532 with the appropriate command for your system):
<br>
Line 2,368:
Console 132 characters by 43 lines. Six columns for months.
<
\\ Calendar - for "REAL" programmers
\\ All statements in UPPERCASE
Line 2,516:
END WHILE
RETURN
</syntaxhighlight>
=={{header|Nim}}==
Line 2,527:
Here is the helper program:
<syntaxhighlight lang=text>import strutils
const progUpper = staticRead("calendar_upper.txt")
Line 2,557:
static: writeFile("calendar_transformed.nim", prog)
include "calendar_transformed.nim"</
Here is the actual program in uppercase.
<syntaxhighlight lang=text>IMPORT TIMES
IMPORT STRFORMAT
Line 2,598:
ECHO ""
PRINTCALENDAR(1969, 5)</
{{out}}
Line 2,637:
at the top level, we need to abuse backticks in order to print anything, as in [http://www.perlmonks.org/?node_id=43797 the infamous JAPH with no letters or numbers]. Consequently, the calendar is printed to standard error instead of standard output.
<
MY @START_DOW = (3, 6, 6, 2, 4, 0,
Line 2,680:
$L = ',' | '@';
`${E}${C}${H}${O} $PROGRAM | ${T}${R} A-Z ${A}-${Z} | ${P}${E}${R}${L}`;</
Although, if we are abusing the backticks and other innocent programs, why not just: <
=={{header|Phix}}==
Line 2,687:
So, the first task is to take a copy of [[Calendar#Phix|Calendar]] and make it output uppercase. Change the line
<!--<
<span style="color: #008080;">return</span> <span style="color: #7060A8;">repeat</span><span style="color: #0000FF;">(</span><span style="color: #008000;">' '</span><span style="color: #0000FF;">,</span><span style="color: #000000;">left</span><span style="color: #0000FF;">)&</span><span style="color: #000000;">s</span><span style="color: #0000FF;">&</span><span style="color: #7060A8;">repeat</span><span style="color: #0000FF;">(</span><span style="color: #008000;">' '</span><span style="color: #0000FF;">,</span><span style="color: #000000;">right</span><span style="color: #0000FF;">)</span>
<!--</
in routine centre to:
<!--<
<span style="color: #008080;">return</span> <span style="color: #7060A8;">repeat</span><span style="color: #0000FF;">(</span><span style="color: #008000;">' '</span><span style="color: #0000FF;">,</span><span style="color: #000000;">left</span><span style="color: #0000FF;">)&</span><span style="color: #7060A8;">upper</span><span style="color: #0000FF;">(</span><span style="color: #000000;">s</span><span style="color: #0000FF;">)&</span><span style="color: #7060A8;">repeat</span><span style="color: #0000FF;">(</span><span style="color: #008000;">' '</span><span style="color: #0000FF;">,</span><span style="color: #000000;">right</span><span style="color: #0000FF;">)</span>
<!--</
(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
<!--<
<span style="color: #000000;">initialSymEntry</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"integer"</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">S_Type</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"TI"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">opInt</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">E_none</span><span style="color: #0000FF;">)</span> <span style="color: #000080;font-style:italic;">-- #01 / 0b0001 integer</span>
<!--</
Immediately after that (it should now be there commented out) add:
<!--<
<span style="color: #000000;">Alias</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"INTEGER"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">symlimit</span><span style="color: #0000FF;">)</span>
<!--</
Add similar lines for length, floor, repeat, upper, day_of_week, sequence, string, 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):
<!--<
<span style="color: #008080;">procedure</span> <span style="color: #000000;">tt_stringA</span><span style="color: #0000FF;">(</span><span style="color: #004080;">sequence</span> <span style="color: #000000;">text</span><span style="color: #0000FF;">,</span> <span style="color: #004080;">integer</span> <span style="color: #000000;">alias</span><span style="color: #0000FF;">)</span>
<span style="color: #000000;">tt_string</span><span style="color: #0000FF;">(</span><span style="color: #000000;">text</span><span style="color: #0000FF;">,-</span><span style="color: #000000;">2</span><span style="color: #0000FF;">)</span>
<span style="color: #000000;">tt</span><span style="color: #0000FF;">[</span><span style="color: #000000;">pcurr</span><span style="color: #0000FF;">]</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">alias</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">procedure</span>
<!--</
and you can find the line
<!--<
<span style="color: #008080;">global</span> <span style="color: #008080;">constant</span> <span style="color: #000000;">T_include</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">596</span> <span style="color: #000000;">tt_stringF</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"include"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">T_include</span><span style="color: #0000FF;">)</span>
<!--</
Sometime after that, in fact after the very last use of tt_stringF, add (likewise you should find this one commented out):
<!--<
<span style="color: #000000;">tt_stringA</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"INCLUDE"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">T_include</span><span style="color: #0000FF;">)</span>
<!--</
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 (which would happen <i>alot</i> if you put the aliases anywhere other than last).
Line 2,728:
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)
<!--<
<span style="color: #000000;">Ch</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">find</span><span style="color: #0000FF;">(</span><span style="color: #000000;">Ch</span><span style="color: #0000FF;">,</span><span style="color: #000000;">escchar</span><span style="color: #0000FF;">)</span>
<!--</
to
<!--<
<span style="color: #000000;">Ch</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">find</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">lower</span><span style="color: #0000FF;">(</span><span style="color: #000000;">Ch</span><span style="color: #0000FF;">),</span><span style="color: #000000;">escchar</span><span style="color: #0000FF;">)</span>
<!--</
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>.
Line 2,748:
While PHP functions are case-sensitive (aside of <code>_()</code>), this isn't the case for language constructs.
<
ECHO <<<REALPROGRAMMERSTHINKINUPPERCASEANDCHEATBYUSINGPRINT
JANUARY FEBRUARY MARCH APRIL MAY JUNE
Line 2,767:
28 29 30 31 25 26 27 28 29 30 31 29 30 27 28 29 30 31 24 25 26 27 28 29 30 29 30 31
REALPROGRAMMERSTHINKINUPPERCASEANDCHEATBYUSINGPRINT
; // MAGICAL SEMICOLON</
=={{header|PicoLisp}}==
The "CALENDAR.L" source file:
<
(PRINL "====== " YEAR " ======")
(FOR DAT (RANGE (DATE YEAR 1 1) (DATE YEAR 12 31))
Line 2,784:
(CAL 1969)
(BYE)</
Then it can be executed with this command line:
<pre>$ pil -'load (list "awk" "{print tolower($0)}" "CALENDAR.L")'</pre>
Line 2,814:
=={{header|PL/I}}==
<
CALENDAR: PROCEDURE (YEAR) OPTIONS (MAIN);
DECLARE YEAR CHARACTER (4) VARYING;
Line 2,865:
END PREPARE_MONTH;
END CALENDAR;</
See CALENDAR for result.
=={{header|Racket}}==
<
#CI(MODULE NAME-OF-THIS-FILE RACKET
(REQUIRE RACKET/DATE)
Line 2,905:
(CALENDAR 1969))
</syntaxhighlight>
=={{header|Raku}}==
Line 2,911:
Uppercase is no challenge, who needs letters at all?
[Requires the year to be supplied as a command-line argument, and Unixish <i>cal</i> command.]
<syntaxhighlight lang=raku
115 97 121 32 34 91 73 78 83 69 82 84 32 83 78 79 79 80 89 32 72 69 82 69 93 34
59 114 117 110 32 60 99 97 108 62 44 64 42 65 82 71 83 91 48 93 47 47 49 57 54 57
>."$_[99]$_[104]$_[114]$_[115]"()."$_[69]$_[86]$_[65]$_[76]"()</
=={{header|REXX}}==
Line 2,937:
(but the second REXX version sure as heck looks
<br>like it was beat with a big ole ugly stick ─── and pardon the strong language).
<
@ABC=
PARSE VALUE SCRSIZE() WITH SD SW .
Line 3,109:
PUT:_=ARG(1);_=TRANSLATE(_,,'_'CHK);IF \GRID THEN _=UNGRID(_);IF LOWERCASE THEN _=LOWER(_);IF UPPERCASE THEN UPPER _;IF SHORTEST&_=' ' THEN RETURN;CALL TELL _;RETURN
TELL:SAY ARG(1);RETURN
UNGRID:RETURN TRANSLATE(ARG(1),,"│║─═┤┐└┴┬├┼┘┌╔╗╚╝╟╢╞╡╫╪╤╧╥╨╠╣")</
Programming note: This REXX program makes use of '''SCRSIZE''' REXX program (or
BIF) which is used to determine the screen
Line 3,218:
=={{header|Ring}}==
<
# PROJECT : CALENDAR - FOR "REAL" PROGRAMMERS
# DATE : 2018/06/28
Line 3,377:
NEXT
NEXT
</syntaxhighlight>
Output:
Line 3,388:
* <code>loadup.rb</code> is the program loader.
<
class Object
Line 3,413:
_PROGRAM = ARGV.SHIFT
_PROGRAM || ABORT("USAGE: #{$0} PROGRAM.RB ARGS...")
LOAD($0 = _PROGRAM)</
* <code>CAL.RB</code> is an UPPERCASE RUBY translation of [[Calendar#Ruby]].
{{works with|Ruby|1.8.7}}
<
REQUIRE 'DATE'.DOWNCASE
Line 3,500:
PROC {80}) }) })
PUTS CAL(ARGV[0].TO_I, _COLUMNS)</
* A local variable must start with a lowercase letter or an underscore, so we have many leading underscores (_YEAR, _COLUMN, _DATE and so on).
Line 3,585:
Then in another program the file CALENDAR.TXT is [http://seed7.sourceforge.net/libraries/getf.htm#getf%28in_string%29 read], converted, [http://seed7.sourceforge.net/libraries/progs.htm#parseStri%28in_string,in_parseOptions,in_array_string,in_string%29 parsed] and [http://seed7.sourceforge.net/libraries/progs.htm#execute%28in_program,in_array_string,in_parseOptions,in_string%29 executed]:
<
include "getf.s7i";
include "progs.s7i";
Line 3,597:
source := replace(source, "daysinmonth", "daysInMonth");
execute(parseStri(source));
end func;</
{{out}}
Line 3,640:
=={{header|Sidef}}==
<
-> MONTHS_PER_COL { 6 }
Line 3,698:
}
FMT_YEAR(ARGV ? ARGV[0].("\LTO_I") : 1969).("\LPRINT")</
{{out}}
<pre>
Line 3,722:
The program starts implementing aliases for all built-in commands. This is done without using any letters at all ;).
CALENDER takes arguments of year and optional terminal width to use.
<
\146\157\162\145\141\143\150 42 [\151\156\146\157 \143\157\155\155\141\156\144\163] {
\145\166\141\154 "
Line 3,771:
CALENDAR
</syntaxhighlight>
{{out}}
<pre>
Line 3,812:
=={{header|UNIX Shell}}==
<
TR=TR
A=A
Z=Z
LANG=C ${CAL,,} 1969 | ${TR,,} ${A,}-${Z,} A-Z</
{{out}}
<pre>
Line 3,861:
Vedit macro language is case insensitive, but it is normal practice to write short commands in upper case.
<
CFT(22)
#3 = 6 // NUMBER OF MONTHS PER LINE
Line 3,925:
REG_EMPTY(#20)
NUM_POP(4,20)
RETURN </
<pre>
Line 3,958:
Copied from [[Calendar#Visual_Basic_.NET]] and converted to uppercase. See entry there for description.
<
OPTION EXPLICIT ON
OPTION INFER ON
Line 4,288:
RETURN S.PADLEFT(((TOTALWIDTH - S.LENGTH) \ 2) + S.LENGTH, PADDINGCHAR).PADRIGHT(TOTALWIDTH, PADDINGCHAR)
END FUNCTION
END MODULE</
{{out|input=COLS:132 ROWS:25 MS/ROW:6 HSTRETCH:FALSE VSTRETCH:FALSE}}
Line 4,324:
{{libheader|Wren-fmt}}
{{libheader|Wren-seq}}
<
IMPORT "/FMT" FOR FMT
IMPORT "/SEQ" FOR LST
Line 4,371:
}
CALENDAR.CALL(1969)</
We then create a script called ''calendar_real.wren'' which takes the above text file as input, changes those items which cannot be upper case into their normal casing and compiles and runs the result:
{{libheader|Wren-str}}
<
import "/str" for Str
import "meta" for Meta
Line 4,393:
for (format in formats) text = text.replace(Str.upper(format), format)
Meta.compile(text).call()</
{{out}}
Line 4,440:
ASSEMBLE WITH: TASM CALENDAR; TLINK /t CALENDAR
<
.CODE
.486
Line 4,626:
DAYS DB 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
DAY DB ?, ?, ?, ?, ?, ?
END START</
{{Out}}
Line 4,654:
=={{header|XLISP}}==
XLISP isn't case-sensitive, so in principle it would be possible just to reproduce the solution given in the "ordinary" Calendar task. But that program makes use of recursion, "fancy" data structures, long variable names, pretty-printy indentation, and a whole host of other features that I don't think REAL programmers like any better than they like lower case: so, instead, here is a version using only global variables and "<tt>DO</tt> loops like God meant them to be".
<
(SETQ M #("JANUARY" "FEBRUARY" "MARCH" "APRIL" "MAY" "JUNE" "JULY" "AUGUST" "SEPTEMBER" "OCTOBER" "NOVEMBER" "DECEMBER"))
(SETQ ML #(31 28 31 30 31 30 31 31 30 31 30 31))
Line 4,689:
(SETQ D (+ D 1))
(IF (> D 6) (TERPRI))
(IF (> D 6) (SETQ D 0))))</
{{out}}
<pre> SNOOPY CALENDAR 1969
Line 4,787:
The calendar code, file UPCAL.zkl (upper cased version of [[Calendar#zkl]]):
<
FCN CENTER(TEXT,M) { STRING(" "*((M-TEXT.LEN())/2),TEXT) }
Line 4,798:
.PUMP(LIST,T(VOID.READ,DAYS.LEN()/3,FALSE),STRING.CREATE));
}
...</
And the pre-processor, hand rolled for the above code (file bbb.zkl):
<
code=Data(Void,code.text.toLower());
mixed:=T("string","String", "list","List", " t("," T(",",t(",",T(",
Line 4,810:
);
mixed.pump(Void,Void.Read,'wrap(up,down){ code.replace(up,down) });
Compiler.Compiler.compileText(code)();</
{{out}}
<pre>
|