source: trunk/minix/commands/m4/M4.out@ 10

Last change on this file since 10 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 11.4 KB
RevLine 
[9]1#
2# test file for mp (not comprehensive)
3#
4# v7 m4 does not have `decr'.
5#
6
7#
8# include string macros
9#
10
11
12
13
14
15#
16# create some fortrash strings for an even uglier language
17#
18integer TEXT(5)
19data TEXT(1)/LETt/
20data TEXT(2)/LETe/
21data TEXT(3)/LETx/
22data TEXT(4)/LETt/
23
24data TEXT(5)/EOS/
25
26integer DATA(5)
27data DATA(1)/LETd/
28data DATA(2)/LETa/
29data DATA(3)/LETt/
30data DATA(4)/LETa/
31
32data DATA(5)/EOS/
33
34integer BEGIN(6)
35data BEGIN(1)/LETb/
36data BEGIN(2)/LETe/
37data BEGIN(3)/LETg/
38data BEGIN(4)/LETi/
39data BEGIN(5)/LETn/
40
41data BEGIN(6)/EOS/
42
43integer END(4)
44data END(1)/LETe/
45data END(2)/LETn/
46data END(3)/LETd/
47
48data END(4)/EOS/
49
50integer IF(3)
51data IF(1)/LETi/
52data IF(2)/LETf/
53
54data IF(3)/EOS/
55
56integer THEN(5)
57data THEN(1)/LETt/
58data THEN(2)/LETh/
59data THEN(3)/LETe/
60data THEN(4)/LETn/
61
62data THEN(5)/EOS/
63
64integer ELSE(5)
65data ELSE(1)/LETe/
66data ELSE(2)/LETl/
67data ELSE(3)/LETs/
68data ELSE(4)/LETe/
69
70data ELSE(5)/EOS/
71
72integer CASE(5)
73data CASE(1)/LETc/
74data CASE(2)/LETa/
75data CASE(3)/LETs/
76data CASE(4)/LETe/
77
78data CASE(5)/EOS/
79
80integer REPEAT(7)
81data REPEAT(1)/LETr/
82data REPEAT(2)/LETe/
83data REPEAT(3)/LETp/
84data REPEAT(4)/LETe/
85data REPEAT(5)/LETa/
86data REPEAT(6)/LETt/
87
88data REPEAT(7)/EOS/
89
90integer WHILE(6)
91data WHILE(1)/LETw/
92data WHILE(2)/LETh/
93data WHILE(3)/LETi/
94data WHILE(4)/LETl/
95data WHILE(5)/LETe/
96
97data WHILE(6)/EOS/
98
99integer DEFAULT(8)
100data DEFAULT(1)/LETd/
101data DEFAULT(2)/LETe/
102data DEFAULT(3)/LETf/
103data DEFAULT(4)/LETa/
104data DEFAULT(5)/LETu/
105data DEFAULT(6)/LETl/
106data DEFAULT(7)/LETt/
107
108data DEFAULT(8)/EOS/
109
110integer UNTIL(6)
111data UNTIL(1)/LETu/
112data UNTIL(2)/LETn/
113data UNTIL(3)/LETt/
114data UNTIL(4)/LETi/
115data UNTIL(5)/LETl/
116
117data UNTIL(6)/EOS/
118
119integer FUNCTION(9)
120data FUNCTION(1)/LETf/
121data FUNCTION(2)/LETu/
122data FUNCTION(3)/LETn/
123data FUNCTION(4)/LETc/
124data FUNCTION(5)/LETt/
125data FUNCTION(6)/LETi/
126data FUNCTION(7)/LETo/
127data FUNCTION(8)/LETn/
128
129data FUNCTION(9)/EOS/
130
131integer PROCEDURE(10)
132data PROCEDURE(1)/LETp/
133data PROCEDURE(2)/LETr/
134data PROCEDURE(3)/LETo/
135data PROCEDURE(4)/LETc/
136data PROCEDURE(5)/LETe/
137data PROCEDURE(6)/LETd/
138data PROCEDURE(7)/LETu/
139data PROCEDURE(8)/LETr/
140data PROCEDURE(9)/LETe/
141
142data PROCEDURE(10)/EOS/
143
144integer EXTERNAL(9)
145data EXTERNAL(1)/LETe/
146data EXTERNAL(2)/LETx/
147data EXTERNAL(3)/LETt/
148data EXTERNAL(4)/LETe/
149data EXTERNAL(5)/LETr/
150data EXTERNAL(6)/LETn/
151data EXTERNAL(7)/LETa/
152data EXTERNAL(8)/LETl/
153
154data EXTERNAL(9)/EOS/
155
156integer FORWARD(8)
157data FORWARD(1)/LETf/
158data FORWARD(2)/LETo/
159data FORWARD(3)/LETr/
160data FORWARD(4)/LETw/
161data FORWARD(5)/LETa/
162data FORWARD(6)/LETr/
163data FORWARD(7)/LETd/
164
165data FORWARD(8)/EOS/
166
167integer TYPE(5)
168data TYPE(1)/LETt/
169data TYPE(2)/LETy/
170data TYPE(3)/LETp/
171data TYPE(4)/LETe/
172
173data TYPE(5)/EOS/
174
175integer VAR(4)
176data VAR(1)/LETv/
177data VAR(2)/LETa/
178data VAR(3)/LETr/
179
180data VAR(4)/EOS/
181
182integer CONST(6)
183data CONST(1)/LETc/
184data CONST(2)/LETo/
185data CONST(3)/LETn/
186data CONST(4)/LETs/
187data CONST(5)/LETt/
188
189data CONST(6)/EOS/
190
191integer PROGRAM(8)
192data PROGRAM(1)/LETp/
193data PROGRAM(2)/LETr/
194data PROGRAM(3)/LETo/
195data PROGRAM(4)/LETg/
196data PROGRAM(5)/LETr/
197data PROGRAM(6)/LETa/
198data PROGRAM(7)/LETm/
199
200data PROGRAM(8)/EOS/
201
202integer INPUT(6)
203data INPUT(1)/LETi/
204data INPUT(2)/LETn/
205data INPUT(3)/LETp/
206data INPUT(4)/LETu/
207data INPUT(5)/LETt/
208
209data INPUT(6)/EOS/
210
211integer OUTPUT(7)
212data OUTPUT(1)/LETo/
213data OUTPUT(2)/LETu/
214data OUTPUT(3)/LETt/
215data OUTPUT(4)/LETp/
216data OUTPUT(5)/LETu/
217data OUTPUT(6)/LETt/
218
219data OUTPUT(7)/EOS/
220
221#
222
223
224defined
225#
226# v7 m4 does this wrong. The right output is
227# this is A vEry lon sEntEnCE
228# see m4 documentation for translit.
229#
230this is A vEry lon sEntEnCE
231#
232# include towers-of-hanoi
233#
234
235
236
237
238
239
240#
241# some reasonable set of disks
242#
243move disk from A to C
244move disk from A to B
245move disk from C to B
246move disk from A to C
247move disk from B to A
248move disk from B to C
249move disk from A to C
250move disk from A to B
251move disk from C to B
252move disk from C to A
253move disk from B to A
254move disk from C to B
255move disk from A to C
256move disk from A to B
257move disk from C to B
258move disk from A to C
259move disk from B to A
260move disk from B to C
261move disk from A to C
262move disk from B to A
263move disk from C to B
264move disk from C to A
265move disk from B to A
266move disk from B to C
267move disk from A to C
268move disk from A to B
269move disk from C to B
270move disk from A to C
271move disk from B to A
272move disk from B to C
273move disk from A to C
274move disk from A to B
275move disk from C to B
276move disk from C to A
277move disk from B to A
278move disk from C to B
279move disk from A to C
280move disk from A to B
281move disk from C to B
282move disk from C to A
283move disk from B to A
284move disk from B to C
285move disk from A to C
286move disk from B to A
287move disk from C to B
288move disk from C to A
289move disk from B to A
290move disk from C to B
291move disk from A to C
292move disk from A to B
293move disk from C to B
294move disk from A to C
295move disk from B to A
296move disk from B to C
297move disk from A to C
298move disk from A to B
299move disk from C to B
300move disk from C to A
301move disk from B to A
302move disk from C to B
303move disk from A to C
304move disk from A to B
305move disk from C to B
306
307#
308# include ackermann's function
309#
310
311
312#
313# something like (3,3) will blow away un*x m4.
314#
3159
316#
317# include a square_root function for fixed nums
318#
319
320
321
322#
323# some square roots.
324#
3253
32610
327negative-square-root
328146
329#
330# some textual material for enjoyment.
331#
332[taken from the 'Clemson University Computer Newsletter',
333 September 1981, pp. 6-7]
334
335I am a wizard in the magical Kingdom of Transformation and I
336slay dragons for a living. Actually, I am a systems programmer.
337One of the problems with systems programming is explaining to
338non-computer enthusiasts what that is. All of the terms I use to
339describe my job are totally meaningless to them. Usually my response
340to questions about my work is to say as little as possible. For
341instance, if someone asks what happened at work this week, I say
342"Nothing much" and then I change the subject.
343
344With the assistance of my brother, a mechanical engineer, I have devised
345an analogy that everyone can understand. The analogy describes the
346"Kingdom of Transformation" where travelers wander and are magically
347transformed. This kingdom is the computer and the travelers are information.
348The purpose of the computer is to change information to a more meaningful
349forma. The law of conservation applies here: The computer never creates
350and never intentionally destroys data. With no further ado, let us travel
351to the Kingdom of Transformation:
352
353In a land far, far away, there is a magical kingdom called the Kingdom of
354Transformation. A king rules over this land and employs a Council of
355Wizardry. The main purpose of this kingdom is to provide a way for
356neighboring kingdoms to transform citizens into more useful citizens. This
357is done by allowing the citizens to enter the kingdom at one of its ports
358and to travel any of the many routes in the kingdom. They are magically
359transformed along the way. The income of the Kingdom of Transformation
360comes from the many toll roads within its boundaries.
361
362The Kingdom of Transformation was created when several kingdoms got
363together and discovered a mutual need for new talents and abilities for
364citizens. They employed CTK, Inc. (Creators of Transformation, Inc.) to
365create this kingdom. CTK designed the country, its transportation routes,
366and its laws of transformation, and created the major highway system.
367
368Hazards
369=======
370
371Because magic is not truly controllable, CTK invariably, but unknowingly,
372creates dragons. Dragons are huge fire-breathing beasts which sometimes
373injure or kill travelers. Fortunately, they do not travel, but always
374remain near their den.
375
376Other hazards also exist which are potentially harmful. As the roads
377become older and more weatherbeaten, pot-holes will develop, trees will
378fall on travelers, etc. CTK maintenance men are called to fix these
379problems.
380
381Wizards
382=======
383
384The wizards play a major role in creating and maintaining the kingdom but
385get little credit for their work because it is performed secretly. The
386wizards do not wan the workers or travelers to learn their incantations
387because many laws would be broken and chaos would result.
388
389CTK's grand design is always general enough to be applicable in many
390different situations. As a result, it is often difficult to use. The
391first duty of the wizards is to tailor the transformation laws so as to be
392more beneficial and easier to use in their particular environment.
393
394After creation of the kingdom, a major duty of the wizards is to search for
395and kill dragons. If travelers do not return on time or if they return
396injured, the ruler of the country contacts the wizards. If the wizards
397determine that the injury or death occurred due to the traveler's
398negligence, they provide the traveler's country with additional warnings.
399If not, they must determine if the cause was a road hazard or a dragon. If
400the suspect a road hazard, they call in a CTK maintenance man to locate the
401hazard and to eliminate it, as in repairing the pothole in the road. If
402they think that cause was a dragon, then they must find and slay it.
403
404The most difficult part of eliminating a dragon is finding it. Sometimes
405the wizard magically knows where the dragon's lair it, but often the wizard
406must send another traveler along the same route and watch to see where he
407disappears. This sounds like a failsafe method for finding dragons (and a
408suicide mission for thr traveler) but the second traveler does not always
409disappear. Some dragons eat any traveler who comes too close; others are
410very picky.
411
412The wizards may call in CTK who designed the highway system and
413transformation laws to help devise a way to locate the dragon. CTK also
414helps provide the right spell or incantation to slay the dragon. (There is
415no general spell to slay dragons; each dragon must be eliminated with a
416different spell.)
417
418Because neither CTK nor wizards are perfect, spells to not always work
419correctly. At best, nothing happens when the wrong spell is uttered. At
420worst, the dragon becomes a much larger dragon or multiplies into several
421smaller ones. In either case, new spells must be found.
422
423If all existing dragons are quiet (i.e. have eaten sufficiently), wizards
424have time to do other things. They hide in castles and practice spells and
425incatations. They also devise shortcuts for travelers and new laws of
426transformation.
427
428Changes in the Kingdom
429======================
430
431As new transformation kingdoms are created and old ones are maintained,
432CTK, Inc. is constantly learning new things. It learns ways to avoid
433creating some of the dragons that they have previously created. It also
434discovers new and better laws of transformation. As a result, CTK will
435periodically create a new grand design which is far better than the old.
436The wizards determine when is a good time to implement this new design.
437This is when the tourist season is slow or when no important travelers
438(VIPs) are to arrive. The kingdom must be closed for the actual
439implementation and is leter reopened as a new and better place to go.
440
441A final question you might ask is what happens when the number of tourists
442becomes too great for the kingdom to handle in a reasonable period of time
443(i.e., the tourist lines at the ports are too long). The Kingdom of
444Transformation has three options: (1) shorten the paths that a tourist must
445travel, or (2) convince CTK to develop a faster breed of horses so that the
446travelers can finish sooner, or (3) annex more territories so that the
447kingdom can handle more travelers.
448
449Thus ends the story of the Kingdom of Transformation. I hope this has
450explained my job to you: I slay dragons for a living.
451
452#
453#should do an automatic undivert..
454#
455
456diversion #1
457
458diversion #2
459
460diversion #3
461
462diversion #4
Note: See TracBrowser for help on using the repository browser.