# -*- tcl -*- tcl.tk//DSL diagram//EN//1.0 set boxwidth [3 cm] proc link {el1 el2} { group { arrow from [0.3 between [$el1 ne] [$el1 se]] to [0.3 between [$el2 nw] [$el2 sw]] arrow from [0.3 between [$el2 sw] [$el2 nw]] to [0.3 between [$el1 se] [$el1 ne]] } } proc note {el args} { group { text at $el {*}$args } } proc cmd {args} { ellipse {*}$args fillcolor salmon } proc x11struct {args} { box {*}$args fillcolor orange } proc tkstruct {args} { box {*}$args fillcolor lightgreen } proc tkimgstruct {args} { box {*}$args fillcolor green } proc tclstruct {args} { box {*}$args fillcolor lightblue } proc tclimgstruct {args} { box {*}$args fillcolor steelblue } set CMD [cmd "\"image\"Cmd"] down ; arrow down down "clientData\naka \"winPtr\" " anchor se set MAINWIN [tkstruct "TkWindow\n(mainwindow)"] right ; arrow "display" above x11struct "Display\n\[X11 struct\]" ; arrow <- "display" above set WINDOW [tkstruct "TkWindow\n(widget)"] arrow from [$WINDOW nw] up left "dispPtr" anchor sw set TKDPY [tkstruct "TkDisplay"] ; down arrow "display" ljust arrow from [$MAINWIN ne] to [$TKDPY sw] "dispPtr" anchor se left ; move from [$MAINWIN w] set MAININFO [tkstruct "TkMainInfo"] link $MAININFO $MAINWIN note [2nd last arrow] "winPtr" with s note [last arrow] "mainPtr" with n group { arrow from [$MAININFO sw] "interp" left down anchor se set INTERP [tclstruct "Interp"] } down ; arrow "imageTable" anchor sw tclstruct "Tcl_HashTable" ; right ; arrow "" above set MASTER [tclimgstruct "ImageMaster"] ; group { up ; arrow "winPtr" anchor nw } down ; arrow "masterData " rjust set MDATA [tclimgstruct "Master Data\n(ex. photo)"] arrow from [$MASTER se] down right "typePtr" anchor sw set IMGTYPE [box "Tk_ImageType" fillcolor turquoise] arrow <- from [$WINDOW s] down " tkwin" ljust set IMAGE [tkimgstruct "Image\n(Instance)"] link $MASTER $IMAGE note [2nd last arrow] "instancePtr " with se note [last arrow] " masterPtr" with nw down ; arrow "instanceData " rjust set IDATA [tkimgstruct "Instance Data\n(ex. photo)"] arrow from [$IMAGE nw] up left "display" anchor sw arrow from [$CMD w] then [[$INTERP n] | [$CMD w]] to [$INTERP n] note [last arrow start] "interp " with se move from [$IMGTYPE s] down set IMGTYPED [block { set boxwidth [10 cm] set boxheight [4 cm] right tclimgstruct ; note [[last box nw] by 10 se] with nw \ "create (type, master) -> master data" \ "delete (master data)" tkimgstruct ; note [[last box nw] by 10 se] with nw \ "get (, master) -> instance data" \ "free (instance data, )" \ "" \ "display (instance data, , , ...)" \ "postscript (instance data, ...)" }] line from [$IMGTYPE sw] to [$IMGTYPED nw] color lightblue stroke 3 dashed line from [$IMGTYPE se] to [$IMGTYPED ne] color lightblue stroke 3 dashed # Partion borders. set a [[0.5 between [$INTERP nw] [[$INTERP nw] | [$MAININFO sw]]] by [2 cm] west] set b [[$IMGTYPE s] by [1.75 cm] south] set c [intersect [move from $a to [by 100 west]] [move from $b to [by 100 north]]] line dotted color blue stroke 3 from $a then $c to $b text with nw at [last line start] textcolor blue text "Tcl Specific" text with sw at [last line start] textcolor blue text "Tk Specific" text with se at [last line end] textcolor blue text "Tcl Specific " text with sw at [last line end] textcolor blue text " Tk Specific" line dotted color red stroke 3 \ from [[0.7 between [$MASTER se] [$MDATA nw]] by [6 cm] west] \ to [[0.7 between [$IMAGE sw] [$IDATA ne]] by [2 cm] east] text with nw at [last line start] textcolor red text "ImageTypes" text with sw at [last line start] textcolor red text "Image Framework"