terryl@sri-unix (08/27/82)
A co-worker of mine recently tried to bring up the UCDS package on a NON-DEC processor, and ran into a few problems that he could not explain. After much digging, we came out with an explanation of the problem. The symptoms were that using the draw-e program, which is the graphics editor of the package to generate layouts, no matter where he tried to place anything, it would always be drawn on the lower left hand corner of the screen. After much head scratching and numerous debug statements, we found out that all of the data was correct up to one point: there are two routines in the package name wtod and dtow, presumably named to mean window to draw- ing conversion, and drawing to window conversion. All these routines did was take the x and y co-ordinates, and either add or subtract on offset, and then do a shift. Now the problem was with the shift. The shift was done with a global variable named gscale, but a constant GSCALE, which was 4, was subtracted from the variable gscale, before the shift was done. The real problem was that gscale had an initial value of 0 (set in some initialization routine), so the shift count was a negative number. Now unless the C standard was changed recently, shifts by negative numbers were undefined. The only reason that it will work at all on DEC hardware is that the sign of the shift count specifies the shift direction, so the right shift in wtod actually became a left shift, but on our processor the right shift was still a right shift with a very big shift count that cleared whatever was being shifted. Has anyone run into this before, and has it been reported???? Terry Laskodi ucbvax!teklabs!terryl or decvax!teklabs!terryl