minix/commands/m4/M4.out
2005-04-21 14:53:53 +00:00

462 lines
11 KiB
Text
Executable file

#
# test file for mp (not comprehensive)
#
# v7 m4 does not have `decr'.
#
#
# include string macros
#
#
# create some fortrash strings for an even uglier language
#
integer TEXT(5)
data TEXT(1)/LETt/
data TEXT(2)/LETe/
data TEXT(3)/LETx/
data TEXT(4)/LETt/
data TEXT(5)/EOS/
integer DATA(5)
data DATA(1)/LETd/
data DATA(2)/LETa/
data DATA(3)/LETt/
data DATA(4)/LETa/
data DATA(5)/EOS/
integer BEGIN(6)
data BEGIN(1)/LETb/
data BEGIN(2)/LETe/
data BEGIN(3)/LETg/
data BEGIN(4)/LETi/
data BEGIN(5)/LETn/
data BEGIN(6)/EOS/
integer END(4)
data END(1)/LETe/
data END(2)/LETn/
data END(3)/LETd/
data END(4)/EOS/
integer IF(3)
data IF(1)/LETi/
data IF(2)/LETf/
data IF(3)/EOS/
integer THEN(5)
data THEN(1)/LETt/
data THEN(2)/LETh/
data THEN(3)/LETe/
data THEN(4)/LETn/
data THEN(5)/EOS/
integer ELSE(5)
data ELSE(1)/LETe/
data ELSE(2)/LETl/
data ELSE(3)/LETs/
data ELSE(4)/LETe/
data ELSE(5)/EOS/
integer CASE(5)
data CASE(1)/LETc/
data CASE(2)/LETa/
data CASE(3)/LETs/
data CASE(4)/LETe/
data CASE(5)/EOS/
integer REPEAT(7)
data REPEAT(1)/LETr/
data REPEAT(2)/LETe/
data REPEAT(3)/LETp/
data REPEAT(4)/LETe/
data REPEAT(5)/LETa/
data REPEAT(6)/LETt/
data REPEAT(7)/EOS/
integer WHILE(6)
data WHILE(1)/LETw/
data WHILE(2)/LETh/
data WHILE(3)/LETi/
data WHILE(4)/LETl/
data WHILE(5)/LETe/
data WHILE(6)/EOS/
integer DEFAULT(8)
data DEFAULT(1)/LETd/
data DEFAULT(2)/LETe/
data DEFAULT(3)/LETf/
data DEFAULT(4)/LETa/
data DEFAULT(5)/LETu/
data DEFAULT(6)/LETl/
data DEFAULT(7)/LETt/
data DEFAULT(8)/EOS/
integer UNTIL(6)
data UNTIL(1)/LETu/
data UNTIL(2)/LETn/
data UNTIL(3)/LETt/
data UNTIL(4)/LETi/
data UNTIL(5)/LETl/
data UNTIL(6)/EOS/
integer FUNCTION(9)
data FUNCTION(1)/LETf/
data FUNCTION(2)/LETu/
data FUNCTION(3)/LETn/
data FUNCTION(4)/LETc/
data FUNCTION(5)/LETt/
data FUNCTION(6)/LETi/
data FUNCTION(7)/LETo/
data FUNCTION(8)/LETn/
data FUNCTION(9)/EOS/
integer PROCEDURE(10)
data PROCEDURE(1)/LETp/
data PROCEDURE(2)/LETr/
data PROCEDURE(3)/LETo/
data PROCEDURE(4)/LETc/
data PROCEDURE(5)/LETe/
data PROCEDURE(6)/LETd/
data PROCEDURE(7)/LETu/
data PROCEDURE(8)/LETr/
data PROCEDURE(9)/LETe/
data PROCEDURE(10)/EOS/
integer EXTERNAL(9)
data EXTERNAL(1)/LETe/
data EXTERNAL(2)/LETx/
data EXTERNAL(3)/LETt/
data EXTERNAL(4)/LETe/
data EXTERNAL(5)/LETr/
data EXTERNAL(6)/LETn/
data EXTERNAL(7)/LETa/
data EXTERNAL(8)/LETl/
data EXTERNAL(9)/EOS/
integer FORWARD(8)
data FORWARD(1)/LETf/
data FORWARD(2)/LETo/
data FORWARD(3)/LETr/
data FORWARD(4)/LETw/
data FORWARD(5)/LETa/
data FORWARD(6)/LETr/
data FORWARD(7)/LETd/
data FORWARD(8)/EOS/
integer TYPE(5)
data TYPE(1)/LETt/
data TYPE(2)/LETy/
data TYPE(3)/LETp/
data TYPE(4)/LETe/
data TYPE(5)/EOS/
integer VAR(4)
data VAR(1)/LETv/
data VAR(2)/LETa/
data VAR(3)/LETr/
data VAR(4)/EOS/
integer CONST(6)
data CONST(1)/LETc/
data CONST(2)/LETo/
data CONST(3)/LETn/
data CONST(4)/LETs/
data CONST(5)/LETt/
data CONST(6)/EOS/
integer PROGRAM(8)
data PROGRAM(1)/LETp/
data PROGRAM(2)/LETr/
data PROGRAM(3)/LETo/
data PROGRAM(4)/LETg/
data PROGRAM(5)/LETr/
data PROGRAM(6)/LETa/
data PROGRAM(7)/LETm/
data PROGRAM(8)/EOS/
integer INPUT(6)
data INPUT(1)/LETi/
data INPUT(2)/LETn/
data INPUT(3)/LETp/
data INPUT(4)/LETu/
data INPUT(5)/LETt/
data INPUT(6)/EOS/
integer OUTPUT(7)
data OUTPUT(1)/LETo/
data OUTPUT(2)/LETu/
data OUTPUT(3)/LETt/
data OUTPUT(4)/LETp/
data OUTPUT(5)/LETu/
data OUTPUT(6)/LETt/
data OUTPUT(7)/EOS/
#
defined
#
# v7 m4 does this wrong. The right output is
# this is A vEry lon sEntEnCE
# see m4 documentation for translit.
#
this is A vEry lon sEntEnCE
#
# include towers-of-hanoi
#
#
# some reasonable set of disks
#
move disk from A to C
move disk from A to B
move disk from C to B
move disk from A to C
move disk from B to A
move disk from B to C
move disk from A to C
move disk from A to B
move disk from C to B
move disk from C to A
move disk from B to A
move disk from C to B
move disk from A to C
move disk from A to B
move disk from C to B
move disk from A to C
move disk from B to A
move disk from B to C
move disk from A to C
move disk from B to A
move disk from C to B
move disk from C to A
move disk from B to A
move disk from B to C
move disk from A to C
move disk from A to B
move disk from C to B
move disk from A to C
move disk from B to A
move disk from B to C
move disk from A to C
move disk from A to B
move disk from C to B
move disk from C to A
move disk from B to A
move disk from C to B
move disk from A to C
move disk from A to B
move disk from C to B
move disk from C to A
move disk from B to A
move disk from B to C
move disk from A to C
move disk from B to A
move disk from C to B
move disk from C to A
move disk from B to A
move disk from C to B
move disk from A to C
move disk from A to B
move disk from C to B
move disk from A to C
move disk from B to A
move disk from B to C
move disk from A to C
move disk from A to B
move disk from C to B
move disk from C to A
move disk from B to A
move disk from C to B
move disk from A to C
move disk from A to B
move disk from C to B
#
# include ackermann's function
#
#
# something like (3,3) will blow away un*x m4.
#
9
#
# include a square_root function for fixed nums
#
#
# some square roots.
#
3
10
negative-square-root
146
#
# some textual material for enjoyment.
#
[taken from the 'Clemson University Computer Newsletter',
September 1981, pp. 6-7]
I am a wizard in the magical Kingdom of Transformation and I
slay dragons for a living. Actually, I am a systems programmer.
One of the problems with systems programming is explaining to
non-computer enthusiasts what that is. All of the terms I use to
describe my job are totally meaningless to them. Usually my response
to questions about my work is to say as little as possible. For
instance, if someone asks what happened at work this week, I say
"Nothing much" and then I change the subject.
With the assistance of my brother, a mechanical engineer, I have devised
an analogy that everyone can understand. The analogy describes the
"Kingdom of Transformation" where travelers wander and are magically
transformed. This kingdom is the computer and the travelers are information.
The purpose of the computer is to change information to a more meaningful
forma. The law of conservation applies here: The computer never creates
and never intentionally destroys data. With no further ado, let us travel
to the Kingdom of Transformation:
In a land far, far away, there is a magical kingdom called the Kingdom of
Transformation. A king rules over this land and employs a Council of
Wizardry. The main purpose of this kingdom is to provide a way for
neighboring kingdoms to transform citizens into more useful citizens. This
is done by allowing the citizens to enter the kingdom at one of its ports
and to travel any of the many routes in the kingdom. They are magically
transformed along the way. The income of the Kingdom of Transformation
comes from the many toll roads within its boundaries.
The Kingdom of Transformation was created when several kingdoms got
together and discovered a mutual need for new talents and abilities for
citizens. They employed CTK, Inc. (Creators of Transformation, Inc.) to
create this kingdom. CTK designed the country, its transportation routes,
and its laws of transformation, and created the major highway system.
Hazards
=======
Because magic is not truly controllable, CTK invariably, but unknowingly,
creates dragons. Dragons are huge fire-breathing beasts which sometimes
injure or kill travelers. Fortunately, they do not travel, but always
remain near their den.
Other hazards also exist which are potentially harmful. As the roads
become older and more weatherbeaten, pot-holes will develop, trees will
fall on travelers, etc. CTK maintenance men are called to fix these
problems.
Wizards
=======
The wizards play a major role in creating and maintaining the kingdom but
get little credit for their work because it is performed secretly. The
wizards do not wan the workers or travelers to learn their incantations
because many laws would be broken and chaos would result.
CTK's grand design is always general enough to be applicable in many
different situations. As a result, it is often difficult to use. The
first duty of the wizards is to tailor the transformation laws so as to be
more beneficial and easier to use in their particular environment.
After creation of the kingdom, a major duty of the wizards is to search for
and kill dragons. If travelers do not return on time or if they return
injured, the ruler of the country contacts the wizards. If the wizards
determine that the injury or death occurred due to the traveler's
negligence, they provide the traveler's country with additional warnings.
If not, they must determine if the cause was a road hazard or a dragon. If
the suspect a road hazard, they call in a CTK maintenance man to locate the
hazard and to eliminate it, as in repairing the pothole in the road. If
they think that cause was a dragon, then they must find and slay it.
The most difficult part of eliminating a dragon is finding it. Sometimes
the wizard magically knows where the dragon's lair it, but often the wizard
must send another traveler along the same route and watch to see where he
disappears. This sounds like a failsafe method for finding dragons (and a
suicide mission for thr traveler) but the second traveler does not always
disappear. Some dragons eat any traveler who comes too close; others are
very picky.
The wizards may call in CTK who designed the highway system and
transformation laws to help devise a way to locate the dragon. CTK also
helps provide the right spell or incantation to slay the dragon. (There is
no general spell to slay dragons; each dragon must be eliminated with a
different spell.)
Because neither CTK nor wizards are perfect, spells to not always work
correctly. At best, nothing happens when the wrong spell is uttered. At
worst, the dragon becomes a much larger dragon or multiplies into several
smaller ones. In either case, new spells must be found.
If all existing dragons are quiet (i.e. have eaten sufficiently), wizards
have time to do other things. They hide in castles and practice spells and
incatations. They also devise shortcuts for travelers and new laws of
transformation.
Changes in the Kingdom
======================
As new transformation kingdoms are created and old ones are maintained,
CTK, Inc. is constantly learning new things. It learns ways to avoid
creating some of the dragons that they have previously created. It also
discovers new and better laws of transformation. As a result, CTK will
periodically create a new grand design which is far better than the old.
The wizards determine when is a good time to implement this new design.
This is when the tourist season is slow or when no important travelers
(VIPs) are to arrive. The kingdom must be closed for the actual
implementation and is leter reopened as a new and better place to go.
A final question you might ask is what happens when the number of tourists
becomes too great for the kingdom to handle in a reasonable period of time
(i.e., the tourist lines at the ports are too long). The Kingdom of
Transformation has three options: (1) shorten the paths that a tourist must
travel, or (2) convince CTK to develop a faster breed of horses so that the
travelers can finish sooner, or (3) annex more territories so that the
kingdom can handle more travelers.
Thus ends the story of the Kingdom of Transformation. I hope this has
explained my job to you: I slay dragons for a living.
#
#should do an automatic undivert..
#
diversion #1
diversion #2
diversion #3
diversion #4