bglenden@colobus.cv.nrao.edu (Brian Glendenning) (05/22/91)
Can anyone tell me what is wrong with the enclosed Eiffel test system - there is probably something simple I'm overlooking, but I can't see it and it is driving me crazy (I have extracted this small sample from a larger, more real, problem). Thank you. Brian --------------------------------------------------------------------------- #!/bin/sh # This is a shell archive (shar 3.24) # made 05/21/1991 20:43 UTC by bglenden@mandrill # Source directory /sun4/aips/pgmr/bglenden/eiffel/tmp/tmp # # existing files WILL be overwritten # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 468 -rw-r--r-- myarray.e # 560 -rw-r--r-- nmyarray.e # 697 -rw-r--r-- sample.e # if touch 2>&1 | fgrep '[-amc]' > /dev/null then TOUCH=touch else TOUCH=true fi # ============= myarray.e ============== echo "x - extracting myarray.e (Text)" sed 's/^X//' << 'SHAR_EOF' > myarray.e && Xclass MYARRAY[T] export X -- For testing X item, put, count, storage Xinherit X VIEWABLE Xfeature X X Create ( s: INTEGER) is X do X storage.Create(1, s); X end; X X storage: ARRAY[T]; -- element storage X X count: INTEGER is X do X Result := storage.count; X end; X X X put (v: T; p: INTEGER) is X do X storage.put(v, p); X end; X X item (p: INTEGER): T is X local X do X Result := storage.item(p) X end; X Xend X SHAR_EOF $TOUCH -am 0521163291 myarray.e && chmod 0644 myarray.e || echo "restore of myarray.e failed" set `wc -c myarray.e`;Wc_c=$1 if test "$Wc_c" != "468"; then echo original size 468, current size $Wc_c fi # ============= nmyarray.e ============== echo "x - extracting nmyarray.e (Text)" sed 's/^X//' << 'SHAR_EOF' > nmyarray.e && Xclass NMYARRAY[T -> NUMERIC] export X repeat MYARRAY, infix "+" Xinherit X MYARRAY[T] rename Create as maCreate; X VIEWABLE X Xfeature X X Create ( s: INTEGER) is X do X maCreate(s); X end; X X infix "+" (other: NMYARRAY[T]): NMYARRAY[T] is X -- Sum of this field and other element by element. X local X i: INTEGER; X do X Result.Create(Current.count); X from i := 1 until i > count X loop X io.putint(i); io.new_line; X Result.storage.put(storage.item(i) + other.storage.item(i), i); X i := i + 1; X end; X end; X Xend SHAR_EOF $TOUCH -am 0521164191 nmyarray.e && chmod 0644 nmyarray.e || echo "restore of nmyarray.e failed" set `wc -c nmyarray.e`;Wc_c=$1 if test "$Wc_c" != "560"; then echo original size 560, current size $Wc_c fi # ============= sample.e ============== echo "x - extracting sample.e (Text)" sed 's/^X//' << 'SHAR_EOF' > sample.e && Xclass SAMPLE export X -- Test Xinherit X VIEWABLE; Xfeature X Create is X local X r, image, beam: NMYARRAY[REAL]; X i, j: INTEGER; X do X-- viewer_on_failure; X image.Create(10); X beam.Create(10); X io.putstring("Setting"); io.new_line; X beam.put(1.0,5); X image.put(10.0,5); X io.putstring("image");io.new_line; X display(image); X io.putstring("beam");io.new_line; X display(beam); X io.putstring("image + beam");io.new_line; X r := image + beam; X display(r); X end; X X display (a: NMYARRAY[REAL]) is X local X i: INTEGER; X do X from i := 1 until i > a.count X loop X io.putreal(a.item(i)); io.putstring(" "); X i := i + 1; X end; X io.new_line; X end; X Xend X SHAR_EOF $TOUCH -am 0521164291 sample.e && chmod 0644 sample.e || echo "restore of sample.e failed" set `wc -c sample.e`;Wc_c=$1 if test "$Wc_c" != "697"; then echo original size 697, current size $Wc_c fi exit 0 -- Brian Glendenning - National Radio Astronomy Observatory bglenden@nrao.edu bglenden@nrao.bitnet (804) 296-0286