argv@island.uu.net (Dan Heller) (04/26/89)
Submitted-by: Gene Dykes <gdykes@tcgould.tn.cornell.edu> Posting-number: Volume 3, Issue 82 Archive-name: xcu/part06 #! /bin/sh # This is a shell archive. Remove anything before this line, then feed it # into a shell via "sh file" or similar. To overwrite existing files, # type "sh file -c". # The tool that generated this appeared in the comp.sources.unix newsgroup; # send mail to comp-sources-unix@uunet.uu.net if you want that tool. # If this archive is complete, you will see the following message at the end: # "End of archive 6 (of 12)." # Contents: examples/xlayout/manip.wc examples/xworld/README # src/CuSimple.c src/CuTbl.y # Wrapped by argv@island on Mon Apr 24 15:41:44 1989 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'examples/xlayout/manip.wc' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'examples/xlayout/manip.wc'\" else echo shar: Extracting \"'examples/xlayout/manip.wc'\" \(17470 characters\) sed "s/^X//" >'examples/xlayout/manip.wc' <<'END_OF_FILE' X#WLDL X6 X X5 CuWlm X12 X18 CuLabel.facetWidth 1 (0) 6 Global X18 CuLabel.foreground 5 (black) 6 Global X19 CuLabel.borderColor 9 (LightGray) 6 Global X18 CuLabel.background 9 (LightGray) 6 Global X17 CuTbl.borderColor 9 (LightGray) 6 Global X17 CuTbl.borderWidth 1 (0) 6 Global X16 CuTbl.background 9 (LightGray) 6 Global X4 font 4 (9x15) 6 Global X16 brightFacetColor 14 (LightSteelBlue) 6 Global X13 dimFacetColor 9 (SteelBlue) 6 Global X18 highlightThickness 1 (2) 6 Global X4 name 6 (office) 5 Local X0 X0 X2 X X 6 CuBmgr X 2 X 8 bmgrType 9 (OneOfMany) 5 Local X 4 name 10 (plus_minus) 5 Local X 0 X 18 X 11 (yo_negative) 6 String 11 (yo_negative) X 11 (yo_positive) 6 String 11 (yo_positive) X 11 (hi_negative) 6 String 11 (hi_negative) X 11 (hi_positive) 6 String 11 (hi_positive) X 11 (sc_negative) 6 String 11 (sc_negative) X 11 (sc_positive) 6 String 11 (sc_positive) X 11 (zm_negative) 6 String 11 (zm_negative) X 11 (zm_positive) 6 String 11 (zm_positive) X 11 (ry_negative) 6 String 11 (ry_negative) X 11 (ry_positive) 6 String 11 (ry_positive) X 11 (rx_negative) 6 String 11 (rx_negative) X 11 (rx_positive) 6 String 11 (rx_positive) X 11 (tz_negative) 6 String 11 (tz_negative) X 11 (tz_positive) 6 String 11 (tz_positive) X 11 (ty_negative) 6 String 11 (ty_negative) X 11 (ty_positive) 6 String 11 (ty_positive) X 11 (tx_negative) 6 String 11 (tx_negative) X 11 (tx_positive) 6 String 11 (tx_positive) X 0 X X 5 CuTbl X 5 X 14 internalHeight 2 (10) 5 Local X 13 internalWidth 2 (10) 5 Local X 11 interHeight 2 (10) 5 Local X 12 formatString 2 (c.) 5 Local X 4 name 7 (visible) 5 Local X 0 X 0 X 11 X X 5 CuTbl X 1 X 12 formatString 2 (c.) 5 Local X 0 X 0 X 1 X X 6 CuBmgr X 2 X 8 bmgrType 9 (Transient) 5 Local X 4 name 4 (quit) 5 Local X 0 X 1 X 4 (QUIT) 6 String 4 (QUIT) X 1 X X 8 CuButton X 1 X 4 name 4 (QUIT) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 1 X 12 formatString 2 (c.) 5 Local X 0 X 0 X 1 X X 6 CuBmgr X 2 X 8 bmgrType 9 (Transient) 5 Local X 4 name 7 (texture) 5 Local X 0 X 1 X 7 (TEXTURE) 6 String 7 (TEXTURE) X 1 X X 8 CuButton X 1 X 4 name 7 (TEXTURE) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 1 X 12 formatString 2 (c.) 5 Local X 0 X 0 X 1 X X 6 CuBmgr X 2 X 8 bmgrType 9 (Transient) 5 Local X 4 name 5 (reset) 5 Local X 0 X 1 X 5 (RESET) 6 String 5 (RESET) X 1 X X 8 CuButton X 1 X 4 name 5 (RESET) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 2 X 12 formatString 6 (c Xc Xc.) 5 Local X 4 name 3 (A11) 5 Local X 0 X 0 X 1 X X 6 CuBmgr X 2 X 8 bmgrType 9 (OneOfMany) 5 Local X 4 name 10 (read_write) 5 Local X 0 X 3 X 3 (OFF) 6 String 3 (OFF) X 6 (RECORD) 6 String 6 (RECORD) X 6 (REPLAY) 6 String 6 (REPLAY) X 3 X X 8 CuButton X 2 X 3 set 4 (True) 5 Local X 4 name 3 (OFF) 5 Local X 0 X 0 X 0 X X 8 CuButton X 1 X 4 name 6 (RECORD) 5 Local X 0 X 0 X 0 X X 8 CuButton X 1 X 4 name 6 (REPLAY) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 2 X 12 equalColumns 4 (True) 5 Local X 12 formatString 4 (c c.) 5 Local X 0 X 0 X 1 X X 6 CuBmgr X 2 X 8 bmgrType 12 (DoubleToggle) 5 Local X 4 name 10 (dbl_buffer) 5 Local X 0 X 2 X 14 (DBL XBUFFER XOFF) 3 Int 1 (0) X 13 (DBL XBUFFER XON) 3 Int 1 (1) X 2 X X 8 CuButton X 1 X 4 name 14 (DBL XBUFFER XOFF) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 3 set 4 (True) 5 Local X 4 name 13 (DBL XBUFFER XON) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 2 X 12 equalColumns 4 (True) 5 Local X 12 formatString 4 (c c.) 5 Local X 0 X 0 X 1 X X 6 CuBmgr X 2 X 8 bmgrType 12 (DoubleToggle) 5 Local X 4 name 2 (up) 5 Local X 0 X 2 X 11 (UP XVARIABLE) 3 Int 1 (0) X 11 (UP XCONSTANT) 3 Int 1 (1) X 2 X X 8 CuButton X 1 X 4 name 11 (UP XVARIABLE) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 3 set 4 (True) 5 Local X 4 name 11 (UP XCONSTANT) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 2 X 12 equalColumns 4 (True) 5 Local X 12 formatString 4 (c c.) 5 Local X 0 X 0 X 1 X X 6 CuBmgr X 2 X 8 bmgrType 12 (DoubleToggle) 5 Local X 4 name 5 (cycle) 5 Local X 0 X 2 X 9 (CYCLE OFF) 3 Int 1 (0) X 8 (CYCLE ON) 3 Int 1 (1) X 2 X X 8 CuButton X 1 X 4 name 8 (CYCLE ON) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 3 set 4 (True) 5 Local X 4 name 9 (CYCLE OFF) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 2 X 12 formatString 6 (c Xc Xc.) 5 Local X 4 name 5 (hi_yo) 5 Local X 0 X 0 X 3 X X 5 CuTbl X 3 X 12 equalColumns 4 (True) 5 Local X 12 formatString 6 (c c c.) 5 Local X 4 name 3 (A10) 5 Local X 0 X 0 X 1 X X 6 CuBmgr X 2 X 8 bmgrType 9 (OneOfMany) 5 Local X 4 name 8 (hy_value) 5 Local X 0 X 6 X 3 (hy8) 5 Float 3 (8.0) X 3 (hy4) 5 Float 3 (4.0) X 3 (hy2) 5 Float 3 (2.0) X 3 (hy1) 5 Float 3 (1.0) X 4 (hy.1) 5 Float 3 (0.1) X 3 (hy0) 5 Float 1 (0) X 6 X X 8 CuButton X 2 X 5 label 1 (8) 5 Local X 4 name 3 (hy8) 5 Local X 0 X 0 X 0 X X 8 CuButton X 3 X 3 set 4 (True) 5 Local X 5 label 1 (4) 5 Local X 4 name 3 (hy4) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 1 (2) 5 Local X 4 name 3 (hy2) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 1 (1) 5 Local X 4 name 3 (hy1) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 2 (.1) 5 Local X 4 name 4 (hy.1) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 2 (RS) 5 Local X 4 name 3 (hy0) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 2 X 10 interWidth 1 (2) 5 Local X 12 formatString 4 (c c.) 5 Local X 0 X 0 X 2 X X 5 CuTbl X 2 X 12 formatString 5 (c c. X) 5 Local X 4 name 2 (yo) 5 Local X 0 X 0 X 2 X X 8 CuButton X 2 X 5 label 1 (+) 5 Local X 4 name 11 (yo_positive) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 1 (-) 5 Local X 4 name 11 (yo_negative) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 2 X 12 formatString 5 (c c. X) 5 Local X 4 name 2 (hi) 5 Local X 0 X 0 X 2 X X 8 CuButton X 2 X 5 label 1 (+) 5 Local X 4 name 11 (hi_positive) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 1 (-) 5 Local X 4 name 11 (hi_negative) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 4 X 10 facetWidth 1 (0) 6 Global X 10 foreground 5 (black) 6 Global X 12 formatString 4 (c c.) 5 Local X 12 equalColumns 4 (True) 5 Local X 0 X 0 X 2 X X 7 CuLabel X 1 X 4 name 3 (YON) 5 Local X 0 X 0 X 0 X X 7 CuLabel X 1 X 4 name 6 (HITHER) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 2 X 12 formatString 6 (c Xc Xc.) 5 Local X 4 name 10 (zoom_scene) 5 Local X 0 X 0 X 3 X X 5 CuTbl X 3 X 12 equalColumns 4 (True) 5 Local X 12 formatString 10 (c c Xc c c.) 5 Local X 4 name 2 (A9) 5 Local X 0 X 0 X 1 X X 6 CuBmgr X 2 X 8 bmgrType 9 (OneOfMany) 5 Local X 4 name 10 (zoom_value) 5 Local X 0 X 5 X 7 (zoom1.5) 5 Float 3 (1.5) X 7 (zoom1.1) 5 Float 3 (1.1) X 6 (zoom.9) 5 Float 3 (0.9) X 6 (zoom.5) 5 Float 3 (0.5) X 5 (zoom0) 5 Float 1 (0) X 5 X X 8 CuButton X 2 X 5 label 3 (1.5) 5 Local X 4 name 7 (zoom1.5) 5 Local X 0 X 0 X 0 X X 8 CuButton X 3 X 3 set 4 (True) 5 Local X 5 label 3 (1.1) 5 Local X 4 name 7 (zoom1.1) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 2 (.9) 5 Local X 4 name 6 (zoom.9) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 2 (.5) 5 Local X 4 name 6 (zoom.5) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 2 (RS) 5 Local X 4 name 5 (zoom0) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 3 X 10 interWidth 1 (2) 5 Local X 12 formatString 6 (c c c.) 5 Local X 4 name 2 (A8) 5 Local X 0 X 0 X 3 X X 5 CuTbl X 2 X 12 formatString 5 (c c. X) 5 Local X 4 name 2 (sc) 5 Local X 0 X 0 X 2 X X 8 CuButton X 2 X 5 label 1 (+) 5 Local X 4 name 11 (sc_positive) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 1 (-) 5 Local X 4 name 11 (sc_negative) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 4 X 18 layoutWhenUnmapped 4 (True) 5 Local X 17 mappedWhenManaged 5 (False) 5 Local X 12 formatString 5 (c c. X) 5 Local X 4 name 3 (A8a) 5 Local X 0 X 0 X 2 X X 8 CuButton X 2 X 5 label 1 (+) 5 Local X 4 name 1 ( ) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 1 (-) 5 Local X 4 name 1 ( ) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 2 X 12 formatString 5 (c c. X) 5 Local X 4 name 2 (zm) 5 Local X 0 X 0 X 2 X X 8 CuButton X 2 X 5 label 1 (+) 5 Local X 4 name 11 (zm_positive) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 1 (-) 5 Local X 4 name 11 (zm_negative) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 2 X 12 formatString 6 (c c c.) 5 Local X 4 name 2 (A7) 5 Local X 0 X 0 X 3 X X 7 CuLabel X 1 X 4 name 2 (SC) 5 Local X 0 X 0 X 0 X X 7 CuLabel X 1 X 4 name 2 ( ) 5 Local X 0 X 0 X 0 X X 7 CuLabel X 1 X 4 name 2 (ZM) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 2 X 12 formatString 6 (c Xc Xc.) 5 Local X 4 name 8 (rotation) 5 Local X 0 X 0 X 3 X X 5 CuTbl X 3 X 12 equalColumns 4 (True) 5 Local X 12 formatString 6 (c c c.) 5 Local X 4 name 2 (A6) 5 Local X 0 X 0 X 1 X X 6 CuBmgr X 2 X 8 bmgrType 9 (OneOfMany) 5 Local X 4 name 12 (rotate_value) 5 Local X 0 X 6 X 8 (rotate90) 5 Float 4 (90.0) X 8 (rotate30) 5 Float 4 (30.0) X 8 (rotate10) 5 Float 2 (10) X 7 (rotate5) 5 Float 1 (5) X 7 (rotate2) 5 Float 1 (2) X 7 (rotate1) 5 Float 1 (1) X 6 X X 8 CuButton X 2 X 5 label 2 (90) 5 Local X 4 name 8 (rotate90) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 2 (30) 5 Local X 4 name 8 (rotate30) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 2 (10) 5 Local X 4 name 8 (rotate10) 5 Local X 0 X 0 X 0 X X 8 CuButton X 3 X 3 set 4 (True) 5 Local X 5 label 1 (5) 5 Local X 4 name 7 (rotate5) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 1 (2) 5 Local X 4 name 7 (rotate2) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 1 (1) 5 Local X 4 name 7 (rotate1) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 3 X 10 interWidth 1 (2) 5 Local X 12 formatString 6 (c c c.) 5 Local X 4 name 2 (A5) 5 Local X 0 X 0 X 3 X X 5 CuTbl X 4 X 18 layoutWhenUnmapped 4 (True) 5 Local X 17 mappedWhenManaged 5 (False) 5 Local X 12 formatString 5 (c c. X) 5 Local X 4 name 2 (rz) 5 Local X 0 X 0 X 2 X X 8 CuButton X 2 X 5 label 1 (+) 5 Local X 4 name 11 (rz_positive) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 1 (-) 5 Local X 4 name 11 (rz_negative) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 2 X 12 formatString 5 (c c. X) 5 Local X 4 name 2 (ry) 5 Local X 0 X 0 X 2 X X 8 CuButton X 2 X 5 label 1 (+) 5 Local X 4 name 11 (ry_positive) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 1 (-) 5 Local X 4 name 11 (ry_negative) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 2 X 12 formatString 5 (c c. X) 5 Local X 4 name 2 (rx) 5 Local X 0 X 0 X 2 X X 8 CuButton X 2 X 5 label 1 (+) 5 Local X 4 name 11 (rx_positive) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 1 (-) 5 Local X 4 name 11 (rx_negative) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 2 X 12 formatString 6 (c c c.) 5 Local X 4 name 2 (A4) 5 Local X 0 X 0 X 3 X X 7 CuLabel X 1 X 4 name 2 ( ) 5 Local X 0 X 0 X 0 X X 7 CuLabel X 1 X 4 name 2 (RY) 5 Local X 0 X 0 X 0 X X 7 CuLabel X 1 X 4 name 2 (RX) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 2 X 12 formatString 6 (c Xc Xc.) 5 Local X 4 name 11 (translation) 5 Local X 0 X 0 X 3 X X 5 CuTbl X 3 X 12 equalColumns 4 (True) 5 Local X 12 formatString 6 (c c c.) 5 Local X 4 name 2 (A3) 5 Local X 0 X 0 X 1 X X 6 CuBmgr X 2 X 8 bmgrType 9 (OneOfMany) 5 Local X 4 name 15 (translate_value) 5 Local X 0 X 6 X 11 (translate10) 5 Float 4 (10.0) X 10 (translate4) 5 Float 3 (4.0) X 10 (translate2) 5 Float 3 (2.0) X 10 (translate1) 5 Float 3 (1.0) X 11 (translate.5) 5 Float 3 (0.5) X 11 (translate.1) 5 Float 3 (0.1) X 6 X X 8 CuButton X 2 X 5 label 2 (10) 5 Local X 4 name 11 (translate10) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 1 (4) 5 Local X 4 name 10 (translate4) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 1 (2) 5 Local X 4 name 10 (translate2) 5 Local X 0 X 0 X 0 X X 8 CuButton X 3 X 3 set 4 (True) 5 Local X 5 label 1 (1) 5 Local X 4 name 10 (translate1) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 2 (.5) 5 Local X 4 name 11 (translate.5) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 2 (.1) 5 Local X 4 name 11 (translate.1) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 3 X 10 interWidth 1 (2) 5 Local X 12 formatString 6 (c c c.) 5 Local X 4 name 2 (A2) 5 Local X 0 X 0 X 3 X X 5 CuTbl X 2 X 12 formatString 5 (c c. X) 5 Local X 4 name 2 (tz) 5 Local X 0 X 0 X 2 X X 8 CuButton X 2 X 5 label 1 (+) 5 Local X 4 name 11 (tz_positive) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 1 (-) 5 Local X 4 name 11 (tz_negative) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 2 X 12 formatString 5 (c c. X) 5 Local X 4 name 2 (ty) 5 Local X 0 X 0 X 2 X X 8 CuButton X 2 X 5 label 1 (+) 5 Local X 4 name 11 (ty_positive) 5 Local X 0 X 0 X 0 X X 8 CuButton X 2 X 5 label 1 (-) 5 Local X 4 name 11 (ty_negative) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 2 X 12 formatString 5 (c c. X) 5 Local X 4 name 2 (tx) 5 Local X 0 X 0 X 2 X X 8 CuButton X 2 X 5 label 1 (+) 5 Local X 4 name 11 (tx_positive) 5 Local X 0 X 0 X 0 X X 8 CuButton X 3 X 3 set 4 (True) 5 Local X 5 label 1 (-) 5 Local X 4 name 11 (tx_negative) 5 Local X 0 X 0 X 0 X X 5 CuTbl X 2 X 12 formatString 6 (c c c.) 5 Local X 4 name 2 (A1) 5 Local X 0 X 0 X 3 X X 7 CuLabel X 1 X 4 name 2 (TZ) 5 Local X 0 X 0 X 0 X X 7 CuLabel X 1 X 4 name 2 (TY) 5 Local X 0 X 0 X 0 X X 7 CuLabel X 1 X 4 name 2 (TX) 5 Local X 0 X 0 X 0 END_OF_FILE echo shar: NEWLINE appended to \"'examples/xlayout/manip.wc'\" if test 17471 -ne `wc -c <'examples/xlayout/manip.wc'`; then echo shar: \"'examples/xlayout/manip.wc'\" unpacked with wrong size! fi # end of 'examples/xlayout/manip.wc' fi if test -f 'examples/xworld/README' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'examples/xworld/README'\" else echo shar: Extracting \"'examples/xworld/README'\" \(516 characters\) sed "s/^X//" >'examples/xworld/README' <<'END_OF_FILE' XThis directory contains a "Good-bye, World" example of using the Xwidget layout manager. The file "world.wl" contains a near minimal Xexample of a layout description, and world.c is a minimal client Xto execute a program using that description. Note that world.c Xcontains the "make_tag_class_list()" function explicitly. It can be Xgenerated automatically as shown in the xwlm example. X XClicking the mouse in the widget will cause a callback that terminates the Xprogram. To execute, issue the command: X X world world END_OF_FILE echo shar: NEWLINE appended to \"'examples/xworld/README'\" if test 517 -ne `wc -c <'examples/xworld/README'`; then echo shar: \"'examples/xworld/README'\" unpacked with wrong size! fi # end of 'examples/xworld/README' fi if test -f 'src/CuSimple.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/CuSimple.c'\" else echo shar: Extracting \"'src/CuSimple.c'\" \(20090 characters\) sed "s/^X//" >'src/CuSimple.c' <<'END_OF_FILE' X/* CuSimple */ X#include <X11/IntrinsicP.h> X#include <X11/copyright.h> X#include <X11/StringDefs.h> X#include "CuSimpleP.h" X/* Facet */ X#include "CuSimpleI.h" X X/* CuSimple */ X#define UnspecifiedPixmap 2 /* ??? NULL */ X#define IsSensitive(w) ((w)->core.sensitive && (w)->core.ancestor_sensitive) X X/* CuSimple */ Xstatic Cursor defaultCursor = None; Xstatic Pixmap defaultPixmap = NULL; X/* Facet */ Xstatic Dimension defFacetWidth = 5 ; Xstatic Dimension defHighlightWidth = 2 ; Xstatic Boolean def_false = False ; Xstatic Pixel def_bp = None ; Xstatic Pixel def_wp = None ; X Xstatic XtResource resources[] = { X#define offset(field) XtOffset(CuSimpleWidget, simple.field) X#include "CuSimpleR.h" X#undef offset X}; X X#ifdef CompositeSimple Xstatic XtResource compResources[] = { X#define offset(field) XtOffset(CuSimpleCompWidget, simple.field) X#include "CuSimpleR.h" X#undef offset X}; X X#endif X/* Forward Definition of private routines */ X Xstatic void ChangeSensitive(); Xstatic void ClassPartInitialize(); Xstatic void Realize(); Xstatic Boolean SetValues(); Xstatic void Initialize(); Xstatic void Redisplay(); Xstatic void Resize(); Xstatic void Destroy(); X/* (private) */ Xstatic void GetCursorColors () ; Xstatic void Draw_Facets(); Xstatic void Draw_Highlight(); Xstatic Boolean SetValuesCorePart(); Xstatic void SetValuesFacetPart(); Xstatic void DestroyFacet(); Xstatic void GetDimFacetGC(); Xstatic void GetBrightFacetGC(); Xstatic void GetHighlightGC(); Xstatic void GetBackgroundGC(); X#ifdef CompositeSimple Xstatic XtGeometryResult GeometryManager() ; Xstatic void CompInitialize(); Xstatic void CompClassPartInitialize(); Xstatic void CompRedisplay(); Xstatic Boolean CompSetValues(); Xstatic void CompDestroy(); X#endif X X/* Static Class Definition */ X XCuSimpleClassRec cuSimpleClassRec = { X { /* core fields */ X /* superclass */ (WidgetClass) &widgetClassRec, X /* class_name */ "CuSimple", X /* widget_size */ sizeof(CuSimpleRec), X /* class_initialize */ NULL, X /* class_part_initialize */ ClassPartInitialize, X /* class_inited */ FALSE, X /* initialize */ Initialize, X /* initialize_hook */ NULL, X /* realize */ Realize, X /* actions */ NULL, X /* num_actions */ 0, X /* resources */ resources, X /* num_resources */ XtNumber(resources), X /* xrm_class */ NULLQUARK, X /* compress_motion */ TRUE, X /* compress_exposure */ TRUE, X /* compress_enterleave */ TRUE, X /* visible_interest */ FALSE, X /* destroy */ Destroy, X /* resize */ Resize, X /* expose */ Redisplay, X /* set_values */ SetValues, X /* set_values_hook */ NULL, X /* set_values_almost */ XtInheritSetValuesAlmost, X /* get_values_hook */ NULL, X /* accept_focus */ NULL, X /* version */ XtVersion, X /* callback_private */ NULL, X /* tm_table */ NULL, X /* query_geometry */ NULL, X /* display_accelerator */ XtInheritDisplayAccelerator, X /* extension */ NULL, X }, X { /* simple fields */ X /* CuSimple */ X /* change_sensitive */ ChangeSensitive, X /* Facet */ X /* draw facet */ Draw_Facets, X /* draw highlight */ Draw_Highlight X } X}; X XWidgetClass cuSimpleWidgetClass = (WidgetClass)&cuSimpleClassRec; X X#ifdef CompositeSimple XCuSimpleCompClassRec cuSimpleCompClassRec = { X { /* core_class fields */ X /* superclass */ (WidgetClass) &compositeClassRec, X /* class_name */ "CuSimple", X /* widget_size */ sizeof(CuSimpleRec), X /* class_initialize */ NULL, X /* class_part_initialize */ CompClassPartInitialize, X /* class_inited */ FALSE, X /* initialize */ CompInitialize, X /* initialize_hook */ NULL, X /* realize */ Realize, X /* actions */ NULL, X /* num_actions */ 0, X /* resources */ compResources, X /* num_resources */ XtNumber(compResources), X /* xrm_class */ NULLQUARK, X /* compress_motion */ TRUE, X /* compress_exposure */ TRUE, X /* compress_enterleave */ TRUE, X /* visible_interest */ FALSE, X /* destroy */ CompDestroy, X /* resize */ Resize, X /* expose */ CompRedisplay, X /* set_values */ CompSetValues, X /* set_values_hook */ NULL, X /* set_values_almost */ XtInheritSetValuesAlmost, X /* get_values_hook */ NULL, X /* accept_focus */ NULL, X /* version */ XtVersion, X /* callback_private */ NULL, X /* tm_table */ NULL, X /* query_geometry */ NULL, X /* display_accelerator */ XtInheritDisplayAccelerator, X /* extension */ NULL, X }, X { /* composite_class fields */ X /* geometry_manager */ GeometryManager, X /* change_managed */ NULL, X /* insert_child */ XtInheritInsertChild, X /* delete_child */ XtInheritDeleteChild, X /* extension */ NULL, X }, X { X /* CuSimple */ X /* change_sensitive */ ChangeSensitive, X /* Facet */ X /* draw facet */ Draw_Facets, X /* draw highlight */ Draw_Highlight X } X}; X XWidgetClass cuSimpleCompWidgetClass = (WidgetClass)&cuSimpleCompClassRec; X X#endif X/** X *** Toolkit Callable Routines X **/ X Xstatic void ClassPartInitialize(class) X WidgetClass class; X{ X register CuSimpleWidgetClass c = (CuSimpleWidgetClass)class; X X /* CuSimple */ X if (c->simple_class.change_sensitive == XtInheritChangeSensitive) X c->simple_class.change_sensitive = ChangeSensitive; X /* Facet */ X if ( c->simple_class.draw_facets == XtInheritDrawFacets ) X c->simple_class.draw_facets = Draw_Facets ; X X if ( c->simple_class.draw_highlight == XtInheritDrawHighlight ) X c->simple_class.draw_highlight = Draw_Highlight ; X} X Xstatic void Initialize(request, new) X Widget request, new; X{ X CuSimpleWidget fw = (CuSimpleWidget) new; X X/* screen depth hack */ X /*** X fw->core.depth = 24 ; X ***/ X X GetDimFacetGC( new, &fw->simple ); X GetBrightFacetGC( new, &fw->simple ); X GetHighlightGC( new, &fw->simple ); X GetCursorColors (fw) ; X fw->simple.highlighted = FALSE; X fw->simple.first_expose = True ; X if (fw->simple.shadow) X { X /* For shadows to look right, parts of it have to look like parent */ X fw->simple.background_pixel = fw->core.background_pixel ; X fw->core.background_pixel = fw->core.parent->core.background_pixel ; X fw->simple.save_border_width = fw->core.border_width ; X fw->core.border_width = 0 ; X GetBackgroundGC (fw) ; X } X} X Xstatic void Realize(w, valueMask, attributes) X register Widget w; X Mask *valueMask; X XSetWindowAttributes *attributes; X{ X Pixmap border_pixmap; X CuSimpleWidget sw = (CuSimpleWidget) w ; X X if (!IsSensitive(w)) { X /* change border to gray; have to remember the old one, X * so XtDestroyWidget deletes the proper one */ X if (!((CuSimpleWidget)w)->simple.insensitive_border) X ((CuSimpleWidget)w)->simple.insensitive_border = X XmuCreateStippledPixmap (XtScreen(w), X w->core.border_pixel, X w->core.background_pixel, X w->core.depth) ; X border_pixmap = w->core.border_pixmap; X attributes->border_pixmap = X w->core.border_pixmap = ((CuSimpleWidget)w)->simple.insensitive_border; X X *valueMask |= CWBorderPixmap; X *valueMask &= ~CWBorderPixel; X } X X if ((attributes->cursor = ((CuSimpleWidget)w)->simple.cursor) != None) X *valueMask |= CWCursor; X X XtCreateWindow( w, (unsigned int)InputOutput, (Visual *)CopyFromParent, X *valueMask, attributes ); X X if (attributes->cursor != None) X { X XRecolorCursor (XtDisplay(w), attributes->cursor, X &sw->simple.cursor_fg, &sw->simple.cursor_bg) ; X } X if (!IsSensitive(w)) X w->core.border_pixmap = border_pixmap; X} X X Xstatic Boolean SetValues(current, request, new) X Widget current, request, new; X{ X CuSimpleWidget curfw = (CuSimpleWidget) current; X CuSimpleWidget reqfw = (CuSimpleWidget) request; X CuSimpleWidget newfw = (CuSimpleWidget) new; X Boolean was_resized ; X X if (curfw->simple.cursor_foreground != newfw->simple.cursor_foreground || X curfw->simple.cursor_background != newfw->simple.cursor_background) X { X GetCursorColors (newfw) ; X } X X if ((current->core.sensitive != new->core.sensitive || X current->core.ancestor_sensitive != new->core.ancestor_sensitive)) X ChangeSensitive( new ); X X was_resized = SetValuesCorePart( current, request, new ) ; X X SetValuesFacetPart( &curfw->simple, &reqfw->simple, &newfw->simple, new ) ; X X if (curfw->simple.shadow != newfw->simple.shadow) X { X if (newfw->simple.shadow) X { X /* For shadows to look right, parts have to look like parent */ X newfw->simple.background_pixel = newfw->core.background_pixel ; X newfw->core.background_pixel = X newfw->core.parent->core.background_pixel; X newfw->simple.save_border_width = newfw->core.border_width ; X newfw->core.border_width = 0 ; X GetBackgroundGC (newfw) ; X } X else X { X /* revert to normal pixmaps */ X newfw->core.background_pixel = newfw->simple.background_pixel; X newfw->core.border_width = newfw->simple.save_border_width ; X XtDestroyGC( newfw->simple.background_GC ); X } X } X X if (was_resized) { X (*XtClass(new)->core_class.resize) ((Widget)newfw); X } X X return( was_resized ); X} X Xstatic void Destroy( w ) X Widget w ; X{ X CuSimpleWidget fw = (CuSimpleWidget)w ; X DestroyFacet( &fw->simple ) ; X if (fw->simple.shadow) X XtDestroyGC( fw->simple.background_GC ); X X} X Xstatic void Resize(w) X Widget w; X{ XXtCallCallbacks (w, XtNresize, NULL) ; Xreturn ; X} X Xstatic void Redisplay(w, event, region) X Widget w; X XEvent *event; X Region region; X{ X CuSimpleWidget fw = (CuSimpleWidget) w; X X /* Draw these parts of the button: facets and highlight */ X X (*((CuSimpleClassRec *)XtClass(fw))->simple_class.draw_facets)(w,&fw->simple); X X if ( fw->simple.highlighted == TRUE ) X (*((CuSimpleClassRec *) XtClass(fw))-> X simple_class.draw_highlight)(w,&fw->simple) ; X X if (fw->simple.first_expose) X { X fw->simple.first_expose = False ; X XtCallCallbacks(w, XtNfirstExpose, region); X } X} X X/** X *** Private Routines X **/ X Xstatic void XGetCursorColors (sw) X CuSimpleWidget sw ; X{ XXrmValue pixel_value ; XXrmValue color_value ; X Xif (sw->simple.cursor_foreground == None) X sw->simple.cursor_foreground = BlackPixelOfScreen(XtScreen((Widget)sw)) ; X Xpixel_value.size = sizeof (sw->simple.cursor_foreground) ; Xpixel_value.addr = (caddr_t) &sw->simple.cursor_foreground ; XXtConvert ((Widget) sw, XtRPixel, &pixel_value, XtRColor, &color_value) ; Xsw->simple.cursor_fg = *((XColor *)color_value.addr) ; X Xif (sw->simple.cursor_background == None) X sw->simple.cursor_background = WhitePixelOfScreen(XtScreen((Widget)sw)) ; X Xpixel_value.size = sizeof (sw->simple.cursor_background) ; Xpixel_value.addr = (caddr_t) &sw->simple.cursor_background ; XXtConvert ((Widget) sw, XtRPixel, &pixel_value, XtRColor, &color_value) ; Xsw->simple.cursor_bg = *((XColor *)color_value.addr) ; X Xreturn ; X} X Xstatic Boolean SetValuesCorePart( cur, req, new ) X Widget cur, req, new ; X{ X Boolean was_resized = False; X X if ((cur->core.width != new->core.width) || X (cur->core.height != new->core.height)) { X X /* we have to know if the size change is going to take X before calling Resize() */ X X if ((XtMakeResizeRequest(cur, X new->core.width, new->core.height, X &new->core.width, &new->core.height) X == XtGeometryNo)) { X new->core.width = cur->core.width; X new->core.height = cur->core.height; X } X else was_resized = True ; X } X X return( was_resized ); X} X Xstatic void SetValuesFacetPart( cur, req, new, w ) X CuSimplePart *cur, *req, *new ; X Widget w ; X{ X if ( cur->dim_facet_color != new->dim_facet_color ) { X XtDestroyGC( cur->dim_facet_GC ); X GetDimFacetGC( w, new ); X } X X if ( cur->highlight_color != new->highlight_color ) { X XtDestroyGC( cur->highlight_GC ); X GetBrightFacetGC( w, new ); X } X X if ( cur->bright_facet_color != new->bright_facet_color ) { X XtDestroyGC( cur->bright_facet_GC ); X GetBrightFacetGC( w, new ); X } X} X Xstatic void DestroyFacet( simple ) X CuSimplePart *simple ; X{ X XtDestroyGC(simple->dim_facet_GC); X XtDestroyGC(simple->bright_facet_GC); X XtDestroyGC(simple->highlight_GC); X} X X/* routines to get all the graphics contexts */ X Xstatic void GetBackgroundGC( fw ) X CuSimpleWidget fw ; X{ X XGCValues values; X X values.foreground = fw->simple.background_pixel; X fw->simple.background_GC = XtGetGC( X (Widget)fw, (unsigned) GCForeground, &values); X} X Xstatic void GetDimFacetGC( w, simple ) X Widget w ; X CuSimplePart *simple ; X{ X XGCValues values; X X values.foreground = simple->dim_facet_color; X simple->dim_facet_GC = XtGetGC( X w, (unsigned) GCForeground, &values); X} X Xstatic void GetBrightFacetGC( w, simple ) X Widget w ; X CuSimplePart *simple ; X{ X XGCValues values; X X values.foreground = simple->bright_facet_color; X simple->bright_facet_GC = XtGetGC( X w, (unsigned) GCForeground, &values); X} X Xstatic void GetHighlightGC( w, simple ) X Widget w ; X CuSimplePart *simple ; X{ X XGCValues values; X X values.foreground = simple->highlight_color; X values.line_width = simple->highlight_width; X simple->highlight_GC = XtGetGC( X w, (unsigned) (GCForeground | GCLineWidth), &values); X} X X/* X * Repaint the widget window X */ X Xstatic void Draw_Facets( w, simple ) X Widget w ; X CuSimplePart *simple ; X{ XCuSimpleWidget fw = (CuSimpleWidget) w ; X XPoint points[4] ; X X /* note that for FillPolygon a pixel on a horizontal boundary X is only filled if the rest of the polygon is below it. X This means we have to fudge some of the boundaries by one */ X Xif (!FacetWidth) X return ; X Xif (fw->simple.shadow) X { X X XFillRectangle( XtDisplay(w), XtWindow(w), DimGC, X FacetWidth, FacetWidth, X Width - FacetWidth, Height - FacetWidth ) ; X XFillRectangle( XtDisplay(w), XtWindow(w), BackgroundGC, X 0, 0, X Width - FacetWidth, Height - FacetWidth ) ; X } Xelse X { X/* top */ X X points[0].x = 0 ; points[0].y = 0 ; X points[1].x = Width ; points[1].y = points[0].y ; X points[2].x = points[1].x - FacetWidth + 1 ; X points[2].y = points[1].y + FacetWidth ; X points[3].x = points[0].x + FacetWidth ; X points[3].y = points[2].y ; X X XFillPolygon( XtDisplay(w), XtWindow(w), BrightGC, points, 4, X Convex, CoordModeOrigin ); X X/* left side */ X X points[0].x = points[0].x ; points[0].y = points[0].y ; X points[1].x = points[3].x ; points[1].y = points[3].y ; X points[2].x = points[1].x ; X points[2].y = Height - FacetWidth ; X points[3].x = points[0].x ; X points[3].y = points[2].y + FacetWidth ; X X XFillPolygon( XtDisplay(w), XtWindow(w), BrightGC, points, 4, X Convex, CoordModeOrigin ); X X/* bottom */ X X points[0].x = points[3].x ; points[0].y = points[3].y ; X points[1].x = points[2].x ; points[1].y = points[2].y ; X points[2].x = Width - FacetWidth - 1 ; X points[2].y = points[1].y ; X points[3].x = Width ; X points[3].y = points[0].y ; X X XFillPolygon( XtDisplay(w), XtWindow(w), DimGC, points, 4, X Convex, CoordModeOrigin ); X X/* right side */ X X points[0].x = points[3].x ; points[0].y = points[3].y ; X points[1].x = points[2].x - 1 ; points[1].y = points[2].y ; X points[2].x = points[1].x ; X points[2].y = FacetWidth ; X points[3].x = points[0].x ; X points[3].y = points[2].y - FacetWidth ; X X XFillPolygon( XtDisplay(w), XtWindow(w), DimGC, points, 4, X Convex, CoordModeOrigin ); X } X X} X Xstatic void Draw_Highlight( w, simple ) X Widget w ; X CuSimplePart *simple ; X{ XCuSimpleWidget fw = (CuSimpleWidget) w ; Xif (Highlighted && HighlightWidth != 0) X { X /* wide lines are centered on the path, so indent it */ X int offset = HighlightWidth/2; X if (fw->simple.shadow) X { X XFillRectangle( XtDisplay(w), XtWindow(w), Highlight_GC, X FacetWidth, Height - FacetWidth, X Width - FacetWidth, FacetWidth ) ; X XFillRectangle( XtDisplay(w), XtWindow(w), Highlight_GC, X Width - FacetWidth, FacetWidth, X FacetWidth, Height - FacetWidth ) ; X X /** X XDrawRectangle (XtDisplay(w), XtWindow(w), X Highlight_GC, X offset + FacetWidth, offset + FacetWidth, X Width - HighlightWidth - FacetWidth, X Height - HighlightWidth - FacetWidth); X **/ X } X else X XDrawRectangle (XtDisplay(w), XtWindow(w), X Highlight_GC, X offset, offset, X Width - HighlightWidth, X Height - HighlightWidth); X } X} X X X/* CuSimple Routines */ X Xstatic void ChangeSensitive(w) X register Widget w; X{ X if (XtIsRealized(w)) { X if (IsSensitive(w)) X if (w->core.border_pixmap != UnspecifiedPixmap) X XSetWindowBorderPixmap( XtDisplay(w), XtWindow(w), X w->core.border_pixmap ); X else X XSetWindowBorder( XtDisplay(w), XtWindow(w), X w->core.border_pixel ); X else { X if (!((CuSimpleWidget)w)->simple.insensitive_border) X ((CuSimpleWidget)w)->simple.insensitive_border = X XmuCreateStippledPixmap (XtScreen(w), X w->core.border_pixel, X w->core.background_pixel, X w->core.depth) ; X XSetWindowBorderPixmap( XtDisplay(w), XtWindow(w), X ((CuSimpleWidget)w)-> X simple.insensitive_border ); X } X } X return ; X} X X#ifdef CompositeSimple X X/* X * Routines for Composite superclasses. X * Doesn't work right now. Get a bad cursor error from the server. X * I haven't had the need or the time to look into it yet. X */ X Xstatic XtGeometryResult GeometryManager(w) XWidget w ; X{ X return( XtGeometryYes ) ; X} X Xstatic void CompClassPartInitialize( widgetClass ) X WidgetClass widgetClass ; X{ X /* X register CuSimpleCompWidgetClass c = (CuSimpleCompWidgetClass)widgetClass; X */ X CuSimpleCompWidgetClass c = (CuSimpleCompWidgetClass)widgetClass; X /* CuSimple */ X if (c->simple_class.change_sensitive == XtInheritChangeSensitive) X c->simple_class.change_sensitive = ChangeSensitive; X /* Facet */ X if ( c->simple_class.draw_facets == XtInheritDrawFacets ) X c->simple_class.draw_facets = Draw_Facets ; X X if ( c->simple_class.draw_highlight == XtInheritDrawHighlight ) X c->simple_class.draw_highlight = Draw_Highlight ; X} X Xstatic void CompInitialize(request, new) X Widget request, new; X{ X CuSimpleCompWidget fcw = (CuSimpleCompWidget) new; X X/* screen depth hack */ X /*** X fcw->core.depth = 24 ; X ***/ X X GetDimFacetGC( new, &fcw->simple ); X GetBrightFacetGC( new, &fcw->simple ); X GetHighlightGC( new, &fcw->simple ); X X fcw->simple.highlighted = FALSE; X X} X Xstatic Boolean CompSetValues(current, request, new) X Widget current, request, new; X{ X CuSimpleCompWidget curfcw = (CuSimpleCompWidget) current; X CuSimpleCompWidget reqfcw = (CuSimpleCompWidget) request; X CuSimpleCompWidget newfcw = (CuSimpleCompWidget) new; X Boolean was_resized ; X X was_resized = SetValuesCorePart( current, request, new ) ; X X SetValuesFacetPart( &curfcw->simple, &reqfcw->simple, &newfcw->simple, new ) ; X X if (was_resized) { X (*XtClass(new)->core_class.resize) ((Widget)newfcw); X } X X return( was_resized ); X} X Xstatic void CompDestroy( w ) X Widget w ; X{ X CuSimpleCompWidget fcw = (CuSimpleCompWidget)w ; X DestroyFacet( &fcw->simple ) ; X} X Xstatic void CompRedisplay(w, event, region) X Widget w; X XEvent *event; X Region region; X{ X CuSimpleCompWidget fcw = (CuSimpleCompWidget) w; X X /* Now draw the button: facets, button face (with text), and border */ X X (*((CuSimpleCompClassRec *) XtClass(fcw))-> X simple_class.draw_facets)( w, &fcw->simple ) ; X X if ( fcw->simple.highlighted == TRUE ) X (*((CuSimpleCompClassRec *) XtClass(fcw))-> X simple_class.draw_highlight)( w, &fcw->simple ) ; X} X X#endif X END_OF_FILE echo shar: NEWLINE appended to \"'src/CuSimple.c'\" if test 20091 -ne `wc -c <'src/CuSimple.c'`; then echo shar: \"'src/CuSimple.c'\" unpacked with wrong size! fi # end of 'src/CuSimple.c' fi if test -f 'src/CuTbl.y' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/CuTbl.y'\" else echo shar: Extracting \"'src/CuTbl.y'\" \(13666 characters\) sed "s/^X//" >'src/CuTbl.y' <<'END_OF_FILE' X%{ X X/* * X * * This code is completely original. Permission is granted to do with X * * it as one wishes. I disclaim any responsibility whatsoever for X * * any bad things that may happen because of using it. X * */ X Xstatic void col_exceeded () ; Xstatic void row_exceeded () ; Xstatic void find_strings () ; Xstatic void mismatch () ; Xstatic void no_rows () ; X Xstatic CuTblWidget tw_ ; /* no other way to get it into yylex... */ Xstatic Boolean new_menu_start = False ; X X%} X X%start init X X%union { X float f_val ; X int i_val ; X char *s_val ; X char c_val ; X } X X%token <i_val> INTEGER X%token <c_val> CHARACTER X%token <s_val> STRING X%token <s_val> ITEM_ELEMENT X%token HSPAN_ELEMENT X%token VSPAN_ELEMENT X%token EQUAL_ROWS X%token EQUAL_COLUMNS X%token ALIGNED_COLUMNS X%token CLIP_ON_SHRINK X%token EQUAL_COLUMNS X%token IGNORED_OPTION X%token TAMPERSAND X%token CONTINUATION X%token STRING_BREAKER X%token LNL_EQUIVALENT X%token SNL_EQUIVALENT X%token INTER_WIDTH X%token INTER_HEIGHT X%token INTERNAL_WIDTH X%token INTERNAL_HEIGHT X%token RESIZE_PARTICIPANTS X%token PADDING X%token INTERS X%token INTERNALS X%token CHILDREN X%token BACKGROUND_COLOR X%token T_BACKGROUND_COLOR X%token C_BACKGROUND_COLOR X%token FOREGROUND_COLOR X%token T_FOREGROUND_COLOR X%token C_FOREGROUND_COLOR X%token BORDER_COLOR X%token T_BORDER_COLOR X%token C_BORDER_COLOR X%token BORDER_WIDTH X%token T_BORDER_WIDTH X%token C_BORDER_WIDTH X%token TS X%token TE X%token NL X%token DOT_NL X%token ERROR X X%% X Xinit : X { X /* One time initializations */ X tw->tbl.null_elements = (ElementRecord *) X XtCalloc (1, sizeof (ElementRecord)) ; X tw->tbl.temp_elements = (ElementRecord *) X XtCalloc (MAX_TBL_COLS, sizeof (ElementRecord)) ; X tw_ = tw ; X } X | init tbl X ; X Xtbl : dot_ts _options format_series dot_nl data dot_te X { X new_menu_start = True ; X } X ; X Xdot_nl : '.' X | DOT_NL X ; X Xdot_ts : X | TS NL X ; X Xdot_te : X | TE X ; X X_options : X | options ';' NL X | options ';' X ; X Xformat_series : format X | format_series NL format X ; X Xformat : element_series X { X Cardinal i ; X X if (tw->tbl.rows == MAX_TBL_ROWS) X row_exceeded () ; X X /* allocate just enough space for the number of columns in this row */ X X tw->tbl.item[tw->tbl.rows] = (ElementRecord *) X XtCalloc (tw->tbl.n_cols, sizeof (ElementRecord)) ; X tw->tbl.cols[tw->tbl.rows] = tw->tbl.n_cols ; X X /* copy the elements found into the permanent record */ X X for (i=0; i < tw->tbl.n_cols; i++) X { X tw->tbl.item[tw->tbl.rows][i] = tw->tbl.temp_elements[i] ; X tw->tbl.temp_elements[i] = *tw->tbl.null_elements ; X } X tw->tbl.rows++ ; X X /* re-initialize for next row */ X X tw->tbl.n_cols = 0 ; X } X ; X Xdata : X | data_group_series X ; X Xdata_group_series : data_group X | data_group_series data_group X ; X Xdata_group : data_series X | TAMPERSAND NL format_series DOT_NL data_series X ; X Xdata_series : stringline X | data_series stringline X ; X Xstringline : STRING X { X find_strings ($1, tw) ; X } X ; X Xoptions : option X | options option X | options NL option X ; X Xoption : EQUAL_ROWS X { X tw->tbl.equal_rows = True ; X } X | EQUAL_COLUMNS X { X tw->tbl.equal_columns = True ; X } X | ALIGNED_COLUMNS X { X tw->tbl.aligned_columns = True ; X } X | CLIP_ON_SHRINK X { X tw->tbl.clip_on_shrink = True ; X } X | IGNORED_OPTION X { X } X | STRING_BREAKER '(' CHARACTER ')' X { X tw->tbl.string_breaker = $3 ; X } X | LNL_EQUIVALENT '(' CHARACTER ')' X { X layout_input->lnl_equivalent = $3 ; X } X | SNL_EQUIVALENT '(' CHARACTER ')' X { X layout_input->snl_equivalent = $3 ; X } X | INTER_WIDTH '(' INTEGER ')' X { X tw->tbl.inter_width = $3 ; X } X | INTER_HEIGHT '(' INTEGER ')' X { X tw->tbl.inter_height = $3 ; X } X | INTERNAL_WIDTH '(' INTEGER ')' X { X tw->tbl.internal_width = $3 ; X } X | INTERNAL_HEIGHT '(' INTEGER ')' X { X tw->tbl.internal_height = $3 ; X } X | INTERS '(' INTEGER ')' X { X tw->tbl.inter_width = $3 ; X tw->tbl.inter_height = $3 ; X } X | INTERNALS '(' INTEGER ')' X { X tw->tbl.internal_width = $3 ; X tw->tbl.internal_height = $3 ; X } X | PADDING '(' INTEGER ')' X { X tw->tbl.inter_width = $3 ; X tw->tbl.inter_height = $3 ; X tw->tbl.internal_width = $3 ; X tw->tbl.internal_height = $3 ; X } X | BORDER_WIDTH '(' INTEGER ')' X { X tw->core.border_width = $3 ; X tw->tbl.child_border_width = $3 ; X } X | T_BORDER_WIDTH '(' INTEGER ')' X { X tw->core.border_width = $3 ; X } X | C_BORDER_WIDTH '(' INTEGER ')' X { X tw->tbl.child_border_width = $3 ; X tw->tbl.typical_border = $3 ; X } X | BORDER_COLOR '(' INTEGER ')' X { X tw->core.border_pixel = $3 ; /* see comment below */ X tw->tbl.child_border_color = $3 ; X } X | T_BORDER_COLOR '(' INTEGER ')' X { X /* X * This doesn't work! X */ X tw->core.border_pixel = $3 ; X } X | C_BORDER_COLOR '(' INTEGER ')' X { X tw->tbl.child_border_color = $3 ; X } X | FOREGROUND_COLOR '(' INTEGER ')' X { X tw->tbl.child_foreground_color = $3 ; X } X | C_FOREGROUND_COLOR '(' INTEGER ')' X { X tw->tbl.child_foreground_color = $3 ; X } X | BACKGROUND_COLOR '(' INTEGER ')' X { X tw->core.background_pixel = $3 ; X tw->tbl.child_background_color = $3 ; X } X | T_BACKGROUND_COLOR '(' INTEGER ')' X { X tw->core.background_pixel = $3 ; X } X | C_BACKGROUND_COLOR '(' INTEGER ')' X { X tw->tbl.child_background_color = $3 ; X } X | resize_participants '(' participants ')' X { X } X ; X Xresize_participants : RESIZE_PARTICIPANTS X { X tw->tbl.resize_participants = CuResizeNone ; X } X ; X Xparticipants : participant X | participants participant X ; X Xparticipant : INTERS X { X tw->tbl.resize_participants = X (CuResizeParticipants) ((int)tw->tbl.resize_participants | X (int)CuResizeInters) ; X } X | INTERNALS X { X tw->tbl.resize_participants = X (CuResizeParticipants) ((int)tw->tbl.resize_participants | X (int)CuResizeInternals) ; X } X | CHILDREN X { X tw->tbl.resize_participants = X (CuResizeParticipants) ((int)tw->tbl.resize_participants | X (int)CuResizeChildren) ; X } X ; X Xelement_series : element X | element_series element X ; X Xelement : ITEM_ELEMENT X { X char *ptr ; X int nc = tw->tbl.n_cols ; X X if (nc == MAX_TBL_COLS) X col_exceeded () ; X X tw->tbl.temp_elements[nc].primary = TBL_ITEM ; X X /* check for qualifiers */ X X ptr = $1 ; X while (*ptr != 0) X { X switch (*ptr++) X { X case 'l' : case 'L' : X { X tw->tbl.temp_elements[nc].justify = CuJustifyLeft ; X break ; X } X case 'r' : case 'R' : X { X tw->tbl.temp_elements[nc].justify = CuJustifyRight ; X break ; X } X case 'c' : case 'C' : X { X tw->tbl.temp_elements[nc].justify = CuJustifyCenter; X break ; X } X case 'e' : case 'E' : X { X tw->tbl.temp_elements[nc].e = True ; X break ; X } X case '@' : X { X tw->tbl.temp_elements[nc].f = True ; X break ; X } X case 'g' : case 'G' : X { X switch (*ptr) X { X case 'n' : case 'N' : X { X switch (*(ptr+1)) X { X case 'e' : case 'E' : X { X tw->tbl.temp_elements[nc].g = CuNorthEastGravity ; X ptr += 2 ; X break ; X } X case 'w' : case 'W' : X { X tw->tbl.temp_elements[nc].g = CuNorthWestGravity ; X ptr += 2 ; X break ; X } X default : X { X tw->tbl.temp_elements[nc].g = CuNorthGravity ; X ptr += 1 ; X break ; X } X } X break ; X } X case 's' : case 'S' : X { X switch (*(ptr+1)) X { X case 'e' : case 'E' : X { X tw->tbl.temp_elements[nc].g = CuSouthEastGravity ; X ptr += 2 ; X break ; X } X case 'w' : case 'W' : X { X tw->tbl.temp_elements[nc].g = CuSouthWestGravity ; X ptr += 2 ; X break ; X } X default : X { X tw->tbl.temp_elements[nc].g = CuSouthGravity ; X ptr += 1 ; X break ; X } X } X break ; X } X case 'e' : case 'E' : X { X tw->tbl.temp_elements[nc].g = CuEastGravity ; X ptr++ ; X break ; X } X case 'w' : case 'W' : X { X tw->tbl.temp_elements[nc].g = CuWestGravity ; X ptr++ ; X break ; X } X case 'c' : case 'C' : X { X tw->tbl.temp_elements[nc].g = CuCenterGravity ; X ptr++ ; X break ; X } X default : X { X char *my_text = "CuTbl: Invalid gravity specifier: (%c)\n" ; X char *etext = XtMalloc (strlen(my_text) + 1) ; X sprintf (etext, my_text, *ptr) ; X XtWarning (etext) ; X break ; X } X } X break ; X } X default : X { X break ; X } X } X } X X XtFree ($1) ; X tw->tbl.n_cols++ ; X } X | VSPAN_ELEMENT X { X if (tw->tbl.n_cols == MAX_TBL_COLS) X col_exceeded () ; X tw->tbl.temp_elements[tw->tbl.n_cols++].primary = TBL_VSPAN ; X } X | HSPAN_ELEMENT X { X if (tw->tbl.n_cols == MAX_TBL_COLS) X col_exceeded () ; X tw->tbl.temp_elements[tw->tbl.n_cols++].primary = TBL_HSPAN ; X } X ; X X%% X X/***** **** *** ** * find_strings * ** *** **** *****/ X Xstatic void Xfind_strings (text, tw) X char *text ; X CuTblWidget tw ; X{ X/* X * One quick pass to find out the number of sub-strings X */ Xint *first_char ; Xint *n_chars ; XCardinal i, j ; XCardinal istring ; XCardinal n_strings ; Xint length = strlen (text) ; X Xtw->tbl.n_cols = 0 ; Xfor (i=0; i < length; i++) X { X if (text[i] == tw->tbl.string_breaker) X { X tw->tbl.n_cols++ ; X } X } Xtw->tbl.n_cols++ ; X X/* X * Check to see if there is a corresponding format row. X * If not, duplicate the last format row. X */ X Xif (tw->tbl.data_row + 1 > tw->tbl.rows) X { X Cardinal i ; X X if (tw->tbl.rows == 0) X no_rows () ; X if (tw->tbl.rows == MAX_TBL_ROWS) X row_exceeded () ; X X /* allocate just enough space for the number of columns in this row */ X X tw->tbl.item[tw->tbl.rows] = X (ElementRecord *) XtCalloc (tw->tbl.cols[tw->tbl.rows-1], X sizeof (ElementRecord)) ; X /* make a copy of the previous row */ X for (i=0; i < tw->tbl.cols[tw->tbl.rows-1]; i++) X tw->tbl.item[tw->tbl.rows][i] = tw->tbl.item[tw->tbl.rows-1][i] ; X tw->tbl.cols[tw->tbl.rows] = tw->tbl.cols[tw->tbl.rows-1] ; X tw->tbl.rows++ ; X } X X/* X * Check to see that the number of data items matches the number of format items X */ X X { X Cardinal n_items = 0 ; X for (i=0; i < tw->tbl.cols[tw->tbl.data_row]; i++) X if (tw->tbl.item[tw->tbl.data_row][i].primary == TBL_ITEM || X tw->tbl.item[tw->tbl.data_row][i].primary == TBL_VSPAN) X n_items++ ; X X if (tw->tbl.n_cols != n_items) X { X mismatch ((Cardinal)tw->tbl.n_cols, n_items, tw->tbl.data_row); X } X } X X/* X * Do another pass of the string to find the starting points and lengths X * of the the substrings X */ X Xfirst_char = (int *) XtMalloc (tw->tbl.n_cols * sizeof (int)) ; Xn_chars = (int *) XtMalloc (tw->tbl.n_cols * sizeof (int)) ; X Xn_strings = 0 ; Xfirst_char[0] = 0 ; X Xfor (i=0; i < length; i++) X { X if (text[i] == tw->tbl.string_breaker) X { X n_chars[n_strings] = i - first_char[n_strings] ; X n_strings++ ; X first_char[n_strings] = i+1 ; X } X } Xn_chars[n_strings] = length - first_char[n_strings] ; X X/* X * Now copy the substrings into the item records X */ X Xistring = 0 ; Xfor (j=0; j < tw->tbl.cols[tw->tbl.data_row]; j++) X { X if (tw->tbl.item[tw->tbl.data_row][j].primary != TBL_ITEM) X { X if (tw->tbl.item[tw->tbl.data_row][j].primary == TBL_VSPAN) X istring++ ; X continue ; X } X tw->tbl.item[tw->tbl.data_row][j].text = XtMalloc (n_chars[istring] + 1) ; X strncpy (tw->tbl.item[tw->tbl.data_row][j].text, X &text[first_char[istring]], n_chars[istring]) ; X tw->tbl.item[tw->tbl.data_row][j].text[n_chars[istring]] = '\0' ; X /* Convert instances of "\n" to '\n' */ X convert_nl (tw->tbl.item[tw->tbl.data_row][j].text) ; X X istring++ ; X } X Xtw->tbl.data_row++ ; Xtw->tbl.n_cols = 0 ; X XXtFree ((char *) first_char) ; XXtFree ((char *) n_chars) ; X Xreturn ; X} X X/***** **** *** ** * row_exceeded * ** *** **** *****/ X Xstatic void Xrow_exceeded () X{ Xchar *my_text = "CuTbl: MAX_TBL_ROWS exceeded: %d\n" ; Xchar *etext = XtMalloc (strlen(my_text) + 5) ; Xsprintf (etext, my_text, MAX_TBL_ROWS) ; XXtError (etext) ; X} X X/***** **** *** ** * no_rows * ** *** **** *****/ X Xstatic void Xno_rows () X{ XXtError ("CuTbl: No format items found before data!\n") ; X} X X/***** **** *** ** * col_exceeded * ** *** **** *****/ X Xstatic void Xcol_exceeded () X{ Xchar *my_text = "CuTbl: MAX_TBL_COLS exceeded: %d\n" ; Xchar *etext = XtMalloc (strlen(my_text) + 5) ; Xsprintf (etext, my_text, MAX_TBL_COLS) ; XXtError (etext) ; X} X X/***** **** *** ** * mismatch * ** *** **** *****/ X Xstatic void Xmismatch (data_items, format_items, row_number) XCardinal data_items ; XCardinal format_items ; XCardinal row_number ; X{ Xchar *my_text = "CuTbl: item/format mismatch in data row # %d (%d != %d)\n" ; Xchar *etext = XtMalloc (strlen(my_text) + 15) ; Xsprintf (etext, my_text, row_number, data_items, format_items) ; XXtError (etext) ; X} X X/***** **** *** ** * convert_nl * ** *** **** *****/ X X/* X * if no newline equivalent, X * convert instances of "\n" into '\n' and collapse the remainder of the text X * else, X * convert the equivalent into a newline X */ X Xstatic void Xconvert_nl (text) X char *text ; X{ XCardinal i, j ; XCardinal len = strlen(text) ; X Xfor (i=0; i < len; i++) X { X if (layout_input->snl_equivalent == -1) X { X if (text[i] == '\\' && text[i+1] == 'n') X { X text[i] = '\n' ; X j = i+1 ; X while (text[j] != 0) X { X text[j] = text[j+1] ; X j++ ; X } X } X } X else X if (text[i] == layout_input->snl_equivalent) X text[i] = '\n' ; X } Xreturn ; X} X X#include "CuTbl.lex.c" END_OF_FILE echo shar: NEWLINE appended to \"'src/CuTbl.y'\" if test 13667 -ne `wc -c <'src/CuTbl.y'`; then echo shar: \"'src/CuTbl.y'\" unpacked with wrong size! fi # end of 'src/CuTbl.y' fi echo shar: End of archive 6 \(of 12\). cp /dev/null ark6isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 11 12 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 12 archives. rm -f ark[1-9]isdone ark[1-9][0-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0