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