home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / ckscripts / localarray < prev    next >
Text File  |  2020-01-01  |  2KB  |  60 lines

  1. #!/usr/local/bin/wermit
  2.  
  3. ; Local array testing script.
  4.  
  5. ; Declare top-level array A.  There is no top-level B.
  6.  
  7. dcl \&a[] = a0-one a0-two a0-three
  8.  
  9. def x1 {
  10.   local \&a[] \&b[]  ; Local A and B at level 1
  11.   dcl \&a[] = a1-one a1-two a1-three
  12.   dcl \&b[] = b1-one b1-two b1-three
  13.   echo ENTERING LEVEL 1 WITH LOCAL A AND B ARRAYS...
  14.   echo You should see "a1-one" thru "a1-three" for A
  15.   echo and "b1-one" thru "b1-three" for B:
  16.   show array a
  17.   show array b
  18.   x2
  19.   echo BACK AT LEVEL 1
  20.   echo You should see "a1-one" thru "a1-three" for A
  21.   echo and "b1-one" thru "b1-three" for B:
  22.   show array a
  23.   show array b
  24. }
  25. def x2 {
  26.   local \&b[]        ; Local B but not A at level 2
  27.   dcl \&b[] = b2-one b2-two b2-three
  28.   echo ENTERING LEVEL 2 WITH LOCAL B BUT NOT A...
  29.   echo You should see "a1-one" thru "a1-three" for A
  30.   echo and "b2-one" thru "b2-three" for B:
  31.   show array a
  32.   show array b
  33.   x3
  34.   echo BACK AT LEVEL 2
  35.   echo You should see "a1-one" thru "a1-three" for A
  36.   echo and "b2-one" thru "b2-three" for B:
  37.   show array a
  38.   show array b
  39. }
  40. def x3 {
  41.   local \&a[]
  42.   dcl \&a[] = a3-one a3-two a3-three a3-four
  43.   echo ENTERING LEVEL 3 WITH LOCAL A BUT NOT B...
  44.   echo You should see "a3-one" thru "a3-three" for A
  45.   echo and "b2-one" thru "b2-three" for B:
  46.   show array a
  47.   show array b
  48. }
  49.  
  50. echo TOP LEVEL
  51. echo You should see "a0-one" thru "a0-three" for A and B not declared:
  52. show array a
  53. show array b
  54. x1
  55. echo BACK AT TOP LEVEL
  56. echo You should see "a0-one" thru "a0-three" for A and B not declared:
  57. show array a
  58. show array b
  59.  
  60.