home *** CD-ROM | disk | FTP | other *** search
/ Mega Top 1 / os2_top1.zip / os2_top1 / APPS / TEKST / FUNNEL_S / ANSWERS / AN03.LIS < prev    next >
File List  |  1992-05-27  |  4KB  |  87 lines

  1. FUNNELWEB LISTING FILE
  2. ======================
  3.  
  4.  
  5. Global Local| Input File
  6. ------------+-------------------------------------------------------------------
  7.      1     1| AN03: Test semantics checking of macros.
  8.      2     2| 
  9.      3     3| First define some macros to call.
  10.      4     4| @$@<Zero@>@Z@M@{@}
  11.      5     5| @$@<One@>@(@1@)@Z@M@{@}
  12.      6     6| @$@<Two@>@(@2@)@Z@M@{@}
  13.      7     7| 
  14.      8     8| 1. Test call to undefined macro.
  15.      9     9| @$@<Sloth1@>@Z==@{@<Walrus@>@}
  16.        Error|...................^Call to undefined macro.
  17.     10    10| 
  18.     11    11| 2. Test calls with wrong number of parameters.
  19.     12    12| @$@<Sloth2@>@Z==@{
  20.     13    13| @<Zero@>
  21.     14    14| @<Zero@>@(@)
  22.        Error|.^Call has 1 parameter, but the macro
  23.             |.^definition at line 4 specifies 0 parameters.
  24.             |.^Note: If your call looks like this: @<Macro@>@(@) then you
  25.             |.^should be aware that FunnelWeb treats this as a call with
  26.             |.^a single parameter consisting of the empty string. This
  27.             |.^is a consequence of parameter delimiters @"@" being optional.
  28.     15    15| @<Zero@>@(@,@)
  29.        Error|.^Call has 2 parameters, but the macro
  30.             |.^definition at line 4 specifies 0 parameters.
  31.     16    16| @<One@>
  32.        Error|.^Call has 0 parameters, but the macro
  33.             |.^definition at line 5 specifies 1 parameter.
  34.     17    17| @<One@>@(@)
  35.     18    18| @<One@>@(Walrus@,@)
  36.        Error|.^Call has 2 parameters, but the macro
  37.             |.^definition at line 5 specifies 1 parameter.
  38.     19    19| @<Two@>@(Sloth@)
  39.        Error|.^Call has 1 parameter, but the macro
  40.             |.^definition at line 6 specifies 2 parameters.
  41.     20    20| @}
  42.     21    21| 
  43.     22    22| 3. Test call to file macro.
  44.     23    23| @O@<deleteme.txt@>@{@}
  45.             |.^This file macro is called one or more times.
  46.             |.^Each call has been flagged with an error message.
  47.     24    24| @$@<Teapot@>@Z@{@<deleteme.txt@>@}
  48.        Error|.................^Calls to file macros are not allowed.
  49.             |.................^Reason: It should be possible to comment out a
  50.             |.................^file macro without a big fuss. Calling a file macro
  51.             |.................^just tangles it up in the macro structure,
  52.             |.................^making it more difficult to comment out later.
  53.     25    25| 
  54.     26    26| 4. Test macro never used and has <special>Z.
  55.     27    27| @$@<Elephant@>@Z@{@}
  56.     28    28| 
  57.     29    29| 5. Test macro often used and has <special>M.
  58.     30    30| @$@<Giraffe@>@M@{@}
  59.     31    31| @$@<Use Giraffe@>@Z@{@<Giraffe@>@<Giraffe@>@}
  60.     32    32| 
  61.     33    33| 6. Test macro never used and no <special>Z
  62.     34    34| @$@<Zebra@>@{@}
  63.        Error|.^This macro is never used (and has no @Z).
  64.     35    35| 
  65.     36    36| 7. Test multiply used and no <special>M.
  66.     37    37| @$@<Monkey@>@{@}
  67.        Error|.^This macro is used more than once (and has no @M).
  68.     38    38| @$@<Use Monkey@>@Z@{@<Monkey@>@<Monkey@>@}
  69.     39    39| 
  70.     40    40| 8. Test directly recursive macro.
  71.     41    41| @$@<Who do ya call?@>@{@<Who do ya call?@>@}
  72.        Error|.^This macro has an infinite expansion.
  73.     42    42| 
  74.     43    43| 9. Test indirectly recursive macro.
  75.     44    44| @$@<X@>@M@{@<Y@>@}
  76.        Error|.^This macro has an infinite expansion.
  77.     45    45| @$@<Y@>@{@<X@>@}
  78.        Error|.^This macro has an infinite expansion.
  79.     46    46| 
  80.     47    47| 10. Test callers of recursive macros.
  81.     48    48| @$@<Z@>@Z@{@<X@>@}
  82.        Error|.^This macro has an infinite expansion.
  83.             | <End-Of-File>
  84. ------------+-------------------------------------------------------------------
  85.  
  86. There were 13 Errors.
  87.