📄 test.m4
字号:
## test file for mp (not comprehensive)## v7 m4 does not have `decr'.#define(DECR,`eval($1-1)')## include string macros#include(String.m4)## create some fortrash strings for an even uglier language#string(TEXT, "text")string(DATA, "data")string(BEGIN, "begin")string(END, "end")string(IF, "if")string(THEN, "then")string(ELSE, "else")string(CASE, "case")string(REPEAT, "repeat")string(WHILE, "while")string(DEFAULT, "default")string(UNTIL, "until")string(FUNCTION, "function")string(PROCEDURE, "procedure")string(EXTERNAL, "external")string(FORWARD, "forward")string(TYPE, "type")string(VAR, "var")string(CONST, "const")string(PROGRAM, "program")string(INPUT, "input")string(OUTPUT, "output")#divert(2)diversion #1divert(3)diversion #2divert(4)diversion #3divert(5)diversion #4divert(0)define(abc,xxx)ifdef(`abc',defined,undefined)## v7 m4 does this wrong. The right output is# this is A vEry lon sEntEnCE# see m4 documentation for translit.#translit(`this is a very long sentence', abcdefg, ABCDEF)## include towers-of-hanoi#include(Hanoi.m4)## some reasonable set of disks#hanoi(6)## include ackermann's function#include(Ack.m4)## something like (3,3) will blow away un*x m4.#ack(2,3)## include a square_root function for fixed nums#include(Sqroot.m4)## some square roots.#square_root(15)square_root(100)square_root(-4)square_root(21372)## 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 Islay dragons for a living. Actually, I am a systems programmer.One of the problems with systems programming is explaining tonon-computer enthusiasts what that is. All of the terms I use todescribe my job are totally meaningless to them. Usually my responseto questions about my work is to say as little as possible. Forinstance, 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 devisedan analogy that everyone can understand. The analogy describes the"Kingdom of Transformation" where travelers wander and are magicallytransformed. This kingdom is the computer and the travelers are information.The purpose of the computer is to change information to a more meaningfulforma. The law of conservation applies here: The computer never createsand never intentionally destroys data. With no further ado, let us travelto the Kingdom of Transformation:In a land far, far away, there is a magical kingdom called the Kingdom ofTransformation. A king rules over this land and employs a Council ofWizardry. The main purpose of this kingdom is to provide a way forneighboring kingdoms to transform citizens into more useful citizens. Thisis done by allowing the citizens to enter the kingdom at one of its portsand to travel any of the many routes in the kingdom. They are magicallytransformed along the way. The income of the Kingdom of Transformationcomes from the many toll roads within its boundaries.The Kingdom of Transformation was created when several kingdoms gottogether and discovered a mutual need for new talents and abilities forcitizens. They employed CTK, Inc. (Creators of Transformation, Inc.) tocreate 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 sometimesinjure or kill travelers. Fortunately, they do not travel, but alwaysremain near their den.Other hazards also exist which are potentially harmful. As the roadsbecome older and more weatherbeaten, pot-holes will develop, trees willfall on travelers, etc. CTK maintenance men are called to fix theseproblems.Wizards=======The wizards play a major role in creating and maintaining the kingdom butget little credit for their work because it is performed secretly. Thewizards do not wan the workers or travelers to learn their incantationsbecause many laws would be broken and chaos would result.CTK's grand design is always general enough to be applicable in manydifferent situations. As a result, it is often difficult to use. Thefirst duty of the wizards is to tailor the transformation laws so as to bemore beneficial and easier to use in their particular environment.After creation of the kingdom, a major duty of the wizards is to search forand kill dragons. If travelers do not return on time or if they returninjured, the ruler of the country contacts the wizards. If the wizardsdetermine that the injury or death occurred due to the traveler'snegligence, they provide the traveler's country with additional warnings.If not, they must determine if the cause was a road hazard or a dragon. Ifthe suspect a road hazard, they call in a CTK maintenance man to locate thehazard and to eliminate it, as in repairing the pothole in the road. Ifthey think that cause was a dragon, then they must find and slay it.The most difficult part of eliminating a dragon is finding it. Sometimesthe wizard magically knows where the dragon's lair it, but often the wizardmust send another traveler along the same route and watch to see where hedisappears. This sounds like a failsafe method for finding dragons (and asuicide mission for thr traveler) but the second traveler does not alwaysdisappear. Some dragons eat any traveler who comes too close; others arevery picky.The wizards may call in CTK who designed the highway system andtransformation laws to help devise a way to locate the dragon. CTK alsohelps provide the right spell or incantation to slay the dragon. (There isno general spell to slay dragons; each dragon must be eliminated with adifferent spell.)Because neither CTK nor wizards are perfect, spells to not always workcorrectly. At best, nothing happens when the wrong spell is uttered. Atworst, the dragon becomes a much larger dragon or multiplies into severalsmaller ones. In either case, new spells must be found.If all existing dragons are quiet (i.e. have eaten sufficiently), wizardshave time to do other things. They hide in castles and practice spells andincatations. They also devise shortcuts for travelers and new laws oftransformation.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 avoidcreating some of the dragons that they have previously created. It alsodiscovers new and better laws of transformation. As a result, CTK willperiodically 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 actualimplementation 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 touristsbecomes 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 ofTransformation has three options: (1) shorten the paths that a tourist musttravel, or (2) convince CTK to develop a faster breed of horses so that thetravelers can finish sooner, or (3) annex more territories so that thekingdom can handle more travelers.Thus ends the story of the Kingdom of Transformation. I hope this hasexplained my job to you: I slay dragons for a living.##should do an automatic undivert..#
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -