DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T d

⟦0a16c4a00⟧ TextFile

    Length: 10271 (0x281f)
    Types: TextFile
    Names: »draw.clu«

Derivation

└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
    └─ ⟦526ad3590⟧ »EUUGD11/gnu-31mar87/X.V10.R4.tar.Z« 
        └─⟦2109abc41⟧ 
            └─ ⟦this⟧ »./X.V10R4/xdemo/draw.clu« 

TextFile

pgray = "\252\252\125\125\252\252\125\125\252\252\125\125\252\252\125\125" ||
	"\252\252\125\125\252\252\125\125\252\252\125\125\252\252\125\125"
pclear = "\000\000\000\000\000\000\370\037\010\020\010\020\010\020\010\020" ||
	 "\010\020\010\020\010\020\010\020\370\037\000\000\000\000\000\000"
pset =  "\377\377\377\377\377\377\007\340\367\357\367\357\367\357\367\357" ||
	"\367\357\367\357\367\357\367\357\007\340\377\377\377\377\377\377"
pdoff = "\000\000\000\000\000\000\230\031\000\020\000\000\010\000\010\020" ||
	"\000\020\000\000\010\020\010\020\140\006\000\000\000\000\000\000"
pdon =  "\377\377\377\377\377\377\147\346\377\357\377\377\367\377\367\357" ||
	"\377\357\377\377\367\357\367\357\237\371\377\377\377\377\377\377"
pdot =  "\377\377\377\377\377\377\257\352\367\377\377\357\367\377\377\357" ||
	"\367\377\377\357\367\377\377\357\127\365\377\377\377\377\377\377"

qs = sequence[string]

digits = qs$[" 0", " 1", " 2", " 3", " 4", " 5", " 6", " 7",
	     " 8", " 9", "10", "11", "12", "13", "14", "15"]

funcs = qs$[" 0", " &", "&~", " s", "~&", " d", " ^", " |",
	    "n|", "~^", "~d", "|~", "~s", "~|", "n&", " 1"]

drawdemo = proc ()
    vcount = 500
    x_keymap$load("")
    bwidth: int := int$parse(xdemo_default("draw", "BorderWidth"))
       except when not_found, overflow, bad_format: bwidth := 2 end
    back: x_pixmap := x_display$white()
    fore: x_pixmap := x_display$black()
    bdr: x_pixmap := x_display$black()
    plane: int := 1
    backpix: int := WhitePixel
    drawpix: int := BlackPixel
    mousepix: int := BlackPixel
    if x_display$cells() > 2
       then begin
	    r, g, b: int := x_parse_color(xdemo_default("draw", "Border"))
	    bdr := x_pixmap$tile(x_display$alloc_color(r, g, b))
	    end except when not_found: end
	    cback: string := xdemo_default("draw", "Background")
	       except when not_found: cback := "" end
	    cfore: string := xdemo_default("draw", "Foreground")
	       except when not_found: cfore := "" end
	    if string$empty(cback)  cand  string$empty(cfore)
	       then exit done end
	    pixs: pixellist
	    pixs, plane := x_display$alloc_cells(1, 1, false)
	    drawpix := pixs[1]
	    fore := x_pixmap$tile(drawpix)
	    backpix := drawpix + plane
	    back := x_pixmap$tile(backpix)
	    r, g, b: int
	    if string$empty(cback)
	       then r, g, b := x_display$query_color(WhitePixel)
	       else r, g, b := x_parse_color(cback)
	       end
	    x_display$store_color(backpix, r, g, b)
	    if string$empty(cfore)
	       then r, g, b := x_display$query_color(BlackPixel)
	       else r, g, b := x_parse_color(cfore)
	       end
	    x_display$store_color(drawpix, r, g, b)
	    begin
	    r, g, b := x_parse_color(xdemo_default("draw", "Mouse"))
	    mousepix := x_display$alloc_color(r, g, b)
	    end except when not_found: end
       end except when done: end
    w: x_window, wid0, hgt0: int := x_cons("draw", back, bdr,
					   xdemo_geometry(), "=400x400+1+1",
					   40, 40, bwidth)
    w.name := "draw"
    x_window$map(w)
    sx, sy, wd, ht, bw, sm, wk: int, iw: x_window := x_window$query(w)
    w.cursor := x_cursor$scons(cross_width, cross_height, cross, cross_mask,
			       backpix, mousepix, cross_x, cross_y, GXcopy)
    white: x_pixmap := back
    black: x_pixmap := fore
    bm: x_bitmap := x_bitmap$screate(16, 16, pgray)
    gray: x_pixmap := x_pixmap$create(bm, backpix, drawpix)
    bm := x_bitmap$screate(16, 16, pclear)
    clear: x_pixmap := x_pixmap$create(bm, backpix, drawpix)
    bm := x_bitmap$screate(16, 16, pset)
    set: x_pixmap := x_pixmap$create(bm, backpix, drawpix)
    bm := x_bitmap$screate(16, 16, pdoff)
    doff: x_pixmap := x_pixmap$create(bm, backpix, drawpix)
    bm := x_bitmap$screate(16, 16, pdon)
    don: x_pixmap := x_pixmap$create(bm, backpix, drawpix)
    bm := x_bitmap$screate(16, 16, pdot)
    dot: x_pixmap := x_pixmap$create(bm, backpix, drawpix)
    wsel: x_window := x_window$create(0, 0, 16, 16, set, w, 0, white)
    wdot: x_window := x_window$create(42, 0, 16, 16, dot, w, 0, white)
    wclear: x_window := x_window$create(58, 0, 16, 16, clear, w, 0, white)
    wset: x_window := x_window$create(74, 0, 16, 16, set, w, 0, white)
    wdoff: x_window := x_window$create(90, 0, 16, 16, doff, w, 0, white)
    wdon: x_window := x_window$create(106, 0, 16, 16, don, w, 0, white)
    wblack: x_window := x_window$create(122, 0, 16, 16, black, w, 0, white)
    wwhite: x_window := x_window$create(138, 0, 16, 16, white, w, 0, white)
    wgray: x_window := x_window$create(154, 0, 16, 16, gray, w, 0, white)
    wheight: x_window := x_window$create(200, -1, 16, 16, white, w, 1, black)
    wwidth: x_window := x_window$create(232, -1, 16, 16, white, w, 1, black)
    wfunc: x_window := x_window$create(264, -1, 16, 16, white, w, 1, black)
    wdraw: x_window := x_window$create(-1, 16, wd, ht - 16, white, w,
				       1, black)
    x_window$map_subwindows(w)
    fn: string := xdemo_default("draw", "BodyFont")
       except when not_found: fn := "timrom10i" end
    font: x_font := x_font$create(fn)
    tfont: x_font := x_font$create("6x10")
    none: x_window := x_window$none()
    nobit: x_bitmap := x_bitmap$none()
    pat: x_pixmap := set
    wclear.input := ButtonPressed
    wset.input := ButtonPressed
    wdoff.input := ButtonPressed
    wdon.input := ButtonPressed
    wdot.input := ButtonPressed
    wblack.input := ButtonPressed
    wwhite.input := ButtonPressed
    wgray.input := ButtonPressed
    wheight.input := KeyPressed
    wwidth.input := KeyPressed
    wfunc.input := KeyPressed
    wdraw.input := ButtonPressed + ExposeWindow + KeyPressed
    vlst: x_vlist := x_vlist$create(vcount + 1)
    e: event := x_input$empty_event()
    e.kind := ExposeWindow
    x_input$enq(e)
    width: int := 1
    height: int := 1
    func: int := GXcopy
    lastx: int := -1
    lasty: int := -1
    curx: int := -1
    while true do
	n: int := 0
	while n < vcount do
	    x_input$deq(e)
	    if e.kind = ExposeWindow
	       then n := 0
		    nht, nwd: int
		    sx, sy, nwd, nht, bw, sm, wk, iw := x_window$query(w)
		    if nht ~= ht  cor  nwd ~= wd
		       then wd := nwd
			    ht := nht
			    if wd <= 40  cor  ht <= 40
			       then x_window$destroy(w)
				    return
			       end
			    x_window$change(wdraw, wd, ht - 16)
		       end
		    x_window$text(wwidth, digits[width + 1], tfont,
				  drawpix, backpix, 3, 2)
		    x_window$text(w, "x", tfont, drawpix, backpix,
				  221, 2)
		    x_window$text(wheight, digits[height + 1], tfont,
				  drawpix, backpix, 3, 2)
		    x_window$text(wfunc, funcs[func + 1], tfont,
				  drawpix, backpix, 3, 2)
		    break
	       end
	    if e.kind = KeyPressed  cand
	       (e.win = wwidth  cor  e.win = wheight  cor  e.win = wfunc)
	       then c: char := x_keymap$getc(e.value, e.mask)
		       except when none, multi (*): continue end
		    i: int
		    if c >= '0'  cand  c <= '9'
		       then i := char$c2i(c) - char$c2i('0')
		     elseif c >= 'a'  cand  c <= 'f'
		       then i := char$c2i(c) - char$c2i('a') + 10
		     else continue end
		    if e.win = wwidth
		       then if i = 0
			       then continue end
			    width := i
		     elseif e.win = wheight
		       then if i = 0
			       then continue end
			    height := i
		     else func := i end
		    strs: qs := digits
		    if e.win = wfunc
		       then strs := funcs end
		    x_window$text(e.win, strs[i + 1], tfont,
				  drawpix, backpix, 3, 2)
		    continue
	       end
	    if e.kind = KeyPressed
	       then s: string := x_keymap$gets(e.value, e.mask)
		       except when none: continue end
		    if e.x ~= lastx  cor  e.y ~= lasty
		       then lastx := e.x
			    lasty := e.y
			    curx := lastx
		       end
		    pix: int := backpix
		    if pat = set  cor  pat = don  cor  pat = black
		       then pix := drawpix end
		    x_window$text_mask_pad(wdraw, s, font, pix, 0, 0,
					   curx, lasty, func, plane)
		    curx := curx + x_font$width(font, s)
		    continue
	       end
	    if e.win ~= wdraw
	       then if e.win = wset
		       then pat := set
		     elseif e.win = wclear
		       then pat := clear
		     elseif e.win = wdon
		       then pat := don
		     elseif e.win = wdoff
		       then pat := doff
		     elseif e.win = wdot
		       then pat := dot
		     elseif e.win = wblack
		       then pat := black
		     elseif e.win = wwhite
		       then pat := white
		     elseif e.win = wgray
		       then pat := gray
		     end
		    wsel.background := pat
		    x_window$clear(wsel)
		    continue
	       end
	    if e.kind = ButtonPressed  cand  e.value = MiddleButton
	       then break end
	    x_window$pix_fill(wdraw, 0, nobit, e.x, e.y, 2, 2, GXinvert, plane)
	    n := n + 1
	    if e.value = LeftButton
	       then x_vlist$store(vlst, n, e.x, e.y, VertexCurved)
	       else x_vlist$store(vlst, n, e.x, e.y, 0)
	       end
	    end
	for i: int in int$from_to(1, n) do
	    x, y, f: int := x_vlist$fetch(vlst, i)
	    x_window$pix_fill(wdraw, 0, nobit, x, y, 2, 2, GXinvert, plane)
	    end
	if n > 2
	   then x, y, f: int := x_vlist$fetch(vlst, 1)
		x_vlist$store(vlst, 1, x, y, f + VertexStartClosed)
		x_vlist$store(vlst, n + 1, x, y, f + VertexEndClosed)
		n := n + 1
	 elseif n > 0
	   then x, y, f: int := x_vlist$fetch(vlst, n)
		x_vlist$store(vlst, n, x, y, f + VertexDrawLastPoint)
	 end
	if n = 0
	   then x_window$clear(wdraw)
	 elseif pat = set
	   then x_window$draw(wdraw, vlst, n, drawpix, width, height,
			      func, plane)
	 elseif pat = clear
	   then x_window$draw(wdraw, vlst, n, backpix, width, height,
			      func, plane)
	 elseif pat = don
	   then x_window$draw_dashed(wdraw, vlst, n, drawpix, width, height,
				     1, 2, 4, func, plane)
	 elseif pat = doff
	   then x_window$draw_dashed(wdraw, vlst, n, backpix, width, height,
				     1, 2, 4, func, plane)
	 elseif pat = dot
	   then x_window$draw_patterned(wdraw, vlst, n, 1, drawpix,
					width, height, 1, 2, 2, func, plane)
	 elseif pat = black  cand  n > 2
	   then x_window$draw_filled(wdraw, vlst, n, drawpix, func, plane)
	 elseif pat = white  cand  n > 2
	   then x_window$draw_filled(wdraw, vlst, n, backpix, func, plane)
	 elseif pat = gray  cand  n > 2
	   then x_window$draw_tiled(wdraw, vlst, n, gray, func, plane)
	 end
	end
    end drawdemo