Annotation of 43BSDTahoe/new/X/CLUlib/x_geometry.clu, revision 1.1.1.1

1.1       root        1: % Copyright    Barbara Liskov    1985
                      2: 
                      3: x_geometry = proc (spec, defspec: string)
                      4:               returns (int, int, int, int, bool, bool, bool)
                      5:     i1: int := string$indexc('x', defspec)
                      6:     i2: int
                      7:     if i1 = 0
                      8:        then i1 := string$indexc('+', defspec)
                      9:            i2 := string$indexc('-', defspec)
                     10:            if i2 > 0  cand  (i1 = 0  cor  i2 < i1)
                     11:               then i1 := i2 end
                     12:            if i1 = 0
                     13:               then i1 := string$size(defspec) + 1 end
                     14:        end
                     15:     dw: int := int$parse(string$substr(defspec, 2, i1 - 2))
                     16:        except others: dw := 1 end
                     17:     if i1 <= string$size(defspec)  cand  defspec[i1] = 'x'
                     18:        then i1 := i1 + 1 end
                     19:     defspec := string$rest(defspec, i1)
                     20:     i1 := string$indexc('+', defspec)
                     21:     i2 := string$indexc('-', defspec)
                     22:     dxp: bool := true
                     23:     if i2 > 0  cand  (i1 = 0  cor  i2 < i1)
                     24:        then i1 := i2
                     25:            dxp := false
                     26:        end
                     27:     if i1 = 0
                     28:        then i1 := string$size(defspec) + 1 end
                     29:     dh: int := int$parse(string$substr(defspec, 1, i1 - 1))
                     30:        except others: dh := 1 end
                     31:     defspec := string$rest(defspec, i1 + 1)
                     32:        except when bounds: defspec := "" end
                     33:     i1 := string$indexc('+', defspec)
                     34:     dyp: bool := true
                     35:     if i1 = 0
                     36:        then i1 := string$indexc('-', defspec)
                     37:            if i1 = 0
                     38:               then i1 := string$size(defspec) + 1
                     39:               else dyp := false
                     40:               end
                     41:        end
                     42:     dx: int := int$parse(string$substr(defspec, 1, i1 - 1))
                     43:        except others: dx := 1 end
                     44:     dy: int := int$parse(string$rest(defspec, i1 + 1))
                     45:        except others: dy := 1 end
                     46: 
                     47:     i1 := string$indexc('x', spec)
                     48:     if i1 = 0
                     49:        then i1 := string$indexc('+', spec)
                     50:            i2 := string$indexc('-', spec)
                     51:            if i2 > 0  cand  (i1 = 0  cor  i2 < i1)
                     52:               then i1 := i2 end
                     53:            if i1 = 0
                     54:               then i1 := string$size(spec) + 1 end
                     55:        end
                     56:     width: int := int$parse(string$substr(spec, 2, i1 - 2))
                     57:        except others: width := dw end
                     58:     if width <= 0
                     59:        then width := dw end
                     60:     if i1 <= string$size(spec)  cand  spec[i1] = 'x'
                     61:        then i1 := i1 + 1 end
                     62:     spec := string$rest(spec, i1)
                     63:     i1 := string$indexc('+', spec)
                     64:     i2 := string$indexc('-', spec)
                     65:     xplus: bool := true
                     66:     place: bool := true
                     67:     if i2 > 0  cand  (i1 = 0  cor  i2 < i1)
                     68:        then i1 := i2
                     69:            xplus := false
                     70:        end
                     71:     if i1 = 0
                     72:        then i1 := string$size(defspec) + 1
                     73:            place := false
                     74:        end
                     75:     height: int := int$parse(string$substr(spec, 1, i1 - 1))
                     76:        except others: height := dh end
                     77:     if height <= 0
                     78:        then height := dh end
                     79:     spec := string$rest(spec, i1 + 1)
                     80:        except when bounds: spec := "" end
                     81:     i1 := string$indexc('+', spec)
                     82:     yplus: bool := true
                     83:     if i1 = 0
                     84:        then i1 := string$indexc('-', spec)
                     85:            if i1 = 0
                     86:               then i1 := string$size(spec) + 1
                     87:               else yplus := false
                     88:               end
                     89:        end
                     90:     x: int := int$parse(string$substr(spec, 1, i1 - 1))
                     91:        except others:
                     92:                   x := dx
                     93:                   xplus := dxp
                     94:              end
                     95:     y: int := int$parse(string$rest(spec, i1 + 1))
                     96:        except others:
                     97:                   y := dy
                     98:                   yplus := dyp
                     99:              end
                    100:     return(width, height, x, y, xplus, yplus, place)
                    101:     end x_geometry

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.